diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SumPeriodBlocks.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SumPeriodBlocks.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8295afc347fa0a5cb884bc228d713f5e2b62481 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SumPeriodBlocks.lean @@ -0,0 +1,77 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.PeriodicOrigin +open Finset Classical Filter + +lemma sum_period_blocks (M : ℕ) (f : ℕ → ℝ) (hp : Function.Periodic f M) (q : ℕ) : + (∑ n ∈ range (M*q), f n) = (q : ℝ) * ∑ n ∈ range M, f n := by + induction q with + | zero => simp + | succ q ih => + rw [Nat.mul_succ,sum_range_add,ih] + have he : (∑ n ∈ range M, f (M*q+n)) = ∑ n ∈ range M, f n := by + apply sum_congr rfl + intro n hn + simpa only [Nat.nsmul_eq_mul,Nat.mul_comm,Nat.add_comm] using hp.nsmul q n + rw [he,Nat.cast_add,Nat.cast_one] + ring + +lemma sum_period_quotient (M N : ℕ) (f : ℕ → ℝ) (hp : Function.Periodic f M) : + (∑ n ∈ range N, f n) = (N/M : ℕ) * (∑ n ∈ range M, f n) + ∑ n ∈ range (N%M), f n := by + have hN : N = M*(N/M)+N%M := (Nat.div_add_mod N M).symm + conv_lhs => rw [hN,sum_range_add,sum_period_blocks M f hp] + congr 1 + apply sum_congr rfl + intro n hn + simpa only [Nat.nsmul_eq_mul,Nat.mul_comm,Nat.add_comm] using hp.nsmul (N/M) n + +theorem discrepancy (M N : ℕ) (hM : 0 < M) (f : ℕ → ℝ) (hp : Function.Periodic f M) : + |(∑ n ∈ range N, f n) - (N : ℝ) * ((∑ n ∈ range M, f n)/(M : ℝ))| ≤ + 2 * ∑ n ∈ range M, |f n| := by + let A := ∑ n ∈ range M, f n + let K := ∑ n ∈ range M, |f n| + have hK : 0 ≤ K := sum_nonneg (fun _ _ => abs_nonneg _) + have hA : |A| ≤ K := abs_sum_le_sum_abs _ _ + have hR : |∑ n ∈ range (N%M), f n| ≤ K := by + apply (abs_sum_le_sum_abs _ _).trans + apply sum_le_sum_of_subset_of_nonneg (range_mono (Nat.mod_lt N hM).le) + intro n hn ho + exact abs_nonneg _ + have hq : (N : ℝ) = (M : ℝ)*(N/M : ℕ)+(N%M : ℕ) := by + exact_mod_cast (Nat.div_add_mod N M).symm + have hmR : (0 : ℝ) < M := by exact_mod_cast hM + have hrlo : (0 : ℝ) ≤ (N%M : ℕ) := Nat.cast_nonneg _ + have hrhi : (N%M : ℕ) / (M : ℝ) ≤ 1 := (div_le_one hmR).mpr (by exact_mod_cast (Nat.mod_lt N hM).le) + have he : (N/M : ℕ)*A - (N : ℝ)*(A/(M : ℝ)) = -((N%M : ℕ)/(M : ℝ)*A) := by + rw [hq] + field_simp + ring + rw [sum_period_quotient M N f hp] + calc + _ = |(∑ n ∈ range (N%M), f n) - ((N%M : ℕ)/(M : ℝ)*A)| := by + congr 1 + dsimp only [A] at he ⊢ + linarith + _ ≤ |∑ n ∈ range (N%M), f n| + |((N%M : ℕ)/(M : ℝ)*A)| := abs_sub _ _ + _ ≤ K+K := by + apply add_le_add hR + rw [abs_mul,abs_of_nonneg (div_nonneg hrlo hmR.le)] + exact (mul_le_mul_of_nonneg_left hA (div_nonneg hrlo hmR.le)).trans + ((mul_le_mul_of_nonneg_right hrhi hK).trans_eq (one_mul K)) + _ = _ := by dsimp only [K]; ring + +end OrdinaryCorrelations.PeriodicOrigin + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Support.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Support.lean new file mode 100644 index 0000000000000000000000000000000000000000..a74ef3cb75430347599b5a8c35703b6ae3414477 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Support.lean @@ -0,0 +1,90 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.TaggedPrimeGroups +variable {P : Type*} [Fintype P] [DecidableEq P] + +def support {m : ℕ} (x : Fin m → P) : Finset P := univ.image x + +def weight (W : P → ℝ) {m : ℕ} (x : Fin m → P) : ℝ := ∏ p ∈ support x, W p + +omit [Fintype P] in +lemma weight_nonneg (W : P → ℝ) (hW : ∀ p, 0 ≤ W p) {m : ℕ} (x : Fin m → P) : + 0 ≤ weight W x := prod_nonneg (fun p _ => hW p) + +omit [Fintype P] in +lemma support_cons {m : ℕ} (p : P) (x : Fin m → P) : + support (Fin.cons p x) = insert p (support x) := by + ext q + simp only [support,mem_image,mem_univ,true_and,mem_insert] + constructor + · rintro ⟨i,hi⟩ + revert hi + refine Fin.cases ?_ (fun j => ?_) i + · intro hi; exact Or.inl hi.symm + · intro hi; exact Or.inr ⟨j,hi⟩ + · rintro (rfl | ⟨j,hj⟩) + · exact ⟨0,Fin.cons_zero _ _⟩ + · exact ⟨j.succ,by simpa only [Fin.cons_succ] using hj⟩ + +omit [Fintype P] in +lemma weight_cons (W : P → ℝ) {m : ℕ} (p : P) (x : Fin m → P) : + weight W (Fin.cons p x) = (if p ∈ support x then 1 else W p) * weight W x := by + unfold weight + rw [support_cons] + by_cases hp : p ∈ support x + · rw [ite_eq_left hp,insert_eq_of_mem hp,one_mul] + · rw [ite_eq_right hp,prod_insert hp] + +lemma repeat_or_new (W : P → ℝ) (hW : ∀ p, 0 ≤ W p) {m : ℕ} (x : Fin m → P) : + (∑ p : P, weight W (Fin.cons p x)) ≤ + ((m : ℝ) + ∑ p : P, W p) * weight W x := by + simp_rw [weight_cons] + rw [← sum_mul] + apply mul_le_mul_of_nonneg_right _ (weight_nonneg W hW x) + calc + _ ≤ ∑ p : P, ((if p ∈ support x then (1 : ℝ) else 0) + W p) := by + apply sum_le_sum + intro p hp + split_ifs <;> linarith [hW p] + _ = ((support x).card : ℝ) + ∑ p : P, W p := by + rw [sum_add_distrib] + congr 1 + simp only [← sum_filter] + simp + _ ≤ _ := by + have hcard : (support x).card ≤ m := by + simpa only [support,card_univ,Fintype.card_fin] using card_image_le (s := univ) (f := x) + have hr : ((support x).card : ℝ) ≤ (m : ℝ) := by exact_mod_cast hcard + linarith + +theorem grouped_prime_sum (W : P → ℝ) (hW : ∀ p, 0 ≤ W p) (m : ℕ) : + (∑ x : Fin m → P, weight W x) ≤ ∏ i ∈ range m, ((i : ℝ) + ∑ p : P, W p) := by + induction m with + | zero => simp [weight,support] + | succ m ih => + rw [← (Fin.consEquiv (fun _ : Fin (m+1) => P)).sum_comp (weight W), + Fintype.sum_prod_type,prod_range_succ] + change (∑ p : P, ∑ x : Fin m → P, weight W (Fin.cons p x)) ≤ _ + rw [sum_comm] + calc + _ ≤ ∑ x : Fin m → P, ((m : ℝ) + ∑ p : P, W p) * weight W x := + sum_le_sum (fun x hx => repeat_or_new W hW x) + _ = ((m : ℝ) + ∑ p : P, W p) * ∑ x : Fin m → P, weight W x := mul_sum .. |>.symm + _ ≤ ((m : ℝ) + ∑ p : P, W p) * ∏ i ∈ range m, ((i : ℝ) + ∑ p : P, W p) := + mul_le_mul_of_nonneg_left ih (add_nonneg (Nat.cast_nonneg _) (sum_nonneg (fun p _ => hW p))) + _ = _ := mul_comm _ _ + +end OrdinaryCorrelations.TaggedPrimeGroups + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportEqUsed.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportEqUsed.lean new file mode 100644 index 0000000000000000000000000000000000000000..cec24c7d1d0ba42f70c80894d029b25d8b631cf3 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportEqUsed.lean @@ -0,0 +1,107 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Ordered +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessTestDescriptor + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.ArithmeticSaving +open OrdinaryCorrelations.SharedSlotPatterns +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L t : ℕ} +namespace WitnessConfiguration +variable (x : WitnessConfiguration D h ℓ L t) + +lemma support_eq_used : support x.primeCode=x.family.used x.primitives := by + ext p + exact (mem_support _ p).trans (x.primeCode_support p) + +noncomputable def name (p : S.Index) (hp : p ∈ support x.primeCode) : + Fin (support x.primeCode).card := (FiniteSlotEncoding.enum (support x.primeCode)).symm ⟨p,hp⟩ + +lemma values_name (p : S.Index) (hp : p ∈ support x.primeCode) : + values x.primeCode (x.name p hp)=p := by + change ((FiniteSlotEncoding.enum (support x.primeCode)) + ((FiniteSlotEncoding.enum (support x.primeCode)).symm _)).val=p + rw [Equiv.apply_symm_apply] + +lemma selected_mem_support {j : Fin t} (d : x.family.Test j) (hd : d.Valid) : + d.selected ∈ support x.primeCode := by + rw [x.support_eq_used] + exact x.family.test_support_used x.primitives d _ (d.selected_mem hd) + +lemma modulus_mem_support {j : Fin t} (d : x.family.Test j) : + d.modulus ∈ support x.primeCode := by + rw [x.support_eq_used] + exact x.family.test_support_used x.primitives d _ d.modulus_mem + +noncomputable def template (c : PrivateFamily.Case) (A : Finset (Fin t)) + (d : ∀ j : A, x.family.Test j.val) (hd : ∀ j, (d j).Valid) : + WitnessTemplateCode ℓ L ⌈C₀*Real.log B⌉₊ t (support x.primeCode).card := + (x.metadata,pattern x.primeCode, + ⟨⟨A.card,Nat.lt_succ_of_le (by simpa using Finset.card_le_univ A)⟩, + fun i => (x.shape (d (c.ordered A i)), + x.name (d (c.ordered A i)).selected (x.selected_mem_support _ (hd _)), + x.name (d (c.ordered A i)).modulus (x.modulus_mem_support _), + decide (d (c.ordered A i)).Linear)⟩) + +lemma template_selected (c : PrivateFamily.Case) (A : Finset (Fin t)) + (d : ∀ j : A, x.family.Test j.val) (hd : ∀ j, (d j).Valid) (i : Fin A.card) : + values x.primeCode ((x.template c A d hd).selected i)=(d (c.ordered A i)).selected := + x.values_name _ _ + +lemma template_modulus (c : PrivateFamily.Case) (A : Finset (Fin t)) + (d : ∀ j : A, x.family.Test j.val) (hd : ∀ j, (d j).Valid) (i : Fin A.card) : + values x.primeCode ((x.template c A d hd).modulus i)=(d (c.ordered A i)).modulus := + x.values_name _ _ + +lemma template_expression (c : PrivateFamily.Case) (A : Finset (Fin t)) + (d : ∀ j : A, x.family.Test j.val) (hd : ∀ j, (d j).Valid) (i : Fin A.card) : + ((x.template c A d hd).expression h i).relabel (values x.primeCode)= + (d (c.ordered A i)).symbolic x.labels := + x.pattern_shape_expression _ + +lemma template_wellFormed (c : PrivateFamily.Case) (A : Finset (Fin t)) + (d : ∀ j : A, x.family.Test j.val) (hd : ∀ j, (d j).Valid) + (hinj : Function.Injective (fun j => (d j).selected)) + (hfuture : ∀ i j : A, c.Precedes i.val j.val → ((d j).selected:ℕ) ∉ (d i).support) : + (x.template c A d hd).WellFormed h := by + apply WitnessTemplateCode.wellFormed_of_relabel (x.template c A d hd) h (values x.primeCode) + (PrivateFamily.testEmbedding c A d hinj) (PrivateFamily.testSystem x.labels c A d hd hinj hfuture) + · exact x.template_selected c A d hd + · exact x.template_expression c A d hd + · exact x.template_modulus c A d hd + · intro i; rfl + +lemma template_admissible (c : PrivateFamily.Case) (A : Finset (Fin t)) + (d : ∀ j : A, x.family.Test j.val) (hd : ∀ j, (d j).Valid) + (hinj : Function.Injective (fun j => (d j).selected)) + (hfuture : ∀ i j : A, c.Precedes i.val j.val → ((d j).selected:ℕ) ∉ (d i).support) + (hnd : ∀ j, if (d j).Linear then ¬(((d j).modulus:ℕ):ℤ) ∣ (d j).coefficient + else (d j).expression ≠ 0) + (hB : 0 ≤ B) (P : ℝ) (hP : ∀ p : S.Index, P ≤ (p:ℝ)) + (hupper : ∀ p : S.Index, (p:ℝ) ≤ Real.exp B) + (r : S.Residues) (hq : ∀ i p, (x.family.witness i).spec.ResidueTest p + (x.family.witness i).vertex (r p)) : + ((x.template c A d hd).system h (x.template_wellFormed c A d hd hinj hfuture)).Admissible + P (PrivateFamily.testSize B C₀ h ℓ L) (fun a => (values x.primeCode a:ℕ)) := by + apply WitnessTemplateCode.system_admissible_of_relabel (x.template c A d hd) h + (x.template_wellFormed c A d hd hinj hfuture) (values x.primeCode) + (PrivateFamily.testEmbedding c A d hinj) (PrivateFamily.testSystem x.labels c A d hd hinj hfuture) + (x.template_selected c A d hd) (x.template_expression c A d hd) + (x.template_modulus c A d hd) (fun _ => rfl) + exact PrivateFamily.testSystem_admissible x.labels c A d hd hinj hfuture hnd hB P hP hupper r hq + +end WitnessConfiguration +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportIffExtraOrLabel.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportIffExtraOrLabel.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5afff6216aada071d46e1de673c7bca89dad59c --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportIffExtraOrLabel.lean @@ -0,0 +1,107 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ListSupport +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.LastEdge + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h L ℓ : ℕ} + +namespace Specification +lemma support_iff_extra_or_label (s : S.Specification D h L) (p : S.Index) : + (p:ℕ) ∈ s.primeSupport ↔ p=s.extra ∨ ∃ i : Fin s.length, (p:ℕ) ∣ s.label i := by + simp only [primeSupport,mem_insert,mem_biUnion,mem_univ,true_and] + constructor + · rintro (he|⟨i,hi⟩) + · exact Or.inl (Subtype.ext he) + · exact Or.inr ⟨i,(Nat.mem_primeFactors.mp hi).2.1⟩ + · rintro (rfl|⟨i,hi⟩) + · exact Or.inl rfl + · exact Or.inr ⟨i,Nat.mem_primeFactors.mpr + ⟨S.prime_mem p p.property,hi,(D.squarefree _ (s.label_mem i)).ne_zero⟩⟩ + +noncomputable def activity (s : S.Specification D h L) (p : S.Index) + (hp : (p:ℕ) ∈ s.primeSupport) : Fin (s.length+1) := + if he : p=s.extra then 0 else + (Classical.choose ((s.support_iff_extra_or_label p).mp hp |>.resolve_left he)).castSucc + +lemma activity_divides (s : S.Specification D h L) (p : S.Index) + (hp : (p:ℕ) ∈ s.primeSupport) (x : ℤ) (hx : s.QualifiesAt x) : + ((p:ℕ):ℤ) ∣ x+s.offset (s.activity p hp) := by + unfold activity + split_ifs with he + · subst p + simpa only [s.offset_zero,add_zero] using hx.1 + · exact dvd_trans (by exact_mod_cast (Classical.choose_spec + (((s.support_iff_extra_or_label p).mp hp).resolve_left he))) + (hx.2 (Classical.choose (((s.support_iff_extra_or_label p).mp hp).resolve_left he))) + +lemma tail_support (s : S.Specification D h L) (r : S.Index) + (hr : (r:ℕ) ∣ s.label s.tailStart) : (r:ℕ) ∈ s.primeSupport := + (s.support_iff_extra_or_label r).mpr (Or.inr ⟨s.tailStart,hr⟩) + +lemma occurs_before_or_tail (s : S.Specification D h L) (q : S.Index) + (hq : (q:ℕ) ∈ s.primeSupport) : + q=s.extra ∨ (∃ i : Fin s.length, i < s.tailStart ∧ (q:ℕ) ∣ s.label i) ∨ + ((q:ℕ) ∣ s.label s.tailStart ∧ + ∀ i : Fin s.length, i < s.tailStart → ¬(q:ℕ) ∣ s.label i) := by + rcases (s.support_iff_extra_or_label q).mp hq with he|⟨i,hi⟩ + · exact Or.inl he + · by_cases hpre : ∃ i : Fin s.length, i < s.tailStart ∧ (q:ℕ) ∣ s.label i + · exact Or.inr (Or.inl hpre) + · right; right + have hat : s.tailStart ≤ i := by + by_contra hn + exact hpre ⟨i,lt_of_not_ge hn,hi⟩ + constructor + · rwa [s.tail_labels i hat] at hi + · intro j hj hd + exact hpre ⟨j,hj,hd⟩ +end Specification + +lemma free_prime_one_side (w : ClosedLine h ℓ) (p : S.Index) (hp : ¬S.IsFixed w p) + (k : Fin (ℓ+1)) : + (∀ i : Fin ℓ, i.val < k.val → ¬(p:ℕ) ∣ w.label i) ∨ + (∀ i : Fin ℓ, k.val ≤ i.val → ¬(p:ℕ) ∣ w.label i) := by + by_cases ha : ∀ i : Fin ℓ, i.val < k.val → ¬(p:ℕ) ∣ w.label i + · exact Or.inl ha + · right + push Not at ha + obtain ⟨e,hek,he⟩ := ha + intro i hki hi + have hei := (unique_occurrence_of_free w p hp e he i).mp hi + subst i + omega + +lemma attached_activity_comparison (w : ClosedLine h ℓ) + (a b : AttachedSpec w D L) (r : S.Index) + (hr : (r:ℕ) ∈ a.spec.primeSupport) + (hrt : (r:ℕ) ∣ b.spec.label b.spec.tailStart) + (x : ℤ) (ha : a.spec.QualifiesAt (x+a.vertex)) + (hb : b.spec.QualifiesAt (x+b.vertex)) : + ((r:ℕ):ℤ) ∣ b.vertex-a.vertex+b.spec.offset b.spec.tailStart.castSucc- + a.spec.offset (a.spec.activity r hr) := by + have hi := a.spec.activity_divides r hr (x+a.vertex) ha + have hj : ((r:ℕ):ℤ) ∣ x+b.vertex+b.spec.offset b.spec.tailStart.castSucc := + dvd_trans (by exact_mod_cast hrt) (hb.2 b.spec.tailStart) + have he : b.vertex-a.vertex+b.spec.offset b.spec.tailStart.castSucc- + a.spec.offset (a.spec.activity r hr) = + (x+b.vertex+b.spec.offset b.spec.tailStart.castSucc)- + (x+a.vertex+a.spec.offset (a.spec.activity r hr)) := by ring + rw [he] + exact dvd_sub hj hi + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Symbolic.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Symbolic.lean new file mode 100644 index 0000000000000000000000000000000000000000..23a607eddc7a48ffa7281366cfe7dd9ccc76e4ee --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Symbolic.lean @@ -0,0 +1,154 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Test +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ZeroExpression +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.EdgeAt +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.LinearCoeffZeroOfNot + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SignedTrace +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h L ℓ n : ℕ} +namespace PrivateFamily.Test +variable {w : ClosedLine h ℓ} (hl : ∀ i, w.label i ∈ D.members) + {F : PrivateFamily w D L n} {j : Fin n} + +noncomputable def symbolic : F.Test j → SquarefreeExpression S.Index ((ℓ+L)+L) + | .extra | .tail _ => + ((SquarefreeExpression.zeroExpression S.Index ℓ).append + ((F.witness j).spec.segmentExpression (F.witness j).spec.suffix.val (F.witness j).spec.length)).append + (SquarefreeExpression.zeroExpression S.Index L) + | .compare i _ r hi => + ((LineExpression.segment w hl (F.witness i).index (F.witness j).index).append + ((F.witness j).spec.segmentExpression 0 (F.witness j).spec.tailStart.val)).append + ((F.witness i).spec.segmentExpression 0 ((F.witness i).spec.activity r hi).val).neg + +lemma symbolic_eval (t : F.Test j) : + (t.symbolic hl).eval (fun p => ((p:ℕ):ℤ)) = t.expression := by + cases t with + | extra => + simp only [symbolic,SquarefreeExpression.eval_append,SquarefreeExpression.eval_zero, + zero_add,add_zero,expression] + exact (F.witness j).spec.segmentExpression_eval _ _ (Fin.isLt _).le le_rfl + | tail q => + simp only [symbolic,SquarefreeExpression.eval_append,SquarefreeExpression.eval_zero, + zero_add,add_zero,expression] + exact (F.witness j).spec.segmentExpression_eval _ _ (Fin.isLt _).le le_rfl + | compare i q r hi => + simp only [symbolic,SquarefreeExpression.eval_append,SquarefreeExpression.eval_neg, + LineExpression.segment_eval] + rw [(F.witness j).spec.segmentExpression_eval 0 _ (Nat.zero_le _) (Fin.isLt _).le, + (F.witness i).spec.segmentExpression_eval 0 _ (Nat.zero_le _) + (Nat.lt_succ_iff.mp ((F.witness i).spec.activity r hi).isLt)] + change w.offset (F.witness j).index-w.offset (F.witness i).index+ + ((F.witness j).spec.offset (F.witness j).spec.tailStart.castSucc-(F.witness j).spec.offset 0)+ + -((F.witness i).spec.offset ((F.witness i).spec.activity r hi)-(F.witness i).spec.offset 0) = _ + rw [(F.witness j).spec.offset_zero,(F.witness i).spec.offset_zero] + simp only [expression,AttachedSpec.vertex,sub_eq_add_neg,neg_zero,add_zero] + +lemma symbolic_coefficient (t : F.Test j) : + (t.symbolic hl).linearCoeff t.selected (fun p => ((p:ℕ):ℤ)) = t.coefficient := by + cases t with + | extra => + simp only [symbolic,selected,SquarefreeExpression.coefficient_append, + SquarefreeExpression.coefficient_zero,zero_add,add_zero,coefficient] + exact SquarefreeExpression.linearCoeff_zero_of_not_support _ _ + ((F.witness j).spec.segmentExpression_extra_absent _ _) _ + | tail q => + simp only [symbolic,selected,SquarefreeExpression.coefficient_append, + SquarefreeExpression.coefficient_zero,zero_add,add_zero,coefficient] + exact (F.witness j).spec.segmentExpression_coefficient _ _ le_rfl _ + | compare i q r hi => + simp only [symbolic,selected,SquarefreeExpression.coefficient_append, + SquarefreeExpression.coefficient_neg,LineExpression.segment_coefficient] + rw [(F.witness j).spec.segmentExpression_coefficient 0 _ (Fin.isLt _).le, + (F.witness i).spec.segmentExpression_coefficient 0 _ + (Nat.lt_succ_iff.mp ((F.witness i).spec.activity r hi).isLt)] + rfl + +lemma symbolic_support (t : F.Test j) {p : S.Index} + (hp : p ∈ (t.symbolic hl).support) : (p:ℕ) ∈ t.support := by + cases t with + | extra => + simp only [symbolic,SquarefreeExpression.support_append,SquarefreeExpression.support_zero, + empty_union,union_empty] at hp + exact (F.witness j).spec.segmentExpression_support _ _ hp + | tail q => + simp only [symbolic,SquarefreeExpression.support_append,SquarefreeExpression.support_zero, + empty_union,union_empty] at hp + exact (F.witness j).spec.segmentExpression_support _ _ hp + | compare i q r hi => + simp only [symbolic,SquarefreeExpression.support_append,SquarefreeExpression.support_neg,mem_union] at hp + rcases hp with (hp|hp)|hp + · exact mem_union_right _ (LineExpression.segment_support w hl _ _ hp) + · exact mem_union_left _ (mem_union_right _ ((F.witness j).spec.segmentExpression_support _ _ hp)) + · exact mem_union_left _ (mem_union_left _ ((F.witness i).spec.segmentExpression_support _ _ hp)) + +lemma symbolic_own_absent (t : F.Test j) (ht : ¬t.Linear) : t.selected ∉ (t.symbolic hl).support := by + cases t with + | extra => + simp only [symbolic,selected,SquarefreeExpression.support_append,SquarefreeExpression.support_zero, + empty_union,union_empty] + exact (F.witness j).spec.segmentExpression_extra_absent _ _ + | tail q => exact (ht trivial).elim + | compare i q r hi => exact (ht trivial).elim + +lemma symbolic_factor_card (t : F.Test j) (i : Fin ((ℓ+L)+L)) : + ((t.symbolic hl).factors i).card ≤ ⌈C₀*Real.log B⌉₊ := by + cases t with + | extra | tail => + apply SquarefreeExpression.factors_append_le _ _ _ _ _ i + · apply SquarefreeExpression.factors_append_le + · intro e; simp [SquarefreeExpression.zeroExpression] + · exact fun e => (F.witness j).spec.segmentExpression_factor_card _ _ e + · intro e; simp [SquarefreeExpression.zeroExpression] + | compare a q r ha => + apply SquarefreeExpression.factors_append_le _ _ _ _ _ i + · apply SquarefreeExpression.factors_append_le + · exact fun e => LineExpression.segment_factor_card w hl _ _ e + · exact fun e => (F.witness j).spec.segmentExpression_factor_card _ _ e + · exact fun e => (F.witness a).spec.segmentExpression_factor_card 0 ((F.witness a).spec.activity r ha).val e + +lemma symbolic_coeff_bound (t : F.Test j) (i : Fin ((ℓ+L)+L)) : + |((t.symbolic hl).coefficient i:ℝ)| ≤ (h:ℝ) := by + cases t with + | extra | tail => + apply SquarefreeExpression.abs_coefficient_append_le _ _ _ _ _ i + · apply SquarefreeExpression.abs_coefficient_append_le + · intro e; simp [SquarefreeExpression.zeroExpression] + · exact fun e => (F.witness j).spec.segmentExpression_coeff_bound _ _ e + · intro e; simp [SquarefreeExpression.zeroExpression] + | compare a q r ha => + apply SquarefreeExpression.abs_coefficient_append_le _ _ _ _ _ i + · apply SquarefreeExpression.abs_coefficient_append_le + · exact fun e => LineExpression.segment_coeff_bound w hl _ _ e + · exact fun e => (F.witness j).spec.segmentExpression_coeff_bound _ _ e + · intro e + simpa only [SquarefreeExpression.neg,Int.cast_neg,abs_neg] using + (F.witness a).spec.segmentExpression_coeff_bound 0 ((F.witness a).spec.activity r ha).val e + +lemma symbolic_size (t : F.Test j) (hB : 0 ≤ B) (x : S.Index → ℕ) + (hx : ∀ p, (x p:ℝ) ≤ Real.exp B) : + |((t.symbolic hl).eval (fun p => (x p:ℤ)):ℝ)| ≤ + ((ℓ+L)+L)*h*Real.exp (B*⌈C₀*Real.log B⌉₊) := by + have hb := SquarefreeExpression.abs_eval_le (t.symbolic hl) ⌈C₀*Real.log B⌉₊ B (h:ℝ) + hB (Nat.cast_nonneg h) (t.symbolic_factor_card hl) (t.symbolic_coeff_bound hl) + (fun p => (x p:ℤ)) (by + intro p hp + simpa only [Int.cast_natCast,abs_of_nonneg (show (0:ℝ) ≤ (x p:ℝ) from Nat.cast_nonneg _)] using hx p) + simpa only [Nat.cast_add] using hb + +end PrivateFamily.Test +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedEdgeProduct.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedEdgeProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fa0ab5f849e8fd9d7955da38004a7bbce5f135e --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedEdgeProduct.lean @@ -0,0 +1,96 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TokenSlot +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.UntaggedEdgeCode + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtrees +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +noncomputable def taggedEdgeProduct (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (a : S.FixedResidues w) (e : Fin ℓ) : ℝ := + ∏ p : S.Index, if e ∈ (taggedTokens w hh 𝔏 (recordAt w hh 𝔏 a) p).biUnion tokenEdges + then (p:ℝ) else 1 + +lemma taggedEdgeProduct_pos (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (a : S.FixedResidues w) (e : Fin ℓ) : + 0 < taggedEdgeProduct w hh 𝔏 a e := by + apply prod_pos + intro p _ + split_ifs + · exact_mod_cast S.prime_mem _ p.property |>.pos + · norm_num + +lemma unorderedEdgeProduct_fibers (w : ClosedLine h ℓ) (f : S.Index → Option (TokenType w)) + (e : Fin ℓ) : + unorderedEdgeProduct (TypeFibers.multiplicity f) (TypeFibers.unordered f) e = + ∏ p : S.Index, TypeFibers.factor f (fun t (p : S.Index) => + if e ∈ t.2.edges.val then (p:ℝ) else 1) p := by + rw [← TypeFibers.fiber_product f] + apply prod_congr rfl + intro t _ + by_cases he : e ∈ t.2.edges.val <;> + simp only [TypeFibers.unordered,he,ite_true,ite_false,prod_const_one] + +lemma tagged_untagged_edge_split (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (a : S.FixedResidues w) (e : Fin ℓ) (p : S.Index) : + (if e ∈ (taggedTokens w hh 𝔏 (recordAt w hh 𝔏 a) p).biUnion tokenEdges then (p:ℝ) else 1) * + TypeFibers.factor (untaggedType w hh 𝔏 a) + (fun t (p : S.Index) => if e ∈ t.2.edges.val then (p:ℝ) else 1) p = + if e ∈ (recordTokens w hh 𝔏 (recordAt w hh 𝔏 a) p).biUnion tokenEdges then (p:ℝ) else 1 := by + rcases he : untaggedType w hh 𝔏 a p with _ | t + · rw [taggedTokens_of_none w hh 𝔏 a p he] + simp only [TypeFibers.factor,he,mul_one] + · rw [taggedTokens_of_some w hh 𝔏 a p t he, + (untaggedType_some w hh 𝔏 a p t he).2] + simp only [biUnion_empty,notMem_empty,ite_false,TypeFibers.factor,he,one_mul, + singleton_biUnion,tokenEdges] + +theorem record_edge_factorization (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (a : S.FixedResidues w) + (hlabels : ∀ i, w.label i ∈ D.members) (e : Fin ℓ) (he : e ∈ w.treeSteps) : + taggedEdgeProduct w hh 𝔏 a e * + unorderedEdgeProduct (TypeFibers.multiplicity (untaggedType w hh 𝔏 a)) + (TypeFibers.unordered (untaggedType w hh 𝔏 a)) e = (w.label e : ℝ) := by + rw [unorderedEdgeProduct_fibers,taggedEdgeProduct,← prod_mul_distrib] + simp_rw [tagged_untagged_edge_split] + have hr := recordTokens_recover_label w hh 𝔏 a hlabels e he + simp only [mem_biUnion] + exact_mod_cast hr + +lemma unorderedEdgeProduct_reference {w v : ClosedLine h ℓ} (H : SameGeometry v w) + (hh : 0 < h) (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) (e : Fin ℓ) : + unorderedEdgeProduct (TypeFibers.multiplicity (untaggedReference H hh 𝔏 a)) + (TypeFibers.unordered (untaggedReference H hh 𝔏 a)) e = + unorderedEdgeProduct (TypeFibers.multiplicity (untaggedType v hh 𝔏 a)) + (TypeFibers.unordered (untaggedType v hh 𝔏 a)) e := by + rw [unorderedEdgeProduct_fibers,unorderedEdgeProduct_fibers] + apply prod_congr rfl + intro p _ + rcases he : untaggedType v hh 𝔏 a p with _ | t <;> + simp only [TypeFibers.factor,untaggedReference,he,Option.map_none,Option.map_some] + rfl + +theorem record_unordered_bins {w v : ClosedLine h ℓ} (H : SameGeometry v w) + (hh : 0 < h) (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) + (hlabels : ∀ i, v.label i ∈ D.members) : + unorderedBins (TypeFibers.multiplicity (untaggedReference H hh 𝔏 a)) + (taggedEdgeProduct v hh 𝔏 a) D.H τ (TypeFibers.unordered (untaggedReference H hh 𝔏 a)) := by + intro e he + rw [unorderedEdgeProduct_reference, + record_edge_factorization v hh 𝔏 a hlabels e (H.trees.symm ▸ he)] + exact ⟨D.lower _ (hlabels e),D.upper _ (hlabels e)⟩ + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShape.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShape.lean new file mode 100644 index 0000000000000000000000000000000000000000..31d8b998ff0eef9418c44e59462422e02bac23d1 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShape.lean @@ -0,0 +1,106 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ModifiedWeightSameBand + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtrees +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +abbrev TaggedShape (w : ClosedLine h ℓ) := Shape w ⊕ Fin ℓ + +def taggedShapeCode (w : ClosedLine h ℓ) : TaggedShape w → LocalToken ℓ + | .inl Q => (true,false,Q.edges.val) + | .inr e => (true,true,{e}) + +lemma taggedShapeCode_injective (w : ClosedLine h ℓ) : Function.Injective (taggedShapeCode w) := by + intro s t he + rcases s with Q | e <;> rcases t with R | j + · exact congrArg Sum.inl (Shape.edges_injective w (congrArg (fun t : LocalToken ℓ => t.2.2) he)) + · have := congrArg (fun t : LocalToken ℓ => t.2.1) he; contradiction + · have := congrArg (fun t : LocalToken ℓ => t.2.1) he; contradiction + · exact congrArg Sum.inr (singleton_injective (congrArg (fun t : LocalToken ℓ => t.2.2) he)) + +lemma taggedPieces_shape (w : ClosedLine h ℓ) (hh : 0 < h) (O E : Finset (Fin ℓ)) + (hE : E ⊆ w.treeSteps) (t : LocalToken ℓ) (ht : t ∈ taggedPieces w hh O E) : + ∃ s : TaggedShape w, taggedShapeCode w s=t := by + rcases mem_union.mp ht with ht | ht + · obtain ⟨c,hc,rfl⟩ := mem_image.mp ht + exact ⟨.inl (shapeFromGrows w _ _ (component_grows w hh hE c hc) + (componentEdges_nonempty w hh E c hc)),rfl⟩ + · obtain ⟨e,he,rfl⟩ := mem_image.mp ht + exact ⟨.inr e,rfl⟩ + +theorem record_tagged_shape (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (a : S.FixedResidues w) (p : S.Index) + (t : LocalToken ℓ) (ht : t ∈ taggedTokens w hh 𝔏 (recordAt w hh 𝔏 a) p) : + ∃ s : TaggedShape w, taggedShapeCode w s=t := by + obtain ⟨ht,htag⟩ := mem_filter.mp ht + by_cases ho : (treeOccurrences w p).Nonempty + · rw [recordTokens,ite_eq_left ho] at ht + by_cases hf : S.IsFixed w p + · rw [ite_eq_left hf] at ht + by_cases hp : (recordAt w hh 𝔏 a).2 p=true + · rw [ite_eq_left hp] at ht + exact taggedPieces_shape w hh _ _ ((recordAt_compatible w hh 𝔏 a p).trans (filter_subset _ _)) t ht + · rw [ite_eq_right hp] at ht + have he := mem_singleton.mp ht + have hfalse : t.1=false := congrArg Prod.fst he + rw [hfalse] at htag + contradiction + · rw [ite_eq_right hf] at ht + obtain ⟨e,he,rfl⟩ := mem_image.mp ht + by_cases hp : singletonIsTagged w 𝔏 p e + · exact ⟨.inr e,by simp only [taggedShapeCode,freePiece,hp,ite_true]⟩ + · simp only [freePiece,hp,ite_false] at htag + contradiction + · rw [recordTokens,ite_eq_right ho] at ht + exact False.elim (Finset.notMem_empty _ ht) + +lemma subtree_shape_sum (w : ClosedLine h ℓ) (p : S.Index) : + (∑ Q : Shape w, subtreeUnionWeight w p Q.edges.val) ≤ bandDefect w (S.beta p) := by + have hA : 0 ≤ S.amplitude p := by + unfold amplitude + split_ifs + · exact A_pos.le + · norm_num + have hne : 1+S.amplitude p ≠ 0 := ne_of_gt (by linarith) + have hunit : S.beta p*(1+S.amplitude p)=1 := inv_mul_cancel₀ hne + rw [sum_shapes] + exact numerical_subtree_sum_le w (S.amplitude p) (S.beta p) hA (beta_nonneg p) hunit + +lemma bandDefect_le_vertices (w : ClosedLine h ℓ) (p : S.Index) : + bandDefect w (S.beta p) ≤ (ℓ:ℝ)+1 := by + calc + _ ≤ ∑ _v ∈ treeVertices w, (1:ℝ) := by + apply sum_le_sum + intro v hv + have hn : 0 ≤ (S.beta p)^(w.children v) := pow_nonneg (beta_nonneg p) _ + linarith + _ = ((treeVertices w).card : ℝ) := by simp + _ ≤ (ℓ:ℝ)+1 := by + have hc : (treeVertices w).card ≤ ℓ+1 := by + simpa only [treeVertices,card_univ,Fintype.card_fin] using card_image_le (s := (univ : Finset (Fin (ℓ+1)))) (f := w.offset) + exact_mod_cast hc + +theorem tagged_shape_sum (w : ClosedLine h ℓ) (p : S.Index) : + (∑ s : TaggedShape w, localTokenWeight w p (taggedShapeCode w s)) ≤ 3*(ℓ:ℝ)+1 := by + rw [Fintype.sum_sum_type] + simp only [taggedShapeCode,localTokenWeight,ite_true,Bool.false_eq_true,ite_false,tokenEdges] + have h1 := subtree_shape_sum w p + have h2 := bandDefect_le_vertices w p + simp only [sum_const,card_univ,Fintype.card_fin,nsmul_eq_mul] + linarith + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShapeMap.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShapeMap.lean new file mode 100644 index 0000000000000000000000000000000000000000..f24bed0cece902ee7fe0ebcb0cf103150a4de847 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShapeMap.lean @@ -0,0 +1,111 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TopologyTreeSteps +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SpecPrimeSlot +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TaggedShape +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Enum +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.VertexIndex + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtrees +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +def taggedShapeMap {w v : ClosedLine h ℓ} (H : SameGeometry v w) : TaggedShape v → TaggedShape w + | .inl Q => .inl (H.shapeMap Q) + | .inr e => .inr e + +lemma taggedShapeMap_code {w v : ClosedLine h ℓ} (H : SameGeometry v w) (s : TaggedShape v) : + taggedShapeCode w (taggedShapeMap H s)=taggedShapeCode v s := by + cases s <;> rfl + +lemma taggedShapeMap_weight {w v : ClosedLine h ℓ} (H : SameGeometry v w) (p : S.Index) + (s : TaggedShape v) : + localTokenWeight w p (taggedShapeCode w (taggedShapeMap H s)) = + localTokenWeight v p (taggedShapeCode v s) := by + cases s with + | inl Q => exact (H.weight p Q.edges.val).symm + | inr e => rfl + +lemma taggedShapeMap_surjective {w v : ClosedLine h ℓ} (H : SameGeometry v w) : + Function.Surjective (taggedShapeMap H) := by + intro t + cases t with + | inl Q => + obtain ⟨R,hR⟩ := H.shapeEquiv.surjective Q + exact ⟨.inl R,congrArg Sum.inl hR⟩ + | inr e => exact ⟨.inr e,rfl⟩ + +noncomputable def taggedPairSet {w v : ClosedLine h ℓ} (_H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) : Finset (S.Index × TaggedShape w) := + univ.filter (fun z => taggedShapeCode w z.2 ∈ taggedTokens v hh 𝔏 (recordAt v hh 𝔏 a) z.1) + +lemma mem_taggedPairSet {w v : ClosedLine h ℓ} (H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) (p : S.Index) (s : TaggedShape w) : + (p,s) ∈ taggedPairSet H hh 𝔏 a ↔ + taggedShapeCode w s ∈ taggedTokens v hh 𝔏 (recordAt v hh 𝔏 a) p := by + simp only [taggedPairSet,mem_filter,mem_univ,true_and] + +lemma taggedToken_iff_pair {w v : ClosedLine h ℓ} (H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) (p : S.Index) (t : LocalToken ℓ) : + t ∈ taggedTokens v hh 𝔏 (recordAt v hh 𝔏 a) p ↔ + ∃ s : TaggedShape w, (p,s) ∈ taggedPairSet H hh 𝔏 a ∧ taggedShapeCode w s=t := by + constructor + · intro ht + obtain ⟨s,hs⟩ := record_tagged_shape v hh 𝔏 a p t ht + refine ⟨taggedShapeMap H s,?_,?_⟩ + · rw [mem_taggedPairSet,taggedShapeMap_code,hs] + exact ht + · exact (taggedShapeMap_code H s).trans hs + · rintro ⟨s,hs,rfl⟩ + exact (mem_taggedPairSet H hh 𝔏 a p s).mp hs + +noncomputable def taggedRecordCode {w v : ClosedLine h ℓ} (H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) (N : ℕ) : + Fin N → Option (S.Index × TaggedShape w) := FiniteSlotEncoding.code (taggedPairSet H hh 𝔏 a) N + +theorem tag_tokens_eq_of_code {w v u : ClosedLine h ℓ} + (H : SameGeometry v w) (I : SameGeometry u w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (𝔐 : List (AttachedSpec u D L)) + (a : S.FixedResidues v) (b : S.FixedResidues u) (N : ℕ) + (hN : (taggedPairSet H hh 𝔏 a).card ≤ N) (hM : (taggedPairSet I hh 𝔐 b).card ≤ N) + (hc : taggedRecordCode H hh 𝔏 a N=taggedRecordCode I hh 𝔐 b N) (p : S.Index) : + taggedTokens v hh 𝔏 (recordAt v hh 𝔏 a) p=taggedTokens u hh 𝔐 (recordAt u hh 𝔐 b) p := by + have hs := FiniteSlotEncoding.code_injective hN hM hc + ext t + rw [taggedToken_iff_pair H hh 𝔏 a p t,taggedToken_iff_pair I hh 𝔐 b p t,hs] + +noncomputable def taggedPairEquiv {w v : ClosedLine h ℓ} (H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) : + ↥(taggedPairSet H hh 𝔏 a) ≃ TaggedSlot v hh 𝔏 a := + Equiv.ofBijective + (fun z => ⟨z.val.1,⟨taggedShapeCode w z.val.2,(mem_taggedPairSet H hh 𝔏 a _ _).mp z.property⟩⟩) + ⟨by + intro x y he + have hp : x.val.1=y.val.1 := congrArg Sigma.fst he + have hT : taggedShapeCode w x.val.2=taggedShapeCode w y.val.2 := + congrArg (fun z : TaggedSlot v hh 𝔏 a => z.2.val) he + exact Subtype.ext (Prod.ext hp (taggedShapeCode_injective w hT)), + by + rintro ⟨p,t⟩ + obtain ⟨s,hs,he⟩ := (taggedToken_iff_pair H hh 𝔏 a p t.val).mp t.property + refine ⟨⟨(p,s),hs⟩,?_⟩ + exact congrArg (fun z => (Sigma.mk p z : TaggedSlot v hh 𝔏 a)) (Subtype.ext he)⟩ + +lemma taggedPairSet_card {w v : ClosedLine h ℓ} (H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) : + (taggedPairSet H hh 𝔏 a).card=Fintype.card (TaggedSlot v hh 𝔏 a) := by + simpa only [Fintype.card_coe] using Fintype.card_congr (taggedPairEquiv H hh 𝔏 a) + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Test.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Test.lean new file mode 100644 index 0000000000000000000000000000000000000000..9b36f08b0a20beb76e791be4c9f25ddd0d456c84 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Test.lean @@ -0,0 +1,163 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.IntegerResidues +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrivateFamily +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CoefficientZeroOfNotSupport +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrefixCoefficientNondvd + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h L ℓ n : ℕ} +namespace PrivateFamily +variable {w : ClosedLine h ℓ} (F : PrivateFamily w D L n) + +inductive Test (j : Fin n) where + | extra + | tail (q : S.Index) + | compare (i : Fin n) (q r : S.Index) + (hr : (r:ℕ) ∈ (F.witness i).spec.primeSupport) + +namespace Test +variable {F} {j : Fin n} + +def selected : F.Test j → S.Index + | .extra => (F.witness j).spec.extra + | .tail q => q + | .compare _ q _ _ => q + +def modulus : F.Test j → S.Index + | .extra => (F.witness j).spec.extra + | .tail _ => (F.witness j).spec.extra + | .compare _ _ r _ => r + +noncomputable def support : F.Test j → Finset ℕ + | .extra => (F.witness j).spec.primeSupport + | .tail _ => (F.witness j).spec.primeSupport + | .compare i _ _ _ => F.comparisonSupport i j + +noncomputable def expression : F.Test j → ℤ + | .extra => (F.witness j).spec.offset (Fin.last (F.witness j).spec.length)- + (F.witness j).spec.offset (F.witness j).spec.suffix.castSucc + | .tail _ => (F.witness j).spec.offset (Fin.last (F.witness j).spec.length)- + (F.witness j).spec.offset (F.witness j).spec.suffix.castSucc + | .compare i _ r hi => (F.witness j).vertex-(F.witness i).vertex+ + (F.witness j).spec.offset (F.witness j).spec.tailStart.castSucc- + (F.witness i).spec.offset ((F.witness i).spec.activity r hi) + +noncomputable def coefficient : F.Test j → ℤ + | .extra => 0 + | .tail q => (F.witness j).spec.coefficient q (F.witness j).spec.suffix.val + (F.witness j).spec.length + | .compare i q r hi => + w.segmentCoefficient q (F.witness i).index (F.witness j).index+ + (F.witness j).spec.coefficient q 0 (F.witness j).spec.tailStart.val- + (F.witness i).spec.coefficient q 0 ((F.witness i).spec.activity r hi).val + +def Valid : F.Test j → Prop + | .extra => True + | .tail q => (q:ℕ) ∣ (F.witness j).spec.label (F.witness j).spec.tailStart ∧ + ∀ e : Fin (F.witness j).spec.length, e < (F.witness j).spec.tailStart → + ¬(q:ℕ) ∣ (F.witness j).spec.label e + | .compare i q r _ => + (r:ℕ) ∣ (F.witness j).spec.label (F.witness j).spec.tailStart ∧ + (∀ e : Fin (F.witness j).spec.length, e < (F.witness j).spec.tailStart → + ¬(r:ℕ) ∣ (F.witness j).spec.label e) ∧ + (∃ e : Fin (F.witness j).spec.length, e < (F.witness j).spec.tailStart ∧ + (q:ℕ) ∣ (F.witness j).spec.label e) ∧ + (q:ℕ) ∉ (F.witness i).spec.primeSupport ∧ + (q:ℕ) ∉ w.segmentSupport (F.witness i).index (F.witness j).index + +def Linear : F.Test j → Prop + | .extra => False + | .tail _ => True + | .compare _ _ _ _ => True + +lemma selected_mem (t : F.Test j) (ht : t.Valid) : (t.selected:ℕ) ∈ t.support := by + cases t with + | extra => exact ((F.witness j).spec.support_iff_extra_or_label _).mpr (Or.inl rfl) + | tail q => + exact ((F.witness j).spec.support_iff_extra_or_label q).mpr + (Or.inr ⟨(F.witness j).spec.tailStart,ht.1⟩) + | compare i q r hi => + obtain ⟨e,he,hqe⟩ := ht.2.2.1 + exact mem_union_left _ (mem_union_right _ + (((F.witness j).spec.support_iff_extra_or_label q).mpr (Or.inr ⟨e,hqe⟩))) + +lemma comparison_coefficient (i : Fin n) (q r : S.Index) + (hi : (r:ℕ) ∈ (F.witness i).spec.primeSupport) + (ht : (Test.compare (F:=F) (j:=j) i q r hi).Valid) : + (Test.compare (F:=F) (j:=j) i q r hi).coefficient = + (F.witness j).spec.coefficient q 0 (F.witness j).spec.tailStart.val := by + change w.segmentCoefficient q (F.witness i).index (F.witness j).index+ + (F.witness j).spec.coefficient q 0 (F.witness j).spec.tailStart.val- + (F.witness i).spec.coefficient q 0 ((F.witness i).spec.activity r hi).val = _ + rw [w.segmentCoefficient_zero q (S.prime_mem q q.property) _ _ ht.2.2.2.2, + (F.witness i).spec.coefficient_zero_of_not_support q ht.2.2.2.1] + ring + +lemma holds (t : F.Test j) (ht : t.Valid) (x : ℤ) + (hx : ∀ i, (F.witness i).spec.QualifiesAt (x+(F.witness i).vertex)) : + ((t.modulus:ℕ):ℤ) ∣ t.expression := by + cases t with + | extra => exact (F.witness j).spec.extra_div_suffix + | tail q => exact (F.witness j).spec.extra_div_suffix + | compare i q r hi => + exact attached_activity_comparison w (F.witness i) (F.witness j) r hi ht.1 x (hx i) (hx j) + +lemma nondegenerate (t : F.Test j) (ht : t.Valid) (hh : 0 < h) + (hpp : h < ((F.witness j).spec.extra:ℕ)) + (hpL : L < ((F.witness j).spec.extra:ℕ)) : + if t.Linear then ¬((t.modulus:ℕ):ℤ) ∣ t.coefficient else t.expression ≠ 0 := by + cases t with + | extra => + simp only [Linear,ite_false,expression,ne_eq,sub_eq_zero] + intro he + have hi := (F.witness j).spec.offsets_distinct he + have hv := congrArg Fin.val hi + have hs := (F.witness j).spec.suffix.isLt + simp only [Fin.val_last,Fin.val_castSucc] at hv + omega + | tail q => + rw [ite_eq_left (show (Test.tail (F:=F) (j:=j) q).Linear from trivial)] + exact (F.witness j).spec.suffix_coefficient_nondvd hh hpp hpL q ht.1 ht.2 + | compare i q r hi => + rw [ite_eq_left (show (Test.compare (F:=F) (j:=j) i q r hi).Linear from trivial)] + change ¬((r:ℕ):ℤ) ∣ _ + rw [comparison_coefficient i q r hi ht] + exact (F.witness j).spec.prefix_coefficient_nondvd (F.witness j).primitive q r + ht.1 ht.2.1 ht.2.2.1 + +lemma modulus_ne_selected (t : F.Test j) (ht : t.Valid) (hl : t.Linear) : + t.modulus ≠ t.selected := by + cases t with + | extra => exact hl.elim + | tail q => + intro he + change (F.witness j).spec.extra=q at he + apply (F.witness j).spec.extra_not_div (F.witness j).spec.tailStart + rw [he] + exact ht.1 + | compare i q r hi => + intro he + obtain ⟨e,he',hqe⟩ := ht.2.2.1 + change r=q at he + apply ht.2.1 e he' + rw [he] + exact hqe + +end Test +end PrivateFamily +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TestVacuous.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TestVacuous.lean new file mode 100644 index 0000000000000000000000000000000000000000..e32688ef8e4c7e1af07a63a6de6a81dd29b7c683 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TestVacuous.lean @@ -0,0 +1,108 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SpecPrimeSlot +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AttachedMetadata +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Cylinder +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.IntegerResidues + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.SourceCylinder +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +instance (w : ClosedLine h ℓ) : Finite (AttachedSpec w D L) := by + apply Finite.of_injective + (fun s : AttachedSpec w D L => (attachedMetadata w s,specPrimeCode s.spec)) + intro s t ht + exact attached_code_injective w s t (congrArg Prod.fst ht) (congrArg Prod.snd ht) + +noncomputable instance (w : ClosedLine h ℓ) : Fintype (AttachedSpec w D L) := Fintype.ofFinite _ + +lemma Specification.test_vacuous (s : S.Specification D h L) (p : S.Index) + (hp : (p:ℕ) ∉ s.primeSupport) (b : ℤ) (a : ZMod (p:ℕ)) : s.ResidueTest p b a := by + constructor + · intro he + exact (hp (mem_insert.mpr (Or.inl he))).elim + · intro i hd + apply False.elim + apply hp + apply mem_insert_of_mem + apply mem_biUnion.mpr + refine ⟨i,mem_univ _,Nat.mem_primeFactors.mpr ⟨S.prime_mem p.val p.property,hd,?_⟩⟩ + have := D.greater_one _ (s.label_mem i) + omega + +lemma Specification.test_unique (s : S.Specification D h L) (p : S.Index) + (hp : (p:ℕ) ∈ s.primeSupport) (b : ℤ) (a a' : ZMod (p:ℕ)) + (ha : s.ResidueTest p b a) (ha' : s.ResidueTest p b a') : a=a' := by + rcases mem_insert.mp hp with he | he + · exact add_right_cancel ((ha.1 he).trans (ha'.1 he).symm) + · obtain ⟨i,hi,hpi⟩ := mem_biUnion.mp he + have hd := (Nat.mem_primeFactors.mp hpi).2.1 + exact add_right_cancel ((ha.2 i hd).trans (ha'.2 i hd).symm) + +namespace AttachedSpec +variable {w : ClosedLine h ℓ} + +noncomputable def origin (s : AttachedSpec w D L) : ℤ := + Classical.choose s.primitive.1 - s.vertex + +lemma origin_tests (s : AttachedSpec w D L) (p : S.Index) : + s.spec.ResidueTest p s.vertex (s.origin : ZMod (p:ℕ)) := by + apply (s.spec.qualifies_iff_residueTests s.origin s.vertex).mp + simpa only [origin,sub_add_cancel] using Classical.choose_spec s.primitive.1 + +noncomputable def fullCylinder (s : AttachedSpec w D L) : + Cylinder (fun p : S.Index => ZMod (p:ℕ)) := + ⟨fun p => if (p:ℕ) ∈ s.spec.primeSupport then some (s.origin : ZMod (p:ℕ)) else none⟩ + +lemma fullCylinder_holds (s : AttachedSpec w D L) (r : S.Residues) : + s.fullCylinder.Holds r ↔ ∀ p : S.Index, s.spec.ResidueTest p s.vertex (r p) := by + constructor + · intro hr p + by_cases hp : (p:ℕ) ∈ s.spec.primeSupport + · have he := hr p (s.origin : ZMod (p:ℕ)) (by simp only [fullCylinder,ite_eq_left hp]) + rw [he] + exact s.origin_tests p + · exact s.spec.test_vacuous p hp s.vertex (r p) + · intro hr p a ha + by_cases hp : (p:ℕ) ∈ s.spec.primeSupport + · have he : (s.origin : ZMod (p:ℕ))=a := Option.some.inj (by + simpa only [fullCylinder,ite_eq_left hp] using ha) + exact (s.spec.test_unique p hp s.vertex (r p) _ (hr p) (s.origin_tests p)).trans he + · simp [fullCylinder,hp] at ha + +@[simp] lemma mem_fullCylinder_support (s : AttachedSpec w D L) (p : S.Index) : + p ∈ s.fullCylinder.support ↔ (p:ℕ) ∈ s.spec.primeSupport := by + by_cases hp : (p:ℕ) ∈ s.spec.primeSupport <;> + simp [Cylinder.support,fullCylinder,hp] + +lemma fullCylinder_width (s : AttachedSpec w D L) : + s.fullCylinder.support.card ≤ L*⌈C₀*Real.log B⌉₊+1 := by + have he : s.fullCylinder.support = univ.image (specSlotPrime s.spec) := by + ext p + simp only [mem_fullCylinder_support,mem_image,mem_univ,true_and] + exact specSupport_iff_slot s.spec p + rw [he] + exact card_image_le.trans (by simpa using specPrimeSlot_card s.spec) + +lemma fullCylinder_integer (s : AttachedSpec w D L) (n : ℤ) : + s.fullCylinder.Holds (S.integerResidues n) ↔ s.spec.QualifiesAt (n+s.vertex) := by + rw [s.fullCylinder_holds] + exact (s.spec.qualifies_iff_residueTests n s.vertex).symm + +end AttachedSpec + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TiltedListLocalMean.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TiltedListLocalMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..05ce999994a1f6e726c1412826918dd68f218486 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TiltedListLocalMean.lean @@ -0,0 +1,99 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AmplitudeGeOne +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.LocalUnlitCount + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegration +open Finset Classical +noncomputable section +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +lemma tilted_list_local_mean (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) + (p : S.Index) (z : ℝ) (hz : 1 ≤ z) (hzp : z^2 ≤ (p:ℝ)) : + avg (fun r => |localWithList w 𝔏 p r| * z^(repeatedUnlitLocal w p r)) ≤ + S.amplitude p ^ S.occurrenceCount w p * + (if p ∈ fullUsedIndices w 𝔏 then ((ℓ:ℝ)+2)*(p:ℝ)⁻¹ else 1) := by + by_cases hr : ¬S.IsCore p ∧ 2 ≤ S.occurrenceCount w p + · have he : ∃ i, (p:ℕ) ∣ w.label i := by + have hm : (univ.filter (fun i : Fin ℓ => (p:ℕ) ∣ w.label i)).Nonempty := by + rw [←card_pos]; exact lt_of_lt_of_le (by norm_num) hr.2 + obtain ⟨i,hi⟩ := hm + exact ⟨i,(mem_filter.mp hi).2⟩ + have hp : p ∈ fullUsedIndices w 𝔏 := mem_filter.mpr ⟨mem_univ _,Or.inl he⟩ + simp only [repeatedUnlitLocal,hr,amplitude,ite_false,one_pow, + one_mul,ite_eq_left hp] + calc + _ ≤ avg (fun r => |S.primeFactor w p r| *z^(localUnlitCount w p r)) := by + apply avg_mono + intro r + apply mul_le_mul_of_nonneg_right _ (pow_nonneg (zero_le_one.trans hz) _) + rw [localWithList,abs_mul,abs_of_nonneg (listLocal_nonneg w 𝔏 p r)] + exact mul_le_of_le_one_right (abs_nonneg _) (listLocal_le_one w 𝔏 p r) + _ ≤ ((ℓ:ℝ)+1)*(p:ℝ)⁻¹ := center_tilt_mean w p hr.1 hr.2 z hz hzp + _ ≤ _ := mul_le_mul_of_nonneg_right (by linarith) (by positivity) + · simp only [repeatedUnlitLocal,hr,ite_false,pow_zero,mul_one] + apply (crude_prime_mean w 𝔏 p).trans + apply mul_le_mul_of_nonneg_left _ (pow_nonneg (zero_le_one.trans (amplitude_ge_one p)) _) + split_ifs + · apply mul_le_mul_of_nonneg_right _ (by positivity) + linarith [(Nat.cast_nonneg ℓ : (0:ℝ) ≤ (ℓ:ℝ))] + · exact le_rfl + +lemma repeated_unlit_tail_integral (w : ClosedLine h ℓ) + (hl : ∀ i, w.label i ∈ D.members) {T : ℝ} (cut : S.Cutoffs T) + (𝔏 : List (AttachedSpec w D L)) (z : ℝ) (hz : 1 ≤ z) + (hzp : ∀ p : S.Index, z^2 ≤ (p:ℝ)) (t : ℕ) : + (avg (fun r : S.Residues => if t ≤ repeatedUnlitTotal w r then + |S.kernel w cut r| *listIndicator w 𝔏 r else 0))*z^t ≤ + A^(ℓ*⌈C₀*Real.log B⌉₊)*((ℓ:ℝ)+2)^(fullUsedIndices w 𝔏).card * + ∏ p ∈ fullUsedIndices w 𝔏,(p:ℝ)⁻¹ := by + have hz0 : 0 ≤ z := zero_le_one.trans hz + have hpt (r : S.Residues) : + (if t ≤ repeatedUnlitTotal w r then |S.kernel w cut r| *listIndicator w 𝔏 r else 0)*z^t ≤ + ∏ p : S.Index, |localWithList w 𝔏 p (r p)| *z^(repeatedUnlitLocal w p (r p)) := by + rw [prod_mul_distrib,prod_pow_eq_pow_sum] + by_cases ht : t ≤ repeatedUnlitTotal w r + · rw [ite_eq_left ht,absolute_list_factorization] + apply mul_le_mul + · exact mul_le_of_le_one_left (prod_nonneg (fun p hp => abs_nonneg _)) (cutoffProduct_le_one w cut _) + · exact pow_le_pow_right₀ hz ht + · exact pow_nonneg hz0 _ + · exact prod_nonneg (fun p hp => abs_nonneg _) + · rw [ite_eq_right ht,zero_mul] + exact mul_nonneg (prod_nonneg (fun p hp => abs_nonneg _)) (pow_nonneg hz0 _) + calc + _ = avg (fun r : S.Residues => (if t ≤ repeatedUnlitTotal w r then + |S.kernel w cut r| *listIndicator w 𝔏 r else 0)*z^t) := (avg_mul_right _ _).symm + _ ≤ avg (fun r : S.Residues => ∏ p : S.Index, + |localWithList w 𝔏 p (r p)| *z^(repeatedUnlitLocal w p (r p))) := avg_mono hpt + _ = ∏ p : S.Index, avg (fun r => |localWithList w 𝔏 p r| *z^(repeatedUnlitLocal w p r)) := by + convert avg_product (Ω := fun p : S.Index => ZMod (p:ℕ)) + (fun p r => |localWithList w 𝔏 p r| *z^(repeatedUnlitLocal w p r)) using 1 + congr 1 + exact Subsingleton.elim _ _ + _ ≤ ∏ p : S.Index, S.amplitude p ^ S.occurrenceCount w p * + (if p ∈ fullUsedIndices w 𝔏 then ((ℓ:ℝ)+2)*(p:ℝ)⁻¹ else 1) := + prod_le_prod₀ (fun p hp => avg_nonneg (fun r => mul_nonneg (abs_nonneg _) (pow_nonneg hz0 _))) + (fun p hp => tilted_list_local_mean w 𝔏 p z hz (hzp p)) + _ = (∏ p : S.Index, S.amplitude p ^ S.occurrenceCount w p)* + (((ℓ:ℝ)+2)^(fullUsedIndices w 𝔏).card * ∏ p ∈ fullUsedIndices w 𝔏,(p:ℝ)⁻¹) := by + rw [prod_mul_distrib,prod_ite_mem,univ_inter,prod_mul_distrib,prod_const] + _ ≤ _ := by + simpa only [mul_assoc] using mul_le_mul_of_nonneg_right (crude_amplitude_product w hl) + (by positivity : 0 ≤ ((ℓ:ℝ)+2)^(fullUsedIndices w 𝔏).card * ∏ p ∈ fullUsedIndices w 𝔏,(p:ℝ)⁻¹) + +end +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TokenSlot.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TokenSlot.lean new file mode 100644 index 0000000000000000000000000000000000000000..44f1d0a8c701e61a85c5116d871cc1e28dc1e261 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TokenSlot.lean @@ -0,0 +1,212 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AllSlotMasses +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FlatSlot + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.PivotSummation +open OrdinaryCorrelations.NumericalSubtrees +open Finset Classical Filter +variable {h ℓ : ℕ} {w : ClosedLine h ℓ} {S : PrimeSystem} + +local instance tokenTypeDec (w : ClosedLine h ℓ) : DecidableEq (TokenType w) := Classical.decEq _ +local instance primeIndexDec (S : PrimeSystem) : DecidableEq S.Index := Classical.decEq _ + +abbrev TokenSlot (j : TokenType w → ℕ) := FactorialAssignments.FlatSlot j + +local instance tokenSlotDec (j : TokenType w → ℕ) : DecidableEq (TokenSlot j) := Classical.decEq _ + +def slotShape (j : TokenType w → ℕ) (s : TokenSlot j) : Shape w := s.1.2 + +def slotCore (j : TokenType w → ℕ) (s : TokenSlot j) : Prop := s.1.1 = true + +def unorderedEdgeProduct (j : TokenType w → ℕ) + (U : FactorialAssignments.Unordered (P := S.Index) j) (e : Fin ℓ) : ℝ := + ∏ t : TokenType w, if e ∈ t.2.edges.val then ∏ p ∈ (U t).val, (p.val : ℝ) else 1 + +def unorderedBins (j : TokenType w → ℕ) + (C : Fin ℓ → ℝ) (H τ : ℝ) (U : FactorialAssignments.Unordered (P := S.Index) j) : Prop := + ∀ e ∈ w.treeSteps, H < C e * unorderedEdgeProduct j U e ∧ + C e * unorderedEdgeProduct j U e ≤ τ*H + +lemma slotEdgeProduct_named (j : TokenType w → ℕ) + (x : FactorialAssignments.Named (P := S.Index) j) (e : Fin ℓ) : + slotEdgeProduct (slotShape j) S (FactorialAssignments.namedFlat j x) e = + unorderedEdgeProduct j (FactorialAssignments.forget j x) e := by + let : DecidableEq S.Index := Classical.decEq _ + unfold slotEdgeProduct unorderedEdgeProduct + rw [Fintype.prod_sigma] + apply prod_congr rfl + intro t ht + by_cases he : e ∈ t.2.edges.val + · simp only [slotShape,he,ite_true,FactorialAssignments.forget, + FactorialAssignments.forgetBlock] + rw [prod_image (fun i _ k _ hik => (x t).injective hik)] + apply prod_congr rfl + intro i hi + rfl + · simp only [slotShape,he,ite_false,prod_const_one] + +lemma pivotBinIndicator_nonneg (j : TokenType w → ℕ) + (C : Fin ℓ → ℝ) (H τ : ℝ) (x : TokenSlot j → S.Index) : + 0 ≤ pivotBinIndicator (slotShape j) (slotCore j) S C H τ x := by + unfold pivotBinIndicator + apply prod_nonneg + intro i hi + split_ifs <;> norm_num + +lemma unorderedBins_gate (j : TokenType w → ℕ) + (C : Fin ℓ → ℝ) (H τ : ℝ) (x : FactorialAssignments.Named (P := S.Index) j) + (hx : unorderedBins j C H τ (FactorialAssignments.forget j x)) : + pivotBinIndicator (slotShape j) (slotCore j) S C H τ (FactorialAssignments.namedFlat j x) = 1 := by + unfold pivotBinIndicator + apply prod_eq_one + intro i hi + rw [slotEdgeProduct_named] + have he : (slotShape j (orderedPivot (slotShape j) (slotCore j) i)).topEdge ∈ w.treeSteps := + Shape.grows _ |>.1 (Shape.topEdge_mem _) + exact ite_eq_left (hx _ he) + +lemma token_constants_product (j : TokenType w → ℕ) (u : TokenType w → ℝ) + (x : TokenSlot j → S.Index) : + (∏ s : TokenSlot j, u s.1 * slotWeight S (slotCore j s) (x s)) = + (∏ t, u t ^ j t) * ∏ s : TokenSlot j, slotWeight S (slotCore j s) (x s) := by + rw [prod_mul_distrib] + congr 1 + rw [Fintype.prod_sigma] + simp only [prod_const,card_univ,Fintype.card_fin] + +lemma slot_mass_product (j : TokenType w → ℕ) (vC vZ : ℝ) : + (∏ s : TokenSlot j, if slotCore j s then vC else vZ) = + ∏ t : TokenType w, tokenMass w vC vZ t ^ j t := by + rw [Fintype.prod_sigma] + apply prod_congr rfl + intro t ht + cases he : t.1 <;> simp [slotCore,tokenMass,he] + +lemma token_gated_sum (j : TokenType w → ℕ) (u : TokenType w → ℝ) + (C : Fin ℓ → ℝ) (H τ : ℝ) : + (∑ x : TokenSlot j → S.Index, + pivotBinIndicator (slotShape j) (slotCore j) S C H τ x * + ∏ s : TokenSlot j, u s.1 * slotWeight S (s.1.1=true) (x s)) = + (∏ t, u t ^ j t) * + (∑ x : TokenSlot j → S.Index, + pivotBinIndicator (slotShape j) (slotCore j) S C H τ x * + ∏ s : TokenSlot j, slotWeight S (slotCore j s) (x s)) := by + rw [mul_sum] + apply sum_congr rfl + intro x hx + change _ * (∏ s : TokenSlot j, u s.1 * slotWeight S (slotCore j s) (x s)) = _ + rw [token_constants_product] + ring + +lemma token_mass_algebra (j : TokenType w → ℕ) (u : TokenType w → ℝ) (vC vZ K : ℝ) : + (∏ t, u t ^ j t) * (K * ∏ s : TokenSlot j, if slotCore j s then vC else vZ) = + K * ∏ t : TokenType w, (tokenMass w vC vZ t * u t) ^ j t := by + rw [slot_mass_product] + simp_rw [mul_pow] + rw [prod_mul_distrib] + ring + +def tokenNamedSum (S : PrimeSystem) (j : TokenType w → ℕ) + (u : TokenType w → ℝ) (C : Fin ℓ → ℝ) (H τ : ℝ) : ℝ := + ∑ x : TokenSlot j → S.Index, + pivotBinIndicator (slotShape j) (slotCore j) S C H τ x * + ∏ s : TokenSlot j, u s.1 * slotWeight S (s.1.1=true) (x s) + +def tokenMassProduct (j : TokenType w → ℕ) (vC vZ : ℝ) (u : TokenType w → ℝ) : ℝ := + ∏ t : TokenType w, (tokenMass w vC vZ t * u t) ^ j t + +def tokenFactorialProduct (j : TokenType w → ℕ) (vC vZ : ℝ) (u : TokenType w → ℝ) : ℝ := + ∏ t : TokenType w, (tokenMass w vC vZ t * u t) ^ j t / (j t).factorial + +def unorderedTokenSum (S : PrimeSystem) (j : TokenType w → ℕ) + (u : TokenType w → ℝ) (C : Fin ℓ → ℝ) (H τ : ℝ) + (V : FactorialAssignments.Unordered (P := S.Index) j → Prop) : ℝ := + ∑ U : FactorialAssignments.Unordered (P := S.Index) j, + if V U ∧ unorderedBins j C H τ U then + FactorialAssignments.unorderedWeight j + (fun t p => u t * slotWeight S (t.1=true) p) U else 0 + +def NamedTokenBound (S : PrimeSystem) (K τ : ℝ) : Prop := + ∀ (h ℓ : ℕ) (w : ClosedLine h ℓ) (j : TokenType w → ℕ) + (C : Fin ℓ → ℝ), (∀ e, 0 < C e) → ∀ H : ℝ, + ∀ (u : TokenType w → ℝ), (∀ t, 0 ≤ u t) → + tokenNamedSum S j u C H τ ≤ + K^(pivotEdges (slotShape j) (slotCore j)).card * + tokenMassProduct j S.harmonicCore S.harmonicCenter u + +def PrimeNamedBound (S : PrimeSystem) (K τ : ℝ) : Prop := + ∀ (h ℓ : ℕ) (w : ClosedLine h ℓ) (σ : Type) [Fintype σ], + ∀ (q : σ → Shape w) (core : σ → Prop) (C : Fin ℓ → ℝ), + (∀ e, 0 < C e) → ∀ H : ℝ, + (∑ x : σ → S.Index, pivotBinIndicator q core S C H τ x * + ∏ s, slotWeight S (core s) (x s)) ≤ + K^(pivotEdges q core).card * + ∏ s : σ, if core s then S.harmonicCore else S.harmonicCenter + +lemma namedTokenBound_of_prime (S : PrimeSystem) (K τ : ℝ) + (hB : PrimeNamedBound S K τ) : NamedTokenBound S K τ := by + intro h ℓ w j C hC H u hu + unfold tokenNamedSum tokenMassProduct + rw [token_gated_sum] + have hp := hB h ℓ w (TokenSlot j) (slotShape j) (slotCore j) C hC H + have h0 : 0 ≤ ∏ t, u t ^ j t := prod_nonneg (fun t _ => pow_nonneg (hu t) _) + have he := mul_le_mul_of_nonneg_left hp h0 + rw [token_mass_algebra] at he + exact he + +lemma source_token_named_sum (τ : ℝ) (hτ : 0 < τ) : + ∀ᶠ B : ℝ in atTop, NamedTokenBound (sourceSystem B) + (((Real.log 4+1)*τ)/B^(1-eta)) τ := by + filter_upwards [source_named_prime_sum τ hτ] with B hB + exact namedTokenBound_of_prime _ _ _ hB + +def UnorderedTokenBound (S : PrimeSystem) (K τ : ℝ) : Prop := + ∀ (h ℓ : ℕ) (w : ClosedLine h ℓ) (j : TokenType w → ℕ) + (C : Fin ℓ → ℝ), (∀ e, 0 < C e) → ∀ H : ℝ, + ∀ (V : FactorialAssignments.Unordered (P := S.Index) j → Prop) + (u : TokenType w → ℝ), (∀ t, 0 ≤ u t) → + unorderedTokenSum S j u C H τ V ≤ + K^(pivotEdges (slotShape j) (slotCore j)).card * + tokenFactorialProduct j S.harmonicCore S.harmonicCenter u + +lemma unorderedTokenBound_of_named (S : PrimeSystem) (K τ : ℝ) + (hB : NamedTokenBound S K τ) : UnorderedTokenBound S K τ := by + intro h ℓ w j C hC H V u hu + have hg := FactorialAssignments.unordered_gated_sum j + (fun U => V U ∧ unorderedBins j C H τ U) + (fun t p => u t * slotWeight S (t.1=true) p) + (fun t p => mul_nonneg (hu t) (slotWeight_nonneg _ _ _)) + (pivotBinIndicator (slotShape j) (slotCore j) S C H τ) + (pivotBinIndicator_nonneg j C H τ) + (fun x hx => unorderedBins_gate j C H τ x hx.2) + have hp := hB h ℓ w j C hC H u hu + have hd : 0 ≤ ((∏ t : TokenType w, (j t).factorial : ℕ) : ℝ) := Nat.cast_nonneg _ + have hc := hg.trans (div_le_div_of_nonneg_right hp hd) + unfold unorderedTokenSum + convert hc using 1 + · apply Finset.sum_congr rfl + intro U hU + by_cases hv : V U ∧ unorderedBins j C H τ U <;> simp only [hv,ite_false] + · unfold tokenMassProduct tokenFactorialProduct + rw [prod_div_distrib,← Nat.cast_prod,mul_div_assoc] + +theorem source_unordered_prime_sum (τ : ℝ) (hτ : 0 < τ) : + ∀ᶠ B : ℝ in atTop, UnorderedTokenBound (sourceSystem B) + (((Real.log 4+1)*τ)/B^(1-eta)) τ := by + filter_upwards [source_token_named_sum τ hτ] with B hB + exact unorderedTokenBound_of_named _ _ _ hB + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Topology.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Topology.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a04d5f37c5c22ff8870030977a6e0c400fe8a76 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Topology.lean @@ -0,0 +1,135 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TreeDestinationInjective + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter + +namespace OrdinaryCorrelations.NumericalSubtrees +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystem +open Finset Classical +variable {h ℓ : ℕ} + +@[reducible] def Topology (ℓ r : ℕ) := + (R : {R : Finset (Fin ℓ) // R.card=r}) × ((Fin ℓ → Bool) × (↥R.val → Fin (ℓ+1))) + +lemma topology_card (ℓ r : ℕ) : Fintype.card (Topology ℓ r) ≤ 4^ℓ*(ℓ+1)^r := by + rw [Fintype.card_sigma] + have he : ∀ R : {R : Finset (Fin ℓ) // R.card=r}, + Fintype.card ((Fin ℓ → Bool) × (↥R.val → Fin (ℓ+1))) = 2^ℓ*(ℓ+1)^r := by + intro R + simp only [Fintype.card_prod,Fintype.card_fun,Fintype.card_bool,Fintype.card_fin, + Fintype.card_coe,R.property] + simp_rw [he] + rw [sum_const,nsmul_eq_mul,Nat.cast_id,card_univ] + have hc : Fintype.card {R : Finset (Fin ℓ) // R.card=r} ≤ 2^ℓ := by + simpa only [Fintype.card_finset,Fintype.card_fin] using + Fintype.card_subtype_le (fun R : Finset (Fin ℓ) => R.card=r) + calc + _ ≤ 2^ℓ*(2^ℓ*(ℓ+1)^r) := Nat.mul_le_mul_right _ hc + _ = _ := by rw [← mul_assoc,← mul_pow]; norm_num + +lemma exists_return_target (w : ClosedLine h ℓ) (e : Fin ℓ) (he : e ∈ returnSteps w) : + ∃ j : Fin (ℓ+1), j.val ≤ e.val ∧ w.offset j = w.offset e.succ := by + have hn : ¬∀ j : Fin (ℓ+1), j.val ≤ e.val → w.offset j ≠ w.offset e.succ := by + intro ht + exact (mem_sdiff.mp he).2 (mem_filter.mpr ⟨mem_univ _,ht⟩) + push Not at hn + exact hn + +def returnTarget (w : ClosedLine h ℓ) (e : Fin ℓ) (he : e ∈ returnSteps w) : Fin (ℓ+1) := + Classical.choose (exists_return_target w e he) + +lemma returnTarget_spec (w : ClosedLine h ℓ) (e : Fin ℓ) (he : e ∈ returnSteps w) : + (returnTarget w e he).val ≤ e.val ∧ w.offset (returnTarget w e he) = w.offset e.succ := + Classical.choose_spec (exists_return_target w e he) + +def signBit (w : ClosedLine h ℓ) (e : Fin ℓ) : Bool := decide (w.sign e=1) + +lemma signBit_decode (w : ClosedLine h ℓ) (e : Fin ℓ) : + w.sign e = if signBit w e then 1 else -1 := by + rcases w.sign_mem e with hs | hs <;> simp [signBit,hs] + +def encodeTopology (w : ClosedLine h ℓ) (r : ℕ) (hr : (returnSteps w).card=r) : Topology ℓ r := + ⟨⟨returnSteps w,hr⟩, signBit w, fun e => returnTarget w e.val e.property⟩ + +def topologyTarget {r : ℕ} (t : Topology ℓ r) (e : Fin ℓ) : Fin (ℓ+1) := + if he : e ∈ t.1.val then t.2.2 ⟨e,he⟩ else 0 + +lemma topologyTarget_encode (w : ClosedLine h ℓ) (r : ℕ) (hr : (returnSteps w).card=r) + (e : Fin ℓ) (he : e ∈ returnSteps w) : + topologyTarget (encodeTopology w r hr) e = returnTarget w e he := by + dsimp only [topologyTarget,encodeTopology] + rw [dite_eq_left he] + +lemma ClosedLine.ext_values (w v : ClosedLine h ℓ) + (ho : w.offset=v.offset) (hl : w.label=v.label) (hs : w.sign=v.sign) : w=v := by + cases w + cases v + simp_all + +theorem topology_tree_labels_injective (w v : ClosedLine h ℓ) (hh : 0 < h) + (r : ℕ) (hwr : (returnSteps w).card=r) (hvr : (returnSteps v).card=r) + (ht : encodeTopology w r hwr=encodeTopology v r hvr) + (hl : ∀ e ∈ w.treeSteps, w.label e=v.label e) : w=v := by + have hR : returnSteps w=returnSteps v := congrArg (fun t : Topology ℓ r => t.1.val) ht + have hs : ∀ e, w.sign e=v.sign e := by + intro e + have hb : signBit w e=signBit v e := congrArg (fun t : Topology ℓ r => t.2.1 e) ht + rw [signBit_decode w e,signBit_decode v e,hb] + have htar : ∀ e (he : e ∈ returnSteps w), + returnTarget w e he=returnTarget v e (hR ▸ he) := by + intro e he + have hte := congrArg (fun t : Topology ℓ r => topologyTarget t e) ht + simpa only [topologyTarget_encode w r hwr e he, + topologyTarget_encode v r hvr e (hR ▸ he)] using hte + have ho : ∀ j, w.offset j=v.offset j := by + have hd : ∀ n : ℕ, ∀ j : Fin (ℓ+1), j.val=n → w.offset j=v.offset j := by + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro j hj + by_cases hj0 : j=0 + · subst j + rw [w.start_zero,v.start_zero] + · obtain ⟨e,rfl⟩ := Fin.exists_succ_eq.mpr hj0 + have heprev := ih e.val (by simpa only [← hj,Fin.val_succ] using Nat.lt_succ_self e.val) + e.castSucc rfl + by_cases het : e ∈ w.treeSteps + · have hw := w.step e + have hv := v.step e + rw [hl e het,hs e] at hw + linarith only [hw,hv,heprev] + · have her : e ∈ returnSteps w := mem_sdiff.mpr ⟨mem_univ _,het⟩ + have hert : (returnTarget w e her).val rw [hs] <;> norm_num) + (by exact_mod_cast ne_of_gt hh) + have hm : (v.sign e*(h : ℤ))*(w.label e : ℤ) = + (v.sign e*(h : ℤ))*(v.label e : ℤ) := hw.symm.trans hv + have he := mul_left_cancel₀ hn hm + exact_mod_cast he + exact ClosedLine.ext_values w v (funext ho) (funext hall) (funext hs) + +end OrdinaryCorrelations.NumericalSubtrees + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TopologyTreeSteps.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TopologyTreeSteps.lean new file mode 100644 index 0000000000000000000000000000000000000000..d58ebfdaa22ee577297bf76f5b111b5c5fd01190 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TopologyTreeSteps.lean @@ -0,0 +1,133 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.BitWeight +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Topology + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.NumericalSubtrees +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystem +open Finset Classical +variable {h ℓ r : ℕ} {w v : ClosedLine h ℓ} + +lemma topology_treeSteps (hw : (returnSteps w).card=r) (hv : (returnSteps v).card=r) + (ht : encodeTopology w r hw=encodeTopology v r hv) : w.treeSteps=v.treeSteps := by + have hr : returnSteps w=returnSteps v := congrArg (fun t : Topology ℓ r => t.1.val) ht + ext e + have he := congrArg (fun E => e ∈ E) hr + simp only [returnSteps,Finset.mem_sdiff,mem_univ,true_and] at he + tauto + +lemma topology_target_eq (hw : (returnSteps w).card=r) (hv : (returnSteps v).card=r) + (ht : encodeTopology w r hw=encodeTopology v r hv) + (e : Fin ℓ) (hew : e ∈ returnSteps w) (hev : e ∈ returnSteps v) : + returnTarget w e hew = returnTarget v e hev := by + have hte := congrArg (fun t : Topology ℓ r => topologyTarget t e) ht + simpa only [topologyTarget_encode w r hw e hew, + topologyTarget_encode v r hv e hev] using hte + +theorem topology_offset_pattern (hw : (returnSteps w).card=r) (hv : (returnSteps v).card=r) + (ht : encodeTopology w r hw=encodeTopology v r hv) (i j : Fin (ℓ+1)) : + w.offset i=w.offset j ↔ v.offset i=v.offset j := by + have htree := topology_treeSteps hw hv ht + have H : ∀ k : ℕ, ∀ i j : Fin (ℓ+1), i.val≤k → j.val≤k → + (w.offset i=w.offset j ↔ v.offset i=v.offset j) := by + intro k + induction k with + | zero => + intro i j hi hj + have hij : i=j := Fin.ext (by omega) + subst j + simp + | succ k ih => + intro i j hi hj + by_cases hik : i.val≤k + · by_cases hjk : j.val≤k + · exact ih i j hik hjk + · have hjev : j.val=k+1 := by omega + let e : Fin ℓ := ⟨k,by omega⟩ + have hje : j=e.succ := Fin.ext hjev + rw [hje] + by_cases het : e ∈ w.treeSteps + · have hevt : e ∈ v.treeSteps := htree ▸ het + have hwn : w.offset i≠w.offset e.succ := (mem_filter.mp het).2 i hik + have hvn : v.offset i≠v.offset e.succ := (mem_filter.mp hevt).2 i hik + simp [hwn,hvn] + · have hew : e ∈ returnSteps w := Finset.mem_sdiff.mpr ⟨mem_univ _,het⟩ + have hev : e ∈ returnSteps v := by + apply Finset.mem_sdiff.mpr + exact ⟨mem_univ _,by simpa only [← htree] using het⟩ + have hetar := topology_target_eq hw hv ht e hew hev + have hs := returnTarget_spec w e hew + have hs' := returnTarget_spec v e hev + rw [← hs.2,← hs'.2,← hetar] + exact ih i (returnTarget w e hew) hik hs.1 + · by_cases hjk : j.val≤k + · have hie : i.val=k+1 := by omega + let e : Fin ℓ := ⟨k,by omega⟩ + have hi' : i=e.succ := Fin.ext hie + rw [hi'] + by_cases het : e ∈ w.treeSteps + · have hevt : e ∈ v.treeSteps := htree ▸ het + have hwn : w.offset e.succ≠w.offset j := Ne.symm ((mem_filter.mp het).2 j hjk) + have hvn : v.offset e.succ≠v.offset j := Ne.symm ((mem_filter.mp hevt).2 j hjk) + simp [hwn,hvn] + · have hew : e ∈ returnSteps w := Finset.mem_sdiff.mpr ⟨mem_univ _,het⟩ + have hev : e ∈ returnSteps v := by + apply Finset.mem_sdiff.mpr + exact ⟨mem_univ _,by simpa only [← htree] using het⟩ + have hetar := topology_target_eq hw hv ht e hew hev + have hs := returnTarget_spec w e hew + have hs' := returnTarget_spec v e hev + rw [← hs.2,← hs'.2,← hetar] + exact ih (returnTarget w e hew) j hs.1 hjk + · have hij : i=j := Fin.ext (by omega) + subst j + simp + exact H ℓ i j (by omega) (by omega) + +structure SameGeometry (w v : ClosedLine h ℓ) : Prop where + trees : w.treeSteps=v.treeSteps + pattern : ∀ i j, w.offset i=w.offset j ↔ v.offset i=v.offset j + +lemma sameGeometry_of_topology (hw : (returnSteps w).card=r) (hv : (returnSteps v).card=r) + (ht : encodeTopology w r hw=encodeTopology v r hv) : SameGeometry w v := + ⟨topology_treeSteps hw hv ht,topology_offset_pattern hw hv ht⟩ + +namespace SameGeometry +lemma symm (H : SameGeometry w v) : SameGeometry v w := + ⟨H.trees.symm,fun i j => (H.pattern i j).symm⟩ + +lemma children (H : SameGeometry w v) (i : Fin (ℓ+1)) : + w.children (w.offset i)=v.children (v.offset i) := by + unfold ClosedLine.children + apply congrArg Finset.card + ext e + simp only [mem_filter,H.trees,H.pattern] + +lemma root (H : SameGeometry w v) (i : Fin (ℓ+1)) : w.offset i=0 ↔ v.offset i=0 := by + simpa only [w.start_zero,v.start_zero] using H.pattern i 0 + +lemma noReturn (H : SameGeometry w v) (i : Fin (ℓ+1)) : + w.NoReturnIncidence (w.offset i) ↔ v.NoReturnIncidence (v.offset i) := by + simp only [ClosedLine.NoReturnIncidence,ne_eq,H.trees,H.pattern] + +lemma good (H : SameGeometry w v) (e : Fin ℓ) : w.Good e ↔ v.Good e := by + simp only [ClosedLine.Good,ne_eq,H.trees,H.children,H.root,H.noReturn] + +lemma grows (H : SameGeometry w v) (i : Fin (ℓ+1)) (E : Finset (Fin ℓ)) : + Grows w (w.offset i) E ↔ Grows v (v.offset i) E := by + simp only [Grows,H.trees,H.pattern] + +end SameGeometry + +end OrdinaryCorrelations.NumericalSubtrees + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalCodeMass.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalCodeMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e72059e490db86da80f05daf7df9a50820de94b --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalCodeMass.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FirstSlot + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.SharedSlotPatterns +open Finset Classical +variable {σ P : Type*} [Fintype σ] [Fintype P] [DecidableEq P] + +lemma total_code_mass (W : P → ℝ) (hW : ∀ p, 0 ≤ W p) : + (∑ x : σ → Option P, ∏ p ∈ support x, W p) ≤ + (Fintype.card σ+1:ℝ)*(Fintype.card σ+1:ℝ)^(Fintype.card σ)* + (max 1 (∑ p,W p))^(Fintype.card σ) := by + let N := Fintype.card σ + let H : ℝ := max 1 (∑ p,W p) + have hH : 1 ≤ H := le_max_left _ _ + have he := weighted_code_sum (σ:=σ) (fun _ => 1) (by intro; norm_num) W hW + simp only [one_mul] at he + apply he.trans + change (∑ z : (m : Fin (N+1)) × (σ → Option (Fin m.val)) × (Fin m.val → P), + ∏ i, W (z.2.2 i)) ≤ _ + rw [Fintype.sum_sigma] + calc + _ ≤ ∑ m : Fin (N+1), ((N+1:ℝ)^N*H^N) := by + apply sum_le_sum + intro m hm + rw [Fintype.sum_prod_type] + have hrow : (∑ v : Fin m.val → P, ∏ i, W (v i)) ≤ H^N := by + rw [←Fintype.prod_sum] + simp only [prod_const,card_univ,Fintype.card_fin] + apply (pow_le_pow_left₀ (sum_nonneg (fun p hp => hW p)) (le_max_right (1:ℝ) _) _).trans + exact pow_le_pow_right₀ hH (Nat.lt_succ_iff.mp m.isLt) + calc + _ ≤ ∑ _d : σ → Option (Fin m.val), H^N := sum_le_sum (fun d hd => hrow) + _ = ((m.val+1:ℕ):ℝ)^N*H^N := by simp [N] + _ ≤ _ := by + apply mul_le_mul_of_nonneg_right _ (pow_nonneg (zero_le_one.trans hH) _) + apply pow_le_pow_left₀ (by positivity) + have hm' : m.val ≤ N := Nat.lt_succ_iff.mp m.isLt + exact_mod_cast Nat.add_le_add_right hm' 1 + _ = _ := by simp [N,H]; ring + +end OrdinaryCorrelations.SharedSlotPatterns + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalUnlitCountEqSubtype.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalUnlitCountEqSubtype.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0700f5d857780c4e7cc0fc5617f259f2aeebf93 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalUnlitCountEqSubtype.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AllCoreLit +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.UncutTreeEdges + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace Finset Classical +noncomputable section +variable {S : PrimeSystem} {h ℓ : ℕ} + +lemma totalUnlitCount_eq_subtype (w : ClosedLine h ℓ) (a : S.FixedResidues w) : + totalUnlitCount w a = ∑ p : S.FixedIndex w, (unlitOccurrences w p.val (a p)).card := by + have he := Finset.sum_subtype (F:=inferInstance) (p:=S.IsFixed w) + (univ.filter (S.IsFixed w)) (by simp) (fixedUnlitCount w a) + rw [sum_filter] at he + have hf : (∑ p : S.Index, if S.IsFixed w p then fixedUnlitCount w a p else 0) = + totalUnlitCount w a := by + apply sum_congr rfl + intro p hp + by_cases hh : S.IsFixed w p <;> simp [hh,fixedUnlitCount] + rw [hf] at he + exact he.trans (sum_congr rfl (fun p hp => by simp [fixedUnlitCount,p.property])) + +lemma cut_tree_edges_le_unlit (w : ClosedLine h ℓ) (a : S.FixedResidues w) : + (w.treeSteps \ uncutTreeEdges w a).card ≤ totalUnlitCount w a := by + have hs : w.treeSteps \ uncutTreeEdges w a ⊆ + univ.biUnion (fun p : S.FixedIndex w => unlitOccurrences w p.val (a p)) := by + intro e he + have ht := (mem_sdiff.mp he).1 + have hn : ¬ ∀ p : S.FixedIndex w, (p.val:ℕ) ∣ w.label e → + a p+(w.offset e.castSucc : ZMod (p.val:ℕ))=0 := by + intro ha + exact (mem_sdiff.mp he).2 (mem_filter.mpr ⟨ht,ha⟩) + push Not at hn + obtain ⟨p,hp,ha⟩ := hn + exact mem_biUnion.mpr ⟨p,mem_univ _,mem_filter.mpr ⟨mem_univ e,hp,ha⟩⟩ + rw [totalUnlitCount_eq_subtype] + exact (card_le_card hs).trans (card_biUnion_le ..) + +lemma cut_tree_edges_lt_of_core_lit (w : ClosedLine h ℓ) (a : S.FixedResidues w) + (hc : AllCoreLit w a) (t : ℕ) (hu : repeatedCenterUnlitCount w a treeEdge w f=treeEdge w e)).card := + card_pos.mpr ⟨e,mem_filter.mpr ⟨(mem_sdiff.mp he).1,rfl⟩⟩ + omega + · exact edgeGraph_adj w hh _ e he + +theorem full_tree_blocks (w : ClosedLine h ℓ) (hh : 0 treeEdge w f=treeEdge w e)).card := + card_pos.mpr ⟨e,mem_filter.mpr ⟨he,rfl⟩⟩ + omega + · exact edgeGraph_adj w hh _ e he + +end +end OrdinaryCorrelations.NumericalSubtrees + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeDestinationInjective.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeDestinationInjective.lean new file mode 100644 index 0000000000000000000000000000000000000000..5deb08a2ad8a8f631f466a8a77f2d396e7b4b7ed --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeDestinationInjective.lean @@ -0,0 +1,112 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TreeVertices + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace +open Finset Classical +variable {h ℓ : ℕ} + +lemma tree_destination_injective (w : ClosedLine h ℓ) : + Set.InjOn (fun i : Fin ℓ => w.offset i.succ) w.treeSteps := by + intro i hi j hj heq + have hi' := (mem_filter.mp hi).2 + have hj' := (mem_filter.mp hj).2 + apply Fin.ext + by_contra hn + rcases lt_or_gt_of_ne hn with hij | hji + · exact hj' i.succ (by change i.val + 1 ≤ j.val; omega) heq + · exact hi' j.succ (by change j.val + 1 ≤ i.val; omega) heq.symm + +lemma tree_destination_nonzero (w : ClosedLine h ℓ) (i : Fin ℓ) (hi : i ∈ w.treeSteps) : + w.offset i.succ ≠ 0 := by + have h := (mem_filter.mp hi).2 0 (Nat.zero_le _) + rwa [w.start_zero, ne_comm] at h + +lemma has_incoming_edge (w : ClosedLine h ℓ) (v : ℤ) + (hv : v ∈ treeVertices w) (hv0 : v ≠ 0) : + ∃ i ∈ w.treeSteps, w.offset i.succ = v := by + let visits : Finset (Fin (ℓ+1)) := univ.filter (fun j => w.offset j = v) + have hn : visits.Nonempty := by + obtain ⟨j,hj,hv⟩ := mem_image.mp hv + exact ⟨j,mem_filter.mpr ⟨hj,hv⟩⟩ + let j := visits.min' hn + have hj : w.offset j = v := (mem_filter.mp (min'_mem visits hn)).2 + have hj0 : j ≠ 0 := by + intro heq + rw [heq, w.start_zero] at hj + exact hv0 hj.symm + obtain ⟨i,hi⟩ := Fin.eq_succ_of_ne_zero hj0 + refine ⟨i,mem_filter.mpr ⟨mem_univ _,?_⟩,?_⟩ + · intro k hk hki + have hkv : w.offset k = v := by rw [hki, ← hi]; exact hj + have hkmin : j ≤ k := min'_le visits k (mem_filter.mpr ⟨mem_univ _,hkv⟩) + have hkmin' : j.val ≤ k.val := hkmin + rw [hi, Fin.val_succ] at hkmin' + omega + · rwa [← hi] + +def goodOrigins (w : ClosedLine h ℓ) : Finset ℤ := + (univ.filter w.Good).image (fun i => w.offset i.castSucc) + +lemma good_origin_data (w : ClosedLine h ℓ) {v : ℤ} (hv : v ∈ goodOrigins w) : + v ∈ treeVertices w ∧ v ≠ 0 ∧ w.children v = 1 ∧ w.NoReturnIncidence v := by + obtain ⟨i, hi, rfl⟩ := mem_image.mp hv + have hg := (mem_filter.mp hi).2 + exact ⟨departure_mem_vertices w i, hg.2.2.2.1, hg.2.1, hg.2.2.2.2.1⟩ + +def incomingCharges (w : ClosedLine h ℓ) (U : Finset ℤ) : Finset (Fin ℓ) := + w.treeSteps.filter (fun i => w.offset i.succ ∈ U) + +def returnSteps (w : ClosedLine h ℓ) : Finset (Fin ℓ) := univ \ w.treeSteps + +lemma incomingCharges_image (w : ClosedLine h ℓ) (U : Finset ℤ) + (hU : U ⊆ goodOrigins w) : + (incomingCharges w U).image (fun i => w.offset i.succ) = U := by + ext v + constructor + · rintro hv + obtain ⟨i,hi,rfl⟩ := mem_image.mp hv + exact (mem_filter.mp hi).2 + · intro hv + have hd := good_origin_data w (hU hv) + obtain ⟨i,hi,hiv⟩ := has_incoming_edge w v hd.1 hd.2.1 + exact mem_image.mpr ⟨i,mem_filter.mpr ⟨hi,by rwa [hiv]⟩,hiv⟩ + +lemma incomingCharges_card (w : ClosedLine h ℓ) (U : Finset ℤ) + (hU : U ⊆ goodOrigins w) : (incomingCharges w U).card = U.card := by + calc + _ = ((incomingCharges w U).image (fun i => w.offset i.succ)).card := + (card_image_iff.mpr ((tree_destination_injective w).mono (filter_subset _ _))).symm + _ = U.card := congrArg Finset.card (incomingCharges_image w U hU) + +lemma incoming_return_disjoint (w : ClosedLine h ℓ) (U : Finset ℤ) : + Disjoint (incomingCharges w U) (returnSteps w) := by + apply disjoint_left.mpr + intro i hi hr + exact (mem_sdiff.mp hr).2 (mem_filter.mp hi).1 + +theorem source_cutoff_charges {S : PrimeSystem} (w : ClosedLine h ℓ) {T : ℝ} + (cut : S.Cutoffs T) (x : S.CoreResidues) (U : Finset ℤ) + (hU : U ⊆ goodOrigins w) : + S.cutoffProduct w cut x ≤ + Real.exp (-kappa * (S.harmonicCore - T * Real.sqrt S.harmonicCore) * + (((returnSteps w).card : ℝ) + U.card)) * + Real.exp (kappa * + ((∑ i ∈ returnSteps w, (S.cutoffCount (w.label i) + (S.shiftCore x (w.offset i.castSucc)) : ℝ)) + + ∑ i ∈ incomingCharges w U, (S.cutoffCount (w.label i) + (S.shiftCore x (w.offset i.succ)) : ℝ))) := by + simpa only [incomingCharges_card w U hU] using + cutoffProduct_le_charges w cut x (returnSteps w) (incomingCharges w U) + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdge.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdge.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed029dc676a770016cbbc95902a372689dda9875 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdge.lean @@ -0,0 +1,137 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Directed + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.NumericalSubtrees +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystem +open Finset Classical SimpleGraph +noncomputable section +variable {h ℓ : ℕ} + +def treeEdge (w : ClosedLine h ℓ) (e : Fin ℓ) : Sym2 ℤ := + s(w.offset e.castSucc,w.offset e.succ) + +lemma grows_full_tree (w : ClosedLine h ℓ) : Grows w 0 w.treeSteps := by + refine ⟨Subset.rfl,?_⟩ + intro e he + by_cases hz : w.offset e.castSucc=0 + · exact Or.inl hz + · obtain ⟨j,hj,hjv⟩ := has_incoming_edge w (w.offset e.castSucc) (departure_mem_vertices w e) hz + exact Or.inr ⟨j,hj,incoming_earlier w hj hjv,hjv⟩ + +lemma reached_full_tree (w : ClosedLine h ℓ) : reached w 0 w.treeSteps=treeVertices w := by + apply Finset.ext + intro v + constructor + · intro hv + rcases mem_insert.mp hv with rfl | hv + · exact mem_image.mpr ⟨0,mem_univ _,w.start_zero⟩ + · obtain ⟨e,he,rfl⟩ := mem_image.mp hv + exact endpoint_mem_vertices w e + · intro hv + by_cases hz : v=0 + · rw [hz]; exact mem_insert_self _ _ + · obtain ⟨e,he,hev⟩ := has_incoming_edge w v hv hz + exact mem_insert_of_mem (mem_image.mpr ⟨e,he,hev⟩) + +theorem grown_tour (w : ClosedLine h ℓ) (hh : 0 treeEdge w e=q)).card := by + suffices aux : ∀ n,∀ E : Finset (Fin ℓ),E.card=n → Grows w v E → + ∃ p : (edgeGraph w hh w.treeSteps).Walk v v, + p.length=2*E.card ∧ (∀ z ∈ reached w v E,z ∈ p.support) ∧ + ∀ q : Sym2 ℤ,p.edges.count q=2*(E.filter (fun e => treeEdge w e=q)).card by + exact aux _ E rfl hg + intro n + induction n using Nat.strong_induction_on with + | h n ih => + intro E hcard hg + by_cases hne : E.Nonempty + · let e := E.max' hne + have he : e ∈ E := max'_mem E hne + let F := E.erase e + have hF : F ⊆ E := erase_subset _ _ + have heF : e ∉ F := notMem_erase _ _ + have hinsert : insert e F=E := insert_erase he + have hFgrow : Grows w v F := by + refine ⟨hF.trans hg.1,?_⟩ + intro f hf + rcases hg.2 f (hF hf) with hr | ⟨j,hj,hjf,hjv⟩ + · exact Or.inl hr + · refine Or.inr ⟨j,mem_erase.mpr ⟨?_,hj⟩,hjf,hjv⟩ + intro hje + subst j + exact (not_lt_of_ge (le_max' E f (hF hf))) hjf + have hlt : F.card (SimpleGraph.Walk.mem_support_append_iff loop p₂).mpr (Or.inr hh))) + · intro s + have hc := hcount s + rw [hp,SimpleGraph.Walk.edges_append,List.count_append] at hc + have hsame : s(w.offset e.castSucc,w.offset e.succ)=treeEdge w e := rfl + have hsym : s(w.offset e.succ,w.offset e.castSucc)=treeEdge w e := Sym2.eq_swap + have hef : e ∉ F.filter (fun e => treeEdge w e=s) := fun he => heF (mem_filter.mp he).1 + have heqcard : (E.filter (fun e => treeEdge w e=s)).card = + (F.filter (fun e => treeEdge w e=s)).card + if treeEdge w e=s then 1 else 0 := by + rw [←hinsert,filter_insert] + split_ifs <;> simp [hef] + rw [heqcard] + simp only [q,loop,SimpleGraph.Walk.edges_append,SimpleGraph.Walk.edges_cons, + SimpleGraph.Walk.edges_nil,List.count_append,hsame,hsym] + by_cases hes : treeEdge w e=s + · subst s + simp only [List.count_cons_self,List.count_nil,ite_true] + omega + · have hse : s≠treeEdge w e := Ne.symm hes + simp only [List.count_cons_of_ne hes,List.count_nil,hes,ite_false] + omega + · have hE : E=∅ := not_nonempty_iff_eq_empty.mp hne + subst E + refine ⟨.nil,by simp,?_,by simp⟩ + intro z hz + simpa [reached] using hz + +end +end OrdinaryCorrelations.NumericalSubtrees + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdgeInjective.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdgeInjective.lean new file mode 100644 index 0000000000000000000000000000000000000000..015fcc47833e0c740b81cb86e49ae780c9df7e15 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdgeInjective.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TreeEdge +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Append + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.NumericalSubtrees +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.ForestTraversal Finset Classical SimpleGraph +noncomputable section +variable {h ℓ : ℕ} + +lemma treeEdge_injective (w : ClosedLine h ℓ) : Set.InjOn (treeEdge w) w.treeSteps := by + intro e he f hf hef + rcases Sym2.eq_iff.mp hef with hd | hs + · exact tree_destination_injective w he hf hd.2 + · have hfe := incoming_earlier w hf hs.1.symm + have hef := incoming_earlier w he hs.2 + exact (lt_asymm hfe hef).elim + +lemma treeEdge_mem_edgeSet_iff (w : ClosedLine h ℓ) (hh : 0 treeEdge w e=q)).card) : + cutCount (edgeGraph w hh (w.treeSteps \ H)) p ≤ 2*H.card := by + let F := p.edges.toFinset.filter (fun q => q ∉ (edgeGraph w hh (w.treeSteps \ H)).edgeSet) + have hF : F ⊆ H.image (treeEdge w) := by + intro q hq + obtain ⟨hql,hqn⟩ := mem_filter.mp hq + have ht := p.edges_subset_edgeSet (List.mem_toFinset.mp hql) + induction q using Sym2.ind with | _ u v => + obtain ⟨e,he,hor | hrev⟩ := ht + · have hqe : s(u,v)=treeEdge w e := by dsimp only at hor; unfold treeEdge; rw [hor.1,hor.2] + refine mem_image.mpr ⟨e,?_,hqe.symm⟩ + by_contra hn + exact hqn (hqe.symm ▸ (treeEdge_mem_edgeSet_iff w hh he sdiff_subset).mpr (mem_sdiff.mpr ⟨he,hn⟩)) + · have hqe : s(u,v)=treeEdge w e := by dsimp only at hrev; unfold treeEdge; rw [hrev.1,hrev.2]; exact Sym2.eq_swap + refine mem_image.mpr ⟨e,?_,hqe.symm⟩ + by_contra hn + exact hqn (hqe.symm ▸ (treeEdge_mem_edgeSet_iff w hh he sdiff_subset).mpr (mem_sdiff.mpr ⟨he,hn⟩)) + have hcount (q : Sym2 ℤ) : p.edges.count q ≤ 2 := by + rw [hc] + have hf : (w.treeSteps.filter (fun e => treeEdge w e=q)).card ≤ 1 := by + apply card_le_one.mpr + intro e he f hf + exact treeEdge_injective w (mem_filter.mp he).1 (mem_filter.mp hf).1 + ((mem_filter.mp he).2.trans (mem_filter.mp hf).2.symm) + omega + calc + cutCount (edgeGraph w hh (w.treeSteps \ H)) p = ∑ q ∈ F,p.edges.count q := + (sum_filter_count_eq_countP _ _).symm + _ ≤ ∑ _q ∈ F,2 := sum_le_sum (fun q _ => hcount q) + _ = 2*F.card := by simp [Nat.mul_comm] + _ ≤ 2*H.card := Nat.mul_le_mul_left 2 ((card_le_card hF).trans card_image_le) + +theorem tree_blocks (w : ClosedLine h ℓ) (hh : 0 (p : ℕ) ∣ w.label i) + +def litEdges (w : ClosedLine h ℓ) (p : S.Index) (a : ZMod (p : ℕ)) : Finset (Fin ℓ) := + (treeOccurrences w p).filter (fun i => a + (w.offset i.castSucc : ZMod (p : ℕ)) = 0) + +def edgeVertices (w : ClosedLine h ℓ) (E : Finset (Fin ℓ)) : Finset ℤ := + E.image (fun i => w.offset i.castSucc) ∪ E.image (fun i => w.offset i.succ) + +lemma edgeVertices_subset (w : ClosedLine h ℓ) (E : Finset (Fin ℓ)) : + edgeVertices w E ⊆ treeVertices w := by + intro v hv + rcases mem_union.mp hv with hv | hv + · obtain ⟨i,hi,rfl⟩ := mem_image.mp hv + exact departure_mem_vertices w i + · obtain ⟨i,hi,rfl⟩ := mem_image.mp hv + exact endpoint_mem_vertices w i + +lemma lit_vertex_active (w : ClosedLine h ℓ) (p : S.Index) (a : ZMod (p : ℕ)) + {v : ℤ} (hv : v ∈ edgeVertices w (litEdges w p a)) : a + (v : ZMod (p : ℕ)) = 0 := by + rcases mem_union.mp hv with hv | hv + · obtain ⟨i,hi,rfl⟩ := mem_image.mp hv + exact (mem_filter.mp hi).2 + · obtain ⟨i,hi,rfl⟩ := mem_image.mp hv + rw [w.label_residue_eq i (mem_filter.mp (mem_filter.mp hi).1).2] + exact (mem_filter.mp hi).2 + +def NoComponentTop (w : ClosedLine h ℓ) (U : Finset ℤ) (p : S.Index) + (E : Finset (Fin ℓ)) : Prop := + S.IsCore p → ∀ i ∈ incomingCharges w U, + w.offset i.succ ∈ edgeVertices w E → (p : ℕ) ∣ w.label i + +def isolatedCharge (w : ClosedLine h ℓ) (U : Finset ℤ) (p : S.Index) + (E : Finset (Fin ℓ)) (a : ZMod (p : ℕ)) (v : ℤ) : ℝ := + if S.IsCore p ∧ v ∈ U ∧ a + (v : ZMod (p : ℕ)) = 0 ∧ v ∉ edgeVertices w E + then Real.exp kappa else 1 + +lemma isolatedCharge_nonneg (w : ClosedLine h ℓ) (U : Finset ℤ) (p : S.Index) + (E : Finset (Fin ℓ)) (a : ZMod (p : ℕ)) (v : ℤ) : + 0 ≤ isolatedCharge w U p E a v := by + unfold isolatedCharge; split_ifs <;> positivity + +lemma incoming_charge_le_isolated (w : ClosedLine h ℓ) (U : Finset ℤ) (p : S.Index) + (E : Finset (Fin ℓ)) (htop : NoComponentTop w U p E) + (a : ZMod (p : ℕ)) (i : Fin ℓ) (hi : i ∈ incomingCharges w U) : + S.primeCharge p (w.label i) (w.offset i.succ) a ≤ + isolatedCharge w U p E a (w.offset i.succ) := by + have hiU := (mem_filter.mp hi).2 + by_cases hc : S.IsCore p + · by_cases he : w.offset i.succ ∈ edgeVertices w E + · have hd := htop hc i hi he + simp [primeCharge, isolatedCharge, hc, hd, he] + · by_cases ha : a + (w.offset i.succ : ZMod (p : ℕ)) = 0 + · simp only [isolatedCharge, hc, hiU, ha, he, not_false_eq_true, and_self, ite_true] + unfold primeCharge + split_ifs + · exact le_rfl + · exact Real.one_le_exp (by unfold kappa eta epsilon; positivity) + · simp [primeCharge, isolatedCharge, ha] + · simp [primeCharge, isolatedCharge, hc] + +lemma incoming_charges_le_vertices (w : ClosedLine h ℓ) (U : Finset ℤ) + (hU : U ⊆ goodOrigins w) (p : S.Index) (E : Finset (Fin ℓ)) + (htop : NoComponentTop w U p E) (a : ZMod (p : ℕ)) : + (∏ i ∈ incomingCharges w U, S.primeCharge p (w.label i) (w.offset i.succ) a) ≤ + ∏ v ∈ treeVertices w, isolatedCharge w U p E a v := by + calc + _ ≤ ∏ i ∈ incomingCharges w U, isolatedCharge w U p E a (w.offset i.succ) := + prod_le_prod₀ (fun _ _ => primeCharge_nonneg _ _ _ _) + (fun i hi => incoming_charge_le_isolated w U p E htop a i hi) + _ = ∏ v ∈ U, isolatedCharge w U p E a v := by + calc + _ = ∏ v ∈ (incomingCharges w U).image (fun i => w.offset i.succ), + isolatedCharge w U p E a v := by + symm + apply prod_image + intro i hi j hj hij + exact tree_destination_injective w (mem_filter.mp hi).1 (mem_filter.mp hj).1 hij + _ = _ := congrArg (fun V => ∏ v ∈ V, isolatedCharge w U p E a v) + (incomingCharges_image w U hU) + _ = ∏ v ∈ treeVertices w, isolatedCharge w U p E a v := by + apply prod_subset (fun v hv => (good_origin_data w (hU hv)).1) + intro v hv hn + simp [isolatedCharge, hn] + +def subtreeUnionWeight (w : ClosedLine h ℓ) (p : S.Index) (E : Finset (Fin ℓ)) : ℝ := + S.amplitude p ^ E.card * ∏ v ∈ edgeVertices w E, S.beta p ^ w.children v + +lemma tree_norm_charges_le (w : ClosedLine h ℓ) (U : Finset ℤ) + (hU : U ⊆ goodOrigins w) (p : S.Index) (a : ZMod (p : ℕ)) + (htop : NoComponentTop w U p (litEdges w p a)) : + (∏ i ∈ w.treeSteps, S.beta p ^ + (if a + (w.offset i.castSucc : ZMod (p : ℕ)) = 0 then (1 : ℕ) else 0)) * + (∏ i ∈ incomingCharges w U, S.primeCharge p (w.label i) (w.offset i.succ) a) ≤ + ∏ v ∈ edgeVertices w (litEdges w p a), S.beta p ^ w.children v := by + let E := litEdges w p a + have hn : ∀ v : ℤ, (0 : ℝ) ≤ (if a + (v : ZMod (p : ℕ)) = 0 then + S.beta p ^ w.children v else 1) := by + intro v + have hb := beta_nonneg p + split_ifs <;> positivity + rw [tree_normalization] + calc + _ ≤ (∏ v ∈ treeVertices w, if a + (v : ZMod (p : ℕ)) = 0 then + S.beta p ^ w.children v else 1) * + ∏ v ∈ treeVertices w, isolatedCharge w U p E a v := + mul_le_mul_of_nonneg_left (incoming_charges_le_vertices w U hU p E htop a) + (prod_nonneg (fun v _ => hn v)) + _ = ∏ v ∈ treeVertices w, (if a + (v : ZMod (p : ℕ)) = 0 then + S.beta p ^ w.children v else 1) * isolatedCharge w U p E a v := by + rw [prod_mul_distrib] + _ ≤ ∏ v ∈ treeVertices w, if v ∈ edgeVertices w E then S.beta p ^ w.children v else 1 := by + apply Finset.prod_le_prod₀ + · intro v hv + exact mul_nonneg (hn v) (isolatedCharge_nonneg w U p E a v) + · intro v hv + by_cases he : v ∈ edgeVertices w E + · rw [ite_eq_left he, ite_eq_left (lit_vertex_active w p a he)] + simp [isolatedCharge, he] + · rw [ite_eq_right he] + by_cases ha : a + (v : ZMod (p : ℕ)) = 0 + · rw [ite_eq_left ha] + by_cases hu : S.IsCore p ∧ v ∈ U + · have hv1 := (good_origin_data w (hU hu.2)).2.2.1 + simp only [isolatedCharge, hu.1, hu.2, ha, he, not_false_eq_true, and_self, + ite_true, hv1, pow_one, beta_eq_core p hu.1] + exact betaC_mul_exp_le_one + · have hc : ¬(S.IsCore p ∧ v ∈ U ∧ a + (v : ZMod (p : ℕ)) = 0 ∧ v ∉ edgeVertices w E) := + fun hh => hu ⟨hh.1,hh.2.1⟩ + rw [isolatedCharge, ite_eq_right hc, mul_one] + exact pow_le_one₀ (beta_nonneg p) (beta_le_one p) + · simp [isolatedCharge, ha] + _ = ∏ v ∈ edgeVertices w E, S.beta p ^ w.children v := by + rw [← prod_filter] + congr 1 + rw [filter_mem_eq_inter, inter_eq_right.mpr (edgeVertices_subset w E)] + +lemma charged_prime_le_tree (w : ClosedLine h ℓ) (U : Finset ℤ) + (p : S.Index) (a : ZMod (p : ℕ)) : + |S.primeFactor w p a| * allPrimeCharges w U p a ≤ + (∏ i ∈ w.treeSteps, |S.occurrenceFactor w p i a|) * + ((∏ i ∈ w.treeSteps, S.beta p ^ + (if a + (w.offset i.castSucc : ZMod (p : ℕ)) = 0 then (1 : ℕ) else 0)) * + ∏ i ∈ incomingCharges w U, S.primeCharge p (w.label i) (w.offset i.succ) a) := by + have hret : |∏ i ∈ returnSteps w, S.stepFactor w p i a| * + (∏ i ∈ returnSteps w, S.primeCharge p (w.label i) (w.offset i.castSucc) a) ≤ 1 := by + rw [abs_prod, ← prod_mul_distrib] + exact prod_le_one₀ (fun i _ => mul_nonneg (abs_nonneg _) (primeCharge_nonneg _ _ _ _)) + (fun i _ => charged_return_le_one w p i a) + have hi0 : 0 ≤ ∏ i ∈ incomingCharges w U, + S.primeCharge p (w.label i) (w.offset i.succ) a := + prod_nonneg (fun i _ => primeCharge_nonneg _ _ _ _) + rw [primeFactor_split_steps, abs_mul, allPrimeCharges] + calc + _ = (|∏ i ∈ w.treeSteps, S.stepFactor w p i a| * + ∏ i ∈ incomingCharges w U, S.primeCharge p (w.label i) (w.offset i.succ) a) * + (|∏ i ∈ returnSteps w, S.stepFactor w p i a| * + ∏ i ∈ returnSteps w, S.primeCharge p (w.label i) (w.offset i.castSucc) a) := by + unfold returnSteps + ring + _ ≤ (|∏ i ∈ w.treeSteps, S.stepFactor w p i a| * + ∏ i ∈ incomingCharges w U, S.primeCharge p (w.label i) (w.offset i.succ) a) * 1 := + mul_le_mul_of_nonneg_left hret (mul_nonneg (abs_nonneg _) hi0) + _ = _ := by + simp only [mul_one, abs_prod, stepFactor, abs_mul, + abs_of_nonneg (pow_nonneg (beta_nonneg p) _), prod_mul_distrib] + ring + +lemma occurrence_abs_le_lit_amplitude (w : ClosedLine h ℓ) (p : S.Index) + (a : ZMod (p : ℕ)) (i : Fin ℓ) (hi : i ∈ w.treeSteps) : + |S.occurrenceFactor w p i a| ≤ + if i ∈ litEdges w p a then S.amplitude p else 1 := by + have ht := theta_div_bounds p + by_cases hd : (p : ℕ) ∣ w.label i <;> + by_cases ha : a + (w.offset i.castSucc : ZMod (p : ℕ)) = 0 <;> + by_cases hc : S.IsCore p + all_goals simp only [occurrenceFactor, activity, hd, ha, hc, ite_true, ite_false, + amplitude, litEdges, treeOccurrences, mem_filter, hi, and_true, + and_false, mul_zero, mul_one, abs_zero, zero_sub, abs_neg] + · exact le_of_eq (abs_of_pos A_pos) + · rw [abs_of_nonneg (sub_nonneg.mpr ht.2)]; linarith [ht.1] + · norm_num + · exact (abs_of_nonneg ht.1).le.trans ht.2 + all_goals norm_num + +lemma occurrence_product_le (w : ClosedLine h ℓ) (p : S.Index) (a : ZMod (p : ℕ)) : + (∏ i ∈ w.treeSteps, |S.occurrenceFactor w p i a|) ≤ + S.amplitude p ^ (litEdges w p a).card := by + calc + _ ≤ ∏ i ∈ w.treeSteps, if i ∈ litEdges w p a then S.amplitude p else 1 := + prod_le_prod₀ (fun _ _ => abs_nonneg _) (fun i hi => occurrence_abs_le_lit_amplitude w p a i hi) + _ = _ := by + rw [prod_ite_mem, inter_eq_right.mpr] + · simp only [prod_const] + · exact (filter_subset _ _).trans (filter_subset _ _) + +theorem charged_prime_le_weight (w : ClosedLine h ℓ) (U : Finset ℤ) + (hU : U ⊆ goodOrigins w) (p : S.Index) (a : ZMod (p : ℕ)) + (htop : NoComponentTop w U p (litEdges w p a)) : + |S.primeFactor w p a| * allPrimeCharges w U p a ≤ + subtreeUnionWeight w p (litEdges w p a) := by + apply (charged_prime_le_tree w U p a).trans + unfold subtreeUnionWeight + apply mul_le_mul (occurrence_product_le w p a) (tree_norm_charges_le w U hU p a htop) + · exact mul_nonneg (prod_nonneg (fun _ _ => pow_nonneg (beta_nonneg p) _)) + (prod_nonneg (fun _ _ => primeCharge_nonneg _ _ _ _)) + · have hp : 0 ≤ S.amplitude p := by + unfold amplitude + split_ifs + · exact A_pos.le + · exact zero_le_one + exact pow_nonneg hp _ + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeOccurrencesEmptyOfFree.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeOccurrencesEmptyOfFree.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e75d72766caa9c89460b05750482833af314907 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeOccurrencesEmptyOfFree.lean @@ -0,0 +1,155 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FixedCharges +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.RecordedTops +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SingleEdgeWeight + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegration +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +lemma treeOccurrences_empty_of_free_core (w : ClosedLine h ℓ) (p : S.FreeCoreIndex w) : + treeOccurrences w p.val.val = ∅ := by + apply eq_empty_iff_forall_notMem.mpr + intro i hi + exact p.val.property ⟨⟨i,(mem_filter.mp hi).2⟩, Or.inl p.property⟩ + +lemma treeOccurrences_singleton_of_free (w : ClosedLine h ℓ) (p : S.FreeIndex w) + (e : Fin ℓ) (he : e ∈ treeOccurrences w p.val) : + treeOccurrences w p.val = {e} := by + ext i + constructor + · intro hi + exact mem_singleton.mpr ((unique_occurrence_of_free w p.val p.property e + (mem_filter.mp he).2 i).mp (mem_filter.mp hi).2) + · intro hi + simpa only [mem_singleton.mp hi] using he + +def freeTreeWeight (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) (p : S.Index) : ℝ := + ∏ e ∈ treeOccurrences w p, singletonTokenWeight w 𝔏 p e + +lemma freeTreeWeight_nonneg (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) + (p : S.Index) : 0 ≤ freeTreeWeight w 𝔏 p := + prod_nonneg (fun _ _ => singletonTokenWeight_nonneg w 𝔏 p _) + +def primeBound (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) (U : Finset ℤ) + (E : S.Index → Finset (Fin ℓ)) (p : S.Index) : ℝ := + if (treeOccurrences w p).Nonempty then + (if S.IsFixed w p then fixedTreeWeight w p (E p) else freeTreeWeight w 𝔏 p) / (p : ℝ) + else outsideTreeBound w 𝔏 U p + +lemma primeBound_nonneg (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) + (U : Finset ℤ) (E : S.Index → Finset (Fin ℓ)) (p : S.Index) : + 0 ≤ primeBound w 𝔏 U E p := by + unfold primeBound + split_ifs + · exact div_nonneg (fixedTreeWeight_nonneg w p _) (Nat.cast_nonneg _) + · exact div_nonneg (freeTreeWeight_nonneg w 𝔏 p) (Nat.cast_nonneg _) + · exact outsideTreeBound_nonneg w 𝔏 U p + +lemma no_tree_of_not_nonempty (w : ClosedLine h ℓ) (p : S.Index) + (hn : ¬(treeOccurrences w p).Nonempty) : + ∀ i ∈ w.treeSteps, ¬(p : ℕ) ∣ w.label i := by + intro i hi hd + exact hn ⟨i, mem_filter.mpr ⟨hi,hd⟩⟩ + +lemma fixed_mean_le_primeBound (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) + (U : Finset ℤ) (hU : U ⊆ goodOrigins w) (E : S.Index → Finset (Fin ℓ)) + (p : S.FixedIndex w) (htop : NoComponentTop w U p.val (E p.val)) : + avg (recordPrime w 𝔏 U p.val (E p.val)) ≤ primeBound w 𝔏 U E p.val := by + by_cases ho : (treeOccurrences w p.val).Nonempty + · rw [primeBound, ite_eq_left ho, ite_eq_left p.property] + exact fixed_tree_mean w 𝔏 U hU p.val (E p.val) htop ho + · rw [primeBound, ite_eq_right ho] + exact (avg_mono (recordPrime_le_charged_local w 𝔏 U p.val (E p.val))).trans + (outside_tree_mean w 𝔏 U hU p.val (no_tree_of_not_nonempty w p.val ho)) + +lemma free_core_mean_le_primeBound (w : ClosedLine h ℓ) + (𝔏 : List (AttachedSpec w D L)) (U : Finset ℤ) (hU : U ⊆ goodOrigins w) + (E : S.Index → Finset (Fin ℓ)) (p : S.FreeCoreIndex w) : + avg (fun a => |localWithList w 𝔏 p.val.val a| * allPrimeCharges w U p.val.val a) ≤ + primeBound w 𝔏 U E p.val.val := by + have ho : ¬(treeOccurrences w p.val.val).Nonempty := by + rw [treeOccurrences_empty_of_free_core w p] + exact not_nonempty_empty + rw [primeBound, ite_eq_right ho] + exact outside_tree_mean w 𝔏 U hU p.val.val (no_tree_of_not_nonempty w p.val.val ho) + +lemma free_center_mean_le_primeBound (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (U : Finset ℤ) (hU : U ⊆ goodOrigins w) + (E : S.Index → Finset (Fin ℓ)) (p : S.FreeCenterIndex w) + (hlarge : 2 * (ℓ+1) ≤ (p.val.val : ℕ)) : + |avg (localWithList w 𝔏 p.val.val)| ≤ primeBound w 𝔏 U E p.val.val := by + by_cases ho : (treeOccurrences w p.val.val).Nonempty + · rw [primeBound, ite_eq_left ho, ite_eq_right p.val.property] + obtain ⟨e,he⟩ := ho + rw [freeTreeWeight, treeOccurrences_singleton_of_free w p.val e he, prod_singleton] + exact free_center_tree_mean w hh 𝔏 p e (mem_filter.mp he).2 hlarge + · rw [primeBound, ite_eq_right ho] + have hc := outside_tree_mean w 𝔏 U hU p.val.val + (no_tree_of_not_nonempty w p.val.val ho) + simp only [allPrimeCharges_center w U p.val.val p.property, mul_one] at hc + exact (abs_avg_le _).trans hc + +lemma product_index_split (w : ClosedLine h ℓ) (f : S.Index → ℝ) : + (∏ p : S.FixedIndex w, f p.val) * + ((∏ p : S.FreeCoreIndex w, f p.val.val) * + (∏ p : S.FreeCenterIndex w, f p.val.val)) = ∏ p : S.Index, f p := by + rw [Fintype.prod_subtype_mul_prod_subtype (fun p : S.FreeIndex w => S.IsCore p.val) + (fun p : S.FreeIndex w => f p.val)] + exact Fintype.prod_subtype_mul_prod_subtype (S.IsFixed w) f + +theorem assignedKernelIntegral_le_all_prime_bounds (w : ClosedLine h ℓ) (hh : 0 < h) + {T : ℝ} (cut : S.Cutoffs T) (𝔏 : List (AttachedSpec w D L)) + (E : S.Index → Finset (Fin ℓ)) (hE : ∀ p, E p ⊆ treeOccurrences w p) + (group : S.FixedResidues w → Prop) + (hgroup : ∀ a, group a → ∀ p : S.FixedIndex w, litEdges w p.val (a p) = E p.val) + (hlarge : ∀ p : S.Index, 2 * (ℓ+1) ≤ (p : ℕ)) : + assignedKernelIntegral w cut 𝔏 group ≤ + chargeConstant (S := S) w T (recordU w E) * + ∏ p : S.Index, primeBound w 𝔏 (recordU w E) E p := by + let U := recordU w E + have hU := recordU_subset w E + have hh' := assignedKernelIntegral_le_prime_means w cut 𝔏 U hU group + (fun p => E p.val) hgroup + apply hh'.trans + calc + _ ≤ chargeConstant (S := S) w T U * + (∏ p : S.FreeCenterIndex w, primeBound w 𝔏 U E p.val.val) * + (∏ p : S.FixedIndex w, primeBound w 𝔏 U E p.val) * + ∏ p : S.FreeCoreIndex w, primeBound w 𝔏 U E p.val.val := by + have hZ := prod_le_prod₀ (s := univ) (fun (p : S.FreeCenterIndex w) _ => abs_nonneg + (avg (localWithList w 𝔏 p.val.val))) + (fun p _ => free_center_mean_le_primeBound w hh 𝔏 U hU E p (hlarge _)) + have hF := prod_le_prod₀ (s := univ) (fun (p : S.FixedIndex w) _ => + avg_nonneg (recordPrime_nonneg w 𝔏 U p.val (E p.val))) + (fun p _ => fixed_mean_le_primeBound w 𝔏 U hU E p + (recordU_noComponentTop w E hE _)) + have hC := prod_le_prod₀ (s := univ) (fun (p : S.FreeCoreIndex w) _ => avg_nonneg (fun a => + mul_nonneg (abs_nonneg _) (allPrimeCharges_nonneg w U p.val.val a))) + (fun p _ => free_core_mean_le_primeBound w 𝔏 U hU E p) + have hZF := mul_le_mul hZ hF + (prod_nonneg (fun p _ => avg_nonneg (recordPrime_nonneg w 𝔏 U p.val _))) + (prod_nonneg (fun p _ => primeBound_nonneg w 𝔏 U E p.val.val)) + have hZFC := mul_le_mul hZF hC + (prod_nonneg (fun p _ => avg_nonneg (fun a => + mul_nonneg (abs_nonneg _) (allPrimeCharges_nonneg w U p.val.val a)))) + (mul_nonneg (prod_nonneg (fun p _ => primeBound_nonneg w 𝔏 U E p.val.val)) + (prod_nonneg (fun p _ => primeBound_nonneg w 𝔏 U E p.val))) + simpa only [chargeConstant, mul_assoc] using mul_le_mul_of_nonneg_left hZFC + ((Real.exp_pos _).le : 0 ≤ chargeConstant (S := S) w T U) + _ = _ := by + rw [← product_index_split w] + ring + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreePrimeSupport.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreePrimeSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cdcbb3a6e07b4d21bcb31e2e9958c867e795be6 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreePrimeSupport.lean @@ -0,0 +1,131 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CardTreeVerticesLe +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrimeFactorsCardLeLog + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegration +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +def treePrimeSupport (w : ClosedLine h ℓ) : Finset ℕ := + w.treeSteps.biUnion (fun i => (w.label i).primeFactors) + +lemma treePrimeSupport_card_le (w : ClosedLine h ℓ) (hlabels : ∀ i, w.label i ∈ D.members) : + (treePrimeSupport w).card ≤ ℓ * ⌈C₀ * Real.log B⌉₊ := by + have hcard : w.treeSteps.card ≤ ℓ := by + exact (card_le_card (filter_subset _ _)).trans_eq (by simp) + exact (card_biUnion_le_card_mul w.treeSteps _ _ + (fun i _ => D.omega _ (hlabels i))).trans (Nat.mul_le_mul_right _ hcard) + +lemma Specification.primeSupport_card_le (s : S.Specification D h L) : + s.primeSupport.card ≤ L * ⌈C₀ * Real.log B⌉₊ + 1 := by + calc + _ ≤ (univ.biUnion (fun i : Fin s.length => (s.label i).primeFactors)).card + 1 := + card_insert_le _ _ + _ ≤ s.length * ⌈C₀ * Real.log B⌉₊ + 1 := by + gcongr + simpa only [card_univ, Fintype.card_fin] using card_biUnion_le_card_mul + (univ : Finset (Fin s.length)) (fun i => (s.label i).primeFactors) _ + (fun i _ => D.omega _ (s.label_mem i)) + _ ≤ _ := Nat.add_le_add_right (Nat.mul_le_mul_right _ s.length_le) _ + +lemma listSupport_card_le (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) : + (listSupport w 𝔏).card ≤ 𝔏.length * (L * ⌈C₀ * Real.log B⌉₊ + 1) := by + exact (card_biUnion_le_card_mul 𝔏.toFinset _ _ + (fun s _ => s.spec.primeSupport_card_le)).trans + (Nat.mul_le_mul_right _ (List.toFinset_card_le _)) + +lemma usedPrime_mem_support (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) + (p : S.Index) : UsedPrime w 𝔏 p ↔ (p : ℕ) ∈ treePrimeSupport w ∪ listSupport w 𝔏 := by + unfold UsedPrime + rw [mem_union] + refine or_congr ?_ Iff.rfl + unfold treePrimeSupport + constructor + · rintro ⟨e,he⟩ + obtain ⟨het,hep⟩ := mem_filter.mp he + exact mem_biUnion.mpr ⟨e,het, Nat.mem_primeFactors.mpr + ⟨S.prime_mem p p.property,hep,(w.label_pos e).ne'⟩⟩ + · intro hm + obtain ⟨e,he,hep⟩ := mem_biUnion.mp hm + exact ⟨e,mem_filter.mpr ⟨he,(Nat.mem_primeFactors.mp hep).2.1⟩⟩ + +def usedIndices (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) : Finset S.Index := + univ.filter (UsedPrime w 𝔏) + +def lineListSlots (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) : ℕ := + ℓ * ⌈C₀ * Real.log B⌉₊ + 𝔏.length * (L * ⌈C₀ * Real.log B⌉₊ + 1) + +lemma usedIndices_card_le (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) + (hlabels : ∀ i, w.label i ∈ D.members) : + (usedIndices w 𝔏).card ≤ lineListSlots w 𝔏 := by + have hsub : (usedIndices w 𝔏).image Subtype.val ⊆ treePrimeSupport w ∪ listSupport w 𝔏 := by + intro p hp + obtain ⟨q,hq,hqp⟩ := mem_image.mp hp + rw [← hqp] + exact (usedPrime_mem_support w 𝔏 q).mp (mem_filter.mp hq).2 + calc + _ = ((usedIndices w 𝔏).image Subtype.val).card := + (card_image_of_injective _ Subtype.val_injective).symm + _ ≤ (treePrimeSupport w ∪ listSupport w 𝔏).card := card_le_card hsub + _ ≤ (treePrimeSupport w).card + (listSupport w 𝔏).card := card_union_le _ _ + _ ≤ _ := Nat.add_le_add (treePrimeSupport_card_le w hlabels) (listSupport_card_le w 𝔏) + +lemma restorationError_le_masses (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) : + restorationError w 𝔏 ≤ ((ℓ : ℝ)+1) * + ((∑ p ∈ usedIndices w 𝔏, (p : ℝ)⁻¹) + + ∑ p ∈ collisionIndices (S := S) w, (p : ℝ)⁻¹) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + rw [usedIndices, collisionIndices, sum_filter, sum_filter, ← sum_add_distrib] + apply sum_le_sum + intro p hp + unfold OmittedPrime + by_cases hu : UsedPrime w 𝔏 p <;> by_cases hc : IsCollision w p <;> + simp [hu,hc, inv_nonneg.mpr (show 0 ≤ (p : ℝ) from Nat.cast_nonneg _)] + +lemma card_tree_offDiag_le (w : ClosedLine h ℓ) : + (treeVertices w).offDiag.card ≤ (ℓ+1)^2 := by + have hsub : (treeVertices w).offDiag ⊆ (treeVertices w) ×ˢ (treeVertices w) := by + intro vu hvu + obtain ⟨hv,hu,_⟩ := mem_offDiag.mp hvu + exact mem_product.mpr ⟨hv,hu⟩ + calc + _ ≤ ((treeVertices w) ×ˢ (treeVertices w)).card := card_le_card hsub + _ = (treeVertices w).card * (treeVertices w).card := card_product _ _ + _ ≤ (ℓ+1) * (ℓ+1) := Nat.mul_le_mul (card_treeVertices_le w) (card_treeVertices_le w) + _ = _ := (pow_two _).symm + +theorem restorationError_le (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) + (hlabels : ∀ i, w.label i ∈ D.members) (M P₀ : ℝ) (hM₀ : 0 ≤ M) (hP₀ : 0 < P₀) + (hp : ∀ p : S.Index, P₀ ≤ (p : ℝ)) + (hM : ∀ v ∈ treeVertices w, ∀ u ∈ treeVertices w, + v ≠ u → ((u-v).natAbs : ℝ) ≤ Real.exp M) : + restorationError w 𝔏 ≤ ((ℓ : ℝ)+1) * + ((lineListSlots w 𝔏 : ℝ) + ((ℓ : ℝ)+1)^2 * (M / Real.log 2)) / P₀ := by + have huCard : ((usedIndices w 𝔏).card : ℝ) ≤ (lineListSlots w 𝔏 : ℝ) := by + exact_mod_cast usedIndices_card_le w 𝔏 hlabels + have hused := (sum_inv_le_card_div (usedIndices w 𝔏) P₀ hP₀ (fun p _ => hp p)).trans + (div_le_div_of_nonneg_right huCard hP₀.le) + have hcoll := collision_reciprocal_mass w M P₀ hP₀ hp hM + have hcoll' : (∑ p ∈ collisionIndices (S := S) w, (p : ℝ)⁻¹) ≤ + ((ℓ : ℝ)+1)^2 * (M / Real.log 2) / P₀ := by + apply hcoll.trans + apply div_le_div_of_nonneg_right _ hP₀.le + exact mul_le_mul_of_nonneg_right (by exact_mod_cast card_tree_offDiag_le w) + (div_nonneg hM₀ (Real.log_nonneg (by norm_num))) + apply (restorationError_le_masses w 𝔏).trans + have hm := mul_le_mul_of_nonneg_left (add_le_add hused hcoll') (by positivity : 0 ≤ (ℓ : ℝ)+1) + convert hm using 1 + ring + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeVertices.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeVertices.lean new file mode 100644 index 0000000000000000000000000000000000000000..6900b6f55cd1ebf8cbd4ef64a5f211a709611d14 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeVertices.lean @@ -0,0 +1,134 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.KappaPos + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.FiniteIntegration OrdinaryCorrelations.SignedTrace +open Finset Classical +variable {S : PrimeSystem} {h ℓ : ℕ} + +def treeVertices (w : ClosedLine h ℓ) : Finset ℤ := univ.image w.offset + +lemma departure_mem_vertices (w : ClosedLine h ℓ) (i : Fin ℓ) : + w.offset i.castSucc ∈ treeVertices w := mem_image.mpr ⟨i.castSucc, mem_univ _, rfl⟩ + +lemma endpoint_mem_vertices (w : ClosedLine h ℓ) (i : Fin ℓ) : + w.offset i.succ ∈ treeVertices w := mem_image.mpr ⟨i.succ, mem_univ _, rfl⟩ + +lemma tree_normalization (w : ClosedLine h ℓ) (p : S.Index) (x : ZMod (p : ℕ)) : + (∏ i ∈ w.treeSteps, S.beta p ^ + (if x + (w.offset i.castSucc : ZMod (p : ℕ)) = 0 then (1 : ℕ) else 0)) = + ∏ v ∈ treeVertices w, if x + (v : ZMod (p : ℕ)) = 0 then + S.beta p ^ w.children v else 1 := by + rw [← prod_fiberwise_of_maps_to (fun i (_ : i ∈ w.treeSteps) => departure_mem_vertices w i)] + apply prod_congr rfl + intro v hv + by_cases ha : x + (v : ZMod (p : ℕ)) = 0 + · simp only [ha, ite_true, ClosedLine.children] + trans ∏ i ∈ w.treeSteps.filter (fun i => w.offset i.castSucc = v), S.beta p + · apply prod_congr rfl + intro i hi + rw [(mem_filter.mp hi).2, ite_eq_left ha, pow_one] + · rw [prod_const] + · rw [ite_eq_right ha] + apply prod_eq_one + intro i hi + rw [(mem_filter.mp hi).2, ite_eq_right ha, pow_zero] + +lemma residue_product_mean {ι : Type*} {p : ℕ} [NeZero p] + (V : Finset ι) (r : ι → ZMod p) (g : ι → ℝ) + (hinj : Set.InjOn r V) : + avg (fun a : ZMod p => ∏ v ∈ V, if a = r v then g v else 1) = + 1 - (∑ v ∈ V, (1 - g v)) / p := by + have hpoint (a : ZMod p) : + (∏ v ∈ V, if a = r v then g v else 1) = + 1 + ∑ v ∈ V, if a = r v then g v - 1 else 0 := by + by_cases ha : ∃ v ∈ V, a = r v + · obtain ⟨v,hv,ha⟩ := ha + have hne (q : ι) (hq : q ∈ V) (hqv : q ≠ v) : a ≠ r q := by + intro h + exact hqv (hinj hq hv (h.symm.trans ha)) + rw [prod_eq_single_of_mem v hv (fun q hq hqv => ite_eq_right (hne q hq hqv)), + sum_eq_single_of_mem v hv (fun q hq hqv => ite_eq_right (hne q hq hqv))] + simp only [ite_eq_left ha] + ring + · have hne (v : ι) (hv : v ∈ V) : a ≠ r v := fun h => ha ⟨v,hv,h⟩ + rw [prod_eq_one (fun v hv => ite_eq_right (hne v hv)), + sum_eq_zero (fun v hv => ite_eq_right (hne v hv))] + ring + simp_rw [hpoint] + simp only [avg, sum_add_distrib, sum_const, card_univ, ZMod.card, nsmul_eq_mul] + rw [sum_comm] + simp only [sum_ite_eq', mem_univ, ite_true] + have hp : (p : ℝ) ≠ 0 := by exact_mod_cast NeZero.ne p + rw [sum_sub_distrib, sum_const, nsmul_eq_mul] + simp only [sum_sub_distrib, sum_const, nsmul_eq_mul] + field_simp + ring + +def backgroundMultiplier (w : ClosedLine h ℓ) (U : Finset ℤ) (p : S.Index) + (a : ZMod (p : ℕ)) : ℝ := + ∏ v ∈ treeVertices w, if a + (v : ZMod (p : ℕ)) = 0 then + S.beta p ^ w.children v * (if S.IsCore p ∧ v ∈ U then Real.exp kappa else 1) else 1 + +def treeDefect (w : ClosedLine h ℓ) (p : S.Index) : ℝ := + ∑ v ∈ treeVertices w, (1 - S.beta p ^ w.children v) + +lemma beta_nonneg (p : S.Index) : 0 ≤ S.beta p := by + have ha := A_pos + unfold beta amplitude + split_ifs <;> positivity + +lemma beta_le_one (p : S.Index) : S.beta p ≤ 1 := by + unfold beta amplitude + split_ifs + · exact betaC_le_one + · norm_num + +lemma background_vertex_le_one (w : ClosedLine h ℓ) (U : Finset ℤ) + (hU : ∀ v ∈ U, w.children v = 1) (p : S.Index) (v : ℤ) : + S.beta p ^ w.children v * (if S.IsCore p ∧ v ∈ U then Real.exp kappa else 1) ≤ 1 := by + by_cases hu : S.IsCore p ∧ v ∈ U + · rw [ite_eq_left hu, hU v hu.2, pow_one] + simpa only [beta, amplitude, hu.1, ite_true, betaC] using betaC_mul_exp_le_one + · rw [ite_eq_right hu, mul_one] + exact pow_le_one₀ (beta_nonneg p) (beta_le_one p) + +lemma backgroundMultiplier_bounds (w : ClosedLine h ℓ) (U : Finset ℤ) + (hU : ∀ v ∈ U, w.children v = 1) (p : S.Index) (a : ZMod (p : ℕ)) : + 0 ≤ backgroundMultiplier w U p a ∧ backgroundMultiplier w U p a ≤ 1 := by + have hnon (v : ℤ) : 0 ≤ (if a + (v : ZMod (p : ℕ)) = 0 then + S.beta p ^ w.children v * (if S.IsCore p ∧ v ∈ U then Real.exp kappa else 1) else 1) := by + have hb := beta_nonneg p + split_ifs <;> positivity + constructor + · exact prod_nonneg (fun v _ => hnon v) + · apply prod_le_one₀ (fun v _ => hnon v) + intro v hv + by_cases ha : a + (v : ZMod (p : ℕ)) = 0 + · rw [ite_eq_left ha] + exact background_vertex_le_one w U hU p v + · rw [ite_eq_right ha] + +lemma background_mean_exact (w : ClosedLine h ℓ) (U : Finset ℤ) + (p : S.Index) (hinj : Set.InjOn (fun v : ℤ => (v : ZMod (p : ℕ))) (treeVertices w)) : + avg (backgroundMultiplier w U p) = 1 - + (∑ v ∈ treeVertices w, + (1 - S.beta p ^ w.children v * + (if S.IsCore p ∧ v ∈ U then Real.exp kappa else 1))) / (p : ℝ) := by + change avg (fun a => ∏ v ∈ treeVertices w, if a + (v : ZMod (p : ℕ)) = 0 then _ else _) = _ + simp only [add_eq_zero_iff_eq_neg] + apply residue_product_mean + intro v hv u hu hneg + exact hinj hv hu (neg_injective hneg) + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoBlockRerooting.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoBlockRerooting.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd2cb1d3db82f9279b771702da939c5079f2ee8e --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoBlockRerooting.lean @@ -0,0 +1,101 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.GateAncestor + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.Rerooting +open Classical Finset SimpleGraph +noncomputable section +variable {V α : Type*} [DecidableEq V] [Fintype α] [DecidableEq α] +variable {G₁ G₂ : SimpleGraph V} {root₁ root₂ : V} {A₁ A₂ : α→Finset V} + +theorem two_block_rerooting (hG₁ : G₁.IsAcyclic) (hG₂ : G₂.IsAcyclic) + (g₁ : ∀ p,Gate G₁ root₁ (A₁ p)) (g₂ : ∀ p,Gate G₂ root₂ (A₂ p)) + (hA₂ : ∀ p,ConnectedSet G₂ (A₂ p)) + (J n : ℕ) (hn : n^8 ≤ Fintype.card α) + (hcap : ∀ x y,G₂.Adj x y → (univ.filter (fun p => x ∈ A₂ p ∧ y ∈ A₂ p)).card ≤ J) : + ∃ (t : Finset α) (root : V) (g : ∀ p : t,Gate G₂ root (A₂ p.val)) (key : t→ℕ), + n ≤ (2*J+1)*t.card ∧ (root=root₂ ∨ ∃ p,root=(g₂ p).vertex) ∧ + ∀ p q : t,gateAncestor (fun p : t => g₁ p.val) p q ∨ gateAncestor g p q → key p g₂ p.val),(fun p => (g₁ p.val).path.length),by simp [hn0],Or.inl rfl,?_⟩ + intro p _ _ + exact (notMem_empty p.val p.property).elim + have hr₁ := ancestor_trans hG₁ root₁ (fun p => (g₁ p).vertex) (fun p => (g₁ p).path) (fun p => (g₁ p).simple) + have hr₂ := ancestor_trans hG₂ root₂ (fun p => (g₂ p).vertex) (fun p => (g₂ p).path) (fun p => (g₂ p).simple) + obtain ⟨c,hcu,hc,hcases⟩ := two_order_extraction (gateAncestor g₁) (gateAncestor g₂) + hr₁ (ancestor_irrefl root₁ (fun p => (g₁ p).vertex) (fun p => (g₁ p).path)) + hr₂ (ancestor_irrefl root₂ (fun p => (g₂ p).vertex) (fun p => (g₂ p).path)) univ n (by simpa using hn) + have hcne : c.Nonempty := card_pos.mp (by omega) + have hcs : n ≤ (2*J+1)*c.card := hc.trans (by nlinarith) + rcases hcases with ha₁|ha₂|hag|hre + · refine ⟨c,root₂,(fun p => g₂ p.val),(fun p => (g₂ p.val).path.length),hcs,Or.inl rfl,?_⟩ + intro p q h + rcases h with h|h + · exact ((ha₁ p.property q.property (fun he => h.2 (congrArg (fun p => (g₁ p).vertex) he))).1 h).elim + · exact ancestor_length_lt hG₂ root₂ _ _ (fun p : c => (g₂ p.val).simple) h + · refine ⟨c,root₂,(fun p => g₂ p.val),(fun p => (g₁ p.val).path.length),hcs,Or.inl rfl,?_⟩ + intro p q h + rcases h with h|h + · exact ancestor_length_lt hG₁ root₁ _ _ (fun p : c => (g₁ p.val).simple) h + · exact ((ha₂ p.property q.property (fun he => h.2 (congrArg (fun p => (g₂ p).vertex) he))).1 h).elim + · refine ⟨c,root₂,(fun p => g₂ p.val),(fun p => (g₁ p.val).path.length),hcs,Or.inl rfl,?_⟩ + intro p q h + rcases h with h|h + · exact ancestor_length_lt hG₁ root₁ _ _ (fun p : c => (g₁ p.val).simple) h + · have hpq : p.val≠q.val := fun he => h.2 (congrArg (fun p => (g₂ p).vertex) he) + rcases hag p.property q.property hpq with ha|ha + · exact ancestor_length_lt hG₁ root₁ _ _ (fun p => (g₁ p).simple) ha.1 + · have hlt := ancestor_length_lt hG₂ root₂ _ _ (fun p : c => (g₂ p.val).simple) h + have hgt := ancestor_length_lt hG₂ root₂ _ _ (fun p => (g₂ p).simple) ha.2 + omega + · let : Nonempty c := ⟨⟨hcne.choose,hcne.choose_spec⟩⟩ + have hre' : Chain (Reverse (gateAncestor (fun p : c => g₁ p.val)) + (gateAncestor (fun p : c => g₂ p.val))) univ := by + intro p _ q _ hpq + exact hre p.property q.property (fun he => hpq (Subtype.ext he)) + have hcap' (x y : V) (hxy : G₂.Adj x y) : + (univ.filter (fun p : c => x ∈ A₂ p.val ∧ y ∈ A₂ p.val)).card ≤ J := by + let u := univ.filter (fun p : c => x ∈ A₂ p.val ∧ y ∈ A₂ p.val) + calc + u.card=(u.image Subtype.val).card := (card_image_of_injective _ Subtype.val_injective).symm + _ ≤ (univ.filter (fun p => x ∈ A₂ p ∧ y ∈ A₂ p)).card := by + apply card_le_card + intro p hp + obtain ⟨q,hq,rfl⟩ := mem_image.mp hp + exact mem_filter.mpr ⟨mem_univ _,(mem_filter.mp hq).2⟩ + _ ≤ J := hcap x y hxy + obtain ⟨root,g,u,hcard,hroot,horder⟩ := reroot_reverse hG₁ hG₂ + (fun p : c => g₁ p.val) (fun p : c => g₂ p.val) (fun p => hA₂ p.val) hre' J hcap' + let t := u.image Subtype.val + have htc : t ⊆ c := image_subset_iff.mpr (fun p _ => p.property) + let e : t→c := fun p => ⟨p.val,htc p.property⟩ + have heu (p : t) : e p ∈ u := by + obtain ⟨q,hq,he⟩ := mem_image.mp p.property + have heq : e p=q := Subtype.ext he.symm + simpa only [heq] using hq + have htcard : t.card=u.card := card_image_of_injective _ Subtype.val_injective + refine ⟨t,root,(fun p => g (e p)),(fun p => (g₁ p.val).path.length),?_,?_,?_⟩ + · rw [htcard] + exact hc.trans (by simpa using hcard) + · right + obtain ⟨p,hp⟩ := hroot + exact ⟨p.val,hp⟩ + · intro p q h + rcases h with h|h + · exact ancestor_length_lt hG₁ root₁ _ _ (fun p : t => (g₁ p.val).simple) h + · exact horder (e p) (heu p) (e q) (heu q) h + +end +end OrdinaryCorrelations.Rerooting + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoTermBinomial.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoTermBinomial.lean new file mode 100644 index 0000000000000000000000000000000000000000..dfaae6e1bb50c87ea013132ca046cf6696469624 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoTermBinomial.lean @@ -0,0 +1,164 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.MemSupport + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.SourceCylinder +variable {ι : Type*} [Fintype ι] {Ω : ι → Type*} [∀ p, Fintype (Ω p)] +local instance twoTermBinomialDecidableEqIndex : DecidableEq ι := Classical.decEq _ +local instance twoTermBinomialDecidableEqIntersection (E : Finset (Cylinder Ω)) : + DecidableEq (Intersection E) := Classical.decEq _ +local instance twoTermBinomialDecidableLEIntersection (E : Finset (Cylinder Ω)) : + DecidableLE (Intersection E) := Classical.decRel _ +local instance twoTermBinomialDecidableLTIntersection (E : Finset (Cylinder Ω)) : + DecidableLT (Intersection E) := Classical.decRel _ +local instance twoTermBinomialLocallyFiniteOrderIntersection (E : Finset (Cylinder Ω)) : + LocallyFiniteOrder (Intersection E) := + Fintype.toLocallyFiniteOrder + +lemma two_term_binomial (a k : ℕ) : + a ^ (k + 1) + (k + 1) * a ^ k ≤ (a + 1) ^ (k + 1) := by + induction k with + | zero => simp + | succ k ih => + have h := Nat.mul_le_mul_right (a + 1) ih + simp only [pow_succ] at h ⊢ + calc + a ^ k * a * a + (k+1+1) * (a^k*a) + ≤ a ^ k * a * a + (k+1+1) * (a^k*a) + (k+1)*a^k := Nat.le_add_right _ _ + _ = (a^k*a + (k+1)*a^k)*(a+1) := by ring + _ ≤ (a+1)^k*(a+1)*(a+1) := h + +lemma double_power_le (n : ℕ) : 2 * n ^ (n+1) ≤ (n+1) ^ (n+1) := by + have h := two_term_binomial n n + have h' : 2 * n ^ (n+1) ≤ n ^ (n+1) + (n+1) * n ^ n := by + rw [pow_succ] + calc + 2*(n^n*n) ≤ 2*(n^n*n)+n^n := Nat.le_add_right _ _ + _ = n^n*n+(n+1)*n^n := by ring + exact h'.trans h + +lemma factorial_power_bound (m : ℕ) (hm : 2 ≤ m) : + 2 ^ m * m.factorial ≤ m ^ (m+1) := by + induction m with + | zero => omega + | succ n ih => + by_cases hn : 2 ≤ n + · calc + 2 ^ (n+1) * (n+1).factorial = (n+1) * (2 * (2^n * n.factorial)) := by + rw [pow_succ, Nat.factorial_succ]; ring + _ ≤ (n+1) * (2 * n ^ (n+1)) := Nat.mul_le_mul_left _ (Nat.mul_le_mul_left _ (ih hn)) + _ ≤ (n+1) * (n+1) ^ (n+1) := Nat.mul_le_mul_left _ (double_power_le n) + _ = (n+1) ^ (n+1+1) := by rw [pow_succ]; ring + · have : n = 1 := by omega + subst n + decide + +lemma geometric_two_bound (m : ℕ) : (∑ k ∈ Finset.range m, 2^k) ≤ 2^m := by + induction m with + | zero => simp + | succ m ih => rw [Finset.sum_range_succ, pow_succ]; omega + +lemma choose_factorial_le {m k : ℕ} (hk : k ≤ m) : + m.choose k * k.factorial ≤ m.factorial := by + have h := Nat.choose_mul_factorial_mul_factorial hk + calc + m.choose k * k.factorial ≤ (m.choose k * k.factorial) * (m-k).factorial := by + exact Nat.le_mul_of_pos_right _ (Nat.factorial_pos _) + _ = m.factorial := h + +omit [Fintype ι] in +lemma proper_subset_factorial_sum (U : Finset ι) : + (∑ S ∈ U.powerset with S.card < U.card, 2 ^ S.card * S.card.factorial) ≤ + 2 ^ U.card * U.card.factorial := by + classical + rw [Finset.sum_filter] + rw [Finset.sum_powerset] + have hlevel (k : ℕ) : + (∑ S ∈ U.powersetCard k, + if S.card < U.card then 2 ^ S.card * S.card.factorial else 0) = + U.card.choose k * (if k < U.card then 2 ^ k * k.factorial else 0) := by + simpa [nsmul_eq_mul] using + (Finset.sum_powersetCard k U (fun k => if k < U.card then 2 ^ k * k.factorial else 0)) + simp_rw [hlevel] + rw [Finset.sum_range_succ] + simp only [lt_self_iff_false, ↓reduceIte, mul_zero, add_zero] + calc + (∑ k ∈ Finset.range U.card, + U.card.choose k * (if k < U.card then 2 ^ k * k.factorial else 0)) + ≤ ∑ k ∈ Finset.range U.card, 2 ^ k * U.card.factorial := by + apply Finset.sum_le_sum + intro k hk + have hk' := Finset.mem_range.mp hk + simp only [hk', ↓reduceIte] + calc + U.card.choose k * (2 ^ k * k.factorial) = 2 ^ k * (U.card.choose k * k.factorial) := by ring + _ ≤ 2 ^ k * U.card.factorial := Nat.mul_le_mul_left _ (choose_factorial_le hk'.le) + _ = (∑ k ∈ Finset.range U.card, 2 ^ k) * U.card.factorial := by rw [Finset.sum_mul] + _ ≤ 2 ^ U.card * U.card.factorial := Nat.mul_le_mul_right _ (geometric_two_bound _) + +omit [∀ p, Fintype (Ω p)] in +lemma intersection_support_inj (E : Finset (Cylinder Ω)) (I : Intersection E) : + Set.InjOn (fun J : Intersection E => J.val.support) {J | J ≤ I} := by + intro J hJ K hK heq + exact Subtype.ext (Cylinder.eq_of_support_eq hJ hK heq) + +lemma coefficient_crude (E : Finset (Cylinder Ω)) (I : Intersection E) : + (coefficient E I).natAbs ≤ 2 ^ I.val.support.card * I.val.support.card.factorial := by + classical + have aux : ∀ m, ∀ I : Intersection E, I.val.support.card = m → + (coefficient E I).natAbs ≤ 2 ^ m * m.factorial := by + intro m + induction m using Nat.strong_induction_on with + | h m ih => + intro I hcard + by_cases hI : I = ⊥ + · subst I + simp [coefficient, IncidenceAlgebra.mu_self, show (⊥ : Intersection E).val = ⊥ from rfl] at hcard ⊢ + subst m + simp + · have hmu : coefficient E I = -∑ J ∈ Finset.Ico ⊥ I, coefficient E J := by + exact IncidenceAlgebra.mu_eq_neg_sum_Ico_of_ne (Ne.symm hI) + rw [hmu, Int.natAbs_neg] + calc + (∑ J ∈ Finset.Ico ⊥ I, coefficient E J).natAbs + ≤ ∑ J ∈ Finset.Ico ⊥ I, (coefficient E J).natAbs := Int.natAbs_sum_le _ _ + _ ≤ ∑ J ∈ Finset.Ico ⊥ I, 2 ^ J.val.support.card * J.val.support.card.factorial := by + apply Finset.sum_le_sum + intro J hJ + have hjlt : J.val.support.card < m := by + rw [← hcard] + exact Finset.card_lt_card (Cylinder.support_ssubset (Finset.mem_Ico.mp hJ).2) + exact ih _ hjlt J rfl + _ = ∑ S ∈ (Finset.Ico ⊥ I).image (fun J : Intersection E => J.val.support), + 2 ^ S.card * S.card.factorial := by + symm + apply Finset.sum_image + intro J hJ K hK hJK + exact intersection_support_inj E I (Finset.mem_Ico.mp hJ).2.le + (Finset.mem_Ico.mp hK).2.le hJK + _ ≤ ∑ S ∈ I.val.support.powerset with S.card < I.val.support.card, + 2 ^ S.card * S.card.factorial := by + apply Finset.sum_le_sum_of_subset_of_nonneg + · intro S hS + obtain ⟨J,hJ,rfl⟩ := Finset.mem_image.mp hS + have hlt := (Finset.mem_Ico.mp hJ).2 + exact Finset.mem_filter.mpr ⟨Finset.mem_powerset.mpr (Cylinder.support_mono hlt.le), + Finset.card_lt_card (Cylinder.support_ssubset hlt)⟩ + · intros; omega + _ ≤ 2 ^ I.val.support.card * I.val.support.card.factorial := proper_subset_factorial_sum _ + _ = 2 ^ m * m.factorial := by rw [hcard] + exact aux _ I rfl + +end OrdinaryCorrelations.SourceCylinder + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UncutTreeEdges.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UncutTreeEdges.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec4d2a904e6775c9e67240f1def48773232adaa5 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UncutTreeEdges.lean @@ -0,0 +1,163 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.NumericalLine +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.NoFixedQualifyingPath + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace Finset Classical +noncomputable section +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +def uncutTreeEdges (w : ClosedLine h ℓ) (a : S.FixedResidues w) : Finset (Fin ℓ) := + w.treeSteps.filter (fun e => ∀ p : S.FixedIndex w, (p.val:ℕ) ∣ w.label e → + a p+(w.offset e.castSucc : ZMod (p.val:ℕ))=0) + +structure TreePath (w : NumericalLine D h ℓ) (L : ℕ) where + length : ℕ + length_pos : 0 < length + length_le : length ≤ L + vertex : Fin (length+1) → ℤ + distinct : Function.Injective vertex + vertex_mem : ∀ i, ∃ j, vertex i=w.line.offset j + edge : Fin length → Fin ℓ + tree : ∀ i, edge i ∈ w.line.treeSteps + forward : Fin length → Bool + endpoints : ∀ i, if forward i then + vertex i.castSucc=w.line.offset (edge i).castSucc ∧ vertex i.succ=w.line.offset (edge i).succ + else vertex i.castSucc=w.line.offset (edge i).succ ∧ vertex i.succ=w.line.offset (edge i).castSucc + +namespace TreePath +variable {w : NumericalLine D h ℓ} + +def pathSign (P : TreePath w L) (i : Fin P.length) : ℤ := + if P.forward i then w.line.sign (P.edge i) else -w.line.sign (P.edge i) + +lemma pathSign_mem (P : TreePath w L) (i : Fin P.length) : + P.pathSign i = -1 ∨ P.pathSign i = 1 := by + rcases w.line.sign_mem (P.edge i) with hs | hs <;> + cases hf : P.forward i <;> simp [pathSign,hf,hs] + +lemma path_step (P : TreePath w L) (i : Fin P.length) : + P.vertex i.succ-P.vertex i.castSucc = P.pathSign i*h*w.line.label (P.edge i) := by + have he := P.endpoints i + have hs := w.line.step (P.edge i) + cases hf : P.forward i <;> simp only [hf,Bool.false_eq_true,ite_false,ite_true] at he + · rw [he.1,he.2] + simp only [pathSign,hf,Bool.false_eq_true,ite_false] + linear_combination -hs + · rw [he.1,he.2] + simpa only [pathSign,hf,ite_true] using hs + +lemma vertex_residue_eq (P : TreePath w L) (p : S.Index) (i : Fin P.length) + (hd : (p:ℕ) ∣ w.line.label (P.edge i)) : + (P.vertex i.succ : ZMod (p:ℕ))=(P.vertex i.castSucc : ZMod (p:ℕ)) := by + have he := P.endpoints i + have hs := w.line.label_residue_eq (P.edge i) hd + cases hf : P.forward i <;> simp only [hf,Bool.false_eq_true,ite_false,ite_true] at he + · rw [he.1,he.2]; exact hs.symm + · rw [he.1,he.2]; exact hs + +lemma departure_lit (P : TreePath w L) (a : S.FixedResidues w.line) + (hu : ∀ i, P.edge i ∈ uncutTreeEdges w.line a) (p : S.FixedIndex w.line) + (i : Fin P.length) (hd : (p.val:ℕ) ∣ w.line.label (P.edge i)) : + a p+(P.vertex i.castSucc : ZMod (p.val:ℕ))=0 := by + have hl := (mem_filter.mp (hu i)).2 p hd + have he := P.endpoints i + cases hf : P.forward i <;> simp only [hf,Bool.false_eq_true,ite_false,ite_true] at he + · rw [he.1,w.line.label_residue_eq (P.edge i) hd]; exact hl + · rw [he.1]; exact hl + +def IsGap (P : TreePath w L) (a : S.FixedResidues w.line) (p : S.FixedIndex w.line) : Prop := + 1 (p:ℝ)⁻¹)) + unfold unlitPrefactor lineMassBound + rw [hHid,←Nat.cast_mul] + change A^N*((ℓ:ℝ)+2)^N*(2^ℓ*((N:ℝ)+1)*((N:ℝ)+1)^N*H^N) ≤ _ + calc + _ ≤ Q^N*Q^N*(Q^ℓ*Q*Q^N*Q^N) := by gcongr + _ = Q^(4*N+ℓ+1) := by simp only [pow_add,pow_mul,pow_one]; ring + _ ≤ _ := pow_le_pow_right₀ (by linarith) + (by unfold witnessEntropyDegree; omega) + +lemma source_unlit_prefactor_small (C₀ : ℝ) (hC₀ : 0 ≤ C₀) : + ∀ᶠ B : ℝ in atTop, + unlitPrefactor (sourceSystem B) (sourceLength B) ⌈C₀*Real.log B⌉₊ ≤ + Real.exp (B^(1+epsilon/2)) := by + have hlim := (isLittleO_log_rpow_atTop (by norm_num [epsilon] : 0 < epsilon/4)).tendsto_div_nhds_zero + filter_upwards [source_witness_entropy_scales C₀ hC₀, + hlim.eventually (eventually_le_nhds (by norm_num : (0:ℝ)<1/2)), + eventually_ge_atTop (1:ℝ)] with B hs hlog hB + have hB0 : 0 < B := zero_lt_one.trans_le hB + have hbase0 : 0 ≤ witnessEntropyBase (sourceSystem B) (sourceListSlotBudget C₀ B) + (sourceLength B) (pathLength B) ⌈C₀*Real.log B⌉₊ (listCutoff B) := by + unfold witnessEntropyBase + have := A_pos + positivity + apply (unlit_polynomial_bound (sourceSystem B) (sourceListSlotBudget C₀ B) + (sourceLength B) (pathLength B) ⌈C₀*Real.log B⌉₊ (listCutoff B)).trans + apply (pow_le_pow_left₀ hbase0 hs.2 _).trans + rw [←Real.rpow_natCast,Real.rpow_def_of_pos (sq_pos_of_pos hB0),Real.log_pow] + apply Real.exp_le_exp.mpr + have hlog0 := Real.log_nonneg hB + have hl := (div_le_iff₀ (Real.rpow_pos_of_pos hB0 (epsilon/4))).mp hlog + have hd := mul_le_mul hs.1 hl hlog0 (Real.rpow_nonneg hB0.le _) + have hid : B^(1+epsilon/4)*((1/2)*B^(epsilon/4)) = (1/2)*B^(1+epsilon/2) := by + rw [mul_left_comm,←Real.rpow_add hB0] + congr 2 + ring + rw [hid] at hd + norm_num only [Nat.cast_ofNat] at * + nlinarith + +theorem source_unlit_tail_small (h : ℕ) (τ T C₀ : ℝ) (hC₀ : 0 ≤ C₀) : + ∀ᶠ B : ℝ in atTop, ∀ (D : (sourceSystem B).DivisorFamily B τ C₀) + (cut : (sourceSystem B).Cutoffs T), + unlitTailSum D h (sourceLength B) (pathLength B) cut (listCutoff B) ≤ + Real.exp (-B^(1+epsilon/2)) := by + filter_upwards [source_unlit_prefactor_small C₀ hC₀, + eventually_const_mul_rpow_le (1+epsilon/2) (1+3*epsilon) 4 (by norm_num [epsilon]), + eventually_ge_atTop (1:ℝ)] with B hpref hdom hB + intro D cut + have hB0 : 0 < B := zero_lt_one.trans_le hB + let z := Real.exp ((1/2)*B^(1-epsilon)) + have hz : 1 ≤ z := Real.one_le_exp (by positivity) + have hzp : ∀ p : (sourceSystem B).Index, z^2 ≤ (p:ℝ) := by + intro p + have he : z^2=sourceMinPrime B := by + dsimp [z,sourceMinPrime] + rw [←Real.exp_nat_mul] + congr 1 + ring + rw [he] + exact (source_prime_lower B hB p).le + have hh := unlit_tail_sum_bound (h:=h) (ℓ:=sourceLength B) (L:=pathLength B) D cut z hz hzp (listCutoff B) + have hzt : 0 < z^(listCutoff B) := pow_pos (Real.exp_pos _) _ + have ht : B^(4*epsilon) ≤ (listCutoff B:ℝ) := Nat.le_ceil _ + have hs : (1/2)*B^(1+3*epsilon) ≤ (listCutoff B:ℝ)*((1/2)*B^(1-epsilon)) := by + have hm := mul_le_mul_of_nonneg_right ht (show 0 ≤ (1/2)*B^(1-epsilon) by positivity) + have he : B^(4*epsilon)*((1/2)*B^(1-epsilon))=(1/2)*B^(1+3*epsilon) := by + rw [mul_left_comm,←Real.rpow_add hB0] + congr 2 + ring + rwa [he] at hm + apply (le_div_iff₀ hzt).mpr (hh.trans hpref) |>.trans + change Real.exp (B^(1+epsilon/2))/(Real.exp ((1/2)*B^(1-epsilon)))^(listCutoff B) ≤ _ + rw [←Real.exp_nat_mul,←Real.exp_sub] + apply Real.exp_le_exp.mpr + nlinarith + +end NumericalLine +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Unselected.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Unselected.lean new file mode 100644 index 0000000000000000000000000000000000000000..340434b092ba35d58f9bcecdaa6151089414bbfa --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Unselected.lean @@ -0,0 +1,92 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.PivotSummation +open Finset Classical +variable {σ P : Type*} {n : ℕ} + +abbrev Unselected (sel : Fin n → σ) := {s : σ // s ∉ Set.range sel} + +def splitSlots (sel : Fin n → σ) (hinj : Function.Injective sel) : + (σ → P) ≃ (Fin n → P) × (Unselected sel → P) := + (Equiv.piEquivPiSubtypeProd (fun s => s ∈ Set.range sel) (fun _ => P)).trans + (Equiv.prodCongr (Equiv.arrowCongr (Equiv.ofInjective sel hinj).symm (Equiv.refl P)) (Equiv.refl _)) + +lemma splitSlots_first (sel : Fin n → σ) (hinj : Function.Injective sel) (x : σ → P) (i : Fin n) : + (splitSlots sel hinj x).1 i = x (sel i) := rfl + +lemma splitSlots_second (sel : Fin n → σ) (hinj : Function.Injective sel) (x : σ → P) (s : Unselected sel) : + (splitSlots sel hinj x).2 s = x s.val := rfl + +def mergeSlots (sel : Fin n → σ) (hinj : Function.Injective sel) + (y : Fin n → P) (z : Unselected sel → P) : σ → P := (splitSlots sel hinj).symm (y,z) + +lemma mergeSlots_selected (sel : Fin n → σ) (hinj : Function.Injective sel) + (y : Fin n → P) (z : Unselected sel → P) (i : Fin n) : + mergeSlots sel hinj y z (sel i)=y i := by + have he := congrArg (fun x : (Fin n → P) × (Unselected sel → P) => x.1 i) + ((splitSlots sel hinj).apply_symm_apply (y,z)) + exact he + +lemma mergeSlots_unselected (sel : Fin n → σ) (hinj : Function.Injective sel) + (y : Fin n → P) (z : Unselected sel → P) (s : Unselected sel) : + mergeSlots sel hinj y z s.val=z s := by + have he := congrArg (fun x : (Fin n → P) × (Unselected sel → P) => x.2 s) + ((splitSlots sel hinj).apply_symm_apply (y,z)) + exact he + +variable [Fintype σ] [Fintype P] + +lemma prod_slots (sel : Fin n → σ) (hinj : Function.Injective sel) (f : σ → ℝ) : + (∏ s, f s) = (∏ i, f (sel i)) * ∏ s : Unselected sel, f s.val := by + rw [← Fintype.prod_subtype_mul_prod_subtype (fun s => s ∈ Set.range sel) f] + congr 1 + convert (Equiv.prod_comp (Equiv.ofInjective sel hinj) (fun s => f s.val)).symm using 1 + · congr 1 + ext x + simp + · rfl + +lemma sum_slots (sel : Fin n → σ) (hinj : Function.Injective sel) (F : (σ → P) → ℝ) : + (∑ x, F x) = ∑ z : Unselected sel → P, ∑ y : Fin n → P, F (mergeSlots sel hinj y z) := by + rw [← Equiv.sum_comp (splitSlots sel hinj).symm F,Fintype.sum_prod_type,sum_comm] + rfl + +theorem slots_weighted_bound (sel : Fin n → σ) (hinj : Function.Injective sel) + (W : σ → P → ℝ) (hW : ∀ s p, 0 ≤ W s p) (A : (σ → P) → ℝ) + (K : ℝ) (hinner : ∀ z : Unselected sel → P, + (∑ y : Fin n → P, A (mergeSlots sel hinj y z) * ∏ i, W (sel i) (y i)) ≤ K) : + (∑ x : σ → P, A x * ∏ s, W s (x s)) ≤ + K * ∏ s : Unselected sel, ∑ p : P, W s.val p := by + rw [sum_slots sel hinj] + have he : ∀ z : Unselected sel → P, + (∑ y : Fin n → P, A (mergeSlots sel hinj y z) * ∏ s, W s (mergeSlots sel hinj y z s)) = + (∑ y : Fin n → P, A (mergeSlots sel hinj y z) * ∏ i, W (sel i) (y i)) * + ∏ s : Unselected sel, W s.val (z s) := by + intro z + rw [sum_mul] + apply sum_congr rfl + intro y hy + rw [prod_slots sel hinj] + simp only [mergeSlots_selected,mergeSlots_unselected,mul_assoc] + simp_rw [he] + calc + _ ≤ ∑ z : Unselected sel → P, K * ∏ s : Unselected sel, W s.val (z s) := by + apply sum_le_sum + intro z hz + exact mul_le_mul_of_nonneg_right (hinner z) (prod_nonneg (fun s _ => hW _ _)) + _ = _ := by rw [← mul_sum,← Fintype.prod_sum (fun s : Unselected sel => W s.val)] + +end OrdinaryCorrelations.PivotSummation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UnselectedCard.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UnselectedCard.lean new file mode 100644 index 0000000000000000000000000000000000000000..fd3feb2077d54da3f33264369d845a6e18f3dad9 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UnselectedCard.lean @@ -0,0 +1,24 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CoordinateEquiv + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.ArithmeticSaving +open Finset Classical +lemma unselected_card {ι : Type*} [Fintype ι] [DecidableEq ι] {k : ℕ} (e : Fin k ↪ ι) : + Fintype.card (Unselected e) = Fintype.card ι-k := by + have he := Fintype.card_congr (coordinateEquiv e) + simp only [Fintype.card_sum,Fintype.card_fin] at he + omega +end OrdinaryCorrelations.ArithmeticSaving + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedEdgeCode.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedEdgeCode.lean new file mode 100644 index 0000000000000000000000000000000000000000..55ca642e1872d05e12a03158a5a1febca485b9b1 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedEdgeCode.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ModifiedWeightSameBand +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TopologyTreeSteps +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.VertexIndex + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtrees +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +def untaggedEdgeCode (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (a : S.FixedResidues w) (p : S.Index) : + Option (Bool × Finset (Fin ℓ)) := + (untaggedType w hh 𝔏 a p).map (fun t => (t.1,t.2.edges.val)) + +lemma tokens_eq_of_codes (w v : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (𝔐 : List (AttachedSpec v D L)) + (a : S.FixedResidues w) (b : S.FixedResidues v) (p : S.Index) + (hT : taggedTokens w hh 𝔏 (recordAt w hh 𝔏 a) p = taggedTokens v hh 𝔐 (recordAt v hh 𝔐 b) p) + (hU : untaggedEdgeCode w hh 𝔏 a p = untaggedEdgeCode v hh 𝔐 b p) : + recordTokens w hh 𝔏 (recordAt w hh 𝔏 a) p = recordTokens v hh 𝔐 (recordAt v hh 𝔐 b) p := by + rcases he : untaggedType w hh 𝔏 a p with _ | t <;> + rcases hf : untaggedType v hh 𝔐 b p with _ | u + · rw [← taggedTokens_of_none w hh 𝔏 a p he,← taggedTokens_of_none v hh 𝔐 b p hf] + exact hT + · simp only [untaggedEdgeCode,he,hf,Option.map_none,Option.map_some] at hU + contradiction + · simp only [untaggedEdgeCode,he,hf,Option.map_none,Option.map_some] at hU + contradiction + · simp only [untaggedEdgeCode,he,hf,Option.map_some] at hU + have hE : t.2.edges.val = u.2.edges.val := congrArg Prod.snd (Option.some.inj hU) + rw [(untaggedType_some w hh 𝔏 a p t he).2,(untaggedType_some v hh 𝔐 b p u hf).2,hE] + +theorem line_eq_of_record_codes (w v : ClosedLine h ℓ) (hh : 0 < h) + (hw : ∀ i, w.label i ∈ D.members) (hv : ∀ i, v.label i ∈ D.members) + (r : ℕ) (hwr : (returnSteps w).card=r) (hvr : (returnSteps v).card=r) + (ht : encodeTopology w r hwr=encodeTopology v r hvr) + (𝔏 : List (AttachedSpec w D L)) (𝔐 : List (AttachedSpec v D L)) + (a : S.FixedResidues w) (b : S.FixedResidues v) + (hT : ∀ p, taggedTokens w hh 𝔏 (recordAt w hh 𝔏 a) p = taggedTokens v hh 𝔐 (recordAt v hh 𝔐 b) p) + (hU : untaggedEdgeCode w hh 𝔏 a = untaggedEdgeCode v hh 𝔐 b) : w=v := by + apply topology_tree_labels_injective w v hh r hwr hvr ht + intro e he + have hev : e ∈ v.treeSteps := topology_treeSteps hwr hvr ht ▸ he + rw [← recordTokens_recover_label w hh 𝔏 a hw e he, + ← recordTokens_recover_label v hh 𝔐 b hv e hev] + apply Finset.prod_congr rfl + intro p hp + rw [tokens_eq_of_codes w v hh 𝔏 𝔐 a b p (hT p) (congrFun hU p)] + +def untaggedReference {w v : ClosedLine h ℓ} (H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) : S.Index → Option (TokenType w) := + fun p => (untaggedType v hh 𝔏 a p).map (fun t => (t.1,H.shapeMap t.2)) + +lemma untaggedReference_edges {w v : ClosedLine h ℓ} (H : SameGeometry v w) (hh : 0 < h) + (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) (p : S.Index) : + (untaggedReference H hh 𝔏 a p).map (fun t => (t.1,t.2.edges.val)) = + untaggedEdgeCode v hh 𝔏 a p := by + simp only [untaggedReference,untaggedEdgeCode,Option.map_map] + rfl + +lemma tokenWeight_reference {w v : ClosedLine h ℓ} (H : SameGeometry v w) + (pC pZ : S.Index) (t : TokenType v) : + tokenWeight v pC pZ t = tokenWeight w pC pZ (t.1,H.shapeMap t.2) := by + unfold tokenWeight + exact H.modifiedWeight _ _ + +lemma untaggedReference_injective {w v : ClosedLine h ℓ} (H : SameGeometry v w) : + Function.Injective (fun t : TokenType v => (t.1,H.shapeMap t.2)) := by + intro t u he + apply Prod.ext + · exact congrArg (fun z : TokenType w => z.1) he + · exact H.shapeEquiv.injective (congrArg Prod.snd he) + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedReferenceWeight.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedReferenceWeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..932debbe70c2be72d601cda7d43bd1cdfb9534da --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedReferenceWeight.lean @@ -0,0 +1,104 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SlotWeight +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.RecordPacket +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ExceptionalCodeSlot +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FlatCode + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtrees +open OrdinaryCorrelations.TaggedPrimeGroups +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +lemma untagged_reference_weight {v w : ClosedLine h ℓ} (H : SameGeometry v w) + (hh : 0 < h) (𝔏 : List (AttachedSpec v D L)) (a : S.FixedResidues v) + (pC pZ : S.Index) (_hpC : S.IsCore pC) (_hpZ : ¬S.IsCore pZ) : + (∏ p : S.Index, TypeFibers.factor (untaggedReference H hh 𝔏 a) + (fun t p => tokenWeight w pC pZ t * slotWeight S (t.1=true) p) p) = + FactorialAssignments.unorderedWeight (TypeFibers.multiplicity (untaggedType v hh 𝔏 a)) + (fun t (p : S.Index) => tokenWeight v pC pZ t * (p:ℝ)⁻¹) + (TypeFibers.unordered (untaggedType v hh 𝔏 a)) := by + rw [TypeFibers.unorderedWeight_eq] + apply prod_congr rfl + intro p hp + rcases he : untaggedType v hh 𝔏 a p with _ | t + · simp only [TypeFibers.factor,untaggedReference,he,Option.map_none] + · have ht := (untaggedType_some v hh 𝔏 a p t he).1 + simp only [TypeFibers.factor,untaggedReference,he,Option.map_some,slotWeight,ht,ite_true] + rw [← tokenWeight_reference H] + +namespace RecordPacket +variable {w₀ : ClosedLine h ℓ} {hh : 0 < h} {r : ℕ} +variable {hr₀ : (returnSteps w₀).card=r} {n N : ℕ} + +noncomputable instance fintype : Fintype (RecordPacket D L w₀ hh r hr₀ n N) := Fintype.ofFinite _ + +noncomputable def exceptionalWeight (c : FlatCode S w₀ C₀ B L n N) : ℝ := + weight (paddedGroupWeight (fun p : S.Index => (p:ℝ)⁻¹)) c.2.1 * + ∏ i : Fin N, paddedShapeWeight (fun p s => localTokenWeight w₀ p (taggedShapeCode w₀ s)) + (c.2.1 (exceptionalPick L ⌈C₀*Real.log B⌉₊ n N i)) (c.2.2.1 i) + +noncomputable def flatWeight (pC pZ : S.Index) (c : FlatCode S w₀ C₀ B L n N) : ℝ := + exceptionalWeight c * ∏ p : S.Index, TypeFibers.factor c.2.2.2 + (fun t p => tokenWeight w₀ pC pZ t * slotWeight S (t.1=true) p) p + +noncomputable def nativeWeight (x : RecordPacket D L w₀ hh r hr₀ n N) : ℝ := + ∏ p : S.Index, (if UsedPrime x.line x.primitives p then (p:ℝ)⁻¹ else 1) * + recordTreeWeight x.line hh x.primitives x.record p + +lemma flatWeight_code (pC pZ : S.Index) (hpC : S.IsCore pC) (hpZ : ¬S.IsCore pZ) + (x : RecordPacket D L w₀ hh r hr₀ n N) : flatWeight pC pZ x.flatCode=x.nativeWeight := by + unfold nativeWeight flatWeight exceptionalWeight + rw [← x.realized_residues,record_weight_factorization x.line hh x.primitives x.residues pC pZ hpC hpZ] + rw [exceptionalCode_weight x.geometry hh x.primitives x.residues n N x.length_le x.tagCount] + congr 1 + exact untagged_reference_weight x.geometry hh x.primitives x.residues pC pZ hpC hpZ + +lemma factor_nonneg {P T : Type*} (f : P → Option T) (W : T → P → ℝ) + (hW : ∀ t p, 0 ≤ W t p) (p : P) : 0 ≤ TypeFibers.factor f W p := by + unfold TypeFibers.factor + cases he : f p with + | none => exact zero_le_one + | some t => exact hW t p + +lemma exceptionalWeight_nonneg (c : FlatCode S w₀ C₀ B L n N) : 0 ≤ exceptionalWeight c := by + unfold exceptionalWeight + apply mul_nonneg + · exact weight_nonneg _ (paddedGroupWeight_nonneg _ (fun p => by positivity)) _ + · exact prod_nonneg (fun i _ => paddedShapeWeight_nonneg _ (fun p s => localTokenWeight_nonneg w₀ p _) _ _) + +lemma flatWeight_nonneg (pC pZ : S.Index) (c : FlatCode S w₀ C₀ B L n N) : + 0 ≤ flatWeight pC pZ c := by + exact mul_nonneg (exceptionalWeight_nonneg c) (prod_nonneg (fun p _ => + factor_nonneg _ _ (fun t p => mul_nonneg (tokenWeight_nonneg _ _ _ _) (slotWeight_nonneg _ _ _)) p)) + +theorem native_sum_le_gated_code (pC pZ : S.Index) (hpC : S.IsCore pC) (hpZ : ¬S.IsCore pZ) : + (∑ x : RecordPacket D L w₀ hh r hr₀ n N, x.nativeWeight) ≤ + ∑ c : FlatCode S w₀ C₀ B L n N, if flatGate D.H τ c then flatWeight pC pZ c else 0 := by + let W := fun c : FlatCode S w₀ C₀ B L n N => if flatGate D.H τ c then flatWeight pC pZ c else 0 + have hx (x : RecordPacket D L w₀ hh r hr₀ n N) : W x.flatCode=x.nativeWeight := by + rw [show W x.flatCode=flatWeight pC pZ x.flatCode from ite_eq_left x.flatCode_gate, + flatWeight_code pC pZ hpC hpZ] + simp_rw [← hx] + calc + _ = ∑ c ∈ univ.image flatCode, W c := (sum_image (fun x _ y _ he => flatCode_injective he)).symm + _ ≤ _ := sum_le_sum_of_subset_of_nonneg (subset_univ _) (fun c _ _ => by + unfold W + split_ifs + · exact flatWeight_nonneg pC pZ c + · exact le_rfl) + +end RecordPacket +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UsedPrimeReciprocal.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UsedPrimeReciprocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc91d5a30f670911e42c0f5fa10b53000c0905c3 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UsedPrimeReciprocal.lean @@ -0,0 +1,133 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SourcePolyDivTendsto +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FixedIsTagged + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegration +open Finset Classical Filter +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ} + +def usedPrimeReciprocal (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) : ℝ := + ∏ p : S.Index, if UsedPrime w 𝔏 p then (p : ℝ)⁻¹ else 1 + +lemma usedPrimeReciprocal_nonneg (w : ClosedLine h ℓ) (𝔏 : List (AttachedSpec w D L)) : + 0 ≤ usedPrimeReciprocal w 𝔏 := by + unfold usedPrimeReciprocal + positivity + +def traceIntegrationMajorant (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (R : AssignedRecord S ℓ) (T err : ℝ) : ℝ := + chargeConstant (S := S) w T (recordU w R.1) * + Real.exp (-S.harmonicCore * bandDefect w betaC - S.harmonicCenter * bandDefect w betaZ + + S.harmonicCore * betaC * (Real.exp kappa - 1) * (recordU w R.1).card + err) * + usedPrimeReciprocal w 𝔏 * ∏ p : S.Index, recordTreeWeight w hh 𝔏 R p + +lemma traceIntegrationMajorant_nonneg (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (R : AssignedRecord S ℓ) (T err : ℝ) : + 0 ≤ traceIntegrationMajorant w hh 𝔏 R T err := by + unfold traceIntegrationMajorant chargeConstant + exact mul_nonneg (mul_nonneg (mul_nonneg (Real.exp_pos _).le (Real.exp_pos _).le) + (usedPrimeReciprocal_nonneg w 𝔏)) (prod_nonneg (fun p _ => recordTreeWeight_nonneg w hh 𝔏 R p)) + +lemma traceIntegrationMajorant_mono (w : ClosedLine h ℓ) (hh : 0 < h) + (𝔏 : List (AttachedSpec w D L)) (R : AssignedRecord S ℓ) (T : ℝ) {e₁ e₂ : ℝ} + (he : e₁ ≤ e₂) : + traceIntegrationMajorant w hh 𝔏 R T e₁ ≤ traceIntegrationMajorant w hh 𝔏 R T e₂ := by + unfold traceIntegrationMajorant + apply mul_le_mul_of_nonneg_right _ (prod_nonneg (fun p _ => recordTreeWeight_nonneg w hh 𝔏 R p)) + apply mul_le_mul_of_nonneg_right _ (usedPrimeReciprocal_nonneg w 𝔏) + apply mul_le_mul_of_nonneg_left _ (Real.exp_pos _).le + apply Real.exp_le_exp.mpr + linarith + +theorem trace_integration_finite (w : ClosedLine h ℓ) (hh : 0 < h) + {T : ℝ} (cut : S.Cutoffs T) (𝔏 : List (AttachedSpec w D L)) + (R : AssignedRecord S ℓ) (hlarge : ∀ p : S.Index, 2 * (ℓ+1) ≤ (p : ℕ)) : + assignedKernelIntegral w cut 𝔏 (recordGroup w hh 𝔏 R) ≤ + traceIntegrationMajorant w hh 𝔏 R T (restorationError w 𝔏) := by + by_cases hex : ∃ a, recordGroup w hh 𝔏 R a + · obtain ⟨a,ha⟩ := hex + change recordAt w hh 𝔏 a = R at ha + subst R + have hb := assignedKernelIntegral_restored w hh cut 𝔏 (recordAt w hh 𝔏 a).1 + (recordAt_compatible w hh 𝔏 a) (recordGroup w hh 𝔏 (recordAt w hh 𝔏 a)) + (fun b hb p => recordGroup_edges w hh 𝔏 (recordAt w hh 𝔏 a) b hb p) hlarge + apply hb.trans + have hp : (∏ p : S.Index, tokenPrimeFactor w 𝔏 (recordAt w hh 𝔏 a).1 p) ≤ + usedPrimeReciprocal w 𝔏 * ∏ p : S.Index, recordTreeWeight w hh 𝔏 (recordAt w hh 𝔏 a) p := by + rw [usedPrimeReciprocal, ← prod_mul_distrib] + exact prod_le_prod₀ (fun p _ => tokenPrimeFactor_nonneg w 𝔏 _ p) + (fun p _ => record_tokenPrimeFactor_le w hh 𝔏 a p) + simpa only [traceIntegrationMajorant,chargeConstant,mul_assoc] using + mul_le_mul_of_nonneg_left hp (mul_nonneg (Real.exp_pos _).le (Real.exp_pos _).le) + · have hfalse : ∀ a, ¬recordGroup w hh 𝔏 R a := not_exists.mp hex + have hz : assignedKernelIntegral w cut 𝔏 (recordGroup w hh 𝔏 R) = 0 := by + simp [assignedKernelIntegral,hfalse,avg] + rw [hz] + exact traceIntegrationMajorant_nonneg w hh 𝔏 R T _ + +theorem trace_integration_source (h : ℕ) (hh : 0 < h) (τ C₀ : ℝ) + (hτ : 0 ≤ τ) (hC₀ : 0 ≤ C₀) : + ∀ᶠ B : ℝ in atTop, + ∀ (D : (sourceSystem B).DivisorFamily B τ C₀) + (w : ClosedLine h (sourceLength B)), + (∀ i, w.label i ∈ D.members) → + ∀ {T : ℝ} (cut : (sourceSystem B).Cutoffs T) + (𝔏 : List (AttachedSpec w D (pathLength B))), + 𝔏.length < listCutoff B → + ∀ R : AssignedRecord (sourceSystem B) (sourceLength B), + assignedKernelIntegral w cut 𝔏 (recordGroup w hh 𝔏 R) ≤ + traceIntegrationMajorant w hh 𝔏 R T (sourceErrorBound h τ C₀ B) := by + filter_upwards [source_eventually_large h] with B hB + intro D w hlabels T cut 𝔏 ht R + have he := restorationError_source_bound w 𝔏 hlabels hB.1 hC₀ hτ + (sourceLength_le B (by linarith [hB.1])) (pathLength_le B hB.1) + ((by exact_mod_cast ht.le : (𝔏.length : ℝ) ≤ (listCutoff B : ℝ)).trans (listCutoff_le B hB.1)) + (fun p => (source_prime_lower B hB.1 p).le) + exact (trace_integration_finite w hh cut 𝔏 R (fun p => (hB.2 p).1)).trans + (traceIntegrationMajorant_mono w hh 𝔏 R T he) + +lemma assignedKernelIntegral_mono (w : ClosedLine h ℓ) {T : ℝ} (cut : S.Cutoffs T) + (𝔏 : List (AttachedSpec w D L)) (G H : S.FixedResidues w → Prop) + (hGH : ∀ a, G a → H a) : + assignedKernelIntegral w cut 𝔏 G ≤ assignedKernelIntegral w cut 𝔏 H := by + apply avg_mono + intro a + by_cases hg : G a + · simp only [hg,hGH a hg,ite_true,le_refl] + · simp only [hg,ite_false] + split_ifs + · exact abs_nonneg _ + · exact le_refl _ + +theorem trace_integration_retained (w : ClosedLine h ℓ) (hh : 0 < h) + {T : ℝ} (cut : S.Cutoffs T) (𝔏 : List (AttachedSpec w D L)) + (R : AssignedRecord S ℓ) (retained : S.FixedResidues w → Prop) + (hlarge : ∀ p : S.Index, 2 * (ℓ+1) ≤ (p : ℕ)) : + assignedKernelIntegral w cut 𝔏 (fun a => retained a ∧ recordGroup w hh 𝔏 R a) ≤ + traceIntegrationMajorant w hh 𝔏 R T (restorationError w 𝔏) := + (assignedKernelIntegral_mono w cut 𝔏 _ _ (fun _ ha => ha.2)).trans + (trace_integration_finite w hh cut 𝔏 R hlarge) + +theorem source_active_graph_eventually (h : ℕ) (hh : 0 < h) : + ∀ᶠ B : ℝ in atTop, ∀ (w : ClosedLine h (sourceLength B)) + (p : (sourceSystem B).Index) (a : ZMod (p : ℕ)) (u v : ℤ), + (edgeGraph w hh (litEdges w p a)).Adj u v ↔ + (edgeGraph w hh w.treeSteps).Adj u v ∧ + a + (u : ZMod (p : ℕ)) = 0 ∧ a + (v : ZMod (p : ℕ)) = 0 := by + filter_upwards [source_eventually_large h] with B hB + intro w p a u v + exact active_graph_exact w hh p (Nat.not_dvd_of_pos_of_lt hh (hB.2 p).2) a u v + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexAt.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexAt.lean new file mode 100644 index 0000000000000000000000000000000000000000..d66b4cadad925b5334ee4c3c530aca9b61fbffc0 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexAt.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.DivisorFamily + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem.Specification +open OrdinaryCorrelations.SignedTrace +open Finset Classical +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h L : ℕ} + +def vertexAt (s : S.Specification D h L) (n : ℕ) : ℤ := + if hn : n ≤ s.length then s.offset ⟨n,by omega⟩ else 0 + +def edgeAt (s : S.Specification D h L) (n : ℕ) : ℤ := + if hn : n (s.edgeAt_eq n (by have := mem_Ico.mp hn; omega)).symm) + +lemma mul_coefficient_interval (s : S.Specification D h L) (q a b : ℕ) + (hab : a ≤ b) (hb : b ≤ s.length) + (hq : ∀ n : Fin s.length, a ≤ n.val → n.val + let i : Fin P.length := ⟨0,P.length_pos⟩ + have hp := block_edge_endpoints b (P.edge i) (hPE i) + have he := P.endpoints i + have hi : i.castSucc=(0:Fin (P.length+1)) := rfl + cases hf : P.forward i <;> simp only [hf,Bool.false_eq_true,ite_false,ite_true] at he + · exact by simpa only [hi] using (he.1.symm ▸ hp.2) + · exact by simpa only [hi] using (he.1.symm ▸ hp.1) + | succ i => + have hp := block_edge_endpoints b (P.edge i) (hPE i) + have he := P.endpoints i + cases hf : P.forward i <;> simp only [hf,Bool.false_eq_true,ite_false,ite_true] at he + · exact he.2.symm ▸ hp.1 + · exact he.2.symm ▸ hp.2 + +lemma block_root_paths (b : Block (edgeGraph w.line hh w.line.treeSteps)) + (hsmall : b.walk.length ≤ K) (hne : (blockEdges b).Nonempty) : + ∃ c : Fin (ℓ+1),w.line.offset c ∈ b.walk.support ∧ + ∀ e ∈ blockEdges b,w.line.offset c=w.line.offset e.castSucc ∨ + ∃ P : TreePath w K,P.vertex 0=w.line.offset c ∧ + P.vertex (Fin.last P.length)=w.line.offset e.castSucc ∧ + (∀ i,P.edge i simpa using hu + | @cons u v z ha p ih => + have hv : v ∈ treeVertices w := by + obtain ⟨e,he,hor | hrev⟩ := ha + · rw [hor.2]; exact endpoint_mem_vertices w e + · rw [hrev.1]; exact departure_mem_vertices w e + intro x hx + rcases List.mem_cons.mp hx with rfl | hx + · exact hu + · exact ih hv x hx + +lemma exists_treePath (w : NumericalLine D h ℓ) (hh : 0 p.adj_getVert_succ i.isLt + choose edge he hor using hedge + let vf : Fin (p.length+1) → ℤ := fun i => p.getVert i.val + let forward : Fin p.length → Bool := fun i => decide (p.getVert i.val=w.line.offset (edge i).castSucc) + have endpoints (i : Fin p.length) : if forward i then + vf i.castSucc=w.line.offset (edge i).castSucc ∧ vf i.succ=w.line.offset (edge i).succ + else vf i.castSucc=w.line.offset (edge i).succ ∧ vf i.succ=w.line.offset (edge i).castSucc := by + dsimp [forward,vf] + split_ifs with hi + · have hi' : p.getVert i.val=w.line.offset (edge i).castSucc := of_decide_eq_true hi + rcases hor i with hor | hrev + · exact hor + · exact (w.line.endpoints_ne hh (edge i) (hi'.symm.trans hrev.2)).elim + · rcases hor i with hor | hrev + · exact (hi (decide_eq_true hor.1)).elim + · exact ⟨hrev.2,hrev.1⟩ + let P : TreePath w L := { + length := p.length + length_pos := hp0 + length_le := hpL + vertex := vf + distinct := by + intro i j hij + apply Fin.ext + exact hp.getVert_injOn (Nat.le_of_lt_succ i.isLt) (Nat.le_of_lt_succ j.isLt) hij + vertex_mem := by + intro i + have hi := walk_vertices w.line hh p hu _ (p.getVert_mem_support i.val) + obtain ⟨j,hj,hjv⟩ := mem_image.mp hi + exact ⟨j,hjv.symm⟩ + edge := edge + tree := fun i => hE (he i) + forward := forward + endpoints := endpoints } + exact ⟨P,by simp [P,vf],by simp [P,vf],he⟩ + +end +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Witness.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Witness.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2543d8cd22cfc6032c34487ee873daa691a6e12 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Witness.lean @@ -0,0 +1,110 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.BoundedLists + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.SourceCylinder +open Finset Classical +variable {α ι : Type*} [Fintype α] [Fintype ι] {Ω : ι → Type*} [∀ p, Fintype (Ω p)] + +abbrev Witness (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) := + {I : Intersection (V.image f) // I ∈ witnesses (V.image f) t} + +omit [Fintype α] in +lemma exists_witnessGenerator (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) + (I : Witness V f t) : ∃ l : List α, l.length ≤ t ∧ + (∀ a ∈ l, a ∈ V) ∧ Cylinder.Generates (l.toFinset.image f) I.val.val := by + obtain ⟨A,hA,hcard,hgen⟩ := (mem_filter.mp I.property).2.2 + let rep : A → α := fun e => Classical.choose (mem_image.mp (hA e.property)) + have hv (e : A) : rep e ∈ V := (Classical.choose_spec (mem_image.mp (hA e.property))).1 + have hf (e : A) : f (rep e)=e.val := (Classical.choose_spec (mem_image.mp (hA e.property))).2 + let l : List α := A.attach.toList.map rep + have hlen : l.length = A.card := by simp [l] + have hmem (a : α) (ha : a ∈ l) : a ∈ V := by + obtain ⟨e,he,rfl⟩ := List.mem_map.mp ha + exact hv e + have he : l.toFinset.image f = A := by + ext c + constructor + · intro hc + obtain ⟨a,ha,rfl⟩ := mem_image.mp hc + obtain ⟨e,he,rfl⟩ := List.mem_map.mp (List.mem_toFinset.mp ha) + rw [hf e] + exact e.property + · intro hc + let e : A := ⟨c,hc⟩ + exact mem_image.mpr ⟨rep e,List.mem_toFinset.mpr + (List.mem_map.mpr ⟨e,mem_toList.mpr (mem_attach A e),rfl⟩),hf e⟩ + exact ⟨l,hlen ▸ hcard,hmem,he.symm ▸ hgen⟩ + +noncomputable def witnessGenerator (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) + (I : Witness V f t) : List α := Classical.choose (exists_witnessGenerator V f t I) + +omit [Fintype α] in +lemma witnessGenerator_spec (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) + (I : Witness V f t) : (witnessGenerator V f t I).length ≤ t ∧ + (∀ a ∈ witnessGenerator V f t I, a ∈ V) ∧ + Cylinder.Generates ((witnessGenerator V f t I).toFinset.image f) I.val.val := + Classical.choose_spec (exists_witnessGenerator V f t I) + +omit [Fintype α] in +lemma witnessGenerator_injective (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) : + Function.Injective (witnessGenerator V f t) := by + intro I J he + apply Subtype.ext + apply Subtype.ext + exact Cylinder.generates_unique (witnessGenerator_spec V f t I).2.2 + (by simpa only [he] using (witnessGenerator_spec V f t J).2.2) + +omit [Fintype α] in +lemma witnessGenerator_holds (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) + (I : Witness V f t) (x : ∀ p, Ω p) (hx : I.val.val.Holds x) : + ∀ a ∈ witnessGenerator V f t I, a ∈ V ∧ (f a).Holds x := by + intro a ha + refine ⟨(witnessGenerator_spec V f t I).2.1 a ha,?_⟩ + apply Cylinder.holds_mono _ hx + exact (witnessGenerator_spec V f t I).2.2.1 (f a) + (mem_image.mpr ⟨a,List.mem_toFinset.mpr ha,rfl⟩) + +omit [Fintype α] in +lemma witnessCount_eq_sum (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) (x : ∀ p, Ω p) : + (witnessCount (V.image f) t x : ℝ) = + ∑ I : Witness V f t, if I.val.val.Holds x then (1:ℝ) else 0 := by + rw [witnessCount,card_eq_sum_ones,Nat.cast_sum] + simp only [Nat.cast_one,sum_filter] + exact sum_subtype (witnesses (V.image f) t) (fun _ => Iff.rfl) + (fun I : Intersection (V.image f) => if I.val.Holds x then (1:ℝ) else 0) + +theorem witnessCount_le_list_sum (V : Finset α) (f : α → Cylinder Ω) (t : ℕ) + (x : ∀ p, Ω p) (F : List α → ℝ) (hF : ∀ l, 0 ≤ F l) + (hI : ∀ I : Witness V f t, I.val.val.Holds x → 1 ≤ F (witnessGenerator V f t I)) : + (witnessCount (V.image f) t x : ℝ) ≤ ∑ l ∈ boundedLists α t, F l := by + rw [witnessCount_eq_sum V f] + calc + _ ≤ ∑ I : Witness V f t, F (witnessGenerator V f t I) := by + apply sum_le_sum + intro I hmem + split_ifs with hx + · exact hI I hx + · exact hF _ + _ ≤ _ := by + rw [← sum_image (fun x _ y _ he => witnessGenerator_injective V f t he)] + apply sum_le_sum_of_subset_of_nonneg + · intro l hl + obtain ⟨I,hI,rfl⟩ := mem_image.mp hl + exact (mem_boundedLists _ _).mpr (witnessGenerator_spec V f t I).1 + · intro l hl hnot + exact hF l + +end OrdinaryCorrelations.SourceCylinder + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessBaseDoublePath.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessBaseDoublePath.lean new file mode 100644 index 0000000000000000000000000000000000000000..ba3123c46266689b5758c982cd983a08152091a0 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessBaseDoublePath.lean @@ -0,0 +1,124 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SourceWitnessBasicScales +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PackedGapPrefactor +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ComponentBoundAfterGap + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegration +open OrdinaryCorrelations.NumericalSubtrees Finset Classical Filter +noncomputable section + +lemma witness_base_double_path (S : PrimeSystem) (M ℓ L J t : ℕ) : + witnessEntropyBase S M ℓ (L+L) J t ≤ 2*witnessEntropyBase S M ℓ L J t := by + unfold witnessEntropyBase witnessSlotCount + rw [WitnessConfiguration.codeSlot_card,WitnessConfiguration.codeSlot_card] + push_cast + have hH : 0 ≤ max 1 (∑ p ∈ S.primes,(p:ℝ)⁻¹) := le_trans (by norm_num) (le_max_left _ _) + have hA := A_pos + have hM := Nat.cast_nonneg (α:=ℝ) M + have hℓ := Nat.cast_nonneg (α:=ℝ) ℓ + have hL := Nat.cast_nonneg (α:=ℝ) L + have hJ := Nat.cast_nonneg (α:=ℝ) J + have ht := Nat.cast_nonneg (α:=ℝ) t + nlinarith +lemma witness_degree_double_path (M ℓ L J t : ℕ) : + witnessEntropyDegree M ℓ (L+L) J t ≤ 2*witnessEntropyDegree M ℓ L J t := by + unfold witnessEntropyDegree witnessSlotCount + rw [WitnessConfiguration.codeSlot_card,WitnessConfiguration.codeSlot_card] + nlinarith + +namespace NumericalLine +lemma source_double_path_prefactor (C₀ : ℝ) (hC₀ : 0≤C₀) : + ∀ᶠ B : ℝ in atTop, + packedGapPrefactor (sourceSystem B) (sourceLength B) (pathLength B+pathLength B) + ⌈C₀*Real.log B⌉₊ (listCutoff B) ≤ Real.exp (B^(1+epsilon/2)) := by + have hlim := (isLittleO_log_rpow_atTop (by norm_num [epsilon] : 0 attachedMetadata x.line (x.family.witness j)) + +noncomputable def primeCode : WitnessCodeSlot ℓ L ⌈C₀*Real.log B⌉₊ t → Option S.Index + | .inl (i,j) => FiniteSlotEncoding.code (labelPrimeSet (x.line.label i) (x.labels i)) ⌈C₀*Real.log B⌉₊ j + | .inr (.inl k) => listPrimeCode x.line x.primitives t k + | .inr (.inr (.inl (j,k))) => specPrimeCode (x.family.witness j).spec k + | .inr (.inr (.inr j)) => some (x.family.key j) + +noncomputable def rawCode := (x.metadata,x.primeCode) + +lemma rawCode_injective : Function.Injective + (rawCode : WitnessConfiguration D h ℓ L t → _) := by + intro x y he + have hm := congrArg Prod.fst he + have hp := congrArg Prod.snd he + have hline : x.line=y.line := by + apply GlobalRecord.line_eq_of_labels_signs + · funext i + have hsets : labelPrimeSet (x.line.label i) (x.labels i)= + labelPrimeSet (y.line.label i) (y.labels i) := by + apply FiniteSlotEncoding.code_injective (m:=⌈C₀*Real.log B⌉₊) + · rw [labelPrimeSet_card]; exact D.omega _ (x.labels i) + · rw [labelPrimeSet_card]; exact D.omega _ (y.labels i) + · funext j + exact congrFun hp (.inl (i,j)) + rw [←labelPrimeSet_product (x.line.label i) (x.labels i), + ←labelPrimeSet_product (y.line.label i) (y.labels i),hsets] + · funext i + have hs : signBit x.line i=signBit y.line i := + congrArg (fun z : WitnessMetadata ℓ L t => z.1 i) hm + rw [signBit_decode x.line i,signBit_decode y.line i,hs] + cases x with + | mk w hw l hl F => + cases y with + | mk v hv m hm' G => + dsimp only at hline + subst v + have hlist : l=m := list_code_injective w l m t hl hm' + (congrArg (fun z : WitnessMetadata ℓ L t => z.2.1) hm) + (funext (fun k => congrFun hp (.inr (.inl k)))) + subst m + have hfamily : F=G := by + apply PrivateFamily.data_injective + apply Prod.ext + · funext j + apply attached_code_injective w + · exact congrArg (fun z : WitnessMetadata ℓ L t => z.2.2 j) hm + · funext k + exact congrFun hp (.inr (.inr (.inl (j,k)))) + · funext j + exact Option.some.inj (congrFun hp (.inr (.inr (.inr j)))) + subst G + rfl + +instance : Finite (WitnessConfiguration D h ℓ L t) := + Finite.of_injective _ rawCode_injective + +noncomputable instance : Fintype (WitnessConfiguration D h ℓ L t) := Fintype.ofFinite _ + +lemma primeCode_support (p : S.Index) : + (∃ k, x.primeCode k=some p) ↔ p ∈ fullUsedIndices x.line (x.primitives++List.ofFn x.family.witness) := by + constructor + · rintro ⟨(⟨i,j⟩ | (k | (⟨j,k⟩ | j))),hp⟩ + · have hm := FiniteSlotEncoding.code_mem _ _ j p hp + exact line_prime_mem_fullUsed x.line _ p ((mem_labelPrimeSet _ _ _).mp hm) + · have hm := (listPrimeCode_support x.line x.primitives t x.length_le p).mpr ⟨k,hp⟩ + obtain ⟨s,hs,hm⟩ := mem_biUnion.mp hm + exact list_prime_mem_fullUsed x.line _ s + (List.mem_append_left _ (List.mem_toFinset.mp hs)) p hm + · exact list_prime_mem_fullUsed x.line _ (x.family.witness j) + (List.mem_append_right _ (List.mem_ofFn.mpr ⟨j,rfl⟩)) p + ((specPrimeCode_support (x.family.witness j).spec p).mpr ⟨k,hp⟩) + · have he : x.family.key j=p := Option.some.inj hp + exact he ▸ list_prime_mem_fullUsed x.line _ (x.family.witness j) + (List.mem_append_right _ (List.mem_ofFn.mpr ⟨j,rfl⟩)) (x.family.key j) (x.family.key_mem j) + · intro hp + rcases (mem_filter.mp hp).2 with ⟨i,hi⟩|hp + · have hc : (labelPrimeSet (x.line.label i) (x.labels i)).card ≤ ⌈C₀*Real.log B⌉₊ := by + rw [labelPrimeSet_card]; exact D.omega _ (x.labels i) + have hm : p ∈ labelPrimeSet (x.line.label i) (x.labels i) := + (mem_labelPrimeSet _ _ _).mpr + (Nat.mem_primeFactors.mpr ⟨S.prime_mem p p.property,hi,(x.line.label_pos i).ne'⟩) + obtain ⟨j,hj⟩ := (FiniteSlotEncoding.mem_iff_code _ _ hc p).mp hm + exact ⟨.inl (i,j),hj⟩ + · obtain ⟨s,hs,hp⟩ := mem_biUnion.mp hp + rcases List.mem_append.mp (List.mem_toFinset.mp hs) with hs|hs + · obtain ⟨k,hk⟩ := (listPrimeCode_support x.line x.primitives t x.length_le p).mp + (mem_biUnion.mpr ⟨s,List.mem_toFinset.mpr hs,hp⟩) + exact ⟨.inr (.inl k),hk⟩ + · obtain ⟨j,rfl⟩ := List.mem_ofFn.mp hs + obtain ⟨k,hk⟩ := (specPrimeCode_support (x.family.witness j).spec p).mp hp + exact ⟨.inr (.inr (.inl (j,k))),hk⟩ + +lemma codeSlot_card (ℓ L J t : ℕ) : + Fintype.card (WitnessCodeSlot ℓ L J t)=ℓ*J+2*t*(L*J+1)+t := by + simp only [WitnessCodeSlot,ListCodeSlot,SpecCodeSlot,Fintype.card_sum,Fintype.card_prod, + Fintype.card_option,Fintype.card_fin] + ring + +lemma metadata_card (ℓ L t : ℕ) : + Fintype.card (WitnessMetadata ℓ L t)= + 2^ℓ*((t+1)*(1+(ℓ+1)*((L+1)^2*2^L))^t)*((ℓ+1)*((L+1)^2*2^L))^t := by + simp only [WitnessMetadata,Fintype.card_prod,Fintype.card_fun,Fintype.card_fin,Fintype.card_bool, + ListMetadata,AttachedMetadata,SpecMetadata,Fintype.card_option] + ring + +end WitnessConfiguration +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessEntropyBase.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessEntropyBase.lean new file mode 100644 index 0000000000000000000000000000000000000000..d604c800b4d620f3a84556e8d83d94add915e2b0 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessEntropyBase.lean @@ -0,0 +1,117 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CylinderBudget +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessSlotCount + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace +open Finset Classical + +noncomputable def witnessEntropyBase (S : PrimeSystem) (M ℓ L J t : ℕ) : ℝ := + 2+A+M+ℓ+L+t+witnessSlotCount ℓ L J t + max 1 (∑ p ∈ S.primes,(p:ℝ)⁻¹) + +noncomputable def witnessEntropyDegree (M ℓ L J t : ℕ) : ℕ := + 2*M+ℓ*J+3*witnessSlotCount ℓ L J t+ℓ+2*t*(L+10)+4 + +lemma add_one_le_pow_succ {Q x : ℝ} {n : ℕ} (hQ : 2 ≤ Q) (hx : x ≤ Q^n) : + x+1 ≤ Q^(n+1) := by + have hpow : 1 ≤ Q^n := one_le_pow₀ (by linarith) + rw [pow_succ] + nlinarith + +lemma witness_polynomial_bound (S : PrimeSystem) (M ℓ L J t : ℕ) : + cylinderBudget M * (A^(ℓ*J)*2^(witnessSlotCount ℓ L J t)) * + (witnessTemplateBudget ℓ L J t:ℝ) * + (max 1 (∑ p ∈ S.primes,(p:ℝ)⁻¹))^(witnessSlotCount ℓ L J t) ≤ + witnessEntropyBase S M ℓ L J t ^ witnessEntropyDegree M ℓ L J t := by + let N := witnessSlotCount ℓ L J t + let H : ℝ := max 1 (∑ p ∈ S.primes,(p:ℝ)⁻¹) + let Q := witnessEntropyBase S M ℓ L J t + have hH : 1 ≤ H := le_max_left _ _ + have hA := A_pos + have hM := Nat.cast_nonneg (α:=ℝ) M + have hℓ := Nat.cast_nonneg (α:=ℝ) ℓ + have hL := Nat.cast_nonneg (α:=ℝ) L + have ht := Nat.cast_nonneg (α:=ℝ) t + have hN := Nat.cast_nonneg (α:=ℝ) N + have hQ : 2 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQA : A ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQM : (M:ℝ) ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQℓ : (ℓ:ℝ)+1 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQL : (L:ℝ)+1 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQt : (t:ℝ)+1 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQN : (N:ℝ)+1 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQH : H ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H,N] at *; linarith + have hQ0 : 0 ≤ Q := by linarith + have hcyl : cylinderBudget M ≤ Q^(2*M+1) := by + unfold cylinderBudget + push_cast + calc + _ ≤ Q^M * Q^(M+1) := by + apply mul_le_mul (pow_le_pow_left₀ (by norm_num) hQ _) _ (by positivity) (pow_nonneg hQ0 _) + apply max_le + · exact one_le_pow₀ (by linarith) + · exact pow_le_pow_left₀ hM hQM _ + _ = _ := by rw [←pow_add]; congr 1; omega + have hcore : ((ℓ:ℝ)+1)*(((L:ℝ)+1)^2*2^L) ≤ Q^(L+3) := by + calc + _ ≤ Q*(Q^2*Q^L) := by gcongr + _ = _ := by rw [show L+3=L+2+1 by omega,pow_succ,pow_add]; ring + have hcore1 : 1+((ℓ:ℝ)+1)*(((L:ℝ)+1)^2*2^L) ≤ Q^(L+4) := by + simpa only [show L+4=(L+3)+1 by omega,add_comm (1:ℝ)] using add_one_le_pow_succ hQ hcore + have hmeta : (Fintype.card (WitnessMetadata ℓ L t):ℝ) ≤ Q^(ℓ+1+2*t*(L+4)) := by + rw [WitnessConfiguration.metadata_card] + push_cast + calc + _ ≤ Q^ℓ*(Q*(Q^(L+4))^t)*(Q^(L+4))^t := by + apply mul_le_mul + · apply mul_le_mul (pow_le_pow_left₀ (by norm_num) hQ _) _ (by positivity) (pow_nonneg hQ0 _) + exact mul_le_mul hQt (pow_le_pow_left₀ (by positivity) hcore1 _) (by positivity) hQ0 + · exact pow_le_pow_left₀ (by positivity) (hcore.trans (pow_le_pow_right₀ (by linarith) (by omega))) _ + · positivity + · positivity + _ = _ := by ring + have hdesc : (Fintype.card (WitnessTestDescriptor ℓ L t N):ℝ) ≤ Q^11 := by + rw [WitnessTemplateCode.descriptor_card] + push_cast + calc + _ ≤ (Q^2*Q*Q^3*Q^2)*Q^2*Q := by + gcongr <;> linarith + _ = _ := by ring + have hdesc1 : (Fintype.card (WitnessTestDescriptor ℓ L t N):ℝ)+1 ≤ Q^12 := + add_one_le_pow_succ hQ hdesc + have hbudget : (witnessTemplateBudget ℓ L J t:ℝ) ≤ + Q^(N+ℓ+2*t*(L+10)+3) := by + unfold witnessTemplateBudget + change (((N+1)*Fintype.card (WitnessMetadata ℓ L t)*(N+1)^N* + ((t+1)*(Fintype.card (WitnessTestDescriptor ℓ L t N)+1)^t):ℕ):ℝ) ≤ _ + push_cast + calc + _ ≤ Q*Q^(ℓ+1+2*t*(L+4))*Q^N*(Q*(Q^12)^t) := by + gcongr + _ = _ := by ring + apply (mul_le_mul (mul_le_mul (mul_le_mul hcyl + (mul_le_mul (pow_le_pow_left₀ hA.le hQA _) (pow_le_pow_left₀ (by norm_num) hQ _) + (by positivity) (pow_nonneg hQ0 _)) (by positivity) (pow_nonneg hQ0 _)) + hbudget (Nat.cast_nonneg _) (by positivity)) + (pow_le_pow_left₀ (zero_le_one.trans hH) hQH _) (by positivity) (by positivity)).trans_eq + unfold witnessEntropyDegree + change Q^(2*M+1)*(Q^(ℓ*J)*Q^N)*Q^(N+ℓ+2*t*(L+10)+3)*Q^N = _ + simp only [←pow_add] + congr 1 + dsimp only [N] + omega + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessSlotCount.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessSlotCount.lean new file mode 100644 index 0000000000000000000000000000000000000000..82669c925196c44c422647fc570265f2fcf9f89c --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessSlotCount.lean @@ -0,0 +1,100 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.UnselectedCard +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessTestDescriptor + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SharedSlotPatterns +open Finset Classical + +noncomputable def witnessSlotCount (ℓ L J t : ℕ) : ℕ := Fintype.card (WitnessCodeSlot ℓ L J t) +noncomputable def witnessTemplateBudget (ℓ L J t : ℕ) : ℕ := + let N := witnessSlotCount ℓ L J t + (N+1)*Fintype.card (WitnessMetadata ℓ L t)*(N+1)^N * + ((t+1)*(Fintype.card (WitnessTestDescriptor ℓ L t N)+1)^t) + +lemma witnessTemplate_card_uniform (ℓ L J t m : ℕ) (hm : m ≤ witnessSlotCount ℓ L J t) : + Fintype.card (WitnessTemplateCode ℓ L J t m) ≤ + Fintype.card (WitnessMetadata ℓ L t)*(witnessSlotCount ℓ L J t+1)^(witnessSlotCount ℓ L J t)* + ((t+1)*(Fintype.card (WitnessTestDescriptor ℓ L t (witnessSlotCount ℓ L J t))+1)^t) := by + apply (WitnessTemplateCode.card_le ℓ L J t m).trans + have hc : Fintype.card (WitnessTestDescriptor ℓ L t m) ≤ + Fintype.card (WitnessTestDescriptor ℓ L t (witnessSlotCount ℓ L J t)) := by + rw [WitnessTemplateCode.descriptor_card,WitnessTemplateCode.descriptor_card] + gcongr + change _ ≤ Fintype.card (WitnessMetadata ℓ L t)* + (witnessSlotCount ℓ L J t+1)^(Fintype.card (WitnessCodeSlot ℓ L J t))*_ + gcongr + +abbrev GoodWitnessTemplate (h ℓ L J t m r : ℕ) := + {d : WitnessTemplateCode ℓ L J t m // d.WellFormed h ∧ r ≤ d.rank} + +noncomputable def witnessTemplateMass (S : PrimeSystem) (P K : ℝ) (h ℓ L J t r : ℕ) : ℝ := + ∑ m : Fin (witnessSlotCount ℓ L J t+1), + ∑ d : GoodWitnessTemplate h ℓ L J t m.val r, + ∑ v : Fin m.val → S.Index, + (d.val.system h d.property.1).fiberWeight P K (fun a => (v a:ℕ)) + +lemma witnessTemplateMass_le (S : PrimeSystem) (P B K : ℝ) (h ℓ L J t r : ℕ) + (hP : 0 < P) (hB : 0 ≤ B) (hK : 0 ≤ K) + (hS : ∀ p : S.Index, P ≤ (p:ℝ) ∧ (p:ℝ) ≤ Real.exp B) + (hδ : max (K/(P*Real.log 2)) ((2+B)/P) ≤ 1) : + witnessTemplateMass S P K h ℓ L J t r ≤ + (witnessTemplateBudget ℓ L J t:ℝ) * + (max 1 (∑ p ∈ S.primes, (p:ℝ)⁻¹))^(witnessSlotCount ℓ L J t) * + (max (K/(P*Real.log 2)) ((2+B)/P))^r := by + let N := witnessSlotCount ℓ L J t + let H : ℝ := max 1 (∑ p ∈ S.primes, (p:ℝ)⁻¹) + let δ : ℝ := max (K/(P*Real.log 2)) ((2+B)/P) + let C : ℕ := Fintype.card (WitnessMetadata ℓ L t)*(N+1)^N * + ((t+1)*(Fintype.card (WitnessTestDescriptor ℓ L t N)+1)^t) + have h0δ : 0 ≤ δ := le_trans (by positivity : 0 ≤ (2+B)/P) (le_max_right _ _) + have hH : 1 ≤ H := le_max_left _ _ + have h0H : 0 ≤ H := le_trans zero_le_one hH + have hrow (m : Fin (N+1)) (d : GoodWitnessTemplate h ℓ L J t m.val r) : + (∑ v : Fin m.val → S.Index, + (d.val.system h d.property.1).fiberWeight P K (fun a => (v a:ℕ))) ≤ H^N*δ^r := by + apply ((d.val.system h d.property.1).fiber_sum_le S.primes P B K hP hB hK + (fun p hp => ⟨S.prime_mem p hp,(hS ⟨p,hp⟩).1,(hS ⟨p,hp⟩).2⟩)).trans + apply mul_le_mul + · apply (pow_le_pow_left₀ (by positivity) (le_max_right (1:ℝ) _) _).trans + apply pow_le_pow_right₀ hH + rw [unselected_card,Fintype.card_fin] + omega + · exact pow_le_pow_of_le_one h0δ hδ d.property.2 + · positivity + · positivity + have hcodes (m : Fin (N+1)) : + (∑ d : GoodWitnessTemplate h ℓ L J t m.val r, + ∑ v : Fin m.val → S.Index, + (d.val.system h d.property.1).fiberWeight P K (fun a => (v a:ℕ))) ≤ + (C:ℝ)*(H^N*δ^r) := by + calc + _ ≤ ∑ _ : GoodWitnessTemplate h ℓ L J t m.val r, H^N*δ^r := + sum_le_sum (fun d _ => hrow m d) + _ = (Fintype.card (GoodWitnessTemplate h ℓ L J t m.val r):ℝ)*(H^N*δ^r) := by simp + _ ≤ _ := by + apply mul_le_mul_of_nonneg_right _ (mul_nonneg (pow_nonneg h0H _) (pow_nonneg h0δ _)) + exact_mod_cast (Fintype.card_subtype_le _).trans + (witnessTemplate_card_uniform ℓ L J t m.val (Nat.lt_succ_iff.mp m.isLt)) + calc + _ ≤ ∑ _ : Fin (N+1), (C:ℝ)*(H^N*δ^r) := sum_le_sum (fun m _ => hcodes m) + _ = ((N+1:ℕ):ℝ)*(C:ℝ)*(H^N*δ^r) := by simp [mul_assoc] + _ = _ := by + dsimp only [witnessTemplateBudget,C,N,H,δ] + push_cast + ring + +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestDescriptor.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestDescriptor.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7bb3cf6f3f7046fa310a6f7811c5b8478847c0f --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestDescriptor.lean @@ -0,0 +1,139 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessTestShape +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.OfRelabel + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SharedSlotPatterns +open Finset Classical + +abbrev WitnessTestDescriptor (ℓ L t m : ℕ) := WitnessTestShape ℓ L t × Fin m × Fin m × Bool +abbrev WitnessTemplateCode (ℓ L J t m : ℕ) := + WitnessMetadata ℓ L t × (WitnessCodeSlot ℓ L J t → Option (Fin m)) × + ((k : Fin (t+1)) × (Fin k.val → WitnessTestDescriptor ℓ L t m)) + +noncomputable instance (ℓ L J t m : ℕ) : Fintype (WitnessTemplateCode ℓ L J t m) := by + haveI : Fintype (WitnessMetadata ℓ L t) := inferInstance + haveI : Fintype (WitnessCodeSlot ℓ L J t → Option (Fin m)) := inferInstance + haveI : Fintype (WitnessTestDescriptor ℓ L t m) := inferInstance + haveI : ∀ k : Fin (t+1), Fintype (Fin k.val → WitnessTestDescriptor ℓ L t m) := + fun k => inferInstance + haveI : Fintype ((k : Fin (t+1)) × (Fin k.val → WitnessTestDescriptor ℓ L t m)) := inferInstance + unfold WitnessTemplateCode + infer_instance + +namespace WitnessTemplateCode +variable {ℓ L J t m : ℕ} +noncomputable def rank (d : WitnessTemplateCode ℓ L J t m) : ℕ := d.2.2.1.val +noncomputable def selected (d : WitnessTemplateCode ℓ L J t m) (i : Fin d.rank) : Fin m := + (d.2.2.2 i).2.1 +noncomputable def modulus (d : WitnessTemplateCode ℓ L J t m) (i : Fin d.rank) : Fin m := + (d.2.2.2 i).2.2.1 +noncomputable def linear (d : WitnessTemplateCode ℓ L J t m) (i : Fin d.rank) : Bool := + (d.2.2.2 i).2.2.2 +noncomputable def expression (d : WitnessTemplateCode ℓ L J t m) (h : ℕ) (i : Fin d.rank) : + SquarefreeExpression (Fin m) ((ℓ+L)+L) := (d.2.2.2 i).1.expression h d.1 d.2.1 + +def WellFormed (d : WitnessTemplateCode ℓ L J t m) (h : ℕ) : Prop := + Function.Injective d.selected ∧ + (∀ i, d.linear i=false → d.modulus i=d.selected i) ∧ + (∀ i, d.linear i=false → d.selected i ∉ (d.expression h i).support) ∧ + (∀ i, d.linear i=true → d.modulus i≠d.selected i) ∧ + (∀ i j, i x (v a)) := by + intro i + have hi := hx i + change (if d.linear i then + ArithmeticClause.linear ((d.expression h i).linearCoeff (d.selected i) (fun a => (x (v a):ℤ))) + ((d.expression h i).constantTerm (d.selected i) (fun a => (x (v a):ℤ))) (x (v (d.modulus i))) + else ArithmeticClause.divisor ((d.expression h i).eval (fun a => (x (v a):ℤ)))).Holds P K (x (v (d.selected i))) + rw [←SquarefreeExpression.linearCoeff_relabel (d.expression h i) v (fun a => (x a:ℤ)) (d.selected i), + ←SquarefreeExpression.constant_relabel (d.expression h i) v (fun a => (x a:ℤ)) (d.selected i), + ←SquarefreeExpression.eval_relabel (d.expression h i) v (fun a => (x a:ℤ)),hs i,hm i,he i,hl i] + exact hi + +lemma descriptor_card (ℓ L t m : ℕ) : + Fintype.card (WitnessTestDescriptor ℓ L t m)= + (t^2*2*(L+1)^3*(ℓ+1)^2)*m^2*2 := by + simp only [WitnessTestDescriptor,Fintype.card_prod,Fintype.card_bool,Fintype.card_fin, + WitnessTestShape.card] + ring + +lemma card_le (ℓ L J t m : ℕ) : + Fintype.card (WitnessTemplateCode ℓ L J t m) ≤ + Fintype.card (WitnessMetadata ℓ L t)*(m+1)^(Fintype.card (WitnessCodeSlot ℓ L J t)) * + ((t+1)*(Fintype.card (WitnessTestDescriptor ℓ L t m)+1)^t) := by + have hc : Fintype.card (WitnessTemplateCode ℓ L J t m) = + Fintype.card (WitnessMetadata ℓ L t)*(m+1)^(Fintype.card (WitnessCodeSlot ℓ L J t)) * + (∑ k : Fin (t+1), (Fintype.card (WitnessTestDescriptor ℓ L t m))^k.val) := by + simp only [WitnessTemplateCode,Fintype.card_prod,Fintype.card_fun,Fintype.card_option, + Fintype.card_fin,Fintype.card_sigma] + ring + rw [hc] + apply Nat.mul_le_mul_left + calc + _ ≤ ∑ k : Fin (t+1), (Fintype.card (WitnessTestDescriptor ℓ L t m)+1)^t := by + apply sum_le_sum + intro k hk + exact (Nat.pow_le_pow_left (Nat.le_succ _) k.val).trans + (Nat.pow_le_pow_right (n:=Fintype.card (WitnessTestDescriptor ℓ L t m)+1) + (Nat.succ_pos _) (Nat.lt_succ_iff.mp k.isLt)) + _ = _ := by simp + +end WitnessTemplateCode +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestShape.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestShape.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c98efd1bf50764c1b5aa1aad83f5651a0015375 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestShape.lean @@ -0,0 +1,130 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Symbolic +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessConfiguration +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SpecSegment +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.RelabelAppend + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.GraphKernel.PrimeSystem +open OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtrees +open OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SharedSlotPatterns +open Finset Classical + +structure WitnessTestShape (ℓ L t : ℕ) where + witness : Fin t + other : Fin t + compare : Bool + a : Fin (L+1) + b : Fin (L+1) + c : Fin (L+1) + lineA : Fin (ℓ+1) + lineB : Fin (ℓ+1) + deriving DecidableEq + +namespace WitnessTestShape +noncomputable def equiv (ℓ L t : ℕ) : WitnessTestShape ℓ L t ≃ + Fin t × Fin t × Bool × Fin (L+1) × Fin (L+1) × Fin (L+1) × Fin (ℓ+1) × Fin (ℓ+1) := + { toFun d := (d.witness,d.other,d.compare,d.a,d.b,d.c,d.lineA,d.lineB) + invFun z := ⟨z.1,z.2.1,z.2.2.1,z.2.2.2.1,z.2.2.2.2.1,z.2.2.2.2.2.1, + z.2.2.2.2.2.2.1,z.2.2.2.2.2.2.2⟩ + left_inv _ := rfl + right_inv _ := rfl } +noncomputable instance (ℓ L t : ℕ) : Fintype (WitnessTestShape ℓ L t) := + Fintype.ofEquiv _ (equiv ℓ L t).symm + +variable {α β : Type*} [DecidableEq α] [DecidableEq β] {ℓ L J t : ℕ} + +noncomputable def expression (d : WitnessTestShape ℓ L t) (h : ℕ) + (m : WitnessMetadata ℓ L t) (p : WitnessCodeSlot ℓ L J t → Option α) : + SquarefreeExpression α ((ℓ+L)+L) := + if d.compare then + ((PatternExpression.lineSegment h m.1 (fun k => p (.inl k)) d.lineA d.lineB).append + (PatternExpression.specSegment h (m.2.2 d.witness).2 + (fun k => p (.inr (.inr (.inl (d.witness,k))))) d.a.val d.b.val)).append + (PatternExpression.specSegment h (m.2.2 d.other).2 + (fun k => p (.inr (.inr (.inl (d.other,k))))) 0 d.c.val).neg + else ((SquarefreeExpression.zeroExpression α ℓ).append + (PatternExpression.specSegment h (m.2.2 d.witness).2 + (fun k => p (.inr (.inr (.inl (d.witness,k))))) d.a.val d.b.val)).append + (SquarefreeExpression.zeroExpression α L) + +lemma expression_relabel (d : WitnessTestShape ℓ L t) (h : ℕ) + (m : WitnessMetadata ℓ L t) (p : WitnessCodeSlot ℓ L J t → Option α) (e : α ↪ β) : + (d.expression h m p).relabel e=d.expression h m (fun s => (p s).map e) := by + unfold expression + split_ifs <;> simp only [SquarefreeExpression.relabel_append, + SquarefreeExpression.relabel_neg,SquarefreeExpression.relabel_zero, + PatternExpression.specSegment_relabel,PatternExpression.lineSegment_relabel] + +lemma card (ℓ L t : ℕ) : + Fintype.card (WitnessTestShape ℓ L t)=t^2*2*(L+1)^3*(ℓ+1)^2 := by + rw [Fintype.card_congr (equiv ℓ L t)] + simp only [Fintype.card_prod,Fintype.card_bool,Fintype.card_fin] + ring +end WitnessTestShape + +variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L t : ℕ} +namespace WitnessConfiguration +variable (x : WitnessConfiguration D h ℓ L t) + +noncomputable def shape {j : Fin t} : x.family.Test j → WitnessTestShape ℓ L t + | .extra | .tail _ => + { witness := j, other := j, compare := false + a := ⟨(x.family.witness j).spec.suffix.val,by + have := (x.family.witness j).spec.suffix.isLt + have := (x.family.witness j).spec.length_le + omega⟩ + b := ⟨(x.family.witness j).spec.length,Nat.lt_succ_of_le (x.family.witness j).spec.length_le⟩ + c := 0, lineA := 0, lineB := 0 } + | .compare i _ r hi => + { witness := j, other := i, compare := true + a := 0 + b := ⟨(x.family.witness j).spec.tailStart.val,by + have := (x.family.witness j).spec.tailStart.isLt + have := (x.family.witness j).spec.length_le + omega⟩ + c := ⟨((x.family.witness i).spec.activity r hi).val,by + have := ((x.family.witness i).spec.activity r hi).isLt + have := (x.family.witness i).spec.length_le + omega⟩ + lineA := (x.family.witness i).index + lineB := (x.family.witness j).index } + +lemma shape_expression {j : Fin t} (d : x.family.Test j) : + (x.shape d).expression h x.metadata x.primeCode=d.symbolic x.labels := by + have hs (j : Fin t) (a b : ℕ) : + PatternExpression.specSegment h (x.metadata.2.2 j).2 + (fun k => x.primeCode (.inr (.inr (.inl (j,k))))) a b = + (x.family.witness j).spec.segmentExpression a b := + PatternExpression.specSegment_source _ a b + have hl (a b : Fin (ℓ+1)) : + PatternExpression.lineSegment h x.metadata.1 (fun k => x.primeCode (.inl k)) a b= + LineExpression.segment x.line x.labels a b := + PatternExpression.lineSegment_source x.line x.labels a b + cases d with + | extra | tail => simp only [shape,WitnessTestShape.expression,Bool.false_eq_true,ite_false, + hs,PrivateFamily.Test.symbolic] + | compare i q r hi => simp only [shape,WitnessTestShape.expression,ite_true,Fin.val_zero, + hs,hl,PrivateFamily.Test.symbolic] + +lemma pattern_shape_expression {j : Fin t} (d : x.family.Test j) : + ((x.shape d).expression h x.metadata (pattern x.primeCode)).relabel (values x.primeCode)= + d.symbolic x.labels := by + rw [WitnessTestShape.expression_relabel] + simp only [decode_pattern] + exact x.shape_expression d + +end WitnessConfiguration +end OrdinaryCorrelations.GraphKernel.PrimeSystem + +end + +end OAI diff --git a/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/ZeroExpression.lean b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/ZeroExpression.lean new file mode 100644 index 0000000000000000000000000000000000000000..f7279296f821ff6faaf03a70136c5547d84dd639 --- /dev/null +++ b/lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/ZeroExpression.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SquarefreeExpression + +namespace OAI + +noncomputable section +open scoped BigOperators +open Finset +open Finset Classical +open Filter +open Finset Classical Filter +open scoped Topology + +namespace OrdinaryCorrelations.ArithmeticSaving.SquarefreeExpression +open Finset Classical +variable {ι : Type*} [DecidableEq ι] {E F : ℕ} + +noncomputable def zeroExpression (ι : Type*) [DecidableEq ι] (E : ℕ) : SquarefreeExpression ι E where + factors _ := ∅ + coefficient _ := 0 + +noncomputable def append (d : SquarefreeExpression ι E) (e : SquarefreeExpression ι F) : + SquarefreeExpression ι (E+F) where + factors := Fin.addCases d.factors e.factors + coefficient := Fin.addCases d.coefficient e.coefficient + +noncomputable def neg (d : SquarefreeExpression ι E) : SquarefreeExpression ι E where + factors := d.factors + coefficient i := -d.coefficient i + +@[simp] lemma eval_zero (x : ι → ℤ) : (zeroExpression ι E).eval x=0 := by simp [eval,zeroExpression] +@[simp] lemma coefficient_zero (q : ι) (x : ι → ℤ) : (zeroExpression ι E).linearCoeff q x=0 := by + simp [linearCoeff,zeroExpression] +@[simp] lemma support_zero : (zeroExpression ι E).support=∅ := by ext v; simp [support,zeroExpression] + +@[simp] lemma eval_append (d : SquarefreeExpression ι E) (e : SquarefreeExpression ι F) (x : ι → ℤ) : + (d.append e).eval x=d.eval x+e.eval x := by + unfold eval + rw [Fin.sum_univ_add] + simp only [append,Fin.addCases_left,Fin.addCases_right] + +@[simp] lemma coefficient_append (d : SquarefreeExpression ι E) (e : SquarefreeExpression ι F) + (q : ι) (x : ι → ℤ) : (d.append e).linearCoeff q x=d.linearCoeff q x+e.linearCoeff q x := by + unfold linearCoeff + rw [Fin.sum_univ_add] + simp only [append,Fin.addCases_left,Fin.addCases_right] + +@[simp] lemma eval_neg (d : SquarefreeExpression ι E) (x : ι → ℤ) : d.neg.eval x= -d.eval x := by + simp only [eval,neg,neg_mul,sum_neg_distrib] + +@[simp] lemma coefficient_neg (d : SquarefreeExpression ι E) (q : ι) (x : ι → ℤ) : + d.neg.linearCoeff q x= -d.linearCoeff q x := by + unfold linearCoeff + rw [←sum_neg_distrib] + apply sum_congr rfl + intro i hi + simp only [neg,neg_mul] + split_ifs <;> simp + +@[simp] lemma support_neg (d : SquarefreeExpression ι E) : d.neg.support=d.support := by + simp only [support,neg,neg_eq_zero] + +@[simp] lemma support_append (d : SquarefreeExpression ι E) (e : SquarefreeExpression ι F) : + (d.append e).support=d.support ∪ e.support := by + ext v + simp only [support,mem_biUnion,mem_univ,true_and,mem_union] + constructor + · rintro ⟨i,hi⟩ + refine Fin.addCases ?_ ?_ i hi + · intro j hj; exact Or.inl ⟨j,by simpa only [append,Fin.addCases_left] using hj⟩ + · intro j hj; exact Or.inr ⟨j,by simpa only [append,Fin.addCases_right] using hj⟩ + · rintro (⟨i,hi⟩|⟨i,hi⟩) + · exact ⟨i.castAdd F,by simpa only [append,Fin.addCases_left] using hi⟩ + · exact ⟨i.natAdd E,by simpa only [append,Fin.addCases_right] using hi⟩ + +lemma factors_append_le (d : SquarefreeExpression ι E) (e : SquarefreeExpression ι F) (J : ℕ) + (hd : ∀ i, (d.factors i).card ≤ J) (he : ∀ i, (e.factors i).card ≤ J) : + ∀ i, ((d.append e).factors i).card ≤ J := by + intro i + refine Fin.addCases ?_ ?_ i + · intro j; simpa only [append,Fin.addCases_left] using hd j + · intro j; simpa only [append,Fin.addCases_right] using he j + +lemma abs_coefficient_append_le (d : SquarefreeExpression ι E) (e : SquarefreeExpression ι F) (H : ℝ) + (hd : ∀ i, |(d.coefficient i:ℝ)| ≤ H) (he : ∀ i, |(e.coefficient i:ℝ)| ≤ H) : + ∀ i, |((d.append e).coefficient i:ℝ)| ≤ H := by + intro i + refine Fin.addCases ?_ ?_ i + · intro j; simpa only [append,Fin.addCases_left] using hd j + · intro j; simpa only [append,Fin.addCases_right] using he j + +end OrdinaryCorrelations.ArithmeticSaving.SquarefreeExpression + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/All.lean b/lean/OAI/NumberTheory/Ostmann/All.lean new file mode 100644 index 0000000000000000000000000000000000000000..366396324c259324fab1f13bcfca6d052566e140 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/All.lean @@ -0,0 +1,152 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternNormRate +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSlotProducts +import OAI.NumberTheory.Ostmann.Arithmetic.BulkKernelCellError +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogPairComparison +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedCellComparison +import OAI.NumberTheory.Ostmann.Arithmetic.BulkPageProjection +import OAI.NumberTheory.Ostmann.Arithmetic.BulkStatisticBound +import OAI.NumberTheory.Ostmann.Arithmetic.CRTInternalLines +import OAI.NumberTheory.Ostmann.Arithmetic.CRTLineProbabilities +import OAI.NumberTheory.Ostmann.Arithmetic.CompensatedHistoryRate +import OAI.NumberTheory.Ostmann.Arithmetic.ForwardHistoryRate +import OAI.NumberTheory.Ostmann.Arithmetic.GlobalHistoryPairDecay +import OAI.NumberTheory.Ostmann.Arithmetic.HarmonicGraphCancellation +import OAI.NumberTheory.Ostmann.Arithmetic.IdealSmoothHistoryNorm +import OAI.NumberTheory.Ostmann.Arithmetic.JointLineComparison +import OAI.NumberTheory.Ostmann.Arithmetic.LeafFrequencySupport +import OAI.NumberTheory.Ostmann.Arithmetic.LeafModulusRanges +import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeFullHarmonicCost +import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeStep +import OAI.NumberTheory.Ostmann.Arithmetic.MovingArithmeticPageDeletion +import OAI.NumberTheory.Ostmann.Arithmetic.MovingArithmeticScale +import OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkLogVariation +import OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkSupport +import OAI.NumberTheory.Ostmann.Arithmetic.MovingCompleteIntegerCells +import OAI.NumberTheory.Ostmann.Arithmetic.MovingConstructedProductStep +import OAI.NumberTheory.Ostmann.Arithmetic.MovingEarlyTemplateCaps +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFieldBulkComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFirstNodeWindows +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFrequencyEnergy +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFullPair +import OAI.NumberTheory.Ostmann.Arithmetic.MovingJointSquareLoss +import OAI.NumberTheory.Ostmann.Arithmetic.MovingMixedResidueRate +import OAI.NumberTheory.Ostmann.Arithmetic.MovingNormalizedEnergyBound +import OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalEnergyBound +import OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalGiantComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalLogGiantWeight +import OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalPair +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPairAdaptiveSupport +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternGoodMaskedPriors +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternHalfLogTwoPrimeIntegratedRate +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternLines +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternLogLeafBridge +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternLogTwoPrimeIntegratedRate +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternMainGain +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternSameNormArithmetic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternSignedArithmetic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternSignedMajorant +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWholeShellArithmetic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWindowWeightedWholeShell +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWindowWholeShellArithmetic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWordArithmetic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPrimeInternalNorm +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPrimeResidueRate +import OAI.NumberTheory.Ostmann.Arithmetic.MovingRealWeight +import OAI.NumberTheory.Ostmann.Arithmetic.MovingRegularOuterComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSampleDiagonalRate +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedDiagonalDecay +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedEarlyDiagonalDecay +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedPhaseStatistic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedPrimeEnergy +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedPrimeStatistic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedStatistic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSeparatedOuterComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSmoothPrimeComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSpectatorRangeUnits +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSupportedOuterComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingTaggedPrimeCore +import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateMatchedBound +import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateNormalizer +import OAI.NumberTheory.Ostmann.Arithmetic.NaturalScheduleEnergy +import OAI.NumberTheory.Ostmann.Arithmetic.PeriodicGraphCancellation +import OAI.NumberTheory.Ostmann.Arithmetic.PrimeIntegerTransfer +import OAI.NumberTheory.Ostmann.Arithmetic.RangedPairAdmissibility +import OAI.NumberTheory.Ostmann.Arithmetic.RecursiveArchimedeanCutoff +import OAI.NumberTheory.Ostmann.Arithmetic.ReducedCoefficientLift +import OAI.NumberTheory.Ostmann.Arithmetic.ResidueProductSupport +import OAI.NumberTheory.Ostmann.Arithmetic.SmoothCellRate +import OAI.NumberTheory.Ostmann.Characters.AnchorDiagonalTotal +import OAI.NumberTheory.Ostmann.Characters.CharacterCompletedOrderOne +import OAI.NumberTheory.Ostmann.Characters.CharacterFinalTop +import OAI.NumberTheory.Ostmann.Characters.MixedGiantIdealization +import OAI.NumberTheory.Ostmann.Characters.PrimeCorrelationBounds +import OAI.NumberTheory.Ostmann.Characters.QuartetAllMajorants +import OAI.NumberTheory.Ostmann.Characters.QuartetFriendlyBound +import OAI.NumberTheory.Ostmann.Construction.BalancedHalfInitialAmplitude +import OAI.NumberTheory.Ostmann.Construction.ConstituentFinalComparison +import OAI.NumberTheory.Ostmann.Construction.ConstituentFourierBridge +import OAI.NumberTheory.Ostmann.Construction.ConstituentMatchingRate +import OAI.NumberTheory.Ostmann.Construction.ConstituentOriginalPair +import OAI.NumberTheory.Ostmann.Construction.ConstituentSelectedProducts +import OAI.NumberTheory.Ostmann.Construction.DiagonalRegularLift +import OAI.NumberTheory.Ostmann.Construction.DyadicGraphHistory +import OAI.NumberTheory.Ostmann.Construction.FinalArithmeticContradiction +import OAI.NumberTheory.Ostmann.Construction.FinalAsymptoticComparison +import OAI.NumberTheory.Ostmann.Construction.FinalEnergyCutoff +import OAI.NumberTheory.Ostmann.Construction.FinalOneSidedFactor +import OAI.NumberTheory.Ostmann.Construction.FiniteMatchedFubini +import OAI.NumberTheory.Ostmann.Construction.FiniteScheduledTemplate +import OAI.NumberTheory.Ostmann.Construction.FormulaHistoryGraphBound +import OAI.NumberTheory.Ostmann.Construction.FrozenOriginalBulk +import OAI.NumberTheory.Ostmann.Construction.FullPrimeRatioPair +import OAI.NumberTheory.Ostmann.Construction.HarmonicMatchedEnergy +import OAI.NumberTheory.Ostmann.Construction.HistoryLineComparison +import OAI.NumberTheory.Ostmann.Construction.HistoryResidueData +import OAI.NumberTheory.Ostmann.Construction.InitialOutsideTransform +import OAI.NumberTheory.Ostmann.Construction.InitialProductSize +import OAI.NumberTheory.Ostmann.Construction.InitialWordSupport +import OAI.NumberTheory.Ostmann.Construction.IntegerGridSupport +import OAI.NumberTheory.Ostmann.Construction.NaturalBadDiagonal +import OAI.NumberTheory.Ostmann.Construction.OriginalKernelComparison +import OAI.NumberTheory.Ostmann.Construction.OriginalPrimeRestoration +import OAI.NumberTheory.Ostmann.Construction.PhaseGiantInitialStatistic +import OAI.NumberTheory.Ostmann.Construction.PrimeCutoffFactors +import OAI.NumberTheory.Ostmann.Construction.PrimeTupleDiagonal +import OAI.NumberTheory.Ostmann.Construction.RepeatedPivotPhase +import OAI.NumberTheory.Ostmann.Construction.ScheduledAnchorDiagonalSplit +import OAI.NumberTheory.Ostmann.Construction.ScheduledAnchorEnergyBound +import OAI.NumberTheory.Ostmann.Construction.ScheduledDistinctSources +import OAI.NumberTheory.Ostmann.Construction.ScheduledFinalBound +import OAI.NumberTheory.Ostmann.Construction.ScheduledFinalPrimeComparison +import OAI.NumberTheory.Ostmann.Construction.ScheduledIntervalStep +import OAI.NumberTheory.Ostmann.Construction.ScheduledNonanchorDecay +import OAI.NumberTheory.Ostmann.Construction.ScheduledSpectatorComparison +import OAI.NumberTheory.Ostmann.Construction.ScheduledSpectatorProducts +import OAI.NumberTheory.Ostmann.Construction.SelectedAnchorEnergyBound +import OAI.NumberTheory.Ostmann.Construction.SelectedAnchorSupportedEnergy +import OAI.NumberTheory.Ostmann.Construction.SelectedCutoffData +import OAI.NumberTheory.Ostmann.Construction.SelectedFinalNaturalPrimeComparison +import OAI.NumberTheory.Ostmann.Construction.SelectedFinalPrimeComparison +import OAI.NumberTheory.Ostmann.Construction.SelectedNodeSources +import OAI.NumberTheory.Ostmann.Construction.SelectedNonanchorDecay +import OAI.NumberTheory.Ostmann.Construction.SmoothGiantLossBudget +import OAI.NumberTheory.Ostmann.Construction.SmoothMatchedPrior +import OAI.NumberTheory.Ostmann.Construction.UniformInitialAmplitude +import OAI.NumberTheory.Ostmann.Construction.WeightedRegularNorm +import OAI.NumberTheory.Ostmann.PaperMain +import OAI.NumberTheory.Ostmann.Preliminaries.Reduction +import OAI.NumberTheory.Ostmann.Quadratic.CommonCenterFromApproximation +import OAI.NumberTheory.Ostmann.Quadratic.KernelPopulationDiscard +import OAI.NumberTheory.Ostmann.Quadratic.QuadraticIntervalInverse +import OAI.NumberTheory.Ostmann.Quadratic.QuadraticNegligibleError +import OAI.NumberTheory.Ostmann.Quadratic.QuadraticSecondCorrections +import OAI.NumberTheory.Ostmann.Quadratic.QuadraticVaryingSmooth +import OAI.NumberTheory.Ostmann.Quadratic.QuadraticWholeDivisorBound +import OAI.NumberTheory.Ostmann.QuadraticCenter.RootSeparation +import OAI.NumberTheory.Ostmann.Tree.PairMoment +import OAI.NumberTheory.Ostmann.ZeroDensity.ActualPrincipalPNT +import OAI.NumberTheory.Ostmann.ZeroDensity.ArithmeticProgressionRows +import OAI.NumberTheory.Ostmann.ZeroDensity.BulkAbsoluteDensity +import OAI.NumberTheory.Ostmann.ZeroDensity.CharacterContourHeights +import OAI.NumberTheory.Ostmann.ZeroDensity.DensityFiniteIntegralEnergy +import OAI.NumberTheory.Ostmann.ZeroDensity.NonexceptionalRieszDecay diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/AccidentalDivisibility.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AccidentalDivisibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..46e067167aa5b32e749fee201f2949d308c9c961 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AccidentalDivisibility.lean @@ -0,0 +1,65 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.AccidentalDivisibility +open scoped BigOperators + +theorem primeFactors_card_log_bound (N : ℕ) (hN : N ≠ 0) : + (N.primeFactors.card : ℝ) * Real.log 2 ≤ Real.log N := by + have hpow : 2 ^ N.primeFactors.card ≤ N := by + calc + _ = ∏ _p ∈ N.primeFactors, 2 := by simp + _ ≤ ∏ p ∈ N.primeFactors, p := Finset.prod_le_prod fun p hp => + (Nat.prime_of_mem_primeFactors hp).two_le + _ ≤ N := Nat.le_of_dvd (Nat.pos_of_ne_zero hN) (Nat.prod_primeFactors_dvd N) + have hreal : (2:ℝ)^N.primeFactors.card ≤ (N:ℝ) := by exact_mod_cast hpow + have hlog := Real.log_le_log (by positivity : 0 < (2:ℝ)^N.primeFactors.card) hreal + simpa only [Real.log_pow] using hlog + +theorem weighted_prime_divisors (N : ℕ) (hN : N ≠ 0) (S : Finset ℕ) + (μ : ℕ → ℝ) {α : ℝ} (hα : 0 ≤ α) + (hbound : ∀ p ∈ S, μ p ≤ α) : + (∑ p ∈ S with p.Prime ∧ p ∣ N, μ p) ≤ + α * (Real.log N / Real.log 2) := by + have hcard : (S.filter fun p => p.Prime ∧ p ∣ N).card ≤ N.primeFactors.card := by + apply Finset.card_le_card + intro p hp + exact Nat.mem_primeFactors.mpr ⟨(Finset.mem_filter.mp hp).2.1, + (Finset.mem_filter.mp hp).2.2,hN⟩ + have hlog2 : 0 < Real.log 2 := Real.log_pos (by norm_num) + calc + _ ≤ ∑ _p ∈ S with _p.Prime ∧ _p ∣ N, α := + Finset.sum_le_sum fun p hp => hbound p (Finset.mem_filter.mp hp).1 + _ = ((S.filter fun p => p.Prime ∧ p ∣ N).card : ℝ) * α := by simp + _ ≤ (N.primeFactors.card:ℝ)*α := + mul_le_mul_of_nonneg_right (by exact_mod_cast hcard) hα + _ ≤ (Real.log N / Real.log 2)*α := by + apply mul_le_mul_of_nonneg_right _ hα + exact (le_div_iff₀ hlog2).2 (primeFactors_card_log_bound N hN) + _ = _ := mul_comm _ _ + +theorem weighted_polynomial_roots {K : Type*} [CommRing K] [IsDomain K] + [DecidableEq K] (P : Polynomial K) (hP : P ≠ 0) (S : Finset K) + (μ : K → ℝ) {α : ℝ} (hα : 0 ≤ α) (hbound : ∀ x ∈ S, μ x ≤ α) : + (∑ x ∈ S with P.eval x = 0, μ x) ≤ (P.natDegree:ℝ)*α := by + have hcard : (S.filter fun x => P.eval x=0).card ≤ P.natDegree := by + calc + _ ≤ P.roots.toFinset.card := Finset.card_le_card fun x hx => by + simpa [Polynomial.mem_roots hP, Polynomial.IsRoot] using + (Finset.mem_filter.mp hx).2 + _ ≤ P.roots.card := Multiset.toFinset_card_le _ + _ ≤ P.natDegree := P.card_roots' + calc + _ ≤ ∑ _x ∈ S with P.eval _x=0, α := + Finset.sum_le_sum fun x hx => hbound x (Finset.mem_filter.mp hx).1 + _ = ((S.filter fun x => P.eval x=0).card:ℝ)*α := by simp + _ ≤ (P.natDegree:ℝ)*α := + mul_le_mul_of_nonneg_right (by exact_mod_cast hcard) hα + +end Ostmann.Arithmetic.AccidentalDivisibility + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticCRTSeparation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticCRTSeparation.lean new file mode 100644 index 0000000000000000000000000000000000000000..9df968c751675b47474bae889484955020c8f825 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticCRTSeparation.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Construction.RegularDiagonalCancellation + +namespace OAI + +/-! # Removing the regular-prime block from the signed arithmetic average -/ + +namespace Ostmann + +open scoped BigOperators + +/-- Simultaneously split the integer and unit giant residues. -/ +noncomputable def crtSplitExternalEquiv (c r : ℕ) (hc : c.Coprime r) : + (ZMod (c * r) × (ZMod (c * r))ˣ) ≃ + (ZMod c × (ZMod c)ˣ) × (ZMod r × (ZMod r)ˣ) := + ((ZMod.chineseRemainder hc).toEquiv.prodCongr (crtSplitUnitEquiv c r hc)).trans + (Equiv.prodProdProdComm _ _ _ _) + +/-- The signed remainder includes spectator, internal-prime and frequency +tests, including the retained Page correction. No absolute value is taken. -/ +theorem crt_external_regular_with_remainder {I : Type*} [Fintype I] [DecidableEq I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] [∀ i, NeZero (p i)] [NeZero (∏ i, p i)] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (r : ℕ) [NeZero r] [NeZero ((∏ i, p i) * r)] + (hcop : (∏ i, p i).Coprime r) + (active : I → Bool) (a : ∀ i, (ZMod (p i))ˣ) (g : ∀ i, ZMod (p i) → ℂ) + (hg : ∀ i, g i 0 = 0) (henergy : ∀ i, (∑ x : ZMod (p i), ‖g i x‖ ^ 2) = p i) + (F : ZMod r × (ZMod r)ˣ → ℂ) : + (Fintype.card (ZMod ((∏ i, p i) * r) × (ZMod ((∏ i, p i) * r))ˣ) : ℂ)⁻¹ * + (∑ z, + ((∏ i, externalRegularLocal (active i) (a i) (g i) + (crtExternalPairEquiv p hc (crtSplitExternalEquiv (∏ i, p i) r hcop z).1 i) : ℝ) : ℂ) * + F (crtSplitExternalEquiv (∏ i, p i) r hcop z).2) = + ((∏ i, if active i then (1 : ℝ) else 1 - (p i : ℝ)⁻¹ : ℝ) : ℂ) * + ((Fintype.card (ZMod r × (ZMod r)ˣ) : ℂ)⁻¹ * ∑ z, F z) := by + have hreg := crt_external_regular_cancellation p hc active a g hg henergy + have hregC : (Fintype.card (ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) : ℂ)⁻¹ * + (∑ z, ((∏ i, externalRegularLocal (active i) (a i) (g i) + (crtExternalPairEquiv p hc z i) : ℝ) : ℂ)) = + ((∏ i, if active i then (1 : ℝ) else 1 - (p i : ℝ)⁻¹ : ℝ) : ℂ) := by + simpa only [Complex.ofReal_mul, Complex.ofReal_inv, Complex.ofReal_natCast, + Complex.ofReal_sum] using congrArg (fun t : ℝ => (t : ℂ)) hreg + rw [uniform_equiv_product_average (crtSplitExternalEquiv (∏ i, p i) r hcop) + (fun z => ((∏ i, externalRegularLocal (active i) (a i) (g i) + (crtExternalPairEquiv p hc z i) : ℝ) : ℂ)) F, hregC] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticCoincidences.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticCoincidences.lean new file mode 100644 index 0000000000000000000000000000000000000000..20c77b62bee664e496e1987f3326dd55065c111a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticCoincidences.lean @@ -0,0 +1,96 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.WeightedPolynomialRoots +import OAI.NumberTheory.Ostmann.Preliminaries.PrimeDivisors + +namespace OAI + +/-! # Accidental prime congruences in the arithmetic comparison + +These finite estimates implement the two errors in §8: an exact polynomial +zero, and an independent sampled prime dividing a nonzero evaluation. +-/ + +namespace Ostmann + +open scoped BigOperators + +/-- A lower bound on the sizes of the sampled primes converts the logarithmic +prime-divisor budget into a bound on their number. -/ +theorem prime_divisor_card_le (P : Finset ℕ) {n : ℕ} (hn : 0 < n) + (hprime : ∀ p ∈ P, p.Prime) (B K : ℝ) (hB : 0 < B) + (hsize : ∀ p ∈ P, B ≤ Real.log (p : ℝ)) + (hlog : Real.log (n : ℝ) ≤ K * B) : + ((P.filter fun p => p ∣ n).card : ℝ) ≤ K := by + classical + have hsum := sum_log_prime_divisors_le (P.filter fun p => p ∣ n) hn + (fun p hp => hprime p (Finset.mem_filter.mp hp).1) + (fun _ hp => (Finset.mem_filter.mp hp).2) + have hlower : ((P.filter fun p => p ∣ n).card : ℝ) * B ≤ + ∑ p ∈ P.filter (fun p => p ∣ n), Real.log (p : ℝ) := by + calc + _ = ∑ _p ∈ P.filter (fun p => p ∣ n), B := by simp + _ ≤ _ := Finset.sum_le_sum fun p hp => hsize p (Finset.mem_filter.mp hp).1 + exact (mul_le_mul_iff_left₀ hB).mp (hlower.trans (hsum.trans hlog)) + +/-- The probability of an independent prime dividing a nonzero integer is +bounded by its maximal atom times the number of possible prime divisors. -/ +theorem prime_divisibility_prior_le (P : Finset ℕ) (ν : ℕ → ℝ) + (β K : ℝ) (hβ : 0 ≤ β) (hν : ∀ p ∈ P, ν p ≤ β) + (n : ℕ) (hcard : ((P.filter fun p => p ∣ n).card : ℝ) ≤ K) : + (∑ p ∈ P, if p ∣ n then ν p else 0) ≤ K * β := by + classical + calc + _ = ∑ p ∈ P.filter (fun p => p ∣ n), ν p := (Finset.sum_filter _ _).symm + _ ≤ ∑ _p ∈ P.filter (fun p => p ∣ n), β := + Finset.sum_le_sum fun p hp => hν p (Finset.mem_filter.mp hp).1 + _ = ((P.filter fun p => p ∣ n).card : ℝ) * β := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right hcard hβ + +/-- Separate the exact-zero event from the independent prime-divisor event. +No conditional equidistribution is used in this estimate. -/ +theorem accidental_divisibility_le {X : Type*} [Fintype X] + (w : X → ℝ) (hw : ∀ x, 0 ≤ w x) (hmass : ∑ x, w x = 1) + (P : Finset ℕ) (ν : ℕ → ℝ) (hνmass : ∑ p ∈ P, ν p = 1) + (N : X → ℕ) (β K : ℝ) (hβ : 0 ≤ β) (hK : 0 ≤ K) + (hν : ∀ p ∈ P, ν p ≤ β) + (hcard : ∀ x, N x ≠ 0 → ((P.filter fun p => p ∣ N x).card : ℝ) ≤ K) : + (∑ x, w x * ∑ p ∈ P, if p ∣ N x then ν p else 0) ≤ + (∑ x, w x * if N x = 0 then 1 else 0) + K * β := by + classical + have hpoint (x : X) : (∑ p ∈ P, if p ∣ N x then ν p else 0) ≤ + (if N x = 0 then 1 else 0) + K * β := by + by_cases hx : N x = 0 + · simp only [hx, dvd_zero, ite_true, hνmass] + exact le_add_of_nonneg_right (mul_nonneg hK hβ) + · simp only [hx, ite_false, zero_add] + exact prime_divisibility_prior_le P ν β K hβ hν (N x) (hcard x hx) + calc + _ ≤ ∑ x, w x * ((if N x = 0 then 1 else 0) + K * β) := + Finset.sum_le_sum fun x _ => mul_le_mul_of_nonneg_left (hpoint x) (hw x) + _ = _ := by + simp only [mul_add, Finset.sum_add_distrib, ← Finset.sum_mul, hmass, one_mul] + +/-- The arithmetic coincidence bound with the exact-zero probability supplied +by the proved weighted polynomial root estimate. -/ +theorem polynomial_prime_coincidence_le {A : Type*} [Fintype A] {n : ℕ} + (value : A → ℚ) (hinj : Function.Injective value) + (F : MvPolynomial (Fin n) ℚ) (hF : F ≠ 0) + (μ : Fin n → A → ℝ) (hμ : ∀ i a, 0 ≤ μ i a) + (hmass : ∀ i, ∑ a, μ i a = 1) + (α : ℝ) (hα : 0 ≤ α) (hmax : ∀ i a, μ i a ≤ α) + (P : Finset ℕ) (ν : ℕ → ℝ) (hνmass : ∑ p ∈ P, ν p = 1) + (N : (Fin n → A) → ℕ) + (hzero : ∀ x, N x = 0 ↔ MvPolynomial.eval (fun i => value (x i)) F = 0) + (β K : ℝ) (hβ : 0 ≤ β) (hK : 0 ≤ K) (hν : ∀ p ∈ P, ν p ≤ β) + (hcard : ∀ x, N x ≠ 0 → ((P.filter fun p => p ∣ N x).card : ℝ) ≤ K) : + (∑ x, productPrior μ x * ∑ p ∈ P, if p ∣ N x then ν p else 0) ≤ + (F.totalDegree : ℝ) * α + K * β := by + classical + refine (accidental_divisibility_le (productPrior μ) (productPrior_nonneg μ hμ) + (productPrior_mass μ hmass) P ν hνmass N β K hβ hK hν hcard).trans ?_ + refine add_le_add ?_ le_rfl + simp_rw [hzero] + exact weighted_polynomial_roots_le value hinj α hα F hF μ hμ hmass hmax + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticDiagonalPatternNormRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticDiagonalPatternNormRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..d8fd5ad8fe716c446a931a6abad45b55029340b7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticDiagonalPatternNormRate.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternErrorRate +import OAI.NumberTheory.Ostmann.Arithmetic.PatternFrequencyNormSum + +namespace OAI + +/-! # The diagonal budget after both giant and bulk comparisons -/ + +namespace Ostmann +open Filter +open scoped Classical BigOperators + +/-- The actual pattern sum and paired frequency sum have an absolute bulk +constant. The cutoff includes the constructed bottom reserve `2 sqrt(m)`. +The five comparison errors retain their saving after the full history count. -/ +theorem arithmetic_diagonal_pattern_norm_rate (ψ : SchwartzMap ℝ ℂ) (n k : ℕ) + (hk : 0 < k) (hn : n ≤ k) (B Cfreq Cprior ε : ℝ) + (hCfreq : 0 ≤ Cfreq) (hCprior : 1 ≤ Cprior) (hε : 0 < ε) + (hdepth : 8 * Cprior ≤ (k : ℝ) ^ 3) : + ∀ᶠ L : ℝ in atTop, let m := spectatorBulkCount k L + ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * Cfreq * m) → + (q.divisors.card : ℝ) ≤ D) ∧ + ∀ (S : Finset ℤ) (N V : ℕ) (Δ err : ℝ), + (S.card : ℝ) ≤ Real.exp (Cfreq * m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + (N : ℝ) ≤ Real.exp (Cfreq * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + 0 ≤ err → err ≤ Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 4 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) → + let _ := sampleSetoidFintype (Bool × MovingSampleIndex n) + let K := ((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m) + ∀ R : Setoid (Bool × MovingSampleIndex n) → FrequencyTree (S × S) n → ℂ, + (∀ s t, ‖R s t‖ ≤ + ((2 : ℝ) ^ Fintype.card (Quotient s) * + (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) * + (err + K * (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod))) → + ‖∑ s, ∑ t, R s t‖ ≤ + Real.exp ((2 ^ n : ℕ) * Δ + (Real.log 12 + 1) * (2 ^ n : ℕ) * m + ε * m) + + 5 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + filter_upwards [arithmetic_prime_pattern_budget_rate ψ n k hk hn B Cfreq Cprior ε + hCfreq hCprior hε hdepth, + movingPattern_five_errors_rate n k hk Cprior Cfreq hCprior hCfreq] + with L hbudget herrors + dsimp only + obtain ⟨D, hD, hdiv, hbudget⟩ := hbudget + refine ⟨D, hD, hdiv, ?_⟩ + intro S N V Δ err hcard hS hN hV herr herrbound R hR + have hdivN : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D := by + intro q hq hqN + apply hdiv q hq + calc + (q : ℝ) ≤ (N : ℝ) ^ 2 := by exact_mod_cast hqN + _ ≤ (Real.exp (Cfreq * spectatorBulkCount k L)) ^ 2 := + pow_le_pow_left₀ (Nat.cast_nonneg N) hN 2 + _ = Real.exp (2 * Cfreq * spectatorBulkCount k L) := by + rw [← Real.exp_nat_mul] + congr 1 + ring + have hsum := pattern_frequency_norm_sum_le S n N V D (Real.exp (Cprior * L)) + (((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * spectatorBulkCount k L) * 4 * 3 ^ (2 ^ n * spectatorBulkCount k L)) * + 2 ^ (2 ^ n * spectatorBulkCount k L)) err hD (Real.exp_nonneg _) (by positivity) + herr hS hdivN R hR + have hcost := hbudget N V Δ hN hV + have he := (mul_le_mul_of_nonneg_left herrbound + (show 0 ≤ ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) by positivity)).trans (herrors S hcard) + apply hsum.trans + nlinarith only [hcost, he] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticErrorRates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticErrorRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..129360697bb622ac66481aa686861455dc0c22bc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticErrorRates.lean @@ -0,0 +1,114 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Ring + +namespace OAI + +/-! # Absorbing the fixed-depth arithmetic comparison costs + +The polynomial and spectator costs in Section 8 are dominated by the +double-exponential savings. The strict numerical gaps in the manuscript +therefore survive the finite history and equality-pattern sums. +-/ + +namespace Ostmann + +open Filter Asymptotics + +theorem arithmetic_exponent_absorption (a b d C c : ℝ) (n : ℕ) + (hb : 0 < b) (hab : a < b) (hdb : d < b) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, + C * L ^ n + C * L * Real.exp (a * L) - c * Real.exp (b * L) ≤ + -Real.exp (d * L) := by + have hp := (isLittleO_pow_exp_pos_mul_atTop n hb).const_mul_left C + have hm : (fun L : ℝ => C * (Real.exp (a * L) * L)) =o[atTop] + (fun L => Real.exp (b * L)) := by + simpa only [Real.rpow_one] using (isLittleO_exp_mul_rpow_of_lt 1 hab).const_mul_left C + have he : (fun L : ℝ => Real.exp (d * L)) =o[atTop] (fun L => Real.exp (b * L)) := by + simpa only [Real.rpow_zero, mul_one] using isLittleO_exp_mul_rpow_of_lt 0 hdb + have h := ((hp.add hm).add he).bound hc + filter_upwards [h] with L hL + simp only [Real.norm_eq_abs, abs_of_pos (Real.exp_pos _)] at hL + have hle := (le_abs_self _).trans hL + nlinarith + +theorem arithmetic_error_absorption (a b d C c : ℝ) (n : ℕ) + (hb : 0 < b) (hab : a < b) (hdb : d < b) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ n + C * L * Real.exp (a * L)) * + Real.exp (-c * Real.exp (b * L)) ≤ Real.exp (-Real.exp (d * L)) := by + filter_upwards [arithmetic_exponent_absorption a b d C c n hb hab hdb hc] with L hL + rw [← Real.exp_add] + apply Real.exp_le_exp.mpr + linarith + +/-- The mesh variation error in the bulk idealization, including the +spectator and polynomial history costs. -/ +theorem bulk_variation_error (C : ℝ) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) * + Real.exp (-Real.exp ((14 / 10000 : ℝ) * L)) ≤ + Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) := by + simpa only [one_mul, neg_mul] using + arithmetic_error_absorption (1 / 1000) (14 / 10000) (125 / 100000) C 1 2 + (by norm_num) (by norm_num) (by norm_num) (by norm_num) + +/-- The polynomial-root loss remains negligible after the same costs. -/ +theorem symbolic_root_error (C c : ℝ) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) * + Real.exp (-c * Real.exp ((4 / 1000 : ℝ) * L)) ≤ + Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) := + arithmetic_error_absorption (1 / 1000) (4 / 1000) (2 / 1000) C c 2 + (by norm_num) (by norm_num) (by norm_num) hc + +/-- The error from the bulk progression formula after counting joint boxes. -/ +theorem bulk_progression_error (C c : ℝ) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ 2 + C * L * Real.exp ((14 / 10000 : ℝ) * L)) * + Real.exp (-c * Real.exp ((16 / 10000 : ℝ) * L)) ≤ + Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) := + arithmetic_error_absorption (14 / 10000) (16 / 10000) (125 / 100000) C c 2 + (by norm_num) (by norm_num) (by norm_num) hc + +/-- Both the prime-square exclusions and the nonzero-polynomial prime-divisor +loss have the stronger internal-prime saving. -/ +theorem internal_prime_error (C c : ℝ) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) * + Real.exp (-c * Real.exp ((1 / 100 : ℝ) * L)) ≤ + Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) := + arithmetic_error_absorption (1 / 1000) (1 / 100) (2 / 1000) C c 2 + (by norm_num) (by norm_num) (by norm_num) hc + +/-- Freezing the two giant log coordinates has ample reserve. -/ +theorem giant_variation_error (C : ℝ) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ 2 + C * L * Real.exp ((12 / 1000 : ℝ) * L)) * + Real.exp (-Real.exp ((15 / 1000 : ℝ) * L)) ≤ + Real.exp (-Real.exp ((13 / 1000 : ℝ) * L)) := by + simpa only [one_mul, neg_mul] using + arithmetic_error_absorption (12 / 1000) (15 / 1000) (13 / 1000) C 1 2 + (by norm_num) (by norm_num) (by norm_num) (by norm_num) + +/-- Summing the giant progression errors over all boxes and residues. -/ +theorem giant_progression_error (C c : ℝ) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ 2 + C * L * Real.exp ((15 / 1000 : ℝ) * L)) * + Real.exp (-c * Real.exp ((18 / 1000 : ℝ) * L)) ≤ + Real.exp (-Real.exp ((13 / 1000 : ℝ) * L)) := + arithmetic_error_absorption (15 / 1000) (18 / 1000) (13 / 1000) C c 2 + (by norm_num) (by norm_num) (by norm_num) hc + +/-- The elementary external-integer error has a stronger saving. -/ +theorem giant_integer_error (C c : ℝ) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, + Real.exp (C * L ^ 2 + C * L * Real.exp ((15 / 1000 : ℝ) * L)) * + Real.exp (-c * Real.exp ((49 / 1000 : ℝ) * L)) ≤ + Real.exp (-Real.exp ((13 / 1000 : ℝ) * L)) := + arithmetic_error_absorption (15 / 1000) (49 / 1000) (13 / 1000) C c 2 + (by norm_num) (by norm_num) (by norm_num) hc + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticFrequencyTree.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticFrequencyTree.lean new file mode 100644 index 0000000000000000000000000000000000000000..eadfd710772f1e7e14dcbd6e71fca7a9e2c7e817 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticFrequencyTree.lean @@ -0,0 +1,114 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyTreeSum +import OAI.NumberTheory.Ostmann.Characters.SignedFrequencySum + +namespace OAI + +/-! # The full arithmetic frequency-tree budget -/ + +namespace Ostmann + +open scoped BigOperators Classical + +noncomputable def pairedFrequencyKernel (S : Finset ℤ) (D : ℝ) + (root left right : S × S) : ℝ := + 2 * D ^ 2 * + (((reducedFrequency ((left.1 : ℤ).natAbs.gcd (right.1 : ℤ).natAbs) (root.1 : ℤ).natAbs).lcm + (reducedFrequency ((left.2 : ℤ).natAbs.gcd (right.2 : ℤ).natAbs) (root.2 : ℤ).natAbs) : ℕ) : ℝ)⁻¹ + +theorem pairedFrequencyKernel_sum_le (S : Finset ℤ) (N : ℕ) (D : ℝ) (hD : 0 ≤ D) + (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) + (hdiv : ∀ v ∈ S, ∀ w ∈ S, ((v.natAbs.gcd w.natAbs).divisors.card : ℝ) ≤ D) + (left right : S × S) : + (∑ root : S × S, pairedFrequencyKernel S D root left right) ≤ + 8 * D ^ 4 * (1 + Real.log N) ^ 3 := by + let g := (left.1 : ℤ).natAbs.gcd (right.1 : ℤ).natAbs + let h := (left.2 : ℤ).natAbs.gcd (right.2 : ℤ).natAbs + have hg : g ≠ 0 := Nat.ne_of_gt (Nat.gcd_pos_of_pos_left _ + (Int.natAbs_pos.mpr (hS _ left.1.property).1)) + have hh : h ≠ 0 := Nat.ne_of_gt (Nat.gcd_pos_of_pos_left _ + (Int.natAbs_pos.mpr (hS _ left.2.property).1)) + have hgd : (g.divisors.card : ℝ) ≤ D := hdiv _ left.1.property _ right.1.property + have hhd : (h.divisors.card : ℝ) ≤ D := hdiv _ left.2.property _ right.2.property + have hpair : + (∑ s : S, ∑ t : S, + (((reducedFrequency g (s : ℤ).natAbs).lcm (reducedFrequency h (t : ℤ).natAbs) : ℕ) : ℝ)⁻¹) = + ∑ s ∈ S, ∑ t ∈ S, + (((reducedFrequency g s.natAbs).lcm (reducedFrequency h t.natAbs) : ℕ) : ℝ)⁻¹ := by + rw [Finset.sum_coe_sort S (fun s : ℤ => ∑ t : S, + (((reducedFrequency g s.natAbs).lcm (reducedFrequency h (t : ℤ).natAbs) : ℕ) : ℝ)⁻¹)] + exact Finset.sum_congr rfl fun s _ => Finset.sum_coe_sort S (fun t : ℤ => + (((reducedFrequency g s.natAbs).lcm (reducedFrequency h t.natAbs) : ℕ) : ℝ)⁻¹) + calc + _ = 2 * D ^ 2 * (∑ s : S, ∑ t : S, + (((reducedFrequency g (s : ℤ).natAbs).lcm (reducedFrequency h (t : ℤ).natAbs) : ℕ) : ℝ)⁻¹) := by + simp only [pairedFrequencyKernel, Fintype.sum_prod_type, ← Finset.mul_sum, g, h] + _ ≤ 2 * D ^ 2 * (4 * (g.divisors.card : ℝ) * h.divisors.card * (1 + Real.log N) ^ 3) := by + rw [hpair] + exact mul_le_mul_of_nonneg_left (signed_reducedFrequency_lcm_sum_le S S N g h hS hS hg hh) + (by positivity) + _ ≤ 2 * D ^ 2 * (4 * D * D * (1 + Real.log N) ^ 3) := by + apply mul_le_mul_of_nonneg_left _ (by positivity) + have hlog : 0 ≤ (1 + Real.log N) ^ 3 := by + have hbase := Real.log_natCast_nonneg N + positivity + exact mul_le_mul_of_nonneg_right + (mul_le_mul (mul_le_mul_of_nonneg_left hgd (by norm_num)) hhd + (Nat.cast_nonneg _) (by positivity)) hlog + _ = _ := by ring + +noncomputable def pairedFrequencyLeaf (S : Finset ℤ) (V : ℕ) (x : S × S) : ℝ := + if (x.1 : ℤ).natAbs ≤ V ∧ (x.2 : ℤ).natAbs ≤ V then 1 else 0 + +theorem pairedFrequencyLeaf_sum_le (S : Finset ℤ) (V : ℕ) + (hS : ∀ s ∈ S, s ≠ 0) : + (∑ x : S × S, pairedFrequencyLeaf S V x) ≤ (2 * (V : ℝ)) ^ 2 := by + let T := S.filter fun s => s.natAbs ≤ V + have hT : ∀ s ∈ T, s ≠ 0 ∧ s.natAbs ≤ V := by + intro s hs + exact ⟨hS s (Finset.mem_filter.mp hs).1, (Finset.mem_filter.mp hs).2⟩ + have hcard : (T.card : ℝ) ≤ 2 * V := by + have hbound := sum_signed_magnitudes_le T V hT (fun _ => (1 : ℝ)) (by intros; norm_num) + simpa using hbound + have hsingle : (∑ s : S, if (s : ℤ).natAbs ≤ V then (1 : ℝ) else 0) = T.card := by + rw [Finset.sum_coe_sort S (fun s : ℤ => if s.natAbs ≤ V then (1 : ℝ) else 0)] + simp only [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul, mul_one, T] + have hterm (x y : S) : pairedFrequencyLeaf S V (x, y) = + (if (x : ℤ).natAbs ≤ V then (1 : ℝ) else 0) * + (if (y : ℤ).natAbs ≤ V then (1 : ℝ) else 0) := by + unfold pairedFrequencyLeaf + split_ifs <;> simp_all + calc + _ = (T.card : ℝ) ^ 2 := by + rw [Fintype.sum_prod_type, pow_two, ← hsingle, Finset.sum_mul_sum] + simp only [hterm] + _ ≤ _ := pow_le_pow_left₀ (Nat.cast_nonneg _) hcard 2 + +/-- Root-first elimination leaves only the two histories' leaf frequencies. +The exponent `2^n-1` is the exact number of internal nodes. -/ +theorem arithmetic_frequency_tree_sum_le (S : Finset ℤ) (N V : ℕ) (D : ℝ) + (hD : 0 ≤ D) (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) + (hdiv : ∀ v ∈ S, ∀ w ∈ S, ((v.natAbs.gcd w.natAbs).divisors.card : ℝ) ≤ D) + (n : ℕ) : + (∑ x : FrequencyTree (S × S) n, + frequencyTreeWeight (pairedFrequencyKernel S D) (pairedFrequencyLeaf S V) n x) ≤ + (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * (2 * (V : ℝ)) ^ (2 * 2 ^ n) := by + have hC : 0 ≤ 8 * D ^ 4 * (1 + Real.log N) ^ 3 := by + have hlog := Real.log_natCast_nonneg N + positivity + have hmain := frequencyTree_sum_le (pairedFrequencyKernel S D) (pairedFrequencyLeaf S V) + (8 * D ^ 4 * (1 + Real.log N) ^ 3) (by intros; unfold pairedFrequencyKernel; positivity) + (by intros; unfold pairedFrequencyLeaf; split_ifs <;> norm_num) hC + (pairedFrequencyKernel_sum_le S N D hD hS hdiv) n + apply hmain.trans + have hleaf := pairedFrequencyLeaf_sum_le S V (fun s hs => (hS s hs).1) + calc + _ ≤ (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + ((2 * (V : ℝ)) ^ 2) ^ (2 ^ n) := + mul_le_mul_of_nonneg_left (pow_le_pow_left₀ + (Finset.sum_nonneg fun x _ => by unfold pairedFrequencyLeaf; split_ifs <;> norm_num) + hleaf _) (pow_nonneg hC _) + _ = _ := by rw [← pow_mul] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticGoodPatternRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticGoodPatternRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..250ef300b648ae3688fbd0b2829482d447de4b9f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticGoodPatternRate.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternErrorRate + +namespace OAI + +/-! # Full equality-pattern and frequency sums in the good-matching estimate -/ + +namespace Ostmann +open Filter +open scoped Classical BigOperators + +/-- The signed gain can be chosen before the local quartet tolerance. This +amount absorbs every original pattern and paired-frequency count. -/ +def goodPatternGain (n : ℕ) (Cprior Cfreq gain : ℝ) : ℝ := + 2 * (((4 * n * 2 ^ n) ^ 2 + 4 * n * 2 ^ n : ℕ) : ℝ) * Cprior + + (2 * (2 ^ (n + 1) - 1 : ℕ) : ℝ) * Cfreq + gain + +theorem arithmetic_good_pattern_rate (n k : ℕ) (hk : 0 < k) + (Cprior Cfreq gain : ℝ) (hCprior : 1 ≤ Cprior) (hCfreq : 0 ≤ Cfreq) : + ∀ᶠ L : ℝ in atTop, let m := spectatorBulkCount k L + ∀ S : Finset ℤ, (S.card : ℝ) ≤ Real.exp (Cfreq * m) → + let _ := sampleSetoidFintype (Bool × MovingSampleIndex n) + ∀ R : Setoid (Bool × MovingSampleIndex n) → FrequencyTree (S × S) n → ℂ, + (∀ s t, ‖R s t‖ ≤ + ((2 : ℝ) ^ Fintype.card (Quotient s) * + (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) * + (Real.exp (-goodPatternGain n Cprior Cfreq gain * m) + + Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 4 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)))) → + ‖∑ s, ∑ t, R s t‖ ≤ Real.exp (-gain * m) + + 5 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + filter_upwards [movingPattern_five_errors_rate n k hk Cprior Cfreq hCprior hCfreq, + eventually_ge_atTop (4 : ℝ)] with L herrors hL + dsimp only + intro S hS R hR + let _ := sampleSetoidFintype (Bool × MovingSampleIndex n) + let m := spectatorBulkCount k L + let A : ℝ := (((4 * n * 2 ^ n) ^ 2 + 4 * n * 2 ^ n : ℕ) : ℝ) * Cprior + let B : ℝ := (2 * (2 ^ (n + 1) - 1 : ℕ) : ℝ) * Cfreq + let cost := (2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n) + let err := Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 4 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) + have hA : 0 ≤ A := by dsimp only [A]; positivity + have hB : 0 ≤ B := by dsimp only [B]; positivity + have hL0 : 0 ≤ L := by linarith + have hkpow : (1 : ℝ) ≤ (k : ℝ) ^ 4 := one_le_pow₀ (by exact_mod_cast hk) + have hLL : L ≤ (k : ℝ) ^ 4 * L := by nlinarith only [hkpow, hL0] + have hhalf := spectatorBulkCount_half k L (show 4 ≤ (k : ℝ) ^ 4 * L by linarith) + have hLm : L ≤ 2 * (m : ℝ) := by dsimp only [m]; linarith + have hcost : cost ≤ Real.exp (2 * A * m) := by + apply (movingPattern_total_cost_le_exp n Cprior L hCprior (by linarith)).trans + apply Real.exp_le_exp.mpr + change A * L ≤ 2 * A * m + nlinarith only [hLm, hA] + have hcard : (Fintype.card (FrequencyTree (S × S) n) : ℝ) ≤ Real.exp (B * m) := by + rw [pairedFrequencyTree_card, Nat.cast_pow] + exact frequency_history_pair_card_bound S n Cfreq m hS + have hgain : cost * (Fintype.card (FrequencyTree (S × S) n) : ℝ) * + Real.exp (-goodPatternGain n Cprior Cfreq gain * m) ≤ Real.exp (-gain * m) := by + apply (mul_le_mul_of_nonneg_right + (mul_le_mul hcost hcard (Nat.cast_nonneg _) (Real.exp_nonneg _)) (Real.exp_nonneg _)).trans_eq + rw [← Real.exp_add, ← Real.exp_add] + congr 1 + dsimp only [goodPatternGain, A, B] + ring + have hsum : ‖∑ s, ∑ t, R s t‖ ≤ + cost * (Fintype.card (FrequencyTree (S × S) n) : ℝ) * + (Real.exp (-goodPatternGain n Cprior Cfreq gain * m) + err) := by + have hs (s : Setoid (Bool × MovingSampleIndex n)) : + ‖∑ t, R s t‖ ≤ + ((Fintype.card (FrequencyTree (S × S) n) : ℝ) * + (Real.exp (-goodPatternGain n Cprior Cfreq gain * m) + err)) * + ((2 : ℝ) ^ Fintype.card (Quotient s) * + (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) := by + apply (norm_sum_le_of_le _ (fun t _ => hR s t)).trans_eq + rw [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + dsimp only [err] + ring + have hh := movingPattern_error_sum_le n (Real.exp (Cprior * L)) + ((Fintype.card (FrequencyTree (S × S) n) : ℝ) * + (Real.exp (-goodPatternGain n Cprior Cfreq gain * m) + err)) + (Real.exp_nonneg _) (by dsimp only [err]; positivity) (fun s => ∑ t, R s t) hs + exact hh.trans_eq (by dsimp only [cost]; ring) + have he : cost * (Fintype.card (FrequencyTree (S × S) n) : ℝ) * err ≤ + 5 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := herrors S hS + calc + _ ≤ _ := hsum + _ = cost * (Fintype.card (FrequencyTree (S × S) n) : ℝ) * + Real.exp (-goodPatternGain n Cprior Cfreq gain * m) + + cost * (Fintype.card (FrequencyTree (S × S) n) : ℝ) * err := by ring + _ ≤ _ := add_le_add hgain he + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticHistoryLines.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticHistoryLines.lean new file mode 100644 index 0000000000000000000000000000000000000000..223618e070be9d93409275b426aaaed2516416a6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticHistoryLines.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Characters.PolynomialLineBounds +import OAI.NumberTheory.Ostmann.Characters.PolynomialAncestorNonvanishing + +namespace OAI + +/-! # The line tests produced by concrete ancestor histories -/ + +namespace Ostmann + +noncomputable def historyLine {σ : Type*} (steps : List (PolynomialReversal σ)) + (v w : MvPolynomial σ ℤ) : PolynomialGiantLine σ := + (polynomialAncestorRows steps).numeratorLine v w + +theorem historyLine_degree {σ : Type*} (steps : List (PolynomialReversal σ)) + (v w : MvPolynomial σ ℤ) (k d : ℕ) (hlen : steps.length ≤ k) + (hs : ∀ s ∈ steps, s.v.totalDegree ≤ d ∧ s.w.totalDegree ≤ d ∧ s.u.totalDegree ≤ d) + (hv : v.totalDegree ≤ d) (hw : w.totalDegree ≤ d) : + (historyLine steps v w).a.totalDegree ≤ (k + 1) * d ∧ + (historyLine steps v w).b.totalDegree ≤ (k + 1) * d := by + have h := PolynomialGiantRows.numeratorLine_degree_le (polynomialAncestorRows steps) + v w (steps.length * d) d (polynomialAncestorRows_degree steps d hs) hv hw + have hn : steps.length * d + d ≤ (k + 1) * d := by nlinarith + exact ⟨h.1.trans hn, h.2.trans hn⟩ + +theorem historyLine_value {σ : Type*} (steps : List (PolynomialReversal σ)) + (v w : MvPolynomial σ ℤ) (φ : MvPolynomial σ ℤ →+* ℝ) + (k : ℕ) (U : ℝ) (hU : 1 ≤ U) (hlen : steps.length ≤ k) + (hs : ∀ s ∈ steps, |φ s.v| ≤ U ∧ |φ s.w| ≤ U ∧ |φ s.u| ≤ U) + (hv : |φ v| ≤ U) (hw : |φ w| ≤ U) : + |φ (historyLine steps v w).a| ≤ (2 * U) ^ (k + 1) ∧ + |φ (historyLine steps v w).b| ≤ (2 * U) ^ (k + 1) := by + have hU0 : 0 ≤ U := by linarith + have h := PolynomialGiantRows.numeratorLine_value_le (polynomialAncestorRows steps) + v w φ ((2 * U) ^ steps.length) U hU0 (polynomialAncestorRows_value steps φ U hU0 hs) hv hw + have hp : 2 * U * (2 * U) ^ steps.length ≤ (2 * U) ^ (k + 1) := by + calc + _ = (2 * U) ^ (steps.length + 1) := by rw [pow_succ]; ring + _ ≤ _ := by gcongr; linarith + exact ⟨h.1.trans hp, h.2.trans hp⟩ + +theorem historyLine_vars_subset {σ : Type*} [DecidableEq σ] + (steps : List (PolynomialReversal σ)) (v w : MvPolynomial σ ℤ) (S : Finset σ) + (hs : ∀ s ∈ steps, s.v.vars ⊆ S ∧ s.w.vars ⊆ S ∧ s.u.vars ⊆ S) + (hv : v.vars ⊆ S) (hw : w.vars ⊆ S) : + (historyLine steps v w).a.vars ⊆ S ∧ (historyLine steps v w).b.vars ⊆ S := + PolynomialGiantRows.numeratorLine_vars_subset _ v w S + (polynomialAncestorRows_usesOnly steps S hs) hv hw + +theorem historyLine_denominator_ne_zero {σ K : Type*} [Field K] + (steps : List (PolynomialReversal σ)) (v w : MvPolynomial σ ℤ) + (φ : MvPolynomial σ ℤ →+* K) (hs : ∀ s ∈ steps, φ s.u ≠ 0) : + φ (historyLine steps v w).denominator ≠ 0 := + polynomialAncestorRows_denominator_ne_zero steps φ hs + +theorem historyLine_nonzero {σ K : Type*} [Field K] + (steps : List (PolynomialReversal σ)) (v w : MvPolynomial σ ℤ) + (φ : MvPolynomial σ ℤ →+* K) + (hs : ∀ s ∈ steps, φ s.v ≠ 0 ∧ φ s.w ≠ 0 ∧ φ s.u ≠ 0) + (hv : φ v ≠ 0) (hw : φ w ≠ 0) : + φ (historyLine steps v w).a ≠ 0 ∨ φ (historyLine steps v w).b ≠ 0 := by + have hn := polynomialAncestorRows_numeratorLine_nonzero steps φ hs v w hv hw + have hd := historyLine_denominator_ne_zero steps v w φ (fun s hs' => (hs s hs').2.2) + have hz := (historyLine steps v w).normalized_zero_iff φ hd + exact hn.imp (fun h h₀ => h (hz.1.mpr h₀)) (fun h h₀ => h (hz.2.mpr h₀)) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticHistorySupportSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticHistorySupportSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..42629c0ba8e4becf781260cef6203071a60732d5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticHistorySupportSum.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyTreeNodes + +namespace OAI + +/-! # Summing the original two-history congruence support over frequencies -/ + +namespace Ostmann + +open scoped BigOperators Classical + +theorem gcd_frequency_divisor_bound (S : Finset ℤ) (N : ℕ) (D : ℝ) + (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (v : ℤ) (hv : v ∈ S) (w : ℤ) (_hw : w ∈ S) : + ((v.natAbs.gcd w.natAbs).divisors.card : ℝ) ≤ D := by + have hv0 : 0 < v.natAbs := Int.natAbs_pos.mpr (hS v hv).1 + have hN : 0 < N := hv0.trans_le (hS v hv).2 + apply hdiv + · exact Nat.ne_of_gt (Nat.gcd_pos_of_pos_left _ hv0) + · calc + _ ≤ v.natAbs := Nat.gcd_le_left _ hv0 + _ ≤ N := (hS v hv).2 + _ ≤ N ^ 2 := by simpa only [pow_two] using Nat.le_mul_of_pos_right N hN + +/-- The bulk residue variables are still sampled from the original Haar +law. Data at each node depend only on earlier split products; the only +extra weights are the restrictions on the leaf frequencies. -/ +theorem arithmetic_history_support_sum_le {Q : ℕ} [NeZero Q] + (S : Finset ℤ) (N V n : ℕ) (D : ℝ) (hD : 0 ≤ D) + (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (P : FrequencyTree (S × S) n → (ZMod Q)ˣ) + (data : FrequencyTree (S × S) n → List (ZMod Q)ˣ → + Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) + (hmatch : ∀ t past d e, data t past = some (d, e) → + d.hasFrequencies (treeNodeFrequencies S n t past.length).1 ∧ + e.hasFrequencies (treeNodeFrequencies S n t past.length).2) : + (∑ t : FrequencyTree (S × S) n, + frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((Fintype.card (TreeLeafFiber (ZMod Q)ˣ n (P t)) : ℝ)⁻¹ * + ∑ x : TreeLeafFiber (ZMod Q)ˣ n (P t), + sequentialSupport (fun past y => arithmeticPairSplitTest (data t past) y) [] + (2 ^ n - 1) (treeLeafSplitEquiv n (P t) x))) ≤ + (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * (2 * (V : ℝ)) ^ (2 * 2 ^ n) := by + apply le_trans _ (arithmetic_frequency_tree_sum_le S N V D hD hS + (gcd_frequency_divisor_bound S N D hS hdiv) n) + apply Finset.sum_le_sum + intro t _ + have hlocal := arithmetic_leaf_support_fixed_frequencies (data t) (treeNodeFrequencies S n t) + D hD (hmatch t) (treeNodeFrequencies_divisor_bound S N D hD hS hdiv n t) n (P t) + have hprod : (∏ j ∈ Finset.range (2 ^ n - 1), + pairFrequencySupportBound D (treeNodeFrequencies S n t j)) = + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + rw [← frequencySplitList_length S n t] + exact prod_range_list_getD _ _ _ + rw [hprod] at hlocal + calc + _ ≤ frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := + mul_le_mul_of_nonneg_left hlocal (frequencyLeafWeight_nonneg _ + (fun _ => by unfold pairedFrequencyLeaf; split_ifs <;> norm_num) n t) + _ = _ := by rw [frequencyTreeWeight_eq_splitList]; ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticIntegerComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticIntegerComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb5a3d333c89253ef1fbacfc3cf36e4848c97e6e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticIntegerComparison.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Characters.IntegerPolynomialBounds +import OAI.NumberTheory.Ostmann.Arithmetic.SymbolicLineComparison + +namespace OAI + +/-! # Signed arithmetic comparison for actual integer polynomial tests -/ + +namespace Ostmann + +open scoped BigOperators + +noncomputable def integerTestValue {A : Type*} {n : ℕ} (value : A → ℤ) + (F : MvPolynomial (Fin n) ℤ) (x : Fin n → A) : ℤ := + MvPolynomial.eval₂Hom (RingHom.id ℤ) (fun j => value (x j)) F + +/-- The signed replacement estimate with all zero and divisor-count bridges +proved for the actual integer polynomial evaluations. -/ +theorem integer_polynomial_symbolic_comparison_le {A I : Type*} [Fintype A] [Fintype I] + {n : ℕ} (value : A → ℤ) (hinj : Function.Injective value) + (F : I → MvPolynomial (Fin n) ℤ) + (μ : Fin n → A → ℝ) (hμ : ∀ i a, 0 ≤ μ i a) + (hmass : ∀ i, ∑ a, μ i a = 1) + (α : ℝ) (hα : 0 ≤ α) (hmax : ∀ i a, μ i a ≤ α) + (P : Finset ℕ) (hprime : ∀ p ∈ P, p.Prime) + (ν : ℕ → ℝ) (hν : ∀ p ∈ P, 0 ≤ ν p) (hνmass : ∑ p ∈ P, ν p = 1) + (β V H : ℝ) (hβ : 0 ≤ β) (hV : 0 < V) (hH : 1 ≤ H) + (hνmax : ∀ p ∈ P, ν p ≤ β) (hsize : ∀ p ∈ P, V ≤ Real.log (p : ℝ)) + (hvalue : ∀ i x, |(integerTestValue value (F i) x : ℝ)| ≤ H) + (Ψ : (Fin n → A) → ℕ → (I → Bool) → ℂ) + (B : ℝ) (hB : 0 ≤ B) (hΨ : ∀ x p v, ‖Ψ x p v‖ ≤ B) : + ‖∑ x, ∑ p ∈ P, ((productPrior μ x * ν p : ℝ) : ℂ) * + (Ψ x p (fun i => arithmeticTestFlag (p ∣ (integerTestValue value (F i) x).natAbs)) - + Ψ x p (fun i => arithmeticTestFlag (F i = 0)))‖ ≤ + 2 * B * ∑ i, (((F i).totalDegree : ℝ) * α + (Real.log H / V) * β) := by + classical + let Q : I → MvPolynomial (Fin n) ℚ := fun i => MvPolynomial.map (Int.castRingHom ℚ) (F i) + let N : I → (Fin n → A) → ℕ := fun i x => (integerTestValue value (F i) x).natAbs + have hzero (i : I) (x : Fin n → A) : N i x = 0 ↔ + MvPolynomial.eval (fun j => (value (x j) : ℚ)) (Q i) = 0 := by + dsimp only [N, Q, integerTestValue] + rw [integerPolynomial_rational_eval] + simp only [Int.natAbs_eq_zero, Int.cast_eq_zero] + have hcard (i : I) (x : Fin n → A) (hx : N i x ≠ 0) : + ((P.filter fun p => p ∣ N i x).card : ℝ) ≤ Real.log H / V := by + have hz : integerTestValue value (F i) x ≠ 0 := by + intro hz + apply hx + simp only [N, hz, Int.natAbs_zero] + exact int_prime_divisor_card_le P _ hz hprime V H hV hsize (hvalue i x) + have hk : 0 ≤ Real.log H / V := div_nonneg (Real.log_nonneg hH) hV.le + have h := polynomial_symbolic_comparison_le (fun a => (value a : ℚ)) + (Int.cast_injective.comp hinj) Q μ hμ hmass α hα hmax P ν hν hνmass N hzero + β (Real.log H / V) hβ hk hνmax hcard Ψ B hB hΨ + have hflag (i : I) : arithmeticTestFlag (Q i = 0) = arithmeticTestFlag (F i = 0) := + congrArg arithmeticTestFlag (propext (integerPolynomial_rational_zero_iff (F i))) + have hdegree (i : I) : (Q i).totalDegree = (F i).totalDegree := + integerPolynomial_rational_degree (F i) + simpa only [hflag, hdegree, N] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLifts.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLifts.lean new file mode 100644 index 0000000000000000000000000000000000000000..85605a4901ba019df46e4c5f818fcd02bdb17c1d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLifts.lean @@ -0,0 +1,157 @@ +import Mathlib.Data.Fintype.BigOperators +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticLines + +namespace OAI + +/-! # Uniform lifts of a nonzero line modulo a prime square + +The reduction map has exactly `p` lifts over every residue. A line with a +unit coefficient has exactly `p` zero lifts among the `p²` pairs over a +fixed solution modulo `p`. This is the relative `1/p` loss in §8. +-/ + +namespace Ostmann + +open scoped BigOperators + +/-- Translate an additive fiber to the zero fiber. -/ +def additiveFiberEquiv {G H : Type*} [AddGroup G] [AddGroup H] + (φ : G →+ H) (x : G) : {y : G // φ y = φ x} ≃ {y : G // φ y = 0} where + toFun y := ⟨y - x, by simp [y.property]⟩ + invFun y := ⟨y + x, by simp [y.property]⟩ + left_inv y := by ext; simp + right_inv y := by ext; simp + +/-- Every fiber of a surjective homomorphism between finite additive groups +has the same size. -/ +theorem card_additiveFiber {G H : Type*} [AddGroup G] [AddGroup H] + [Fintype G] [Fintype H] [DecidableEq H] + (φ : G →+ H) (hφ : Function.Surjective φ) (a : H) : + Fintype.card G = Fintype.card H * Fintype.card {y : G // φ y = a} := by + have hsame (b : H) : Fintype.card {y : G // φ y = b} = + Fintype.card {y : G // φ y = a} := by + obtain ⟨x, rfl⟩ := hφ a + obtain ⟨y, rfl⟩ := hφ b + exact Fintype.card_congr ((additiveFiberEquiv φ y).trans (additiveFiberEquiv φ x).symm) + calc + _ = Fintype.card (Σ b : H, {y : G // φ y = b}) := + (Fintype.card_congr (Equiv.sigmaFiberEquiv φ)).symm + _ = ∑ b : H, Fintype.card {y : G // φ y = b} := Fintype.card_sigma + _ = _ := by simp only [hsame, Finset.sum_const, Finset.card_univ, smul_eq_mul] + +/-- The actual reduction map modulo a prime. -/ +def squareReduction (p : ℕ) : ZMod (p ^ 2) →+* ZMod p := + ZMod.castHom (dvd_pow_self p (by decide : 2 ≠ 0)) (ZMod p) + +@[simp] theorem squareReduction_natCast (p n : ℕ) : + squareReduction p (n : ZMod (p ^ 2)) = (n : ZMod p) := map_natCast _ _ + +theorem card_squareReduction_fiber {p : ℕ} [Fact p.Prime] (a : ZMod p) : + Fintype.card {x : ZMod (p ^ 2) // squareReduction p x = a} = p := by + have h := card_additiveFiber (squareReduction p).toAddMonoidHom + (ZMod.castHom_surjective (dvd_pow_self p (by decide : 2 ≠ 0))) a + simp only [ZMod.card] at h + exact Nat.eq_of_mul_eq_mul_left (Fact.out : p.Prime).pos (h.symm.trans (pow_two p)) + +/-- A prime-square residue is a unit exactly when its reduction is nonzero. -/ +theorem isUnit_square_iff {p : ℕ} [Fact p.Prime] (x : ZMod (p ^ 2)) : + IsUnit x ↔ squareReduction p x ≠ 0 := by + constructor + · intro hx + exact (hx.map (squareReduction p)).ne_zero + · intro hx + have hv : squareReduction p x = (x.val : ZMod p) := by + have h := congrArg (squareReduction p) (ZMod.natCast_zmod_val x) + simpa only [map_natCast] using h.symm + have hc : x.val.Coprime p := (ZMod.isUnit_iff_coprime _ _).mp + (isUnit_iff_ne_zero.mpr (hv ▸ hx)) + have hunit : IsUnit (x.val : ZMod (p ^ 2)) := + (ZMod.isUnit_iff_coprime _ _).mpr (hc.pow_right 2) + simpa only [ZMod.natCast_zmod_val] using hunit + +/-- Above a nonzero residue every lift is a unit; passing to Haar-unit +coordinates leaves the same `p` uniformly weighted lifts. -/ +noncomputable def squareUnitLiftEquiv {p : ℕ} [Fact p.Prime] + (a : ZMod p) (ha : a ≠ 0) : + {u : (ZMod (p ^ 2))ˣ // squareReduction p u = a} ≃ + {x : ZMod (p ^ 2) // squareReduction p x = a} where + toFun u := ⟨u.1, u.property⟩ + invFun x := by + have hred : squareReduction p (x : ZMod (p ^ 2)) ≠ 0 := by + rw [x.property] + exact ha + have hu : IsUnit (x : ZMod (p ^ 2)) := + (isUnit_square_iff (p := p) (x : ZMod (p ^ 2))).mpr hred + exact ⟨hu.unit, by simpa only [IsUnit.unit_spec] using x.property⟩ + left_inv u := by + apply Subtype.ext + apply Units.ext + exact IsUnit.unit_spec _ + right_inv x := by + apply Subtype.ext + dsimp only + exact IsUnit.unit_spec _ + +theorem card_squareUnitLift {p : ℕ} [Fact p.Prime] (a : ZMod p) (ha : a ≠ 0) : + Fintype.card {u : (ZMod (p ^ 2))ˣ // squareReduction p u = a} = p := by + rw [Fintype.card_congr (squareUnitLiftEquiv a ha), card_squareReduction_fiber] + +/-- In both giant environments the second residue is a unit. A nonzero +row vanishing there must have a unit first coefficient. -/ +theorem square_line_first_isUnit {p : ℕ} [Fact p.Prime] + (a b : ZMod (p ^ 2)) (x₀ y₀ : ZMod p) (hy : y₀ ≠ 0) + (hrow : squareReduction p a ≠ 0 ∨ squareReduction p b ≠ 0) + (hbase : squareReduction p a * x₀ + squareReduction p b * y₀ = 0) : + IsUnit a := by + apply (isUnit_square_iff a).mpr + intro ha + have hb := hrow.resolve_left (not_not.mpr ha) + exact line_zero_first_coefficient (squareReduction p b) x₀ y₀ hb hy (ha ▸ hbase) + +private theorem unit_linear_solution {R : Type*} [CommRing R] + (a : Rˣ) (b x y : R) (h : (a : R) * x + b * y = 0) : + x = -(a⁻¹ : Rˣ) * b * y := by + have he := congrArg (fun z : R => (a⁻¹ : Rˣ) * z) h + simp only [mul_add, ← mul_assoc, Units.inv_mul, one_mul, mul_zero] at he + linear_combination he + +/-- A line with a unit first coefficient has one zero lift for each lift of +the second coordinate, over any fixed solution in the quotient. -/ +def liftedLineEquiv {R K : Type*} [CommRing R] [CommRing K] + (φ : R →+* K) (a : Rˣ) (b : R) (x₀ y₀ : K) + (hbase : φ a * x₀ + φ b * y₀ = 0) : + {xy : R × R // φ xy.1 = x₀ ∧ φ xy.2 = y₀ ∧ (a : R) * xy.1 + b * xy.2 = 0} ≃ + {y : R // φ y = y₀} where + toFun xy := ⟨xy.1.2, xy.property.2.1⟩ + invFun y := ⟨(-(a⁻¹ : Rˣ) * b * y, y), by + refine ⟨?_, y.property, ?_⟩ + · have he := unit_linear_solution (Units.map φ.toMonoidHom a) (φ b) x₀ y₀ hbase + change x₀ = -φ (↑(a⁻¹)) * φ b * y₀ at he + simpa only [map_mul, map_neg, y.property] using he.symm + · simp [mul_assoc]⟩ + left_inv xy := by + apply Subtype.ext + apply Prod.ext + · exact (unit_linear_solution a b xy.1.1 xy.1.2 xy.property.2.2).symm + · rfl + right_inv y := rfl + +/-- Exactly one out of `p` uniform pairs of lifts makes the line vanish +modulo `p²`, conditional on its vanishing modulo `p`. -/ +theorem square_line_lift_probability {p : ℕ} [Fact p.Prime] + (a : (ZMod (p ^ 2))ˣ) (b : ZMod (p ^ 2)) (x₀ y₀ : ZMod p) + (hbase : squareReduction p a * x₀ + squareReduction p b * y₀ = 0) : + (Fintype.card {xy : ZMod (p ^ 2) × ZMod (p ^ 2) // + squareReduction p xy.1 = x₀ ∧ squareReduction p xy.2 = y₀ ∧ + (a : ZMod (p ^ 2)) * xy.1 + b * xy.2 = 0} : ℝ) / + ((Fintype.card {x : ZMod (p ^ 2) // squareReduction p x = x₀} : ℝ) * + (Fintype.card {y : ZMod (p ^ 2) // squareReduction p y = y₀} : ℝ)) = + (p : ℝ)⁻¹ := by + rw [Fintype.card_congr (liftedLineEquiv (squareReduction p) a b x₀ y₀ hbase)] + simp only [card_squareReduction_fiber] + have hp : (p : ℝ) ≠ 0 := by exact_mod_cast (Fact.out : p.Prime).ne_zero + field_simp + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..c5545c2877fa75d4e2422444dcc6f7801f5eebc1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineComparison.lean @@ -0,0 +1,122 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticLineIntegration + +namespace OAI + +/-! # Signed symbolic replacement for the actual integrated line factors -/ + +namespace Ostmann + +open scoped BigOperators Classical + +noncomputable def integerLineReduction {A : Type*} {n : ℕ} (value : A → ℤ) + (x : Fin n → A) (p : ℕ) : MvPolynomial (Fin n) ℤ →+* ZMod p := + MvPolynomial.eval₂Hom (Int.castRingHom (ZMod p)) (fun j => (value (x j) : ZMod p)) + +noncomputable def sampledLineProbability {A J : Type*} {n : ℕ} (value : A → ℤ) + (L : J → PolynomialGiantLine (Fin n)) (external : Bool) + (P : Finset ℕ) (hprime : ∀ p ∈ P, p.Prime) (x : Fin n → A) (p : P) : ℝ := + let _ : Fact p.val.Prime := ⟨hprime p p.property⟩ + internalLineProbability external (fun j => ((L j).normalized (integerLineReduction value x p)).1) + (fun j => ((L j).normalized (integerLineReduction value x p)).2) + +theorem sampledLineProbability_eq_flagWeight {A J : Type*} {n : ℕ} (value : A → ℤ) + (L : J → PolynomialGiantLine (Fin n)) (i : J) (external : Bool) + (P : Finset ℕ) (hprime : ∀ p ∈ P, p.Prime) (x : Fin n → A) (p : P) + (hd : ∀ j, integerLineReduction value x p (L j).denominator ≠ 0) + (hrow : integerLineReduction value x p (L i).a ≠ 0 ∨ + integerLineReduction value x p (L i).b ≠ 0) : + sampledLineProbability value L external P hprime x p = + internalLineFlagWeight external p (fun s => arithmeticTestFlag + (p.val ∣ (integerTestValue value (lineTestPolynomials L i s) x).natAbs)) := by + let _ : Fact p.val.Prime := ⟨hprime p p.property⟩ + have hr : ((L i).normalized (integerLineReduction value x p)).1 ≠ 0 ∨ + ((L i).normalized (integerLineReduction value x p)).2 ≠ 0 := by + have hz := (L i).normalized_zero_iff (integerLineReduction value x p) (hd i) + exact hrow.imp (fun h h₀ => h (hz.1.mp h₀)) (fun h h₀ => h (hz.2.mp h₀)) + unfold sampledLineProbability + rw [internalLineProbability_eq_flags external L i _ hd hr] + change internalLineFlagWeight external p (fun s => arithmeticTestFlag + (MvPolynomial.eval₂Hom (Int.castRingHom (ZMod p.val)) + (fun j => (value (x j) : ZMod p.val)) (lineTestPolynomials L i s) = 0)) = _ + rw [line_divisibility_flags_eq value L i x p.val] + +/-- Keep the amplitude, including the spectator factors, signed while replacing +the coefficient and rank flags of one internal prime. -/ +theorem integer_line_flag_comparison_le {A J : Type*} [Fintype A] [Fintype J] + {n : ℕ} (value : A → ℤ) (hinj : Function.Injective value) + (L : J → PolynomialGiantLine (Fin n)) (i : J) (external : Bool) + (μ : Fin n → A → ℝ) (hμ : ∀ j a, 0 ≤ μ j a) + (hmass : ∀ j, ∑ a, μ j a = 1) + (α : ℝ) (hα : 0 ≤ α) (hmax : ∀ j a, μ j a ≤ α) + (P : Finset ℕ) (hprime : ∀ p ∈ P, p.Prime) + (ν : ℕ → ℝ) (hν : ∀ p ∈ P, 0 ≤ ν p) (hνmass : ∑ p ∈ P, ν p = 1) + (β V H : ℝ) (hβ : 0 ≤ β) (hV : 0 < V) (hH : 1 ≤ H) + (hνmax : ∀ p ∈ P, ν p ≤ β) (hsize : ∀ p ∈ P, V ≤ Real.log (p : ℝ)) + (hvalue : ∀ s x, |(integerTestValue value (lineTestPolynomials L i s) x : ℝ)| ≤ H) + (F : (Fin n → A) → ℕ → ℂ) (B : ℝ) (hB : 0 ≤ B) (hF : ∀ x p, ‖F x p‖ ≤ B) : + ‖∑ x, ∑ p ∈ P, ((productPrior μ x * ν p : ℝ) : ℂ) * F x p * + ((internalLineFlagWeight external p (fun s => arithmeticTestFlag + (p ∣ (integerTestValue value (lineTestPolynomials L i s) x).natAbs)) : ℂ) - + (internalLineFlagWeight external p + (fun s => arithmeticTestFlag (lineTestPolynomials L i s = 0)) : ℂ))‖ ≤ + 2 * B * ∑ s, (((lineTestPolynomials L i s).totalDegree : ℝ) * α + + (Real.log H / V) * β) := by + let Ψ : (Fin n → A) → ℕ → (Bool ⊕ J → Bool) → ℂ := + fun x p flags => F x p * (internalLineFlagWeight external p flags : ℂ) + have hΨ (x : Fin n → A) (p : ℕ) (flags : Bool ⊕ J → Bool) : ‖Ψ x p flags‖ ≤ B := by + dsimp only [Ψ] + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg + (internalLineFlagWeight_nonneg external p flags)] + calc + _ ≤ ‖F x p‖ * 1 := mul_le_mul_of_nonneg_left + (internalLineFlagWeight_le_one external p flags) (norm_nonneg _) + _ ≤ B := by simpa using hF x p + have h := integer_polynomial_symbolic_comparison_le value hinj (lineTestPolynomials L i) + μ hμ hmass α hα hmax P hprime ν hν hνmass β V H hβ hV hH hνmax hsize hvalue + Ψ B hB hΨ + simpa only [Ψ, mul_sub, mul_assoc] using h + +/-- The same estimate expressed using the actual simultaneous line counts. +No rank, feasibility, or probability formula is assumed. -/ +theorem sampled_line_probability_comparison_le {A J : Type*} [Fintype A] [Fintype J] + {n : ℕ} (value : A → ℤ) (hinj : Function.Injective value) + (L : J → PolynomialGiantLine (Fin n)) (i : J) (external : Bool) + (μ : Fin n → A → ℝ) (hμ : ∀ j a, 0 ≤ μ j a) + (hmass : ∀ j, ∑ a, μ j a = 1) + (α : ℝ) (hα : 0 ≤ α) (hmax : ∀ j a, μ j a ≤ α) + (P : Finset ℕ) (hprime : ∀ p ∈ P, p.Prime) + (ν : ℕ → ℝ) (hν : ∀ p ∈ P, 0 ≤ ν p) (hνmass : ∑ p ∈ P, ν p = 1) + (β V H : ℝ) (hβ : 0 ≤ β) (hV : 0 < V) (hH : 1 ≤ H) + (hνmax : ∀ p ∈ P, ν p ≤ β) (hsize : ∀ p ∈ P, V ≤ Real.log (p : ℝ)) + (hvalue : ∀ s x, |(integerTestValue value (lineTestPolynomials L i s) x : ℝ)| ≤ H) + (hd : ∀ (x : Fin n → A) (p : P) j, integerLineReduction value x p (L j).denominator ≠ 0) + (hrow : ∀ (x : Fin n → A) (p : P), + integerLineReduction value x p (L i).a ≠ 0 ∨ + integerLineReduction value x p (L i).b ≠ 0) + (F : (Fin n → A) → ℕ → ℂ) (B : ℝ) (hB : 0 ≤ B) (hF : ∀ x p, ‖F x p‖ ≤ B) : + ‖∑ x, ∑ p : P, ((productPrior μ x * ν p : ℝ) : ℂ) * F x p * + ((sampledLineProbability value L external P hprime x p : ℂ) - + (internalLineFlagWeight external p + (fun s => arithmeticTestFlag (lineTestPolynomials L i s = 0)) : ℂ))‖ ≤ + 2 * B * ∑ s, (((lineTestPolynomials L i s).totalDegree : ℝ) * α + + (Real.log H / V) * β) := by + have heq (x : Fin n → A) (p : P) := + sampledLineProbability_eq_flagWeight value L i external P hprime x p (hd x p) (hrow x p) + simp_rw [heq] + let term := fun x p => ((productPrior μ x * ν p : ℝ) : ℂ) * F x p * + ((internalLineFlagWeight external p (fun s => arithmeticTestFlag + (p ∣ (integerTestValue value (lineTestPolynomials L i s) x).natAbs)) : ℂ) - + (internalLineFlagWeight external p + (fun s => arithmeticTestFlag (lineTestPolynomials L i s = 0)) : ℂ)) + change ‖∑ x, ∑ p : P, term x p‖ ≤ _ + have hs : (∑ x, ∑ p : P, term x p) = ∑ x, ∑ p ∈ P, term x p := by + apply Finset.sum_congr rfl + intro x _ + exact (Finset.sum_subtype P (fun _ => Iff.rfl) (term x)).symm + rw [hs] + exact integer_line_flag_comparison_le value hinj L i external μ hμ hmass α hα hmax + P hprime ν hν hνmass β V H hβ hV hH hνmax hsize hvalue F B hB hF + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineIntegration.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineIntegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..6bd16cd8476a95cbc29c3622179dc6b401fce921 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLineIntegration.lean @@ -0,0 +1,105 @@ +import Mathlib.Data.Nat.Totient +import OAI.NumberTheory.Ostmann.Characters.PolynomialLineFlags + +namespace OAI + +/-! # Actual line integrals as bounded functions of the cleared polynomial tests -/ + +namespace Ostmann + +open scoped BigOperators Classical + +noncomputable def internalLineScalar (external : Bool) (p : ℕ) : ℝ := + ((if external then p else p - 1 : ℕ) : ℝ)⁻¹ + +theorem internalLineScalar_nonneg (external : Bool) (p : ℕ) : + 0 ≤ internalLineScalar external p := by + unfold internalLineScalar + positivity + +theorem internalLineScalar_le_one (external : Bool) (p : ℕ) : + internalLineScalar external p ≤ 1 := by + let n : ℕ := if external then p else p - 1 + change (n : ℝ)⁻¹ ≤ 1 + rcases Nat.eq_zero_or_pos n with h | h + · simp [h] + · exact inv_le_one_of_one_le₀ (by exact_mod_cast h) + +noncomputable def internalLineFlagWeight {J : Type*} (external : Bool) (p : ℕ) + (flags : Bool ⊕ J → Bool) : ℝ := + if lineFeasibleFlags external flags then internalLineScalar external p else 0 + +theorem internalLineFlagWeight_nonneg {J : Type*} (external : Bool) (p : ℕ) + (flags : Bool ⊕ J → Bool) : 0 ≤ internalLineFlagWeight external p flags := by + unfold internalLineFlagWeight + split_ifs + · exact internalLineScalar_nonneg external p + · rfl + +theorem internalLineFlagWeight_le_one {J : Type*} (external : Bool) (p : ℕ) + (flags : Bool ⊕ J → Bool) : internalLineFlagWeight external p flags ≤ 1 := by + unfold internalLineFlagWeight + split_ifs + · exact internalLineScalar_le_one external p + · norm_num + +/-- The normalized count before the giant variables are integrated out. -/ +noncomputable def internalLineProbability {J : Type*} {p : ℕ} [Fact p.Prime] + (external : Bool) (a b : J → ZMod p) : ℝ := + if external then + (Fintype.card {z : ZMod p × (ZMod p)ˣ // ∀ j, a j * z.1 + b j * z.2 = 0} : ℝ) / + Fintype.card (ZMod p × (ZMod p)ˣ) + else + (Fintype.card {z : (ZMod p)ˣ × (ZMod p)ˣ // ∀ j, a j * z.1 + b j * z.2 = 0} : ℝ) / + Fintype.card ((ZMod p)ˣ × (ZMod p)ˣ) + +theorem internalLineProbability_nonneg {J : Type*} {p : ℕ} [Fact p.Prime] + (external : Bool) (a b : J → ZMod p) : 0 ≤ internalLineProbability external a b := by + unfold internalLineProbability + split_ifs <;> positivity + +theorem external_lineSystem_integral_eq_flags {σ J : Type*} {p : ℕ} [Fact p.Prime] + (L : J → PolynomialGiantLine σ) (i : J) (φ : MvPolynomial σ ℤ →+* ZMod p) + (hd : ∀ j, φ (L j).denominator ≠ 0) + (hrow : ((L i).normalized φ).1 ≠ 0 ∨ ((L i).normalized φ).2 ≠ 0) : + (Fintype.card {z : ZMod p × (ZMod p)ˣ // + ∀ j, ((L j).normalized φ).1 * z.1 + ((L j).normalized φ).2 * z.2 = 0} : ℝ) / + Fintype.card (ZMod p × (ZMod p)ˣ) = + internalLineFlagWeight true p + (fun s => arithmeticTestFlag (φ (lineTestPolynomials L i s) = 0)) := by + rw [external_lineSystem_probability _ _ i hrow] + unfold internalLineFlagWeight + rw [external_polynomialLine_flags_iff L i φ hd] + rfl + +theorem unit_lineSystem_integral_eq_flags {σ J : Type*} {p : ℕ} [Fact p.Prime] + (L : J → PolynomialGiantLine σ) (i : J) (φ : MvPolynomial σ ℤ →+* ZMod p) + (hd : ∀ j, φ (L j).denominator ≠ 0) + (hrow : ((L i).normalized φ).1 ≠ 0 ∨ ((L i).normalized φ).2 ≠ 0) : + (Fintype.card {z : (ZMod p)ˣ × (ZMod p)ˣ // + ∀ j, ((L j).normalized φ).1 * z.1 + ((L j).normalized φ).2 * z.2 = 0} : ℝ) / + Fintype.card ((ZMod p)ˣ × (ZMod p)ˣ) = + internalLineFlagWeight false p + (fun s => arithmeticTestFlag (φ (lineTestPolynomials L i s) = 0)) := by + rw [unit_lineSystem_probability _ _ i hrow] + unfold internalLineFlagWeight + rw [unit_polynomialLine_flags_iff L i φ hd] + have hc : Fintype.card (ZMod p)ˣ = p - 1 := by + rw [ZMod.card_units_eq_totient, Nat.totient_prime (Fact.out : p.Prime)] + simp only [internalLineScalar, Bool.false_eq_true, ite_false, hc] + +theorem internalLineProbability_eq_flags {σ J : Type*} {p : ℕ} [Fact p.Prime] + (external : Bool) (L : J → PolynomialGiantLine σ) (i : J) + (φ : MvPolynomial σ ℤ →+* ZMod p) (hd : ∀ j, φ (L j).denominator ≠ 0) + (hrow : ((L i).normalized φ).1 ≠ 0 ∨ ((L i).normalized φ).2 ≠ 0) : + internalLineProbability external (fun j => ((L j).normalized φ).1) + (fun j => ((L j).normalized φ).2) = + internalLineFlagWeight external p + (fun s => arithmeticTestFlag (φ (lineTestPolynomials L i s) = 0)) := by + cases external + · exact unit_lineSystem_integral_eq_flags L i φ hd hrow + · exact external_lineSystem_integral_eq_flags L i φ hd hrow + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLines.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLines.lean new file mode 100644 index 0000000000000000000000000000000000000000..4364787e48c5631994364999d0a06f835da88026 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticLines.lean @@ -0,0 +1,97 @@ +import Mathlib.Algebra.Field.ZMod +import Mathlib.Data.Fintype.Prod +import Mathlib.Basic.Real.Basic +import Mathlib.Tactic.FieldSimp +import Mathlib.Tactic.LinearCombination + +namespace OAI + +/-! # Exact line counts in the ideal giant residues -/ + +namespace Ostmann + +open scoped BigOperators + +/-- A feasible line on two unit coordinates has one point for each second coordinate. -/ +def unitLineEquiv {G : Type*} [CommGroup G] (a b : G) : + {xy : G × G // a * xy.1 = b * xy.2} ≃ G where + toFun xy := xy.1.2 + invFun y := ⟨(a⁻¹ * b * y, y), by simp [mul_assoc]⟩ + left_inv xy := by + apply Subtype.ext + apply Prod.ext + · change a⁻¹ * b * xy.1.2 = xy.1.1 + rw [mul_assoc, ← xy.property] + simp + · rfl + right_inv _ := rfl + +theorem card_unitLine {G : Type*} [CommGroup G] [Fintype G] [DecidableEq G] (a b : G) : + Fintype.card {xy : G × G // a * xy.1 = b * xy.2} = Fintype.card G := + Fintype.card_congr (unitLineEquiv a b) + +/-- An external integer coordinate is unrestricted; the second coordinate is still a unit. -/ +noncomputable def externalLineEquiv {p : ℕ} [Fact p.Prime] + (a : (ZMod p)ˣ) (b : ZMod p) : + {xy : ZMod p × (ZMod p)ˣ // (a : ZMod p) * xy.1 = b * xy.2} ≃ (ZMod p)ˣ where + toFun xy := xy.1.2 + invFun y := ⟨(b / (a : ZMod p) * y, y), by field_simp⟩ + left_inv xy := by + apply Subtype.ext + apply Prod.ext + · change b / (a : ZMod p) * xy.1.2 = xy.1.1 + apply (mul_left_cancel₀ (Units.ne_zero a)) + calc + (a : ZMod p) * (b / (a : ZMod p) * xy.1.2) = b * xy.1.2 := by field_simp + _ = _ := xy.property.symm + · rfl + right_inv _ := rfl + +theorem card_externalLine {p : ℕ} [Fact p.Prime] + (a : (ZMod p)ˣ) (b : ZMod p) : + Fintype.card {xy : ZMod p × (ZMod p)ˣ // (a : ZMod p) * xy.1 = b * xy.2} = + Fintype.card (ZMod p)ˣ := + Fintype.card_congr (externalLineEquiv a b) + +theorem unitLine_probability {p : ℕ} [Fact p.Prime] (a b : (ZMod p)ˣ) : + (Fintype.card {xy : (ZMod p)ˣ × (ZMod p)ˣ // a * xy.1 = b * xy.2} : ℝ) / + (Fintype.card ((ZMod p)ˣ × (ZMod p)ˣ) : ℝ) = + (Fintype.card (ZMod p)ˣ : ℝ)⁻¹ := by + rw [card_unitLine, Fintype.card_prod, Nat.cast_mul] + have hU : (Fintype.card (ZMod p)ˣ : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + field_simp + +theorem externalLine_probability {p : ℕ} [Fact p.Prime] + (a : (ZMod p)ˣ) (b : ZMod p) : + (Fintype.card {xy : ZMod p × (ZMod p)ˣ // (a : ZMod p) * xy.1 = b * xy.2} : ℝ) / + (Fintype.card (ZMod p × (ZMod p)ˣ) : ℝ) = (p : ℝ)⁻¹ := by + rw [card_externalLine, Fintype.card_prod, ZMod.card, Nat.cast_mul] + have hU : (Fintype.card (ZMod p)ˣ : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + field_simp + +theorem independent_lines_no_unit_solution {K : Type*} [Field K] + (a b c d x y : K) (hdet : a * d - b * c ≠ 0) (hy : y ≠ 0) + (h₁ : a * x + b * y = 0) (h₂ : c * x + d * y = 0) : False := by + have he : (a * d - b * c) * y = 0 := by + linear_combination a * h₂ - c * h₁ + exact hy ((mul_eq_zero.mp he).resolve_left hdet) + +theorem line_zero_first_coefficient {K : Type*} [Field K] + (b x y : K) (hb : b ≠ 0) (hy : y ≠ 0) : ¬ (0 : K) * x + b * y = 0 := by + simpa only [zero_mul, zero_add] using mul_ne_zero hb hy + +/-- Vanishing two-by-two minors reduce all occurrence tests to one nonzero row. -/ +theorem dependent_lines_iff {K I : Type*} [Field K] + (a b : I → K) (i : I) (ha : a i ≠ 0) + (hdet : ∀ j, a i * b j - b i * a j = 0) (x y : K) : + (∀ j, a j * x + b j * y = 0) ↔ a i * x + b i * y = 0 := by + constructor + · exact fun h => h i + · intro h j + have he : a i * (a j * x + b j * y) = 0 := by + linear_combination a j * h + y * hdet j + exact (mul_eq_zero.mp he).resolve_left ha + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticNormRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticNormRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..89a1b5a230733f1a8ffe0bfe98c2c1e199a69f07 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticNormRate.lean @@ -0,0 +1,113 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.VariableModulusSupport + +namespace OAI + +/-! # The numerical rate after the actual arithmetic frequency sum -/ + +namespace Ostmann +open Filter + +/-- The divisor constant is chosen uniformly before the history-dependent +modulus. This is the numerical estimate used by the same-assignment norm. -/ +theorem arithmetic_frequency_budget_rate (n : ℕ) (K C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * C * m) → (q.divisors.card : ℝ) ≤ D) ∧ + ∀ N V : ℕ, ∀ Δ : ℝ, (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + Real.exp (-(2 ^ n : ℕ) * Δ + K) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n)) ≤ + Real.exp ((2 ^ n : ℕ) * Δ + ε * m) := by + let r : ℕ := 2 ^ n + have hr : (0 : ℝ) < r := by exact_mod_cast (Nat.two_pow_pos n) + let δ : ℝ := ε / (2 * r) + have hδ : 0 < δ := div_pos hε (by positivity) + have hδr : δ * r = ε / 2 := by dsimp [δ]; field_simp + obtain ⟨M, hM⟩ := leaf_frequency_budget_sublinear r K (ε / 8) (by positivity) + filter_upwards [frequency_budget_subexponential C δ hC hδ, + eventually_ge_atTop (M / 4), eventually_ge_atTop (0 : ℝ)] with m hrate hm hm0 + obtain ⟨D, hD, hdiv, hcost⟩ := hrate + refine ⟨D, hD, hdiv, ?_⟩ + intro N V Δ hN hV + have hC0 : 0 ≤ 8 * D ^ 4 * (1 + Real.log N) ^ 3 := by + have := Real.log_natCast_nonneg N + positivity + have hnode : (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) ≤ + Real.exp ((ε / 2) * m) := by + calc + _ ≤ Real.exp (δ * m) ^ (r - 1) := pow_le_pow_left₀ hC0 (hcost N hN) _ + _ = Real.exp ((r - 1 : ℕ) * (δ * m)) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := by + apply Real.exp_le_exp.mpr + have hcount : ((r - 1 : ℕ) : ℝ) ≤ r := by exact_mod_cast Nat.sub_le r 1 + have h := mul_le_mul_of_nonneg_right hcount (mul_nonneg hδ.le hm0) + nlinarith [hδr] + have hleaf : (2 * (V : ℝ)) ^ (2 * r) * Real.exp (-(r : ℝ) * Δ + K) ≤ + Real.exp ((r : ℝ) * Δ + (ε / 2) * m) := by + convert hM (4 * m) (by linarith) Δ V hV using 1 + congr 1 + ring + calc + _ = (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) * + ((2 * (V : ℝ)) ^ (2 * r) * Real.exp (-(r : ℝ) * Δ + K)) := by ring + _ ≤ Real.exp ((ε / 2) * m) * Real.exp ((r : ℝ) * Δ + (ε / 2) * m) := + mul_le_mul hnode hleaf (by positivity) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; dsimp [r]; congr 1; ring + +/-- There are `r*m` bulk Page factors and `m` spectators. Their combined +loss is exactly `2 * 6^(r*m)`, independently of the depth. -/ +theorem arithmetic_norm_page_spectator_cost (n m : ℕ) : + (2 : ℝ) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * m) = + 2 * Real.exp (Real.log 6 * (2 ^ n : ℕ) * m) := by + rw [mul_right_comm _ 2, ← mul_pow, show (2 : ℝ) * 3 = 6 by norm_num, mul_comm _ 2] + congr 1 + rw [show Real.log 6 * (2 ^ n : ℕ) * m = ((2 ^ n * m : ℕ) : ℝ) * Real.log 6 by + push_cast + ring, Real.exp_nat_mul, Real.exp_log (by norm_num : (0 : ℝ) < 6)] + +/-- Fixed profile constants are absorbed without changing the coefficient +`log 6` of the bulk cost. -/ +theorem arithmetic_norm_budget_rate (n : ℕ) (A C ε : ℝ) (hA : 0 ≤ A) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * C * m) → (q.divisors.card : ℝ) ≤ D) ∧ + ∀ N V : ℕ, ∀ Δ : ℝ, (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + (A * Real.exp (-(2 ^ n : ℕ) * Δ)) * + ((2 * Real.exp (Real.log 6 * (2 ^ n : ℕ) * m)) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n))) ≤ + Real.exp ((2 ^ n : ℕ) * Δ + Real.log 6 * (2 ^ n : ℕ) * m + ε * m) := by + let K := Real.log (2 * A + 1) + have hK : 2 * A ≤ Real.exp K := by + dsimp only [K] + rw [Real.exp_log (by positivity : 0 < 2 * A + 1)] + linarith + filter_upwards [arithmetic_frequency_budget_rate n K C ε hC hε] with m hm + obtain ⟨D, hD, hdiv, hcost⟩ := hm + refine ⟨D, hD, hdiv, ?_⟩ + intro N V Δ hN hV + have hb : 0 ≤ (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n) := by + have := Real.log_natCast_nonneg N + positivity + calc + _ = Real.exp (Real.log 6 * (2 ^ n : ℕ) * m) * + ((2 * A) * Real.exp (-(2 ^ n : ℕ) * Δ) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n))) := by ring + _ ≤ Real.exp (Real.log 6 * (2 ^ n : ℕ) * m) * + (Real.exp (-(2 ^ n : ℕ) * Δ + K) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n))) := by + apply mul_le_mul_of_nonneg_left _ (Real.exp_pos _).le + rw [Real.exp_add] + exact mul_le_mul_of_nonneg_right + ((mul_le_mul_of_nonneg_right hK (Real.exp_pos _).le).trans_eq (mul_comm _ _)) hb + _ ≤ Real.exp (Real.log 6 * (2 ^ n : ℕ) * m) * + Real.exp ((2 ^ n : ℕ) * Δ + ε * m) := + mul_le_mul_of_nonneg_left (hcost N V Δ hN hV) (Real.exp_pos _).le + _ = _ := by rw [← Real.exp_add]; congr 1; ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternErrorRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternErrorRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..97af208fc53d3aa05b531f48fc61dc64680daf31 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternErrorRate.lean @@ -0,0 +1,119 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternPriorRate +import OAI.NumberTheory.Ostmann.Construction.FinalHistoryCount + +namespace OAI + +/-! # The original pattern and frequency counts preserve the arithmetic error -/ + +namespace Ostmann +open Filter + +theorem pairedFrequencyTree_card (S : Finset ℤ) (n : ℕ) : + Fintype.card (FrequencyTree (S × S) n) = (Fintype.card (FrequencyTree S n)) ^ 2 := by + simp only [card_frequencyTree, Fintype.card_prod, pow_two, mul_pow] + +theorem movingPattern_frequency_error_rate (n k : ℕ) (hk : 0 < k) + (Cprior Cfreq α β : ℝ) (hCprior : 1 ≤ Cprior) (hCfreq : 0 ≤ Cfreq) + (hα : 0 < α) (hβα : β < α) : + ∀ᶠ L : ℝ in atTop, ∀ S : Finset ℤ, + (S.card : ℝ) ≤ Real.exp (Cfreq * spectatorBulkCount k L) → + ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) * Real.exp (-Real.exp (α * L)) ≤ + Real.exp (-Real.exp (β * L)) := by + let J := 4 * n * 2 ^ n + let A : ℝ := ((J ^ 2 + J : ℕ) : ℝ) * Cprior + let B : ℝ := (2 * (2 ^ (n + 1) - 1 : ℕ) : ℝ) * Cfreq + let H := A + B * (k : ℝ) ^ 4 + have hA : 0 ≤ A := by dsimp only [A]; positivity + have hB : 0 ≤ B := by dsimp only [B]; positivity + have hH : 0 ≤ H := by dsimp only [H]; positivity + filter_upwards [arithmetic_exponent_absorption 0 α β H 1 0 hα hα hβα (by norm_num), + eventually_ge_atTop (1 : ℝ)] with L hrate hL S hS + have hL0 : 0 ≤ L := by linarith + have hp := movingPattern_total_cost_le_exp n Cprior L hCprior hL + have hc := frequency_history_pair_card_bound S n Cfreq (spectatorBulkCount k L) hS + have hc' : (Fintype.card (FrequencyTree (S × S) n) : ℝ) ≤ + Real.exp (B * (k : ℝ) ^ 4 * L) := by + rw [pairedFrequencyTree_card, Nat.cast_pow] + apply hc.trans + apply Real.exp_le_exp.mpr + have hm := mul_le_mul_of_nonneg_left (spectatorBulkCount_upper k L hL0) hB + exact hm.trans_eq (by ring) + have hprod := mul_le_mul hp hc' (Nat.cast_nonneg _) (Real.exp_nonneg _) + have hexp : ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) ≤ Real.exp (H * L) := by + apply hprod.trans_eq + rw [← Real.exp_add] + congr 1 + dsimp only [H, A, J] + ring + apply (mul_le_mul_of_nonneg_right hexp (Real.exp_nonneg _)).trans + rw [← Real.exp_add] + apply Real.exp_le_exp.mpr + simp only [pow_zero, mul_one, zero_mul, Real.exp_zero, one_mul] at hrate + linarith + +/-- All three errors in the original-prior norm bound fit the final common +scale after the exact equality-pattern and two-history sums. -/ +theorem movingPattern_three_errors_rate (n k : ℕ) (hk : 0 < k) + (Cprior Cfreq : ℝ) (hCprior : 1 ≤ Cprior) (hCfreq : 0 ≤ Cfreq) : + ∀ᶠ L : ℝ in atTop, ∀ S : Finset ℤ, + (S.card : ℝ) ≤ Real.exp (Cfreq * spectatorBulkCount k L) → + ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) * + (Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 2 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L))) ≤ + 3 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + filter_upwards [movingPattern_frequency_error_rate n k hk Cprior Cfreq + (125 / 100000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num), + movingPattern_frequency_error_rate n k hk Cprior Cfreq + (2 / 1000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num)] + with L hfirst hsecond S hS + have h := add_le_add (hfirst S hS) (mul_le_mul_of_nonneg_left (hsecond S hS) + (by norm_num : (0 : ℝ) ≤ 2)) + nlinarith only [h] + +/-- The internal-prime comparison contributes one further error of the same +scale. All four errors survive both finite sums with a common saving. -/ +theorem movingPattern_four_errors_rate (n k : ℕ) (hk : 0 < k) + (Cprior Cfreq : ℝ) (hCprior : 1 ≤ Cprior) (hCfreq : 0 ≤ Cfreq) : + ∀ᶠ L : ℝ in atTop, ∀ S : Finset ℤ, + (S.card : ℝ) ≤ Real.exp (Cfreq * spectatorBulkCount k L) → + ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) * + (Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 3 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L))) ≤ + 4 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + filter_upwards [movingPattern_three_errors_rate n k hk Cprior Cfreq hCprior hCfreq, + movingPattern_frequency_error_rate n k hk Cprior Cfreq + (2 / 1000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num)] + with L hthree hone S hS + have h := add_le_add (hthree S hS) (hone S hS) + nlinarith only [h] + +/-- The literal giant comparison adds one further error to the two bulk and +one internal comparison errors. All five survive the exact finite sums. -/ +theorem movingPattern_five_errors_rate (n k : ℕ) (hk : 0 < k) + (Cprior Cfreq : ℝ) (hCprior : 1 ≤ Cprior) (hCfreq : 0 ≤ Cfreq) : + ∀ᶠ L : ℝ in atTop, ∀ S : Finset ℤ, + (S.card : ℝ) ≤ Real.exp (Cfreq * spectatorBulkCount k L) → + ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) * + (Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 4 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L))) ≤ + 5 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + filter_upwards [movingPattern_four_errors_rate n k hk Cprior Cfreq hCprior hCfreq, + movingPattern_frequency_error_rate n k hk Cprior Cfreq + (2 / 1000) (12 / 10000) hCprior hCfreq (by norm_num) (by norm_num)] + with L hfour hone S hS + have h := add_le_add (hfour S hS) (hone S hS) + nlinarith only [h] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternNormRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternNormRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..7f3d0f20b124816465f0c0d9de763e379bedfc4b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternNormRate.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternErrorRate +import OAI.NumberTheory.Ostmann.Arithmetic.PatternFrequencyNormSum + +namespace OAI + +/-! # The full numerical norm bound with the original equality patterns -/ + +namespace Ostmann +open Filter +open scoped Classical BigOperators + +/-- The actual pattern sum and paired frequency sum have an absolute bulk +constant. The cutoff includes the constructed bottom reserve `2 sqrt(m)`. +Only the genuine comparison errors use the full number of histories. -/ +theorem arithmetic_pattern_norm_rate (ψ : SchwartzMap ℝ ℂ) (n k : ℕ) + (hk : 0 < k) (hn : n ≤ k) (B Cfreq Cprior ε : ℝ) + (hCfreq : 0 ≤ Cfreq) (hCprior : 1 ≤ Cprior) (hε : 0 < ε) + (hdepth : 8 * Cprior ≤ (k : ℝ) ^ 3) : + ∀ᶠ L : ℝ in atTop, let m := spectatorBulkCount k L + ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * Cfreq * m) → + (q.divisors.card : ℝ) ≤ D) ∧ + ∀ (S : Finset ℤ) (N V : ℕ) (Δ err : ℝ), + (S.card : ℝ) ≤ Real.exp (Cfreq * m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + (N : ℝ) ≤ Real.exp (Cfreq * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + 0 ≤ err → err ≤ Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 3 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) → + let _ := sampleSetoidFintype (Bool × MovingSampleIndex n) + let K := ((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m) + ∀ R : Setoid (Bool × MovingSampleIndex n) → FrequencyTree (S × S) n → ℂ, + (∀ s t, ‖R s t‖ ≤ + ((2 : ℝ) ^ Fintype.card (Quotient s) * + (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) * + (err + K * (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod))) → + ‖∑ s, ∑ t, R s t‖ ≤ + Real.exp ((2 ^ n : ℕ) * Δ + (Real.log 12 + 1) * (2 ^ n : ℕ) * m + ε * m) + + 4 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + filter_upwards [arithmetic_prime_pattern_budget_rate ψ n k hk hn B Cfreq Cprior ε + hCfreq hCprior hε hdepth, + movingPattern_four_errors_rate n k hk Cprior Cfreq hCprior hCfreq] + with L hbudget herrors + dsimp only + obtain ⟨D, hD, hdiv, hbudget⟩ := hbudget + refine ⟨D, hD, hdiv, ?_⟩ + intro S N V Δ err hcard hS hN hV herr herrbound R hR + have hdivN : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D := by + intro q hq hqN + apply hdiv q hq + calc + (q : ℝ) ≤ (N : ℝ) ^ 2 := by exact_mod_cast hqN + _ ≤ (Real.exp (Cfreq * spectatorBulkCount k L)) ^ 2 := + pow_le_pow_left₀ (Nat.cast_nonneg N) hN 2 + _ = Real.exp (2 * Cfreq * spectatorBulkCount k L) := by + rw [← Real.exp_nat_mul] + congr 1 + ring + have hsum := pattern_frequency_norm_sum_le S n N V D (Real.exp (Cprior * L)) + (((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * spectatorBulkCount k L) * 4 * 3 ^ (2 ^ n * spectatorBulkCount k L)) * + 2 ^ (2 ^ n * spectatorBulkCount k L)) err hD (Real.exp_nonneg _) (by positivity) + herr hS hdivN R hR + have hcost := hbudget N V Δ hN hV + have he := (mul_le_mul_of_nonneg_left herrbound + (show 0 ≤ ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) by positivity)).trans (herrors S hcard) + apply hsum.trans + nlinarith only [hcost, he] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternPriorRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternPriorRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..dac3ad5db46d46fc7d28c061727604f5ad612388 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPatternPriorRate.lean @@ -0,0 +1,105 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternCostRate +import OAI.NumberTheory.Ostmann.Construction.SpectatorBulkScale +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPrimeNormRate + +namespace OAI + +/-! # A depth-independent cost for all original equality patterns -/ + +namespace Ostmann +open Filter + +/-- The original internal-prior cost has an absolute coefficient of `2^n m` +once the depth is chosen. The fixed pattern count is absorbed only as `L` +tends to infinity; no constant exponential in the depth is charged per slot. -/ +theorem movingPattern_prior_cost_rate (k : ℕ) (hk : 0 < k) + (C ε : ℝ) (hC : 1 ≤ C) (hε : 0 < ε) (hdepth : 8 * C ≤ (k : ℝ) ^ 3) : + ∀ᶠ L : ℝ in atTop, ∀ n : ℕ, n ≤ k → + (2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (C * L))) ^ (4 * n * 2 ^ n) ≤ + Real.exp ((2 ^ n : ℕ) * spectatorBulkCount k L + ε * spectatorBulkCount k L) := by + let J := 4 * k * 2 ^ k + let A : ℝ := (J ^ 2 : ℕ) * Real.log 2 + have hkR : 0 < (k : ℝ) := by exact_mod_cast hk + have hm := (spectatorBulkCount_tendsto k hk).eventually + (eventually_ge_atTop (A / ε)) + filter_upwards [hm, eventually_ge_atTop (1 : ℝ), + eventually_ge_atTop (4 / (k : ℝ) ^ 4)] with L hm hL hscale n hn + have hL0 : 0 ≤ L := by linarith + have hscale' : 4 ≤ (k : ℝ) ^ 4 * L := by + simpa only [mul_comm] using + (div_le_iff₀ (by positivity : 0 < (k : ℝ) ^ 4)).mp hscale + have hbulk := spectatorBulkCount_half k L hscale' + have hsmall : A ≤ ε * spectatorBulkCount k L := by + simpa only [mul_comm] using (div_le_iff₀ hε).mp hm + have hJ : 4 * n * 2 ^ n ≤ J := by + dsimp only [J] + exact Nat.mul_le_mul (Nat.mul_le_mul_left 4 hn) (Nat.pow_le_pow_right (by decide) hn) + have hcount : (((4 * n * 2 ^ n) ^ 2 : ℕ) : ℝ) * Real.log 2 ≤ A := by + apply mul_le_mul_of_nonneg_right _ (Real.log_nonneg (by norm_num)) + exact_mod_cast Nat.pow_le_pow_left hJ 2 + have hkc : 8 * C * (k : ℝ) ≤ (k : ℝ) ^ 4 := by + calc + _ ≤ (k : ℝ) ^ 3 * k := mul_le_mul_of_nonneg_right hdepth hkR.le + _ = _ := by ring + have hkcL := mul_le_mul_of_nonneg_right hkc hL0 + have hprior : 4 * (n : ℝ) * C * L ≤ (spectatorBulkCount k L : ℝ) := by + have hnR : (n : ℝ) ≤ k := by exact_mod_cast hn + have hnk := mul_le_mul_of_nonneg_right hnR (mul_nonneg (by linarith : 0 ≤ C) hL0) + nlinarith + have hprior' := mul_le_mul_of_nonneg_left hprior + (show (0 : ℝ) ≤ ((2 ^ n : ℕ) : ℝ) by positivity) + have hCL : 1 ≤ C * L := one_le_mul_of_one_le_of_one_le hC hL + have he : (2 : ℝ) ≤ Real.exp (C * L) := by linarith [Real.add_one_le_exp (C * L)] + rw [max_eq_right he, ← Real.exp_log (by norm_num : (0 : ℝ) < 2), + ← Real.exp_nat_mul, ← Real.exp_nat_mul, ← Real.exp_add] + apply Real.exp_le_exp.mpr + push_cast at hcount hprior' ⊢ + nlinarith + +/-- The retained numerical norm, including all original equality-pattern +weights, has the absolute bulk constant `log 12 + 1`. -/ +theorem arithmetic_prime_pattern_budget_rate (ψ : SchwartzMap ℝ ℂ) (n k : ℕ) + (hk : 0 < k) (hn : n ≤ k) (B Cfreq Cprior ε : ℝ) + (hCfreq : 0 ≤ Cfreq) (hCprior : 1 ≤ Cprior) (hε : 0 < ε) + (hdepth : 8 * Cprior ≤ (k : ℝ) ^ 3) : + ∀ᶠ L : ℝ in atTop, let m := spectatorBulkCount k L + ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * Cfreq * m) → + (q.divisors.card : ℝ) ≤ D) ∧ + ∀ N V : ℕ, ∀ Δ : ℝ, (N : ℝ) ≤ Real.exp (Cfreq * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + ((((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + (((2 : ℝ) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n)))) * 2 ^ (2 ^ n * m)) ≤ + Real.exp ((2 ^ n : ℕ) * Δ + (Real.log 12 + 1) * (2 ^ n : ℕ) * m + ε * m) := by + filter_upwards [movingPattern_prior_cost_rate k hk Cprior (ε / 4) hCprior + (by positivity) hdepth, + arithmetic_prime_fourier_budget_rate ψ n k hk B Cfreq (ε / 4) hCfreq (by positivity), + (spectatorBulkCount_tendsto k hk).eventually (eventually_ge_atTop (2 / ε))] + with L hprior hrate hm + dsimp only + obtain ⟨D, hD, hdiv, hcost⟩ := hrate + refine ⟨D, hD, hdiv, ?_⟩ + intro N V Δ hN hV + have hp := hprior n hn + have hc := hcost N V Δ hN hV + have htwo : (2 : ℝ) ≤ Real.exp ((ε / 2) * spectatorBulkCount k L) := by + have hscale := (div_le_iff₀ hε).mp hm + have he := Real.add_one_le_exp ((ε / 2) * spectatorBulkCount k L) + nlinarith + have hprod := mul_le_mul hp hc (by positivity) (Real.exp_nonneg _) + have hmain := mul_le_mul_of_nonneg_left hprod (by norm_num : (0 : ℝ) ≤ 2) + apply le_trans (le_of_eq (by ring)) hmain |>.trans + apply (mul_le_mul_of_nonneg_right htwo (by positivity)).trans_eq + simp only [← Real.exp_add] + congr 1 + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPrecision.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..a360959dd011d65060a2ea54c90e2894b57422c3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPrecision.lean @@ -0,0 +1,58 @@ +import Mathlib.Data.Int.ModEq +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSupport + +namespace OAI + +/-! # The exact loss of frequency precision at a reversing node -/ + +namespace Ostmann + +theorem modEq_cancel_coprime_left (m u a b : ℤ) (hu : IsCoprime u m) + (h : u * a ≡ u * b [ZMOD m]) : a ≡ b [ZMOD m] := by + apply Int.modEq_iff_dvd.mpr + apply hu.symm.dvd_of_dvd_mul_left + have hd := h.dvd + rwa [← mul_sub] at hd + +/-- Division by `s` consumes one copy of `R`; division by its unit factor consumes none. -/ +theorem reversal_residue_precision (R s u u' N N' p p' : ℤ) (k : ℕ) + (hs : s ≠ 0) (hsR : s ∣ R) (hu : IsCoprime u R) + (hN : N = s * u * p) (hN' : N' = s * u' * p') + (hmod : N ≡ N' [ZMOD R ^ (k + 1)]) (humod : u ≡ u' [ZMOD R ^ k]) : + p ≡ p' [ZMOD R ^ k] := by + have hdiv : s * R ^ k ∣ N' - N := by + apply dvd_trans _ hmod.dvd + simpa only [pow_succ, mul_comm s] using mul_dvd_mul_left (R ^ k) hsR + rw [hN', hN, show s * u' * p' - s * u * p = s * (u' * p' - u * p) by ring] at hdiv + have hproducts : u * p ≡ u' * p' [ZMOD R ^ k] := + Int.modEq_iff_dvd.mpr (Int.dvd_of_mul_dvd_mul_left hs hdiv) + apply modEq_cancel_coprime_left (R ^ k) u p p' hu.pow_right + exact hproducts.trans (humod.symm.mul_right p') + +/-- At every depth of a chain the remaining power still determines the reconstructed integer. -/ +theorem reversal_chain_residue_precision (R : ℤ) (s u u' v v' : ℕ → ℤ) (k : ℕ) + (hs : ∀ j, s j ≠ 0) (hsR : ∀ j, s j ∣ R) (hu : ∀ j, IsCoprime (u j) R) + (hv : ∀ j, v j = s j * u j * v (j + 1)) + (hv' : ∀ j, v' j = s j * u' j * v' (j + 1)) + (hmod : v 0 ≡ v' 0 [ZMOD R ^ (k + 1)]) + (humod : ∀ j, u j ≡ u' j [ZMOD R ^ (k + 1)]) : + ∀ j ≤ k + 1, v j ≡ v' j [ZMOD R ^ (k + 1 - j)] := by + intro j + induction j with + | zero => intro _; simpa using hmod + | succ j ih => + intro hj + have hj' : j ≤ k := by omega + have hexp : k + 1 - j = (k - j) + 1 := by omega + have hprev := ih (by omega) + rw [hexp] at hprev + have hunit : u j ≡ u' j [ZMOD R ^ (k - j)] := + (humod j).of_dvd (pow_dvd_pow R (by omega : k - j ≤ k + 1)) + have h := reversal_residue_precision R (s j) (u j) (u' j) (v j) (v' j) + (v (j + 1)) (v' (j + 1)) (k - j) (hs j) (hsR j) (hu j) + (hv j) (hv' j) hprev hunit + simpa only [show k + 1 - (j + 1) = k - j by omega] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPrimeNormRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPrimeNormRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..9757028e683d23123ad84d07b7fcb02973e5b0d9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticPrimeNormRate.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticNormRate +import OAI.NumberTheory.Ostmann.Characters.FourierWindowDecay +import OAI.NumberTheory.Ostmann.Construction.SpectatorBulkScale + +namespace OAI + +/-! # The frequency budget after return to the original prime law -/ + +namespace Ostmann +open Filter +open scoped SchwartzMap + +theorem arithmetic_prime_page_spectator_cost (n m : ℕ) : + ((2 : ℝ) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m) = + 2 * Real.exp (Real.log 12 * (2 ^ n : ℕ) * m) := by + have hbase : (2 : ℝ) * 3 * 2 = 12 := by norm_num + calc + _ = 2 * (((2 : ℝ) * 3 * 2) ^ (2 ^ n * m)) := by + simp only [mul_pow] + ring + _ = _ := by + rw [hbase] + congr 1 + rw [show Real.log 12 * (2 ^ n : ℕ) * m = + ((2 ^ n * m : ℕ) : ℝ) * Real.log 12 by push_cast; ring, + Real.exp_nat_mul, Real.exp_log (by norm_num : (0 : ℝ) < 12)] + +/-- The prime-cell mixture adds one factor two per bulk coordinate. This +changes the constant in the exponential from log six to log twelve. -/ +theorem arithmetic_prime_norm_budget_rate (n : ℕ) (A C ε : ℝ) + (hA : 0 ≤ A) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * C * m) → (q.divisors.card : ℝ) ≤ D) ∧ + ∀ N V : ℕ, ∀ Δ : ℝ, (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + (A * Real.exp (-(2 ^ n : ℕ) * Δ)) * + ((2 * Real.exp (Real.log 12 * (2 ^ n : ℕ) * m)) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n))) ≤ + Real.exp ((2 ^ n : ℕ) * Δ + Real.log 12 * (2 ^ n : ℕ) * m + ε * m) := by + have hlog : Real.log 12 = Real.log 2 + Real.log 6 := by + rw [← Real.log_mul (by norm_num : (2 : ℝ) ≠ 0) (by norm_num : (6 : ℝ) ≠ 0)] + norm_num + filter_upwards [arithmetic_norm_budget_rate n A C ε hA hC hε] with m hm + obtain ⟨D, hD, hdiv, hcost⟩ := hm + refine ⟨D, hD, hdiv, ?_⟩ + intro N V Δ hN hV + have h := mul_le_mul_of_nonneg_left (hcost N V Δ hN hV) + (Real.exp_pos (Real.log 2 * (2 ^ n : ℕ) * m)).le + convert h using 1 <;> rw [hlog] <;> + simp only [add_mul, Real.exp_add] <;> ring + +/-- Specialization to the actual even bulk size, with the literal window and +Page/spectator constants of the prime norm estimate. -/ +theorem arithmetic_prime_fourier_budget_rate (ψ : 𝓢(ℝ, ℂ)) (n k : ℕ) (hk : 0 < k) + (B C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ L : ℝ in atTop, let m := spectatorBulkCount k L + ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * C * m) → (q.divisors.card : ℝ) ≤ D) ∧ + ∀ N V : ℕ, ∀ Δ : ℝ, (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + (((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + (((2 : ℝ) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * m)) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 * 2 ^ n)))) * 2 ^ (2 ^ n * m) ≤ + Real.exp ((2 ^ n : ℕ) * Δ + Real.log 12 * (2 ^ n : ℕ) * m + ε * m) := by + let A : ℝ := ((SchwartzMap.seminorm ℝ 0 0 ψ) ^ (2 ^ n) * B ^ (2 ^ n - 1)) ^ 2 + have hrate := (spectatorBulkCount_tendsto k hk).eventually + (arithmetic_prime_norm_budget_rate n A C ε (sq_nonneg _) hC hε) + filter_upwards [hrate] with L hrate + obtain ⟨D, hD, hdiv, hcost⟩ := hrate + refine ⟨D, hD, hdiv, ?_⟩ + intro N V Δ hN hV + have h := hcost N V Δ hN hV + rw [← arithmetic_prime_page_spectator_cost n (spectatorBulkCount k L)] at h + rw [fourier_window_pair_exp] + exact le_trans (le_of_eq (by dsimp only [A]; ring)) h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticProductSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticProductSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..aadfcae03bd5007172d76e529c808d4427aa467c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticProductSupport.lean @@ -0,0 +1,94 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSupportRate +import OAI.NumberTheory.Ostmann.Characters.TreeProductDisintegration + +namespace OAI + +/-! # The frequency-support estimate under the independent leaf law -/ + +namespace Ostmann + +open scoped BigOperators Classical +open Filter + +noncomputable def arithmeticProductSupportSum {Q : ℕ} [NeZero Q] + (S : Finset ℤ) (V n : ℕ) + (data : FrequencyTree (S × S) n → (ZMod Q)ˣ → List (ZMod Q)ˣ → + Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) : ℝ := + ∑ t : FrequencyTree (S × S) n, + frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((Fintype.card (TreeLeafTuple (ZMod Q)ˣ n) : ℝ)⁻¹ * + ∑ x : TreeLeafTuple (ZMod Q)ˣ n, + sequentialSupport + (fun past y => arithmeticPairSplitTest (data t (treeLeafProduct n x) past) y) [] + (2 ^ n - 1) (treeLeafSplitEquiv n (treeLeafProduct n x) ⟨x, rfl⟩)) + +theorem arithmeticProductSupportSum_eq {Q : ℕ} [NeZero Q] + (S : Finset ℤ) (V n : ℕ) + (data : FrequencyTree (S × S) n → (ZMod Q)ˣ → List (ZMod Q)ˣ → + Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) : + arithmeticProductSupportSum S V n data = + (Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ * ∑ P : (ZMod Q)ˣ, + arithmeticHistorySupportSum S V n (fun _ => P) (fun t => data t P) := by + unfold arithmeticProductSupportSum + calc + _ = ∑ t : FrequencyTree (S × S) n, + frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ * ∑ P : (ZMod Q)ˣ, + (Fintype.card (TreeLeafFiber (ZMod Q)ˣ n P) : ℝ)⁻¹ * + ∑ x : TreeLeafFiber (ZMod Q)ˣ n P, + sequentialSupport (fun past y => arithmeticPairSplitTest (data t P past) y) [] + (2 ^ n - 1) (treeLeafSplitEquiv n P x)) := by + apply Finset.sum_congr rfl + intro t _ + congr 1 + exact treeLeaf_average_by_product (G := (ZMod Q)ˣ) n + (fun P x => sequentialSupport + (fun past y => arithmeticPairSplitTest (data t P past) y) [] + (2 ^ n - 1) (treeLeafSplitEquiv n P x)) + _ = _ := by + unfold arithmeticHistorySupportSum + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro P _ + apply Finset.sum_congr rfl + intro t _ + ring_nf + +/-- No restriction on the total leaf product appears here: this is the +original independent product measure on all bulk leaf products. -/ +theorem arithmetic_product_support_rate {Q : ℕ} [NeZero Q] + (n : ℕ) (K C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∀ N V : ℕ, ∀ Δ : ℝ, ∀ S : Finset ℤ, + (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + ∀ data : FrequencyTree (S × S) n → (ZMod Q)ˣ → List (ZMod Q)ˣ → + Option (ArithmeticSplitData Q × ArithmeticSplitData Q), + (∀ t P past d e, data t P past = some (d, e) → + d.hasFrequencies (treeNodeFrequencies S n t past.length).1 ∧ + e.hasFrequencies (treeNodeFrequencies S n t past.length).2) → + Real.exp (-(2 ^ n : ℕ) * Δ + K) * arithmeticProductSupportSum S V n data ≤ + Real.exp ((2 ^ n : ℕ) * Δ + ε * m) := by + filter_upwards [arithmetic_history_support_rate (Q := Q) n K C ε hC hε] with m hm + intro N V Δ S hN hV hS data hmatch + rw [arithmeticProductSupportSum_eq] + calc + _ = (Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ * ∑ P : (ZMod Q)ˣ, + Real.exp (-(2 ^ n : ℕ) * Δ + K) * + arithmeticHistorySupportSum S V n (fun _ => P) (fun t => data t P) := by + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro P _ + ring + _ ≤ (Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ * ∑ _P : (ZMod Q)ˣ, + Real.exp ((2 ^ n : ℕ) * Δ + ε * m) := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + exact Finset.sum_le_sum fun P _ => hm N V Δ S hN hV hS _ _ (fun t => hmatch t P) + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + rw [← mul_assoc, inv_mul_cancel₀ (by exact_mod_cast Fintype.card_ne_zero), one_mul] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticQuadraticCoefficient.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticQuadraticCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..c730d13409f1fa51711850d3fe84f3951844c41a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticQuadraticCoefficient.lean @@ -0,0 +1,110 @@ +import OAI.NumberTheory.Ostmann.QuadraticCenter.FullQuadraticCoefficient +import OAI.NumberTheory.Ostmann.QuadraticSieve.WeightedJacobiMoment + +namespace OAI + +/-! # Dependence of the original coefficient on finite arithmetic residues -/ + +namespace Ostmann + +open scoped BigOperators SchwartzMap + +noncomputable def quadraticInverseResidue (M : ℕ) (U : Finset ℕ) : ZMod U.toList.prod := + -(M : ZMod U.toList.prod)⁻¹ + +noncomputable def quadraticSymbolCoefficient (M : ℕ) (U : Finset ℕ) : ℂ := + ((1 / 16 : ℝ) ^ U.card : ℂ) * (realJacobi U.toList.prod M : ℂ) + +noncomputable def quadraticDivisorSymbol (M : ℕ) (V : Finset ℕ) : ℂ := + (realJacobi V.toList.prod M : ℂ) + +noncomputable def arithmeticQuadraticCoefficient (Q : Finset ℕ) + (hQ : ∀ p ∈ Q, p.Prime) (D : ∀ p : ℕ, Finset (ZMod p)) + (Φ : 𝓢(ℝ, ℂ)) (R : ℝ) (P M h₀ : ℕ) (θ : ℝ) (s : ℕ) : ℂ := + fullQuadraticCoefficient Q hQ D (quadraticInverseResidue M) + (fun _ => (h₀ : ℝ) + θ) Φ R P (quadraticSymbolCoefficient M) (quadraticDivisorSymbol M) s + +theorem quadraticSymbolCoefficient_norm_le (M : ℕ) (U : Finset ℕ) : + ‖quadraticSymbolCoefficient M U‖ ≤ (1 / 16 : ℝ) ^ U.card := by + have hn : ‖((1 / 16 : ℝ) : ℂ)‖ = (1 / 16 : ℝ) := by norm_num + rw [quadraticSymbolCoefficient, norm_mul, norm_pow, hn, + Complex.norm_real, Real.norm_eq_abs] + exact mul_le_of_le_one_right (by positivity) (realJacobi_abs_le _ _) + +theorem quadraticDivisorSymbol_norm_le (M : ℕ) (V : Finset ℕ) : + ‖quadraticDivisorSymbol M V‖ ≤ 1 := by + simpa only [quadraticDivisorSymbol, Complex.norm_real, Real.norm_eq_abs] using + realJacobi_abs_le V.toList.prod M + +theorem realJacobi_mod_multiple (L d M : ℕ) (hd : d ∣ L) (hM : Odd M) : + realJacobi d M = realJacobi d (M % (4 * L)) := by + have hr : Odd (M % (4 * L)) := hM.mod_even (Even.mul_right (by decide) L) + unfold realJacobi + rw [jacobiSym.mod_right' d hM, jacobiSym.mod_right' d hr, + Nat.mod_mod_of_dvd M (Nat.mul_dvd_mul_left 4 hd)] + +theorem quadraticInverseResidue_mod_multiple (L M : ℕ) (U : Finset ℕ) + (hU : U.toList.prod ∣ L) : + quadraticInverseResidue M U = quadraticInverseResidue (M % (4 * L)) U := by + have hd : U.toList.prod ∣ 4 * L := dvd_mul_of_dvd_right hU 4 + have he : ((M % (4 * L) : ℕ) : ZMod U.toList.prod) = (M : ZMod U.toList.prod) := by + rw [ZMod.natCast_eq_natCast_iff'] + exact Nat.mod_mod_of_dvd M hd + simp only [quadraticInverseResidue, he] + +theorem primeDivisorPositive_congr_point (Q : Finset ℕ) + (hQ : ∀ p ∈ Q, p.Prime) (D : ∀ p : ℕ, Finset (ZMod p)) + (a b : ∀ U : Finset ℕ, ZMod U.toList.prod) (θ : Finset ℕ → ℝ) + (Φ : 𝓢(ℝ, ℂ)) (R v : ℝ) (U : Finset ℕ) (s : ℕ) + (ha : a U = b U) : + primeDivisorPositive Q hQ D a θ Φ R v U s = + primeDivisorPositive Q hQ D b θ Φ R v U s := by + unfold primeDivisorPositive + split_ifs + · rw [ha] + · rfl + +theorem fullQuadraticCoefficient_congr_on (Q : Finset ℕ) + (hQ : ∀ p ∈ Q, p.Prime) (D : ∀ p : ℕ, Finset (ZMod p)) + (a b : ∀ U : Finset ℕ, ZMod U.toList.prod) (θ : Finset ℕ → ℝ) + (Φ : 𝓢(ℝ, ℂ)) (R : ℝ) (P : ℕ) (c c' ξ ξ' : Finset ℕ → ℂ) (s : ℕ) + (ha : ∀ U ∈ Q.powerset, a U = b U) + (hc : ∀ U ∈ Q.powerset, c U = c' U) + (hξ : ∀ V ∈ Q.powerset, ξ V = ξ' V) : + fullQuadraticCoefficient Q hQ D a θ Φ R P c ξ s = + fullQuadraticCoefficient Q hQ D b θ Φ R P c' ξ' s := by + unfold fullQuadraticCoefficient divisorWeightedCoefficient + apply Finset.sum_congr rfl + intro V hV + rw [hξ V hV] + apply congrArg (fun z : ℂ => (ξ' V * (Real.sqrt (V.toList.prod : ℝ) : ℂ)⁻¹) * z) + apply Finset.sum_congr rfl + intro U hU + rw [hc U hU] + apply congrArg (fun z : ℂ => c' U * z) + unfold primeDivisorMultiples + rw [primeDivisorPositive_congr_point Q hQ D (divisorQuadraticScalar a V) + (divisorQuadraticScalar b V) θ Φ R V.toList.prod U + (s * P ^ 2) (divisorQuadraticScalar_congr_point a b V U (ha U hU))] + +theorem arithmeticQuadraticCoefficient_mod (Q : Finset ℕ) + (hQ : ∀ p ∈ Q, p.Prime) (D : ∀ p : ℕ, Finset (ZMod p)) + (Φ : 𝓢(ℝ, ℂ)) (R : ℝ) (P M h₀ : ℕ) (θ : ℝ) (s : ℕ) (hM : Odd M) : + arithmeticQuadraticCoefficient Q hQ D Φ R P M h₀ θ s = + arithmeticQuadraticCoefficient Q hQ D Φ R P (M % (4 * Q.toList.prod)) h₀ θ s := by + apply fullQuadraticCoefficient_congr_on + · intro U hU + exact quadraticInverseResidue_mod_multiple Q.toList.prod M U + (primeSet_prod_dvd_of_subset Q U (Finset.mem_powerset.mp hU)) + · intro U hU + unfold quadraticSymbolCoefficient + rw [realJacobi_mod_multiple Q.toList.prod U.toList.prod M + (primeSet_prod_dvd_of_subset Q U (Finset.mem_powerset.mp hU)) hM] + · intro V hV + unfold quadraticDivisorSymbol + rw [realJacobi_mod_multiple Q.toList.prod V.toList.prod M + (primeSet_prod_dvd_of_subset Q V (Finset.mem_powerset.mp hV)) hM] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticResidueReversal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticResidueReversal.lean new file mode 100644 index 0000000000000000000000000000000000000000..1570b86970a329e06b6480c65354c623d839c4df --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticResidueReversal.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticResidueSplit + +namespace OAI + +/-! # Agreement of the residue split with integer reversal -/ + +namespace Ostmann + +theorem intCast_frequency_zero_iff (s a : ℤ) : + (a : ZMod s.natAbs) = 0 ↔ s ∣ a := by + rw [ZMod.intCast_zmod_eq_zero_iff_dvd, Int.natAbs_dvd] + +theorem ArithmeticResidueSplit.numerator_integer {Q : ℕ} (d : ArithmeticResidueSplit Q) + (x : (ZMod Q)ˣ) (XL XR CL CR ML MR : ℤ) + (hL : d.leftFactor = (XR * CR : ℤ)) + (hR : d.rightFactor = (XL * CL : ℤ)) + (hML : (x : ZMod Q) = ML) (hMR : (d.parentProduct / x : (ZMod Q)ˣ) = (MR : ZMod Q)) : + d.numerator x = (d.frequencies.left * (XR * CR * MR) - + d.frequencies.right * (XL * CL * ML) : ℤ) := by + simp only [ArithmeticResidueSplit.numerator, hL, hR, hML, hMR, + Int.cast_sub, Int.cast_mul] + ring + +/-- The frequency-divisibility test in the residue evaluator is precisely +the integer test, including either sign of the frequency. -/ +theorem ArithmeticResidueSplit.frequency_test_integer {Q : ℕ} + (d : ArithmeticResidueSplit Q) (x : (ZMod Q)ˣ) (N : ℤ) + (hN : d.numerator x = N) : + d.reduce (d.numerator x) = 0 ↔ d.frequencies.root ∣ N := by + rw [hN, ArithmeticResidueSplit.reduce, map_intCast] + exact intCast_frequency_zero_iff _ _ + +noncomputable def ArithmeticResidueSplit.pivot {R M : ℕ} + (d : ArithmeticResidueSplit (R * M)) (hsR : d.frequencies.root.natAbs ∣ R) + (U : (ZMod M)ˣ) (x : (ZMod (R * M))ˣ) : ZMod M := + frequencyQuotient R M d.frequencies.root hsR (d.numerator x) * ↑U⁻¹ + +/-- The residue evaluator reconstructs the same pivot as the original +integer formula, at the remaining precision. -/ +theorem ArithmeticResidueSplit.pivot_integer {R M : ℕ} [NeZero M] + (d : ArithmeticResidueSplit (R * M)) (hsR : d.frequencies.root.natAbs ∣ R) + (U : (ZMod M)ˣ) (x : (ZMod (R * M))ˣ) (u p : ℤ) + (hU : (U : ZMod M) = u) + (hN : d.numerator x = (d.frequencies.root * u * p : ℤ)) : + d.pivot hsR U x = p := by + rw [ArithmeticResidueSplit.pivot, hN] + simpa only [Int.cast_mul] using frequencyQuotient_reversal R M d.frequencies.root + d.frequency_ne_zero hsR u p U hU + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticResidueSplit.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticResidueSplit.lean new file mode 100644 index 0000000000000000000000000000000000000000..1c1a42838309f479bf105106683637289e5eaca9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticResidueSplit.lean @@ -0,0 +1,115 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSplitTreeSupport +import OAI.NumberTheory.Ostmann.Arithmetic.ResidueQuotient + +namespace OAI + +/-! # Constructing the support data from an actual residue numerator -/ + +namespace Ostmann + +open scoped Classical + +/-- The two coefficients contain the current giant and its nonbulk +factors. They are allowed to fail the required unit tests. -/ +structure ArithmeticResidueSplit (Q : ℕ) where + frequencies : NodeFrequencies + frequency_ne_zero : frequencies.root ≠ 0 + frequency_dvd : frequencies.root.natAbs ∣ Q + leftFactor : ZMod Q + rightFactor : ZMod Q + parentProduct : (ZMod Q)ˣ + +def ArithmeticResidueSplit.reduce {Q : ℕ} (d : ArithmeticResidueSplit Q) : + ZMod Q →+* ZMod d.frequencies.root.natAbs := + ZMod.castHom d.frequency_dvd _ + +def ArithmeticResidueSplit.numerator {Q : ℕ} (d : ArithmeticResidueSplit Q) + (x : (ZMod Q)ˣ) : ZMod Q := + (d.frequencies.left : ZMod Q) * d.leftFactor * ↑(d.parentProduct / x) - + (d.frequencies.right : ZMod Q) * d.rightFactor * ↑x + +def ArithmeticResidueSplit.support {Q : ℕ} (d : ArithmeticResidueSplit Q) + (x : (ZMod Q)ˣ) : Prop := + IsUnit (d.reduce d.leftFactor) ∧ IsUnit (d.reduce d.rightFactor) ∧ + d.reduce (d.numerator x) = 0 + +noncomputable def ArithmeticResidueSplit.toData {Q : ℕ} (d : ArithmeticResidueSplit Q) : + Option (ArithmeticSplitData Q) := + if hL : IsUnit (d.reduce d.leftFactor) then + if hR : IsUnit (d.reduce d.rightFactor) then + some { + frequency := d.frequencies.root + frequency_ne_zero := d.frequency_ne_zero + frequency_dvd := d.frequency_dvd + leftFrequency := d.frequencies.left + rightFrequency := d.frequencies.right + leftFactor := hL.unit + rightFactor := hR.unit + parentProduct := ZMod.unitsMap d.frequency_dvd d.parentProduct } + else none + else none + +theorem ArithmeticResidueSplit.toData_frequencies {Q : ℕ} + (d : ArithmeticResidueSplit Q) (e : ArithmeticSplitData Q) + (h : d.toData = some e) : e.hasFrequencies d.frequencies := by + unfold ArithmeticResidueSplit.toData at h + split_ifs at h with hL hR + · cases Option.some.inj h + exact ⟨rfl, rfl, rfl⟩ + +theorem ArithmeticResidueSplit.toData_test {Q : ℕ} + (d : ArithmeticResidueSplit Q) (x : (ZMod Q)ˣ) : + (∃ e, d.toData = some e ∧ e.test x) ↔ d.support x := by + have hquot : ZMod.unitsMap d.frequency_dvd d.parentProduct / + ZMod.unitsMap d.frequency_dvd x = ZMod.unitsMap d.frequency_dvd (d.parentProduct / x) := + (map_div (ZMod.unitsMap d.frequency_dvd) _ _).symm + unfold ArithmeticResidueSplit.toData ArithmeticResidueSplit.support + split_ifs with hL hR + · simp only [Option.some.injEq, hL, hR, true_and] + constructor + · rintro ⟨e, rfl, h⟩ + dsimp only [ArithmeticSplitData.test] at h + rw [hquot] at h + simpa only [ArithmeticResidueSplit.numerator, ArithmeticResidueSplit.reduce, + map_sub, map_mul, map_intCast, sub_eq_zero, Units.val_mul, IsUnit.unit_spec, + ZMod.unitsMap, Units.coe_map, MonoidHom.coe_coe, mul_assoc] using h + · intro h + refine ⟨_, rfl, ?_⟩ + dsimp only [ArithmeticSplitData.test] + rw [hquot] + simpa only [ArithmeticResidueSplit.numerator, ArithmeticResidueSplit.reduce, + map_sub, map_mul, map_intCast, sub_eq_zero, Units.val_mul, IsUnit.unit_spec, + ZMod.unitsMap, Units.coe_map, MonoidHom.coe_coe, mul_assoc] using h + · simp [hR] + · simp [hL] + +noncomputable def arithmeticResiduePairData {Q : ℕ} + (d e : ArithmeticResidueSplit Q) : Option (ArithmeticSplitData Q × ArithmeticSplitData Q) := + match d.toData, e.toData with + | some d', some e' => some (d', e') + | _, _ => none + +theorem arithmeticResiduePairData_test {Q : ℕ} + (d e : ArithmeticResidueSplit Q) (x : (ZMod Q)ˣ) : + arithmeticPairSplitTest (arithmeticResiduePairData d e) x ↔ + d.support x ∧ e.support x := by + rw [← d.toData_test x, ← e.toData_test x] + unfold arithmeticResiduePairData + cases hd : d.toData <;> cases he : e.toData <;> + simp [arithmeticPairSplitTest] + +theorem arithmeticResiduePairData_frequencies {Q : ℕ} + (d e : ArithmeticResidueSplit Q) (d' e' : ArithmeticSplitData Q) + (h : arithmeticResiduePairData d e = some (d', e')) : + d'.hasFrequencies d.frequencies ∧ e'.hasFrequencies e.frequencies := by + unfold arithmeticResiduePairData at h + cases hd : d.toData <;> cases he : e.toData <;> simp only [hd, he] at h + · cases h + · cases h + · cases h + · cases Option.some.inj h + exact ⟨d.toData_frequencies _ hd, e.toData_frequencies _ he⟩ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSlotProducts.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSlotProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..a29a6a4ace120a777bb90099b84b7124d8ac12db --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSlotProducts.lean @@ -0,0 +1,104 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticHistoryLines + +namespace OAI + +/-! # Frequency times products of the actual small slots + +Slot lists retain multiplicities. These are the coefficient polynomials used +in the ancestor reversals, so their degree and magnitude bounds come from +the number and size of the original slots. +-/ + +namespace Ostmann + +noncomputable def slotProduct {σ : Type*} : List σ → MvPolynomial σ ℤ + | [] => 1 + | s :: slots => MvPolynomial.X s * slotProduct slots + +noncomputable def frequencySlotProduct {σ : Type*} (frequency : ℤ) (slots : List σ) : + MvPolynomial σ ℤ := MvPolynomial.C frequency * slotProduct slots + +theorem slotProduct_eval {σ R : Type*} [CommRing R] (slots : List σ) + (x : σ → R) : + MvPolynomial.eval₂Hom (Int.castRingHom R) x (slotProduct slots) = (slots.map x).prod := by + induction slots with + | nil => simp [slotProduct] + | cons s slots ih => + simp only [slotProduct, map_mul, List.map_cons, List.prod_cons, ih] + rw [MvPolynomial.eval₂Hom_X'] + +theorem frequencySlotProduct_eval {σ R : Type*} [CommRing R] + (frequency : ℤ) (slots : List σ) (x : σ → R) : + MvPolynomial.eval₂Hom (Int.castRingHom R) x (frequencySlotProduct frequency slots) = + (frequency : R) * (slots.map x).prod := by + unfold frequencySlotProduct + rw [map_mul, MvPolynomial.eval₂Hom_C, slotProduct_eval] + rfl + +theorem slotProduct_degree_le {σ : Type*} (slots : List σ) : + (slotProduct slots).totalDegree ≤ slots.length := by + induction slots with + | nil => simp [slotProduct] + | cons s slots ih => + have h := MvPolynomial.totalDegree_mul (MvPolynomial.X (R := ℤ) s) (slotProduct slots) + simp only [MvPolynomial.totalDegree_X, List.length_cons] at h ⊢ + exact h.trans (by omega) + +theorem frequencySlotProduct_degree_le {σ : Type*} (frequency : ℤ) (slots : List σ) : + (frequencySlotProduct frequency slots).totalDegree ≤ slots.length := by + have h := MvPolynomial.totalDegree_mul (MvPolynomial.C frequency) (slotProduct slots) + simp only [MvPolynomial.totalDegree_C, zero_add] at h + exact h.trans (slotProduct_degree_le slots) + +theorem slotProduct_vars_subset {σ : Type*} [DecidableEq σ] (slots : List σ) : + (slotProduct slots).vars ⊆ slots.toFinset := by + induction slots with + | nil => simp [slotProduct] + | cons s slots ih => + apply (MvPolynomial.vars_mul _ _).trans + simp only [MvPolynomial.vars_X, List.toFinset_cons, Finset.union_subset_iff] + exact ⟨Finset.singleton_subset_iff.mpr (Finset.mem_insert_self _ _), + ih.trans (Finset.subset_insert _ _)⟩ + +theorem frequencySlotProduct_vars_subset {σ : Type*} [DecidableEq σ] + (frequency : ℤ) (slots : List σ) : + (frequencySlotProduct frequency slots).vars ⊆ slots.toFinset := by + apply (MvPolynomial.vars_mul _ _).trans + rw [MvPolynomial.vars_C, Finset.empty_union] + exact slotProduct_vars_subset slots + +theorem slotProduct_value_le {σ : Type*} (slots : List σ) (x : σ → ℝ) + (U : ℝ) (hU : 0 ≤ U) (hx : ∀ s ∈ slots, |x s| ≤ U) : + |MvPolynomial.eval₂Hom (Int.castRingHom ℝ) x (slotProduct slots)| ≤ U ^ slots.length := by + rw [slotProduct_eval] + induction slots with + | nil => simp + | cons s slots ih => + simp only [List.map_cons, List.prod_cons, List.length_cons, abs_mul] + rw [pow_succ] + exact (mul_le_mul (hx s (by simp)) (ih (fun t ht => hx t (by simp [ht]))) + (abs_nonneg _) hU).trans_eq (mul_comm _ _) + +theorem frequencySlotProduct_value_le {σ : Type*} (frequency : ℤ) (slots : List σ) + (x : σ → ℝ) (U C : ℝ) (hU : 0 ≤ U) (hfreq : |(frequency : ℝ)| ≤ C) + (hx : ∀ s ∈ slots, |x s| ≤ U) : + |MvPolynomial.eval₂Hom (Int.castRingHom ℝ) x (frequencySlotProduct frequency slots)| ≤ + C * U ^ slots.length := by + simp only [frequencySlotProduct, map_mul, MvPolynomial.eval₂Hom_C, abs_mul] + exact mul_le_mul hfreq (slotProduct_value_le slots x U hU hx) (abs_nonneg _) (by linarith [abs_nonneg (frequency : ℝ)]) + +theorem frequencySlotProduct_ne_zero {σ K : Type*} [Field K] + (frequency : ℤ) (slots : List σ) (x : σ → K) + (hfreq : (frequency : K) ≠ 0) (hx : ∀ s ∈ slots, x s ≠ 0) : + MvPolynomial.eval₂Hom (Int.castRingHom K) x (frequencySlotProduct frequency slots) ≠ 0 := by + rw [frequencySlotProduct_eval] + apply mul_ne_zero hfreq + induction slots with + | nil => simp + | cons s slots ih => + simp only [List.map_cons, List.prod_cons] + exact mul_ne_zero (hx s (by simp)) (ih (fun t ht => hx t (by simp [ht]))) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSpectatorHistory.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSpectatorHistory.lean new file mode 100644 index 0000000000000000000000000000000000000000..56a146a283cf976205c13684464f4c160c5e62c0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSpectatorHistory.lean @@ -0,0 +1,125 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSpectatorNode +import OAI.NumberTheory.Ostmann.Construction.TransferConjugations +import OAI.NumberTheory.Ostmann.Tree.RationalTreeLeaves + +namespace OAI + +/-! # From reconstructed integer histories to the spectator tree + +The realization conditions record the two child products and the terminal +modulus. They allow composite inserted pivots: division by the compensation +unit gives the giant used by the rational tree. No prime law is assigned to +that composite integer. +-/ + +namespace Ostmann +open scoped Classical ComplexConjugate + +noncomputable def spectatorHistoryLeaf {State : Type*} {q : ℕ} [Fact q.Prime] + (modulus : State → ℕ) (g : ZMod q → ℂ) (D : (ZMod q)ˣ) (σ : State) (s : ℤ) : ℂ := + g ((s : ZMod q) / ((D : ZMod q) * (modulus σ : ZMod q))) + +noncomputable def spectatorHistoryCutoff {State : Type*} {q : ℕ} [Fact q.Prime] + (sys : TransferHistorySystem State) (σ : State) (s v w : ℤ) : ℝ := + if (historyPivot sys σ s v w : ZMod q) = 0 then 0 else 1 + +noncomputable def spectatorHistoryWeight {State : Type*} {q : ℕ} [Fact q.Prime] + (sys : TransferHistorySystem State) (modulus : State → ℕ) + (g : ZMod q → ℂ) (D : (ZMod q)ˣ) (n : ℕ) (σ : State) (t : FrequencyTree ℤ n) : ℂ := + recursiveTransferWeight sys (spectatorHistoryLeaf modulus g D) + (spectatorHistoryCutoff (q := q) sys) n σ t + +def SpectatorHistoryRealizes {State : Type*} {q : ℕ} [Fact q.Prime] + (sys : TransferHistorySystem State) (modulus : State → ℕ) : + {n : ℕ} → {C : (ZMod q)ˣ} → RationalTreeData (ZMod q)ˣ n C → + State → FrequencyTree ℤ n → (ZMod q)ˣ → (ZMod q)ˣ → TreeLeafTuple (ZMod q)ˣ n → Prop + | _, _, .leaf s C, σ, t, XL, XR, x => + ((frequencyRoot (A := ℤ) 0 t : ℤ) : ZMod q) = s ∧ + (modulus σ : ZMod q) = (XL * XR * C * treeLeafProduct 0 x : (ZMod q)ˣ) + | n + 1, _, .node s CL CR u left right, σ, t, XL, XR, x => + let v := frequencyRoot n t.2.1 + let w := frequencyRoot n t.2.2 + let P := historyPivot sys σ t.1 v w + ValidTransferNode sys σ t.1 v w P ∧ + (t.1 : ZMod q) = s ∧ (v : ZMod q) = left.frequency ∧ (w : ZMod q) = right.frequency ∧ + (sys.leftProduct σ : ZMod q) = (XL * CL * treeLeafProduct n x.1 : (ZMod q)ˣ) ∧ + (sys.rightProduct σ : ZMod q) = (XR * CR * treeLeafProduct n x.2 : (ZMod q)ˣ) ∧ + ∀ h : (P : ZMod q) ≠ 0, + SpectatorHistoryRealizes sys modulus left (sys.leftState σ P) t.2.1 + (Units.mk0 (P : ZMod q) h / u) XL x.1 ∧ + SpectatorHistoryRealizes sys modulus right (sys.rightState σ P) t.2.2 + (Units.mk0 (P : ZMod q) h / u) XR x.2 + +theorem spectatorHistoryWeight_eq_tree {State : Type*} {q : ℕ} [Fact q.Prime] + (sys : TransferHistorySystem State) (modulus : State → ℕ) + (g : ZMod q → ℂ) (D : (ZMod q)ˣ) + {n : ℕ} {C : (ZMod q)ˣ} (T : RationalTreeData (ZMod q)ˣ n C) + (σ : State) (t : FrequencyTree ℤ n) (XL XR : (ZMod q)ˣ) + (x : TreeLeafTuple (ZMod q)ˣ n) + (h : SpectatorHistoryRealizes sys modulus T σ t XL XR x) (b : Bool) : + (if b then conj (spectatorHistoryWeight sys modulus g D n σ t) + else spectatorHistoryWeight sys modulus g D n σ t) = + rationalTreeAmplitude g D T XL XR (transferConjugations n b) x := by + induction T generalizing σ XL XR b with + | leaf s C => + rcases h with ⟨hs, hM⟩ + have ha : ((frequencyRoot (A := ℤ) 0 t : ℤ) : ZMod q) / ((D : ZMod q) * (modulus σ : ZMod q)) = + (rationalTreeArgument s C D XL XR x : ZMod q) := by + rw [hs, hM] + simp only [rationalTreeArgument, Units.val_div_eq_div_val, Units.val_mul] + apply congrArg (fun z : ZMod q => (s : ZMod q) / z) + dsimp only [treeLeafProduct] + ring + cases b with + | false => exact congrArg g ha + | true => exact congrArg star (congrArg g ha) + | @node n s CL CR u left right ihL ihR => + rcases h with ⟨hvalid, hs, hv, hw, hL, hR, hchild⟩ + let P := historyPivot sys σ t.1 (frequencyRoot n t.2.1) (frequencyRoot n t.2.2) + let V := reconstructedEntry (s : ZMod q) left.frequency right.frequency u + ((XL * CL * treeLeafProduct n x.1 : (ZMod q)ˣ) : ZMod q) + ((XR * CR * treeLeafProduct n x.2 : (ZMod q)ˣ) : ZMod q) + have hs0 : (t.1 : ZMod q) ≠ 0 := by rw [hs]; exact Units.ne_zero s + have hV : V = (P : ZMod q) / u := by + dsimp only [V] + rw [← hs, ← hv, ← hw, ← hL, ← hR] + exact hvalid.spectator_composite_reconstruction u hs0 + have hW := recursiveTransferWeight_node sys (spectatorHistoryLeaf modulus g D) + (spectatorHistoryCutoff (q := q) sys) n σ t P hvalid + change (if b then conj _ else _) = _ + by_cases hp : (P : ZMod q) = 0 + · have hV0 : V = 0 := by rw [hV, hp, zero_div] + have hweight : spectatorHistoryWeight sys modulus g D (n + 1) σ t = 0 := by + unfold spectatorHistoryWeight + rw [hW] + simp only [spectatorHistoryCutoff, show (historyPivot sys σ t.1 + (frequencyRoot n t.2.1) (frequencyRoot n t.2.2) : ZMod q) = 0 from hp, + ↓reduceIte, Complex.ofReal_zero, zero_mul] + simp only [hweight, map_zero, ite_self, rationalTreeAmplitude, transferConjugations] + change 0 = if hv : V = 0 then 0 else _ + rw [dite_eq_left hV0] + · have hV0 : V ≠ 0 := by rw [hV]; exact div_ne_zero hp (Units.ne_zero u) + have hunit : Units.mk0 V hV0 = Units.mk0 (P : ZMod q) hp / u := by + apply Units.ext + simpa only [Units.val_mk0, Units.val_div_eq_div_val] using hV + have hweight : spectatorHistoryWeight sys modulus g D (n + 1) σ t = + spectatorHistoryWeight sys modulus g D n (sys.leftState σ P) t.2.1 * + conj (spectatorHistoryWeight sys modulus g D n (sys.rightState σ P) t.2.2) := by + unfold spectatorHistoryWeight + rw [hW] + simp only [spectatorHistoryCutoff, show (historyPivot sys σ t.1 + (frequencyRoot n t.2.1) (frequencyRoot n t.2.2) : ZMod q) ≠ 0 from hp, + ↓reduceIte, Complex.ofReal_one, one_mul, Complex.star_def] + have hl := ihL (sys.leftState σ P) t.2.1 + (Units.mk0 (P : ZMod q) hp / u) XL x.1 (hchild hp).1 b + have hr := ihR (sys.rightState σ P) t.2.2 + (Units.mk0 (P : ZMod q) hp / u) XR x.2 (hchild hp).2 (!b) + rw [hweight] + simp only [rationalTreeAmplitude, transferConjugations] + change _ = if hv : V = 0 then 0 else _ + rw [dite_eq_right hV0, hunit, ← hl, ← hr] + cases b <;> simp + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSpectatorNode.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSpectatorNode.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9c16d73f4879c47269f969c54fe6c48728abc36 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSpectatorNode.lean @@ -0,0 +1,76 @@ +import Mathlib.Algebra.Field.ZMod +import OAI.NumberTheory.Ostmann.Construction.TransferHistoryUniqueness +import OAI.NumberTheory.Ostmann.Characters.TreeCoordinates + +namespace OAI + +/-! # The actual integer pivot gives the spectator's rational reconstruction -/ + +namespace Ostmann + +theorem ValidTransferNode.spectator_composite_reconstruction {State : Type*} + {sys : TransferHistorySystem State} {σ : State} {s v w : ℤ} {P : ℕ} + (h : ValidTransferNode sys σ s v w P) {q : ℕ} [Fact q.Prime] + (u : (ZMod q)ˣ) (hs : (s : ZMod q) ≠ 0) : + reconstructedEntry (s : ZMod q) (v : ZMod q) (w : ZMod q) u + (sys.leftProduct σ : ZMod q) (sys.rightProduct σ : ZMod q) = (P : ZMod q) / u := by + have hr : (v : ZMod q) * sys.rightProduct σ - (w : ZMod q) * sys.leftProduct σ = + (s : ZMod q) * P := by + have hz := congrArg (fun z : ℤ => (z : ZMod q)) h.relation + simpa only [Int.cast_sub, Int.cast_mul, Int.cast_natCast] using hz + unfold reconstructedEntry + rw [hr] + field_simp + +theorem ValidTransferNode.spectator_composite_zero_iff {State : Type*} + {sys : TransferHistorySystem State} {σ : State} {s v w : ℤ} {P : ℕ} + (h : ValidTransferNode sys σ s v w P) {q : ℕ} [Fact q.Prime] + (u : (ZMod q)ˣ) (hs : (s : ZMod q) ≠ 0) : + reconstructedEntry (s : ZMod q) (v : ZMod q) (w : ZMod q) u + (sys.leftProduct σ : ZMod q) (sys.rightProduct σ : ZMod q) = 0 ↔ q ∣ P := by + rw [h.spectator_composite_reconstruction u hs, div_eq_zero_iff, + or_iff_left (Units.ne_zero u), ZMod.natCast_eq_zero_iff] + +theorem spectator_frequency_ne_zero {q : ℕ} [Fact q.Prime] (s : ℤ) + (hs : s ≠ 0) (hsmall : s.natAbs < q) : (s : ZMod q) ≠ 0 := by + intro hz + have hd : q ∣ s.natAbs := Int.natCast_dvd.mp ((ZMod.intCast_zmod_eq_zero_iff_dvd s q).mp hz) + exact (not_le_of_gt hsmall) (Nat.le_of_dvd (Int.natAbs_pos.mpr hs) hd) + +theorem ValidTransferNode.spectator_reconstruction {State : Type*} + {sys : TransferHistorySystem State} {σ : State} {s v w : ℤ} {P : ℕ} + (h : ValidTransferNode sys σ s v w P) {q : ℕ} [Fact q.Prime] + (u p : ℕ) (hP : P = u * p) (hs : (s : ZMod q) ≠ 0) (hu : (u : ZMod q) ≠ 0) : + reconstructedEntry (s : ZMod q) (v : ZMod q) (w : ZMod q) (u : ZMod q) + (sys.leftProduct σ : ZMod q) (sys.rightProduct σ : ZMod q) = (p : ZMod q) := by + have hr : (v : ZMod q) * sys.rightProduct σ - (w : ZMod q) * sys.leftProduct σ = + (s : ZMod q) * (u * p) := by + have hi := h.relation + rw [hP] at hi + have hz := congrArg (fun z : ℤ => (z : ZMod q)) hi + simpa only [Int.cast_sub, Int.cast_mul, Int.cast_natCast, Nat.cast_mul] using hz + unfold reconstructedEntry + apply (div_eq_iff (mul_ne_zero hs hu)).mpr + rw [hr] + ring + +theorem ValidTransferNode.spectator_zero_iff {State : Type*} + {sys : TransferHistorySystem State} {σ : State} {s v w : ℤ} {P : ℕ} + (h : ValidTransferNode sys σ s v w P) {q : ℕ} [Fact q.Prime] + (u p : ℕ) (hP : P = u * p) (hs : (s : ZMod q) ≠ 0) (hu : (u : ZMod q) ≠ 0) : + reconstructedEntry (s : ZMod q) (v : ZMod q) (w : ZMod q) (u : ZMod q) + (sys.leftProduct σ : ZMod q) (sys.rightProduct σ : ZMod q) = 0 ↔ q ∣ p := by + rw [h.spectator_reconstruction u p hP hs hu, ZMod.natCast_eq_zero_iff] + +theorem spectator_child_argument {q : ℕ} [Fact q.Prime] (s : ℤ) (D H : ZMod q) + (u p P : ℕ) (hP : P = u * p) : + childArgument (s : ZMod q) D (u : ZMod q) H (p : ZMod q) = + (s : ZMod q) / (D * (P : ZMod q) * H) := by + rw [hP, Nat.cast_mul] + unfold childArgument + congr 1 + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSplitData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSplitData.lean new file mode 100644 index 0000000000000000000000000000000000000000..e44eec0bdb86f360ffaf1e52e356ce88d8eaa5a6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSplitData.lean @@ -0,0 +1,106 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.SignedSplitSupport +import OAI.NumberTheory.Ostmann.Arithmetic.SequentialProductSupport +import OAI.NumberTheory.Ostmann.Characters.TreeSplitCoordinates + +namespace OAI + +/-! # Fixed residue data at an exposed arithmetic split -/ + +namespace Ostmann + +open scoped BigOperators Classical + +/-- All entries are known before the child product is exposed. The units +contain the current giants and the nonbulk constants. -/ +structure ArithmeticSplitData (Q : ℕ) where + frequency : ℤ + frequency_ne_zero : frequency ≠ 0 + frequency_dvd : frequency.natAbs ∣ Q + leftFrequency : ℤ + rightFrequency : ℤ + leftFactor : (ZMod frequency.natAbs)ˣ + rightFactor : (ZMod frequency.natAbs)ˣ + parentProduct : (ZMod frequency.natAbs)ˣ + +instance ArithmeticSplitData.modulusNeZero {Q : ℕ} (d : ArithmeticSplitData Q) : + NeZero d.frequency.natAbs := ⟨Int.natAbs_ne_zero.mpr d.frequency_ne_zero⟩ + +def ArithmeticSplitData.reducedModulus {Q : ℕ} (d : ArithmeticSplitData Q) : ℕ := + reducedFrequency (d.leftFrequency.natAbs.gcd d.rightFrequency.natAbs) d.frequency.natAbs + +def ArithmeticSplitData.test {Q : ℕ} (d : ArithmeticSplitData Q) (x : (ZMod Q)ˣ) : Prop := + (d.leftFrequency : ZMod d.frequency.natAbs) * + (d.leftFactor * (d.parentProduct / ZMod.unitsMap d.frequency_dvd x) : + (ZMod d.frequency.natAbs)ˣ) = + (d.rightFrequency : ZMod d.frequency.natAbs) * + (d.rightFactor * ZMod.unitsMap d.frequency_dvd x : (ZMod d.frequency.natAbs)ˣ) + +theorem ArithmeticSplitData.pair_probability_le {Q : ℕ} [NeZero Q] + (d e : ArithmeticSplitData Q) : + (Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ * + (∑ x : (ZMod Q)ˣ, if d.test x ∧ e.test x then (1 : ℝ) else 0) ≤ + 2 * ((d.reducedModulus.lcm e.reducedModulus).divisors.card : ℝ) ^ 2 / + d.reducedModulus.lcm e.reducedModulus := by + have h := signed_joint_split_probability_le d.frequency_dvd e.frequency_dvd + d.leftFrequency d.rightFrequency e.leftFrequency e.rightFrequency + d.leftFactor d.rightFactor d.parentProduct e.leftFactor e.rightFactor e.parentProduct + convert h using 1 + · congr 1 + apply Finset.sum_congr rfl + intro x _ + dsimp only [ArithmeticSplitData.test] + split_ifs with ht + · exact ite_eq_left ht + · exact ite_eq_right ht + · rfl + +/-- `none` means a preceding unit or support test failed. It has zero +weight and does not impose any condition on an unexposed split. -/ +def arithmeticPairSplitTest {Q : ℕ} (d : Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) + (x : (ZMod Q)ˣ) : Prop := + match d with + | none => False + | some (d, e) => d.test x ∧ e.test x + +theorem arithmeticPairSplit_probability_le {Q : ℕ} [NeZero Q] + (d : Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) (B : ℝ) (hB : 0 ≤ B) + (hbound : ∀ d₁ d₂, d = some (d₁, d₂) → + 2 * ((d₁.reducedModulus.lcm d₂.reducedModulus).divisors.card : ℝ) ^ 2 / + d₁.reducedModulus.lcm d₂.reducedModulus ≤ B) : + (Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ * + (∑ x : (ZMod Q)ˣ, if arithmeticPairSplitTest d x then (1 : ℝ) else 0) ≤ B := by + cases d with + | none => simpa only [arithmeticPairSplitTest, ↓reduceIte, Finset.sum_const_zero, mul_zero] using hB + | some d => + have h := (d.1.pair_probability_le d.2).trans (hbound d.1 d.2 rfl) + convert h using 1 + congr 1 + apply Finset.sum_congr rfl + intro x _ + dsimp only [arithmeticPairSplitTest] + split_ifs with ht + · exact ite_eq_left ht + · exact ite_eq_right ht + +/-- All residue data are functions of the exposed prefix alone. This +derives the product bound for the actual two-history congruence tests. -/ +theorem arithmetic_sequential_support_le {Q : ℕ} [NeZero Q] + (data : List (ZMod Q)ˣ → Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) + (B : ℕ → ℝ) (hB : ∀ j, 0 ≤ B j) + (hbound : ∀ past d e, data past = some (d, e) → + 2 * ((d.reducedModulus.lcm e.reducedModulus).divisors.card : ℝ) ^ 2 / + d.reducedModulus.lcm e.reducedModulus ≤ B past.length) + (n : ℕ) : + (Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ ^ n * + (∑ x : SplitSamples (ZMod Q)ˣ n, + sequentialSupport (fun past y => arithmeticPairSplitTest (data past) y) [] n x) ≤ + ∏ j ∈ Finset.range n, B j := by + have h := sequentialSupport_average_le_product + (fun past y => arithmeticPairSplitTest (data past) y) B hB + (fun past => arithmeticPairSplit_probability_le (data past) (B past.length) (hB _) + (hbound past)) [] n + simpa only [List.length_nil, Nat.zero_add] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSplitTreeSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSplitTreeSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..32bedcacc5ac629b42766836ec795e7b9133b996 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSplitTreeSupport.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSplitData + +namespace OAI + +/-! # Multiplying the actual split probabilities at fixed frequencies -/ + +namespace Ostmann + +open scoped BigOperators Classical + +structure NodeFrequencies where + root : ℤ + left : ℤ + right : ℤ + +def NodeFrequencies.reducedModulus (f : NodeFrequencies) : ℕ := + reducedFrequency (f.left.natAbs.gcd f.right.natAbs) f.root.natAbs + +def ArithmeticSplitData.hasFrequencies {Q : ℕ} (d : ArithmeticSplitData Q) + (f : NodeFrequencies) : Prop := + d.frequency = f.root ∧ d.leftFrequency = f.left ∧ d.rightFrequency = f.right + +theorem ArithmeticSplitData.reducedModulus_eq {Q : ℕ} (d : ArithmeticSplitData Q) + (f : NodeFrequencies) (h : d.hasFrequencies f) : d.reducedModulus = f.reducedModulus := by + simp only [ArithmeticSplitData.reducedModulus, NodeFrequencies.reducedModulus, h.1, h.2.1, h.2.2] + +noncomputable def pairFrequencySupportBound (D : ℝ) (f : NodeFrequencies × NodeFrequencies) : ℝ := + 2 * D ^ 2 / f.1.reducedModulus.lcm f.2.reducedModulus + +theorem pairFrequencySupportBound_nonneg (D : ℝ) (f : NodeFrequencies × NodeFrequencies) : + 0 ≤ pairFrequencySupportBound D f := by unfold pairFrequencySupportBound; positivity + +/-- The reduced moduli depend only on the fixed frequencies. All pivot +and unit data may still vary with the previously exposed split products. -/ +theorem arithmetic_support_fixed_frequencies {Q : ℕ} [NeZero Q] + (data : List (ZMod Q)ˣ → Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) + (frequencies : ℕ → NodeFrequencies × NodeFrequencies) (D : ℝ) (_hD : 0 ≤ D) + (hmatch : ∀ past d e, data past = some (d, e) → + d.hasFrequencies (frequencies past.length).1 ∧ + e.hasFrequencies (frequencies past.length).2) + (hdiv : ∀ j, (((frequencies j).1.reducedModulus.lcm + (frequencies j).2.reducedModulus).divisors.card : ℝ) ≤ D) + (n : ℕ) : + (Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ ^ n * + (∑ x : SplitSamples (ZMod Q)ˣ n, + sequentialSupport (fun past y => arithmeticPairSplitTest (data past) y) [] n x) ≤ + ∏ j ∈ Finset.range n, pairFrequencySupportBound D (frequencies j) := by + apply arithmetic_sequential_support_le data _ (fun _ => pairFrequencySupportBound_nonneg _ _) _ n + intro past d e hd + obtain ⟨hdmatch, hematch⟩ := hmatch past d e hd + rw [d.reducedModulus_eq _ hdmatch, e.reducedModulus_eq _ hematch] + unfold pairFrequencySupportBound + apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) + exact mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (Nat.cast_nonneg _) (hdiv past.length) 2) (by norm_num) + +/-- The same product estimate on the original uniformly sampled leaf +tuples, conditional only on their total product. -/ +theorem arithmetic_leaf_support_fixed_frequencies {Q : ℕ} [NeZero Q] + (data : List (ZMod Q)ˣ → Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) + (frequencies : ℕ → NodeFrequencies × NodeFrequencies) (D : ℝ) (hD : 0 ≤ D) + (hmatch : ∀ past d e, data past = some (d, e) → + d.hasFrequencies (frequencies past.length).1 ∧ + e.hasFrequencies (frequencies past.length).2) + (hdiv : ∀ j, (((frequencies j).1.reducedModulus.lcm + (frequencies j).2.reducedModulus).divisors.card : ℝ) ≤ D) + (n : ℕ) (P : (ZMod Q)ˣ) : + (Fintype.card (TreeLeafFiber (ZMod Q)ˣ n P) : ℝ)⁻¹ * + (∑ x : TreeLeafFiber (ZMod Q)ˣ n P, + sequentialSupport (fun past y => arithmeticPairSplitTest (data past) y) [] + (2 ^ n - 1) (treeLeafSplitEquiv n P x)) ≤ + ∏ j ∈ Finset.range (2 ^ n - 1), pairFrequencySupportBound D (frequencies j) := by + rw [treeLeafSplit_average] + exact arithmetic_support_fixed_frequencies data frequencies D hD hmatch hdiv (2 ^ n - 1) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..41c70c2543aba954ccf82a3f087deb73b0183386 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSupport.lean @@ -0,0 +1,65 @@ +import Mathlib.RingTheory.Coprime.Lemmas +import Mathlib.Data.Nat.Prime.Int +import Mathlib.Tactic.LinearCombination + +namespace OAI + +/-! +# Arithmetic support at a reversing node + +These are the elementary support facts preceding the progression estimate +in Section 8. The numerator is automatically coprime to inherited slots; +the remaining condition at a new prime is exactly nondivisibility by its square. +-/ + +namespace Ostmann + +theorem reversal_numerator_coprime (v w HL HR : ℤ) + (hLR : IsCoprime HL HR) (hv : IsCoprime v HL) (hw : IsCoprime w HR) : + IsCoprime (v * HR - w * HL) HL ∧ IsCoprime (v * HR - w * HL) HR := by + constructor + · exact IsCoprime.sub_mul_right_left_iff.mpr (hv.mul_left hLR.symm) + · exact IsCoprime.mul_sub_right_left_iff.mpr (hw.mul_left hLR) + +/-- Both the inserted integer and its compensation product inherit all required coprimalities. -/ +theorem reversal_inherited_coprime (v w HL HR s u p : ℤ) + (hLR : IsCoprime HL HR) (hv : IsCoprime v HL) (hw : IsCoprime w HR) + (hrel : v * HR - w * HL = s * u * p) : + IsCoprime p (HL * HR) ∧ IsCoprime u (HL * HR) := by + obtain ⟨hL, hR⟩ := reversal_numerator_coprime v w HL HR hLR hv hw + have hboth := hL.mul_right hR + rw [hrel] at hboth + exact ⟨hboth.of_mul_left_right, hboth.of_mul_left_left.of_mul_left_right⟩ + +/-- A prime occurring once in `u` occurs once in the numerator exactly when it misses `p`. -/ +theorem reversal_square_test (b s u p : ℕ) (hb : b.Prime) + (hbs : ¬ b ∣ s) (hbu : b ∣ u) (hbu2 : ¬ b ^ 2 ∣ u) : + (¬ b ^ 2 ∣ s * u * p) ↔ ¬ b ∣ p := by + obtain ⟨v, rfl⟩ := hbu + have hbv : ¬ b ∣ v := by + intro hv + apply hbu2 + simpa only [pow_two] using mul_dvd_mul_left b hv + have heq : s * (b * v) * p = b * (s * v * p) := by ring + rw [heq, pow_two, mul_dvd_mul_iff_left hb.ne_zero] + simp only [hb.dvd_mul, hbs, hbv, or_self, false_or] + +/-- Divisibility by the frequency and all distinct new prime factors gives integer reconstruction. -/ +theorem reversal_integral_of_prime_tests (s N : ℤ) (U : Finset ℕ) + (hprime : ∀ b ∈ U, b.Prime) (hs : s ∣ N) + (hsu : ∀ b ∈ U, IsCoprime s (b : ℤ)) + (hdiv : ∀ b ∈ U, (b : ℤ) ∣ N) : + (s * ∏ b ∈ U, (b : ℤ)) ∣ N := by + classical + have hpair : (U : Set ℕ).Pairwise (fun b c => IsCoprime (b : ℤ) (c : ℤ)) := by + intro b hb c hc hbc + exact Int.isCoprime_iff_gcd_eq_one.mpr (by + simpa only [Int.gcd_natCast_natCast] using (hprime b hb).coprime_iff_not_dvd.mpr + (fun h => hbc ((hprime c hc).eq_one_or_self_of_dvd b h |>.resolve_left (hprime b hb).ne_one))) + have hprod : (∏ b ∈ U, (b : ℤ)) ∣ N := Finset.prod_dvd_of_coprime hpair hdiv + have hcop : IsCoprime s (∏ b ∈ U, (b : ℤ)) := IsCoprime.prod_right hsu + exact hcop.mul_dvd hs hprod + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSupportRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSupportRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c5b3f3404ed5863dcf6922fb6e594528cbf3504 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticSupportRate.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticHistorySupportSum +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyBudgetRates +import OAI.NumberTheory.Ostmann.Arithmetic.LeafFrequencyBudget + +namespace OAI + +/-! # The asymptotic frequency-support cost under the original Haar law -/ + +namespace Ostmann + +open scoped BigOperators Classical +open Filter + +noncomputable def arithmeticHistorySupportSum {Q : ℕ} [NeZero Q] + (S : Finset ℤ) (V n : ℕ) (P : FrequencyTree (S × S) n → (ZMod Q)ˣ) + (data : FrequencyTree (S × S) n → List (ZMod Q)ˣ → + Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) : ℝ := + ∑ t : FrequencyTree (S × S) n, + frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((Fintype.card (TreeLeafFiber (ZMod Q)ˣ n (P t)) : ℝ)⁻¹ * + ∑ x : TreeLeafFiber (ZMod Q)ˣ n (P t), + sequentialSupport (fun past y => arithmeticPairSplitTest (data t past) y) [] + (2 ^ n - 1) (treeLeafSplitEquiv n (P t) x)) + +theorem arithmetic_history_support_rate {Q : ℕ} [NeZero Q] + (n : ℕ) (K C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∀ N V : ℕ, ∀ Δ : ℝ, ∀ S : Finset ℤ, + (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + ∀ P : FrequencyTree (S × S) n → (ZMod Q)ˣ, + ∀ data : FrequencyTree (S × S) n → List (ZMod Q)ˣ → + Option (ArithmeticSplitData Q × ArithmeticSplitData Q), + (∀ t past d e, data t past = some (d, e) → + d.hasFrequencies (treeNodeFrequencies S n t past.length).1 ∧ + e.hasFrequencies (treeNodeFrequencies S n t past.length).2) → + Real.exp (-(2 ^ n : ℕ) * Δ + K) * arithmeticHistorySupportSum S V n P data ≤ + Real.exp ((2 ^ n : ℕ) * Δ + ε * m) := by + let r : ℕ := 2 ^ n + have hr : (0 : ℝ) < r := by exact_mod_cast (Nat.two_pow_pos n) + let δ : ℝ := ε / (2 * r) + have hδ : 0 < δ := div_pos hε (by positivity) + have hδr : δ * r = ε / 2 := by dsimp [δ]; field_simp + obtain ⟨M, hM⟩ := leaf_frequency_budget_sublinear r K (ε / 2) (by positivity) + filter_upwards [frequency_budget_subexponential C δ hC hδ, + eventually_ge_atTop M, eventually_ge_atTop (0 : ℝ)] with m hrate hm hm0 + intro N V Δ S hN hV hS P data hmatch + obtain ⟨D, hD, hdiv, hcost⟩ := hrate + have hdivN (q : ℕ) (hq : q ≠ 0) (hqN : q ≤ N ^ 2) : (q.divisors.card : ℝ) ≤ D := by + apply hdiv q hq + calc + (q : ℝ) ≤ (N : ℝ) ^ 2 := by exact_mod_cast hqN + _ ≤ Real.exp (C * m) ^ 2 := pow_le_pow_left₀ (Nat.cast_nonneg _) hN 2 + _ = Real.exp (2 * C * m) := by rw [← Real.exp_nat_mul]; congr 1; ring + have hsum := arithmetic_history_support_sum_le S N V n D hD hS hdivN P data hmatch + change arithmeticHistorySupportSum S V n P data ≤ + (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) * (2 * (V : ℝ)) ^ (2 * r) at hsum + have hC0 : 0 ≤ 8 * D ^ 4 * (1 + Real.log N) ^ 3 := by + have hlog := Real.log_natCast_nonneg N + positivity + have hnode : (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) ≤ + Real.exp ((ε / 2) * m) := by + calc + _ ≤ Real.exp (δ * m) ^ (r - 1) := pow_le_pow_left₀ hC0 (hcost N hN) _ + _ = Real.exp ((r - 1 : ℕ) * (δ * m)) := (Real.exp_nat_mul _ _).symm + _ ≤ _ := by + apply Real.exp_le_exp.mpr + have hcount : ((r - 1 : ℕ) : ℝ) ≤ r := by exact_mod_cast Nat.sub_le r 1 + have h := mul_le_mul_of_nonneg_right hcount (mul_nonneg hδ.le hm0) + nlinarith [hδr] + have hleaf := hM m hm Δ V hV + change Real.exp (-(r : ℝ) * Δ + K) * arithmeticHistorySupportSum S V n P data ≤ _ + calc + _ ≤ Real.exp (-(r : ℝ) * Δ + K) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) * (2 * (V : ℝ)) ^ (2 * r)) := + mul_le_mul_of_nonneg_left hsum (Real.exp_pos _).le + _ = (8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (r - 1) * + ((2 * (V : ℝ)) ^ (2 * r) * Real.exp (-(r : ℝ) * Δ + K)) := by ring + _ ≤ Real.exp ((ε / 2) * m) * Real.exp ((r : ℝ) * Δ + (ε / 2) * m) := + mul_le_mul hnode hleaf (by positivity) (Real.exp_pos _).le + _ = Real.exp ((2 ^ n : ℕ) * Δ + ε * m) := by + rw [← Real.exp_add] + dsimp [r] + congr 1 + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticTwoPrimePatternNormRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticTwoPrimePatternNormRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..28d25b406e4c9cf966b07e58838994e0506f5270 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ArithmeticTwoPrimePatternNormRate.lean @@ -0,0 +1,172 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternErrorRate +import OAI.NumberTheory.Ostmann.Arithmetic.PrimePatternFrequencyNormSum + +namespace OAI + +/-! # The full numerical norm bound with the original equality patterns -/ + +namespace Ostmann +open Filter +open scoped Classical BigOperators + +/-- The actual pattern sum and paired frequency sum have an absolute bulk +constant. The cutoff includes the constructed bottom reserve `2 sqrt(m)`. +Only the genuine comparison errors use the full number of histories. -/ +theorem arithmetic_two_prime_pattern_norm_rate (ψ : SchwartzMap ℝ ℂ) (n k : ℕ) + (hk : 0 < k) (hn : n ≤ k) (B Cfreq Cprior ε : ℝ) + (hCfreq : 0 ≤ Cfreq) (hCprior : 1 ≤ Cprior) (hε : 0 < ε) + (hdepth : 8 * (Cprior + 1) ≤ (k : ℝ) ^ 3) : + ∀ᶠ L : ℝ in atTop, let m := spectatorBulkCount k L + ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * Cfreq * m) → + (q.divisors.card : ℝ) ≤ D) ∧ + ∀ (S : Finset ℤ) (N V : ℕ) (Δ err : ℝ), + (S.card : ℝ) ≤ Real.exp (Cfreq * m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + (N : ℝ) ≤ Real.exp (Cfreq * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + 0 ≤ err → err ≤ Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 3 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) → + let _ := sampleSetoidFintype (Bool × MovingSampleIndex n) + let K := ((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m) + ∀ R : Setoid (Bool × MovingSampleIndex n) → FrequencyTree (S × S) n → ℂ, + (∀ s t, ‖R s t‖ ≤ + ((4 : ℝ) ^ Fintype.card (Quotient s) * + (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) * + (err + K * (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod))) → + ‖∑ s, ∑ t, R s t‖ ≤ + Real.exp ((2 ^ n : ℕ) * Δ + (Real.log 12 + 1) * (2 ^ n : ℕ) * m + ε * m) + + 4 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + have hCplus : 1 ≤ Cprior + 1 := by linarith + filter_upwards [arithmetic_prime_pattern_budget_rate ψ n k hk hn B Cfreq (Cprior + 1) ε + hCfreq hCplus hε hdepth, + movingPattern_four_errors_rate n k hk (Cprior + 1) Cfreq hCplus hCfreq, + eventually_ge_atTop (2 : ℝ)] with L hbudget herrors hL + dsimp only + obtain ⟨D, hD, hdiv, hbudget⟩ := hbudget + refine ⟨D, hD, hdiv, ?_⟩ + intro S N V Δ err hcard hS hN hV herr herrbound R hR + have hdivN : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D := by + intro q hq hqN + apply hdiv q hq + calc + (q : ℝ) ≤ (N : ℝ) ^ 2 := by exact_mod_cast hqN + _ ≤ (Real.exp (Cfreq * spectatorBulkCount k L)) ^ 2 := + pow_le_pow_left₀ (Nat.cast_nonneg N) hN 2 + _ = Real.exp (2 * Cfreq * spectatorBulkCount k L) := by + rw [← Real.exp_nat_mul] + congr 1 + ring + have hexp : (4 : ℝ) ≤ Real.exp ((Cprior + 1) * L) := by + have hCL := mul_le_mul hCplus hL (by norm_num : (0 : ℝ) ≤ 2) (by linarith) + have hCL' := mul_le_mul_of_nonneg_right hCprior (by linarith : 0 ≤ L) + linarith [Real.add_one_le_exp ((Cprior + 1) * L)] + have hmono : max 4 (Real.exp (Cprior * L)) ≤ max 2 (Real.exp ((Cprior + 1) * L)) := by + apply max_le + · exact hexp.trans (le_max_right _ _) + · exact (Real.exp_le_exp.mpr (by linarith)).trans (le_max_right _ _) + have hpriorcost : + (2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n) ≤ + (2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * (max 2 (Real.exp ((Cprior + 1) * L))) ^ (4 * n * 2 ^ n) := + mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (by positivity) hmono _) (by positivity) + have hsum := prime_pattern_frequency_norm_sum_le S n N V D (Real.exp (Cprior * L)) + (((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * spectatorBulkCount k L) * 4 * 3 ^ (2 ^ n * spectatorBulkCount k L)) * + 2 ^ (2 ^ n * spectatorBulkCount k L)) err hD (Real.exp_nonneg _) (by positivity) + herr hS hdivN R hR + have hcost := (mul_le_mul_of_nonneg_right hpriorcost (by positivity)).trans (hbudget N V Δ hN hV) + have he := (mul_le_mul_of_nonneg_left herrbound + (show 0 ≤ ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) by positivity)).trans + ((mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hpriorcost + (Nat.cast_nonneg _)) (by positivity)).trans (herrors S hcard)) + apply hsum.trans + nlinarith only [hcost, he] + +/-- The actual pattern sum and paired frequency sum have an absolute bulk +constant. The cutoff includes the constructed bottom reserve `2 sqrt(m)`. +The fifth error is the literal giant comparison; only comparison errors use the full number of histories. -/ +theorem arithmetic_two_prime_original_pattern_norm_rate (ψ : SchwartzMap ℝ ℂ) (n k : ℕ) + (hk : 0 < k) (hn : n ≤ k) (B Cfreq Cprior ε : ℝ) + (hCfreq : 0 ≤ Cfreq) (hCprior : 1 ≤ Cprior) (hε : 0 < ε) + (hdepth : 8 * (Cprior + 1) ≤ (k : ℝ) ^ 3) : + ∀ᶠ L : ℝ in atTop, let m := spectatorBulkCount k L + ∃ D : ℝ, 0 ≤ D ∧ + (∀ q : ℕ, q ≠ 0 → (q : ℝ) ≤ Real.exp (2 * Cfreq * m) → + (q.divisors.card : ℝ) ≤ D) ∧ + ∀ (S : Finset ℤ) (N V : ℕ) (Δ err : ℝ), + (S.card : ℝ) ≤ Real.exp (Cfreq * m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + (N : ℝ) ≤ Real.exp (Cfreq * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt (4 * m)) → + 0 ≤ err → err ≤ Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) + + 4 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) → + let _ := sampleSetoidFintype (Bool × MovingSampleIndex n) + let K := ((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m) + ∀ R : Setoid (Bool × MovingSampleIndex n) → FrequencyTree (S × S) n → ℂ, + (∀ s t, ‖R s t‖ ≤ + ((4 : ℝ) ^ Fintype.card (Quotient s) * + (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) * + (err + K * (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod))) → + ‖∑ s, ∑ t, R s t‖ ≤ + Real.exp ((2 ^ n : ℕ) * Δ + (Real.log 12 + 1) * (2 ^ n : ℕ) * m + ε * m) + + 5 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by + have hCplus : 1 ≤ Cprior + 1 := by linarith + filter_upwards [arithmetic_prime_pattern_budget_rate ψ n k hk hn B Cfreq (Cprior + 1) ε + hCfreq hCplus hε hdepth, + movingPattern_five_errors_rate n k hk (Cprior + 1) Cfreq hCplus hCfreq, + eventually_ge_atTop (2 : ℝ)] with L hbudget herrors hL + dsimp only + obtain ⟨D, hD, hdiv, hbudget⟩ := hbudget + refine ⟨D, hD, hdiv, ?_⟩ + intro S N V Δ err hcard hS hN hV herr herrbound R hR + have hdivN : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D := by + intro q hq hqN + apply hdiv q hq + calc + (q : ℝ) ≤ (N : ℝ) ^ 2 := by exact_mod_cast hqN + _ ≤ (Real.exp (Cfreq * spectatorBulkCount k L)) ^ 2 := + pow_le_pow_left₀ (Nat.cast_nonneg N) hN 2 + _ = Real.exp (2 * Cfreq * spectatorBulkCount k L) := by + rw [← Real.exp_nat_mul] + congr 1 + ring + have hexp : (4 : ℝ) ≤ Real.exp ((Cprior + 1) * L) := by + have hCL := mul_le_mul hCplus hL (by norm_num : (0 : ℝ) ≤ 2) (by linarith) + have hCL' := mul_le_mul_of_nonneg_right hCprior (by linarith : 0 ≤ L) + linarith [Real.add_one_le_exp ((Cprior + 1) * L)] + have hmono : max 4 (Real.exp (Cprior * L)) ≤ max 2 (Real.exp ((Cprior + 1) * L)) := by + apply max_le + · exact hexp.trans (le_max_right _ _) + · exact (Real.exp_le_exp.mpr (by linarith)).trans (le_max_right _ _) + have hpriorcost : + (2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n) ≤ + (2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * (max 2 (Real.exp ((Cprior + 1) * L))) ^ (4 * n * 2 ^ n) := + mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (by positivity) hmono _) (by positivity) + have hsum := prime_pattern_frequency_norm_sum_le S n N V D (Real.exp (Cprior * L)) + (((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Δ)) ^ (2 ^ n) * + B ^ (2 ^ n - 1)) ^ 2 * + ((2 : ℝ) ^ (2 ^ n * spectatorBulkCount k L) * 4 * 3 ^ (2 ^ n * spectatorBulkCount k L)) * + 2 ^ (2 ^ n * spectatorBulkCount k L)) err hD (Real.exp_nonneg _) (by positivity) + herr hS hdivN R hR + have hcost := (mul_le_mul_of_nonneg_right hpriorcost (by positivity)).trans (hbudget N V Δ hN hV) + have he := (mul_le_mul_of_nonneg_left herrbound + (show 0 ≤ ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) * + (max 4 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) * + (Fintype.card (FrequencyTree (S × S) n) : ℝ) by positivity)).trans + ((mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hpriorcost + (Nat.cast_nonneg _)) (by positivity)).trans (herrors S hcard)) + apply hsum.trans + nlinarith only [hcost, he] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/AssignedPrimeCellReplacement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AssignedPrimeCellReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..531c0705e86f72f2bf67e1c9705701b8406886cb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AssignedPrimeCellReplacement.lean @@ -0,0 +1,125 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionReplacement +import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionTuples +import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellJointReplacementAlgebra + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.LogCellPartition +open PrimeProgression PrimeCellReplacement +open scoped BigOperators + +def assignedJointComplexTestSum {ι : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (M : ℕ) [NeZero M] (lo hi η Z : ι → ℝ) + (j : GridBoxIndex lo hi η) (F : (ι → (ZMod M)ˣ) → ℂ) : ℂ := + ∑ p : AssignedPrimeTuple N lo hi η j, + (∏ i, (((Z i * ((p i).val : ℝ))⁻¹ : ℝ) : ℂ)) * + jointUnitTest F (fun i => ((p i).val : ZMod M)) + +theorem assignedJointComplexTestSum_eq {ι : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (M : ℕ) [NeZero M] (lo hi η Z : ι → ℝ) + (j : GridBoxIndex lo hi η) (F : (ι → (ZMod M)ˣ) → ℂ) : + assignedJointComplexTestSum N M lo hi η Z j F = + ∑ u : ι → (ZMod M)ˣ, + (∏ i, (assignedResidueMass (N i) M (u i) (lo i) (hi i) (η i) (Z i) (j i) : ℂ)) * F u := by + classical + have hpart := finite_product_prior_partition + (fun i (p : {p : ℕ // p ∈ assignedPrimeSupport (N i) (lo i) (hi i) (η i) (j i)}) => + (p.val : ZMod M)) + (fun i (p : {p : ℕ // p ∈ assignedPrimeSupport (N i) (lo i) (hi i) (η i) (j i)}) => + (((Z i * (p.val : ℝ))⁻¹ : ℝ) : ℂ)) F + change assignedJointComplexTestSum N M lo hi η Z j F = _ at hpart + rw [hpart] + apply Finset.sum_congr rfl + intro u hu + congr 1 + apply Finset.prod_congr rfl + intro i hi' + rw [Finset.sum_coe_sort (assignedPrimeSupport (N i) (lo i) (hi i) (η i) (j i)) + (fun p : ℕ => if (u i : ZMod M) = (p : ZMod M) then + (((Z i * (p : ℝ))⁻¹ : ℝ) : ℂ) else 0)] + simp only [assignedResidueMass, Complex.ofReal_sum, Finset.sum_filter] + apply Finset.sum_congr rfl + intro p hp + by_cases he : (p : ZMod M) = (u i : ZMod M) + · simp [he] + · simp [he, Ne.symm he] + +theorem assignedJointComplexTestSum_error {ι : Type*} [Fintype ι] [DecidableEq ι] + (N : ι → ℕ) (M : ℕ) [NeZero M] (lo hi η Z : ι → ℝ) + (j : GridBoxIndex lo hi η) (main E : ι → ℝ) + (F : (ι → (ZMod M)ˣ) → ℂ) {ε B : ℝ} (hε : 0 ≤ ε) (hB : 1 ≤ B) + (hE : ∀ i, E i ≤ ε) (hbound : ∀ i, |main i| + E i ≤ B) + (hmass : ∀ i (u : (ZMod M)ˣ), + |assignedResidueMass (N i) M u (lo i) (hi i) (η i) (Z i) (j i) - main i| ≤ E i) : + ‖assignedJointComplexTestSum N M lo hi η Z j F - + (∏ i, (main i : ℂ)) * ∑ u : ι → (ZMod M)ˣ, F u‖ ≤ + Fintype.card ι * ε * B ^ Fintype.card ι * ∑ u : ι → (ZMod M)ˣ, ‖F u‖ := by + classical + have hμ : ∀ i (u : (ZMod M)ˣ), + ‖(assignedResidueMass (N i) M u (lo i) (hi i) (η i) (Z i) (j i) : ℂ)‖ ≤ B := by + intro i u + have ht := abs_add_le + (assignedResidueMass (N i) M u (lo i) (hi i) (η i) (Z i) (j i) - main i) (main i) + rw [sub_add_cancel] at ht + simp only [Complex.norm_real, Real.norm_eq_abs] + linarith [hmass i u, hbound i] + have hν : ∀ i (u : (ZMod M)ˣ), ‖(main i : ℂ)‖ ≤ B := by + intro i u + have he0 : 0 ≤ E i := (abs_nonneg _).trans (hmass i 1) + simp only [Complex.norm_real, Real.norm_eq_abs] + linarith [hbound i] + have he : ∀ i (u : (ZMod M)ˣ), + ‖(assignedResidueMass (N i) M u (lo i) (hi i) (η i) (Z i) (j i) : ℂ) - (main i : ℂ)‖ ≤ ε := by + intro i u + simpa only [← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using + (hmass i u).trans (hE i) + have h := joint_product_test_error + (fun i (u : (ZMod M)ˣ) => + (assignedResidueMass (N i) M u (lo i) (hi i) (η i) (Z i) (j i) : ℂ)) + (fun i (_ : (ZMod M)ˣ) => (main i : ℂ)) F hε hB hμ hν he + rw [assignedJointComplexTestSum_eq] + simpa only [Finset.mul_sum] using h + +theorem exists_assigned_joint_primeCell_replacement_constants : + ∃ d K L₀ : ℝ, 0 < d ∧ 0 < K ∧ 1 ≤ L₀ ∧ + ∀ (ι : Type*) [Fintype ι] [DecidableEq ι] (N : ι → ℕ) (M : ℕ) [NeZero M] + (lo hi η Z : ι → ℝ), + (∀ i, L₀ ≤ lo i ∧ lo i ≤ hi i ∧ 0 < η i ∧ η i ≤ 1 ∧ + ⌊Real.exp (hi i)⌋₊ ≤ N i ∧ 0 < Z i ∧ + (M : ℝ) ≤ Real.exp (d * (lo i) ^ (1 / 3 : ℝ))) → + ∀ (j : GridBoxIndex lo hi η) (ε B : ℝ), 0 ≤ ε → 1 ≤ B → + (∀ i, (K / Z i) * Real.exp (-d * (gridPoint (lo i) (hi i) (η i) (j i).val) ^ (1 / 3 : ℝ)) + + (Z i*Real.exp (gridPoint (lo i) (hi i) (η i) (j i).val))⁻¹ ≤ ε) → + (∀ i, |harmonicIntegral M (gridPoint (lo i) (hi i) (η i) (j i).val) + (gridPoint (lo i) (hi i) (η i) ((j i).val+1)) / Z i| + + ((K / Z i) * Real.exp (-d * (gridPoint (lo i) (hi i) (η i) (j i).val) ^ (1 / 3 : ℝ)) + + (Z i*Real.exp (gridPoint (lo i) (hi i) (η i) (j i).val))⁻¹) ≤ B) → + ∀ F : (ι → (ZMod M)ˣ) → ℂ, + ‖assignedJointComplexTestSum N M lo hi η Z j F - + (∏ i, ((harmonicIntegral M (gridPoint (lo i) (hi i) (η i) (j i).val) + (gridPoint (lo i) (hi i) (η i) ((j i).val+1)) / Z i : ℝ) : ℂ)) * + ∑ u : ι → (ZMod M)ˣ, F u‖ ≤ + Fintype.card ι * ε * B ^ Fintype.card ι * + ∑ u : ι → (ZMod M)ˣ, ‖F u‖ := by + obtain ⟨d,K,L₀,hd,hK,hL₀,h⟩ := exists_assigned_residueMass_error_constants + refine ⟨d,K,L₀,hd,hK,hL₀,?_⟩ + intro ι _ _ N M _ lo hi η Z hcell j ε B hε hB hE hbound F + apply assignedJointComplexTestSum_error N M lo hi η Z j + (fun i => harmonicIntegral M (gridPoint (lo i) (hi i) (η i) (j i).val) + (gridPoint (lo i) (hi i) (η i) ((j i).val+1)) / Z i) + (fun i => (K / Z i) * Real.exp (-d * (gridPoint (lo i) (hi i) (η i) (j i).val) ^ (1 / 3 : ℝ)) + + (Z i*Real.exp (gridPoint (lo i) (hi i) (η i) (j i).val))⁻¹) F hε hB hE hbound + intro i u + obtain ⟨hlo,hlohi,hη,hη1,hN,hZ,hmod⟩ := hcell i + exact h (lo i) (hi i) (η i) hlo hlohi hη hη1 (N i) M (Z i) hN hZ hmod (j i) u u.isUnit + +end Ostmann.Arithmetic.LogCellPartition + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/AtomIntervalComplexity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AtomIntervalComplexity.lean new file mode 100644 index 0000000000000000000000000000000000000000..41b46aef9d974accdd414f3c5c60cce07fed187d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AtomIntervalComplexity.lean @@ -0,0 +1,27 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.AtomIntervalRanges + +namespace OAI + +/-! # The original interval guards have bounded complexity at every finite depth -/ +namespace Ostmann +open scoped Classical + +theorem atomIntervalRanges_singleton {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (lo hi : I → ℕ) (n : ℕ) + (r : ScheduleAtomRange role n) (hr : r ∈ atomIntervalRanges role lo hi n) : + r.atoms.length = 1 := by + obtain ⟨v, _, rfl⟩ := List.mem_map.mp hr + rfl + +theorem atomIntervalRanges_length_le {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (lo hi : I → ℕ) (k n : ℕ) (hn : n ≤ k) : + (atomIntervalRanges role lo hi n).length ≤ 3 ^ k * Fintype.card I := by + have he : (atomIntervalRanges role lo hi n).length = Fintype.card (CopyScheduleAtoms role n) := by + simp only [atomIntervalRanges, List.length_map, Finset.length_toList, Finset.card_univ] + rw [he] + exact (copyScheduleAtoms_card_le role n).trans + (Nat.mul_le_mul_right _ (Nat.pow_le_pow_right (by omega : 1 ≤ 3) hn)) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/AtomIntervalRanges.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AtomIntervalRanges.lean new file mode 100644 index 0000000000000000000000000000000000000000..d1b71d343cdbc3ec6ca63c29202f90373c54e50a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AtomIntervalRanges.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Construction.FullAtomRangeSupport +import OAI.NumberTheory.Ostmann.Construction.ConstituentCopiedSupport + +namespace OAI + +/-! # Concrete inherited intervals for every original atom role -/ + +namespace Ostmann + +open scoped Classical + +noncomputable def atomInterval {I : Type*} (role : I → CopyScheduleRole) + (lo hi : I → ℕ) (n : ℕ) (v : CopyScheduleAtoms role n) : ScheduleAtomRange role n where + atoms := [v] + lower := lo (copyScheduleOrigin n v.val) + upper := hi (copyScheduleOrigin n v.val) + +noncomputable def atomIntervalRanges {I : Type*} [Fintype I] (role : I → CopyScheduleRole) + (lo hi : I → ℕ) (n : ℕ) : List (ScheduleAtomRange role n) := + Finset.univ.toList.map (atomInterval role lo hi n) + +theorem atomInterval_holds_iff {I : Type*} (role : I → CopyScheduleRole) + (lo hi : I → ℕ) (n : ℕ) (v : CopyScheduleAtoms role n) (x : CopyScheduleAtoms role n → ℕ) : + (atomInterval role lo hi n v).Holds x ↔ + lo (copyScheduleOrigin n v.val) ≤ x v ∧ x v ≤ hi (copyScheduleOrigin n v.val) := by + simp only [atomInterval, ScheduleAtomRange.Holds, List.map_singleton, List.prod_singleton, + Set.mem_Icc, Nat.cast_le] + +theorem atomIntervalRanges_holds_iff {I : Type*} [Fintype I] (role : I → CopyScheduleRole) + (lo hi : I → ℕ) (n : ℕ) (x : CopyScheduleAtoms role n → ℕ) : + (∀ r ∈ atomIntervalRanges role lo hi n, r.Holds x) ↔ + ∀ v, lo (copyScheduleOrigin n v.val) ≤ x v ∧ x v ≤ hi (copyScheduleOrigin n v.val) := by + constructor + · intro h v + apply (atomInterval_holds_iff role lo hi n v x).mp + apply h + exact List.mem_map.mpr ⟨v, Finset.mem_toList.mpr (Finset.mem_univ v), rfl⟩ + · intro h r hr + obtain ⟨v, _, rfl⟩ := List.mem_map.mp hr + exact (atomInterval_holds_iff role lo hi n v x).mpr (h v) + +/-- Copying preserves the original atom origin and hence its exact interval. -/ +theorem atomIntervalRanges_copied {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (lo hi : I → ℕ) (n M : ℕ) + (u : CopyScheduleY role n → ℕ) (l r : CopyScheduleH role n → ℕ) + (hL : ∀ a ∈ atomIntervalRanges role lo hi n, + a.Holds (scheduledInsertedAtoms role n M l u)) + (hR : ∀ a ∈ atomIntervalRanges role lo hi n, + a.Holds (scheduledInsertedAtoms role n M r u)) : + ∀ a ∈ atomIntervalRanges role lo hi (n + 1), + a.Holds (scheduledCopiedAssignment role n u l r) := by + apply (atomIntervalRanges_holds_iff role lo hi (n + 1) _).mpr + have hL' := (atomIntervalRanges_holds_iff role lo hi n _).mp hL + have hR' := (atomIntervalRanges_holds_iff role lo hi n _).mp hR + intro v + obtain ⟨j, rfl⟩ := (copyScheduleSurvivorEquiv role n).symm.surjective v + rcases j with ⟨b, h⟩ | y + · cases b + · have hh := hR' ⟨h.val, h.property.1⟩ + change lo (copyScheduleOrigin n h.val) ≤ r h ∧ r h ≤ hi (copyScheduleOrigin n h.val) + simpa only [scheduledInsertedAtoms_H] using hh + · have hh := hL' ⟨h.val, h.property.1⟩ + change lo (copyScheduleOrigin n h.val) ≤ l h ∧ l h ≤ hi (copyScheduleOrigin n h.val) + simpa only [scheduledInsertedAtoms_H] using hh + · have hh := hL' ⟨y.val, y.property.1⟩ + change lo (copyScheduleOrigin n y.val) ≤ u y ∧ u y ≤ hi (copyScheduleOrigin n y.val) + simpa only [scheduledInsertedAtoms_Y] using hh + +/-- Both old full coefficients enforce every new interval. This discharges +the interval clause in the actual guarded arithmetic step. -/ +theorem fullAtomTransferWeight_copied_intervals {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (lo hi : I → ℕ) + (childBound pivotBound : ℕ → ℕ) (leaf : ScheduleAtomState role → ℤ → ℂ) + (n M : ℕ) (u : CopyScheduleY role n → ℕ) (l r : CopyScheduleH role n → ℕ) + (t t' : FrequencyTree ℤ n) + (hL : fullAtomTransferWeight role childBound pivotBound (atomIntervalRanges role lo hi) leaf n + (scheduledInsertedAtoms role n M l u) t ≠ 0) + (hR : fullAtomTransferWeight role childBound pivotBound (atomIntervalRanges role lo hi) leaf n + (scheduledInsertedAtoms role n M r u) t' ≠ 0) : + ∀ a ∈ atomIntervalRanges role lo hi (n + 1), a.Holds (scheduledCopiedAssignment role n u l r) := by + exact atomIntervalRanges_copied role lo hi n M u l r + (fun a ha => fullAtomTransferWeight_top_range role childBound pivotBound _ leaf n _ t hL a ha) + (fun a ha => fullAtomTransferWeight_top_range role childBound pivotBound _ leaf n _ t' hR a ha) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/AveragedArithmeticTransfer.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AveragedArithmeticTransfer.lean new file mode 100644 index 0000000000000000000000000000000000000000..9bba83fccebf8feeaf5435a64dadf4943c8c2f86 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/AveragedArithmeticTransfer.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Characters.PivotArithmeticTransfer + +namespace OAI + +/-! # Retaining the complex off-diagonal through the outside average -/ + +namespace Ostmann + +open scoped BigOperators + +/-- The real-part form must be averaged before taking the norm of the next +amplitude. The original outside law may be a subprobability law. -/ +theorem averaged_arithmetic_transfer {Y : Type*} [Fintype Y] + (μ : Y → ℝ) (hμ : ∀ y, 0 ≤ μ y) (hmass : ∑ y, μ y ≤ 1) + (η θ : Y → ℂ) (D : Y → ℝ) (C : ℝ) (hC : 0 ≤ C) + (hlocal : ∀ y, ‖η y‖ ^ 2 ≤ C * (D y + (θ y).re)) : + ‖∑ y, (μ y : ℂ) * η y‖ ^ 2 ≤ + C * ((∑ y, μ y * D y) + ‖∑ y, (μ y : ℂ) * θ y‖) := by + have hRe : (∑ y, (μ y : ℂ) * θ y).re = ∑ y, μ y * (θ y).re := by + simp only [Complex.re_sum, Complex.mul_re, Complex.ofReal_re, Complex.ofReal_im, + zero_mul, sub_zero] + calc + _ ≤ ∑ y, μ y * ‖η y‖ ^ 2 := subprobability_weighted_norm_sq_le μ hμ hmass η + _ ≤ ∑ y, μ y * (C * (D y + (θ y).re)) := + Finset.sum_le_sum fun y _ => mul_le_mul_of_nonneg_left (hlocal y) (hμ y) + _ = ∑ y, C * (μ y * D y + μ y * (θ y).re) := by + apply Finset.sum_congr rfl + intro y _ + ring + _ = C * ((∑ y, μ y * D y) + ∑ y, μ y * (θ y).re) := by + rw [← Finset.mul_sum, Finset.sum_add_distrib] + _ = C * ((∑ y, μ y * D y) + (∑ y, (μ y : ℂ) * θ y).re) := by rw [hRe] + _ ≤ _ := mul_le_mul_of_nonneg_left (add_le_add le_rfl (Complex.re_le_norm _)) hC + +/-- A concrete harmonic-prior loss bounded by exp(d) gives the normalized +transfer inequality used by the iteration theorem. -/ +theorem normalized_arithmetic_transfer (η θ : ℂ) (D C d : ℝ) + (hD : 0 ≤ D) (hC : C ≤ Real.exp d) + (htransfer : ‖η‖ ^ 2 ≤ C * (D + ‖θ‖)) : + Real.exp (-d) * ‖η‖ ^ 2 ≤ D + ‖θ‖ := by + have hCD : Real.exp (-d) * C ≤ 1 := by + calc + _ ≤ Real.exp (-d) * Real.exp d := mul_le_mul_of_nonneg_left hC (Real.exp_pos _).le + _ = 1 := by rw [← Real.exp_add]; simp + calc + _ ≤ Real.exp (-d) * (C * (D + ‖θ‖)) := + mul_le_mul_of_nonneg_left htransfer (Real.exp_pos _).le + _ = (Real.exp (-d) * C) * (D + ‖θ‖) := by ring + _ ≤ 1 * (D + ‖θ‖) := mul_le_mul_of_nonneg_right hCD (add_nonneg hD (norm_nonneg _)) + _ = _ := one_mul _ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BipartiteHaar.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BipartiteHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0d5ce8c537ef06392f86ec8cce8e73c9268105f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BipartiteHaar.lean @@ -0,0 +1,113 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.IncidenceComponents + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.BipartiteHaar +open IncidenceHaar + +variable {L R E G : Type*} [Fintype L] [Fintype R] [Fintype E] + [DecidableEq L] [DecidableEq R] [CommGroup G] + +def signedEquiv : ((L → G) × (R → G)) ≃* (L ⊕ R → G) where + toFun x := Sum.elim x.1 (fun r => (x.2 r)⁻¹) + invFun x := (fun l => x (.inl l),fun r => (x (.inr r))⁻¹) + left_inv x := by ext z <;> simp + right_inv x := by funext z; cases z <;> simp + map_mul' x y := by funext z; cases z <;> simp [mul_comm] + +def slotProducts (left : E → L) (right : E → R) : + (E → G) →* ((L → G) × (R → G)) where + toFun x := (fun l => fiberProduct left l x,fun r => fiberProduct right r x) + map_one' := by ext z <;> simp + map_mul' x y := by ext z <;> simp + +omit [Fintype L] [Fintype R] in +theorem signed_slotProducts (left : E → L) (right : E → R) (x : E → G) : + signedEquiv (slotProducts left right x) = + boundary (fun e => Sum.inl (left e)) (fun e => Sum.inr (right e)) x := by + funext v + cases v with + | inl l => + change (∏ e ∈ Finset.univ.filter (fun e => left e=l),x e) = + (∏ e, flow (Sum.inl (left e)) (Sum.inr (right e)) (x e)) (Sum.inl l) + simp [flow, Finset.prod_apply, Pi.mulSingle_apply, Finset.prod_filter,eq_comm] + | inr r => + change (∏ e ∈ Finset.univ.filter (fun e => right e=r),x e)⁻¹ = + (∏ e, flow (Sum.inl (left e)) (Sum.inr (right e)) (x e)) (Sum.inr r) + simp [flow, Finset.prod_apply, Pi.mulSingle_apply, Finset.prod_filter,eq_comm] + +abbrev Components (left : E → L) (right : E → R) := + Component (fun e => Sum.inl (left e)) (fun e => Sum.inr (right e)) + +def leftComponent (left : E → L) (right : E → R) (l : L) : Components left right := + componentLabel _ _ (Sum.inl l) +def rightComponent (left : E → L) (right : E → R) (r : R) : Components left right := + componentLabel _ _ (Sum.inr r) + +omit [DecidableEq L] [DecidableEq R] in +theorem fiberProduct_signed {C : Type*} [DecidableEq C] + (pl : L → C) (pr : R → C) (c : C) (x : (L → G) × (R → G)) : + fiberProduct (Sum.elim pl pr) c (signedEquiv x) = + fiberProduct pl c x.1 / fiberProduct pr c x.2 := by + simp only [fiberProduct,Finset.prod_filter,Fintype.prod_sum_type] + simp only [signedEquiv,MulEquiv.coe_mk,Equiv.coe_fn_mk,Sum.elim_inl,Sum.elim_inr] + change (∏ l, if pl l = c then x.1 l else 1) * + (∏ r, if pr r = c then (x.2 r)⁻¹ else 1) = + (∏ l, if pl l = c then x.1 l else 1) / + (∏ r, if pr r = c then x.2 r else 1) + rw [div_eq_mul_inv,← Finset.prod_inv_distrib] + congr 1 + apply Finset.prod_congr rfl + intro r hr + split_ifs <;> simp + +omit [Fintype E] [DecidableEq L] [DecidableEq R] in +theorem componentProduct_signed (left : E → L) (right : E → R) + (c : Components left right) (x : (L → G) × (R → G)) : + fiberProduct (componentLabel (fun e => Sum.inl (left e)) + (fun e => Sum.inr (right e))) c (signedEquiv x) = + fiberProduct (leftComponent left right) c x.1 / + fiberProduct (rightComponent left right) c x.2 := by + have hlabel : componentLabel (fun e => Sum.inl (left e)) (fun e => Sum.inr (right e)) = + Sum.elim (leftComponent left right) (rightComponent left right) := by + funext v; cases v <;> rfl + rw [hlabel] + exact fiberProduct_signed _ _ c x + +def coupled (left : E → L) (right : E → R) : Subgroup ((L → G) × (R → G)) := + (balanced (fun e => Sum.inl (left e)) (fun e => Sum.inr (right e))).comap + signedEquiv.toMonoidHom + +omit [Fintype E] [DecidableEq L] [DecidableEq R] in +theorem mem_coupled_iff (left : E → L) (right : E → R) (x : (L → G) × (R → G)) : + x ∈ coupled left right ↔ ∀ c : Components left right, + fiberProduct (leftComponent left right) c x.1 = + fiberProduct (rightComponent left right) c x.2 := by + change (∀ c, fiberProduct _ c (signedEquiv x) = 1) ↔ _ + simp only [componentProduct_signed,div_eq_one] + +theorem slotProducts_range (left : E → L) (right : E → R) : + (slotProducts (G:=G) left right).range = coupled left right := by + ext x + constructor + · rintro ⟨y,rfl⟩ + change signedEquiv (slotProducts left right y) ∈ balanced _ _ + rw [signed_slotProducts,← boundary_range_eq_balanced] + exact ⟨y,rfl⟩ + · intro hx + have hx' : signedEquiv x ∈ (boundary + (fun e => Sum.inl (left e)) (fun e => Sum.inr (right e))).range := by + rw [boundary_range_eq_balanced] + exact hx + obtain ⟨y,hy⟩ := hx' + refine ⟨y, signedEquiv.injective ?_⟩ + rw [signed_slotProducts] + exact hy + +end Ostmann.Arithmetic.BipartiteHaar + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BoundedLineComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BoundedLineComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe5c2baf6b3cb8f7594876053952b93c0b5e0d0b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BoundedLineComparison.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticLineComparison +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticHistoryLines + +namespace OAI + +/-! # The quantitative line comparison from coefficient size and degree -/ + +namespace Ostmann + +open scoped BigOperators Classical + +theorem bounded_line_probability_comparison_le {A J : Type*} [Fintype A] [Fintype J] + {n : ℕ} (value : A → ℤ) (hinj : Function.Injective value) + (L : J → PolynomialGiantLine (Fin n)) (i : J) (external : Bool) + (D : ℕ) (U : ℝ) (hU : 1 ≤ U) + (hdegree : ∀ j, (L j).a.totalDegree ≤ D ∧ (L j).b.totalDegree ≤ D) + (hcoeff : ∀ (x : Fin n → A) j, + |MvPolynomial.eval₂Hom (Int.castRingHom ℝ) (fun k => (value (x k) : ℝ)) (L j).a| ≤ U ∧ + |MvPolynomial.eval₂Hom (Int.castRingHom ℝ) (fun k => (value (x k) : ℝ)) (L j).b| ≤ U) + (μ : Fin n → A → ℝ) (hμ : ∀ j a, 0 ≤ μ j a) + (hmass : ∀ j, ∑ a, μ j a = 1) + (α : ℝ) (hα : 0 ≤ α) (hmax : ∀ j a, μ j a ≤ α) + (P : Finset ℕ) (hprime : ∀ p ∈ P, p.Prime) + (ν : ℕ → ℝ) (hν : ∀ p ∈ P, 0 ≤ ν p) (hνmass : ∑ p ∈ P, ν p = 1) + (β V : ℝ) (hβ : 0 ≤ β) (hV : 0 < V) + (hνmax : ∀ p ∈ P, ν p ≤ β) (hsize : ∀ p ∈ P, V ≤ Real.log (p : ℝ)) + (hd : ∀ (x : Fin n → A) (p : P) j, integerLineReduction value x p (L j).denominator ≠ 0) + (hrow : ∀ (x : Fin n → A) (p : P), + integerLineReduction value x p (L i).a ≠ 0 ∨ integerLineReduction value x p (L i).b ≠ 0) + (F : (Fin n → A) → ℕ → ℂ) (B : ℝ) (hB : 0 ≤ B) (hF : ∀ x p, ‖F x p‖ ≤ B) : + ‖∑ x, ∑ p : P, ((productPrior μ x * ν p : ℝ) : ℂ) * F x p * + ((sampledLineProbability value L external P hprime x p : ℂ) - + (internalLineFlagWeight external p + (fun s => arithmeticTestFlag (lineTestPolynomials L i s = 0)) : ℂ))‖ ≤ + 2 * B * (Fintype.card J + 2 : ℝ) * + (2 * D * α + (Real.log (2 * U ^ 2) / V) * β) := by + have hU' : 1 ≤ 2 * U ^ 2 := by nlinarith + have hv (s : Bool ⊕ J) (x : Fin n → A) : + |(integerTestValue value (lineTestPolynomials L i s) x : ℝ)| ≤ 2 * U ^ 2 := by + rw [integerTestValue_real_cast] + exact lineTestPolynomials_value_le L i _ U hU (hcoeff x) s + have h := sampled_line_probability_comparison_le value hinj L i external μ hμ hmass + α hα hmax P hprime ν hν hνmass β V (2 * U ^ 2) hβ hV hU' hνmax hsize hv hd hrow F B hB hF + refine h.trans ?_ + have hsum : (∑ s : Bool ⊕ J, + (((lineTestPolynomials L i s).totalDegree : ℝ) * α + Real.log (2 * U ^ 2) / V * β)) ≤ + (Fintype.card J + 2 : ℝ) * (2 * D * α + Real.log (2 * U ^ 2) / V * β) := by + calc + _ ≤ ∑ _s : Bool ⊕ J, (2 * D * α + Real.log (2 * U ^ 2) / V * β) := by + apply Finset.sum_le_sum + intro s _ + have hd' : ((lineTestPolynomials L i s).totalDegree : ℝ) ≤ 2 * D := by + exact_mod_cast lineTestPolynomials_degree_le L i D hdegree s + have hm := mul_le_mul_of_nonneg_right hd' hα + linarith + _ = _ := by simp [Fintype.card_sum, add_comm]; ring + calc + _ ≤ 2 * B * ((Fintype.card J + 2 : ℝ) * + (2 * D * α + Real.log (2 * U ^ 2) / V * β)) := + mul_le_mul_of_nonneg_left hsum (by positivity) + _ = _ := by ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkAbsoluteIntegral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkAbsoluteIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..989560ca1fe8cf1a17f905e4e23ea896a8391f70 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkAbsoluteIntegral.lean @@ -0,0 +1,99 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResidueIntegral +import OAI.NumberTheory.Ostmann.ZeroDensity.BulkHaarDensity +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSeparatedKernelBound + +namespace OAI + +/-! # Integrating the nonnegative arithmetic norm under the original Page density -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +/-- The absolute residue average is integrated with the true harmonic box +volume. The Page factors remain inside the arithmetic norm estimate. -/ +theorem bulk_absolute_integral_bound {J : Type*} [Fintype J] + (P : PublishedProgressionInput) (Q M : ℕ) [NeZero M] + (u v : J → ℝ) (hu : ∀ j, 0 < u j) + (K : BulkIntegrand J) (a : (J → (ZMod M)ˣ) → ℂ) (W A : ℝ) + (hW : 0 ≤ W) (hK : ∀ y, ‖K y‖ ≤ W) + (hA : ∀ y : J → ℝ, (∀ j, y j ∈ Set.Ioc (u j) (v j)) → + (Fintype.card (J → (ZMod M)ˣ) : ℝ)⁻¹ * + ∑ z, ‖a z * ∏ j, pageGiantWeight P Q M (z j).val.val (y j)‖ ≤ A) : + ‖∑ z : J → (ZMod M)ˣ, ∫ y, (K.constMul (a z)) y ∂Measure.pi (fun j => + primeGiantMeasure P Q M (z j).val.val (u j) (v j))‖ ≤ + (W * A) * ∏ j, ∫ x in Set.Ioc (u j) (v j), (x : ℝ)⁻¹ := by + let μ : J → Measure ℝ := fun j => volume.restrict (Set.Ioc (u j) (v j)) + have hi (j : J) : Integrable (fun x : ℝ => x⁻¹) (μ j) := by + have hc : ContinuousOn (fun x : ℝ => x⁻¹) (Set.Icc (u j) (v j)) := + continuousOn_inv₀.mono (fun x hx => ne_of_gt (lt_of_lt_of_le (hu j) hx.1)) + exact hc.integrableOn_Icc.mono_set Set.Ioc_subset_Icc_self + have hp : Integrable (fun y : J → ℝ => ∏ j, (y j)⁻¹) (Measure.pi μ) := + Integrable.fintype_prod hi + rw [bulk_page_residue_integral P Q (fun _ => M) (fun z j => (z j).val.val) u v hu (fun z => K.constMul (a z))] + have hb : ∀ᵐ y ∂Measure.pi μ, + ‖∑ z, (K.constMul (a z)) y * + ∏ j, (selectedPrimeLogDensity P Q M (z j).val.val (y j) : ℂ)‖ ≤ + (W * A) * ∏ j, (y j)⁻¹ := by + have hm : ∀ᵐ y ∂Measure.pi μ, ∀ j, y j ∈ Set.Ioc (u j) (v j) := + Filter.eventually_all.mpr (fun j => + (Measure.tendsto_eval_ae_ae (μ := μ) (i := j)).eventually (ae_restrict_mem measurableSet_Ioc)) + filter_upwards [hm] with y hy + have hny (j : J) : 0 < y j := (hu j).trans (hy j).1 + have he : (∑ z, (K.constMul (a z)) y * + ∏ j, (selectedPrimeLogDensity P Q M (z j).val.val (y j) : ℂ)) = + K y * ∑ z, a z * ∏ j, (selectedPrimeLogDensity P Q M (z j).val.val (y j) : ℂ) := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro z _ + change (a z * K y) * _ = _ + ring + rw [he, bulk_prime_density_haar P Q M y a, norm_mul, norm_mul] + have hmean : ‖(Fintype.card (J → (ZMod M)ˣ) : ℂ)⁻¹ * + ∑ z, a z * ∏ j, pageGiantWeight P Q M (z j).val.val (y j)‖ ≤ A := by + rw [norm_mul, norm_inv, Complex.norm_natCast] + exact (mul_le_mul_of_nonneg_left (norm_sum_le _ _) (by positivity)).trans (hA y hy) + have hprod : ‖∏ j, (y j : ℂ)⁻¹‖ = ∏ j, (y j)⁻¹ := by + rw [norm_prod] + apply Finset.prod_congr rfl + intro j _ + rw [norm_inv, Complex.norm_real, Real.norm_of_nonneg (hny j).le] + rw [hprod, ← mul_assoc] + exact mul_le_mul_of_nonneg_right (mul_le_mul (hK y) hmean (norm_nonneg _) hW) + (Finset.prod_nonneg fun j _ => inv_nonneg.mpr (hny j).le) + have hn := norm_integral_le_of_norm_le (hp.const_mul (W * A)) hb + simpa only [integral_const_mul, integral_fintype_prod_eq_prod] using hn + +/-- Sum all original boxes with their unchanged reciprocal-prime normalizers. -/ +theorem bulk_absolute_mixture_bound {J C : Type*} [Fintype J] [Fintype C] + (P : PublishedProgressionInput) (Q M : ℕ) [NeZero M] + (u v : J → C → ℝ) (hu : ∀ j c, 0 < u j c) + (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (hmass : ∀ j, Z j * ∑ c, ∫ x in Set.Ioc (u j c) (v j c), (x : ℝ)⁻¹ ≤ 2) + (K : BulkIntegrand J) (a : (J → (ZMod M)ˣ) → ℂ) (W A : ℝ) + (hW : 0 ≤ W) (hA0 : 0 ≤ A) (hK : ∀ y, ‖K y‖ ≤ W) + (hA : ∀ y : J → ℝ, (∀ j, 0 ≤ y j) → + (Fintype.card (J → (ZMod M)ˣ) : ℝ)⁻¹ * + ∑ z, ‖a z * ∏ j, pageGiantWeight P Q M (z j).val.val (y j)‖ ≤ A) : + ‖∑ z : J → (ZMod M)ˣ, ∫ y, (K.constMul (a z)) y ∂Measure.pi (fun j => + bulkCellMixture (Z j) (fun c => primeGiantMeasure P Q M (z j).val.val (u j c) (v j c)))‖ ≤ + (W * A) * 2 ^ Fintype.card J := by + let μ := fun (z : J → (ZMod M)ˣ) j c => + primeGiantMeasure P Q M (z j).val.val (u j c) (v j c) + let _ : ∀ z j c, IsFiniteMeasure (μ z j c) := fun z j c => + finite_primeGiantMeasure P Q _ _ _ _ (hu j c) + change ‖∑ z, ∫ y, (K.constMul (a z)) y ∂Measure.pi (fun j => bulkCellMixture (Z j) (μ z j))‖ ≤ _ + rw [bulk_residue_mixture_integral Z hZ μ (fun z => K.constMul (a z))] + let H := fun j c => ∫ x in Set.Ioc (u j c) (v j c), (x : ℝ)⁻¹ + have hH (j : J) (c : C) : 0 ≤ H j c := by + apply integral_nonneg_of_ae + filter_upwards [ae_restrict_mem measurableSet_Ioc] with x hx + exact inv_nonneg.mpr ((hu j c).trans hx.1).le + apply bulk_box_sum_bound Z hZ H hH hmass (W * A) (mul_nonneg hW hA0) + intro c + exact bulk_absolute_integral_bound P Q M (fun j => u j (c j)) (fun j => v j (c j)) + (fun j => hu j (c j)) K a W A hW hK (fun y hy => hA y (fun j => ((hu j (c j)).trans (hy j).1).le)) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkAtomicProduct.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkAtomicProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..2df9fd418c2e236791fd028de2a9cd2fa5c2d5d1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkAtomicProduct.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkProductMixtures + +namespace OAI + +/-! # Exact finite atomic product integrals for the original prime cells -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +theorem bulk_pi_scaled_dirac {J : Type*} [Fintype J] + (x : J → ℝ) (w : J → ℝ) (hw : ∀ j, 0 ≤ w j) : + Measure.pi (fun j => ENNReal.ofReal (w j) • Measure.dirac (x j)) = + ENNReal.ofReal (∏ j, w j) • Measure.dirac x := by + let _ : ∀ j, IsFiniteMeasure (ENNReal.ofReal (w j) • Measure.dirac (x j)) := + fun j => (Measure.dirac (x j)).smul_finite ENNReal.ofReal_ne_top + apply Measure.pi_eq + intro s hs + simp only [Measure.smul_apply, Measure.dirac_apply' _ (MeasurableSet.univ_pi hs), + Measure.dirac_apply' _ (hs _), smul_eq_mul] + rw [ENNReal.ofReal_prod_of_nonneg (fun j _ => hw j), Finset.prod_mul_distrib] + by_cases h : ∀ j, x j ∈ s j + · simp [h] + · have hex : ∃ j, x j ∉ s j := not_forall.mp h + obtain ⟨j, hj⟩ := hex + have hz : (∏ i, (s i).indicator (fun _ => (1 : ENNReal)) (x i)) = 0 := + Finset.prod_eq_zero (Finset.mem_univ j) (Set.indicator_of_notMem hj _) + change (∏ i, ENNReal.ofReal (w i)) * + (Set.univ.pi s).indicator (fun _ => (1 : ENNReal)) x = + (∏ i, ENNReal.ofReal (w i)) * ∏ i, (s i).indicator (fun _ => (1 : ENNReal)) (x i) + rw [hz, Set.indicator_of_notMem (by simpa only [Set.mem_univ_pi] using h)] + +theorem BulkIntegrand.integral_atomic_product {J A : Type*} [Fintype J] [Fintype A] + (f : BulkIntegrand J) (x : J → A → ℝ) (w : J → A → ℝ) + (hw : ∀ j a, 0 ≤ w j a) : + (∫ y, f y ∂Measure.pi (fun j => ∑ a, ENNReal.ofReal (w j a) • Measure.dirac (x j a))) = + ∑ a : J → A, ((∏ j, w j (a j) : ℝ) : ℂ) * f (fun j => x j (a j)) := by + let _ : ∀ j a, IsFiniteMeasure (ENNReal.ofReal (w j a) • Measure.dirac (x j a)) := + fun j a => (Measure.dirac (x j a)).smul_finite ENNReal.ofReal_ne_top + have he := f.integral_product_mixtures (fun _ => 1) (fun _ => zero_le_one) + (fun j a => ENNReal.ofReal (w j a) • Measure.dirac (x j a)) + simp only [bulkCellMixture, ENNReal.ofReal_one, one_smul, Finset.prod_const_one, + Complex.ofReal_one, one_mul] at he + rw [he] + apply Finset.sum_congr rfl + intro a _ + rw [bulk_pi_scaled_dirac (fun j => x j (a j)) (fun j => w j (a j)) (fun j => hw j (a j)), + integral_smul_measure, ENNReal.toReal_ofReal (Finset.prod_nonneg fun j _ => hw j (a j)), + integral_dirac, Complex.real_smul] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkBoxReassembly.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkBoxReassembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..809510938c607af58447c14d409cc3a76618724a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkBoxReassembly.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkProductMixtures + +namespace OAI + +/-! # The harmonic box masses absorb the joint cell sum -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +/-- Reassembling boxes costs the product of their normalized masses. It does +not cost the number of boxes in the main term. -/ +theorem bulk_box_sum_bound {J C : Type*} [Fintype J] [Fintype C] + (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) (H : J → C → ℝ) + (hH : ∀ j c, 0 ≤ H j c) (hmass : ∀ j, Z j * ∑ c, H j c ≤ 2) + (B : ℝ) (hB : 0 ≤ B) (E : (J → C) → ℂ) + (hE : ∀ c, ‖E c‖ ≤ B * ∏ j, H j (c j)) : + ‖((∏ j, Z j : ℝ) : ℂ) * ∑ c, E c‖ ≤ B * 2 ^ Fintype.card J := by + have hZp : 0 ≤ ∏ j, Z j := Finset.prod_nonneg fun j _ => hZ j + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg hZp] + calc + _ ≤ (∏ j, Z j) * ∑ c : J → C, B * ∏ j, H j (c j) := by + apply mul_le_mul_of_nonneg_left _ hZp + exact (norm_sum_le _ _).trans (Finset.sum_le_sum fun c _ => hE c) + _ = B * ∏ j, (Z j * ∑ c, H j c) := by + rw [← Finset.mul_sum, ← Fintype.prod_sum, Finset.prod_mul_distrib] + ring + _ ≤ B * 2 ^ Fintype.card J := by + apply mul_le_mul_of_nonneg_left _ hB + calc + _ ≤ ∏ _j : J, (2 : ℝ) := Finset.prod_le_prod₀ + (fun j _ => mul_nonneg (hZ j) (Finset.sum_nonneg fun c _ => hH j c)) + (fun j _ => hmass j) + _ = _ := by simp only [Finset.prod_const, Finset.card_univ] + +/-- The same bound for the exact normalized product of cell measures. -/ +theorem BulkIntegrand.integral_product_mixtures_bound {J C : Type*} [Fintype J] [Fintype C] + (f : BulkIntegrand J) (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (μ : J → C → Measure ℝ) [∀ j c, IsFiniteMeasure (μ j c)] + (H : J → C → ℝ) (hH : ∀ j c, 0 ≤ H j c) + (hmass : ∀ j, Z j * ∑ c, H j c ≤ 2) + (B : ℝ) (hB : 0 ≤ B) + (hbox : ∀ c : J → C, + ‖∫ x, f x ∂Measure.pi (fun j => μ j (c j))‖ ≤ B * ∏ j, H j (c j)) : + ‖∫ x, f x ∂Measure.pi (fun j => bulkCellMixture (Z j) (μ j))‖ ≤ B * 2 ^ Fintype.card J := by + rw [f.integral_product_mixtures Z hZ μ] + exact bulk_box_sum_bound Z hZ H hH hmass B hB _ hbox + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCellMixtures.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCellMixtures.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac3695ae7244078f39890d3733d7449fc04563a4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCellMixtures.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkIntegrands + +namespace OAI + +/-! # Reassembling log cells with the original normalization -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +noncomputable def bulkCellMixture {C : Type*} [Fintype C] + (Z : ℝ) (μ : C → Measure ℝ) : Measure ℝ := ENNReal.ofReal Z • ∑ c, μ c + +instance finite_bulkCellMixture {C : Type*} [Fintype C] + (Z : ℝ) (μ : C → Measure ℝ) [∀ c, IsFiniteMeasure (μ c)] : + IsFiniteMeasure (bulkCellMixture Z μ) := by + unfold bulkCellMixture + exact (∑ c, μ c).smul_finite ENNReal.ofReal_ne_top + +theorem BulkIntegrand.average_cellMixture {σ C : Type*} [Fintype σ] [Fintype C] + (f : BulkIntegrand σ) (Z : ℝ) (hZ : 0 ≤ Z) + (μ : C → Measure ℝ) [∀ c, IsFiniteMeasure (μ c)] (i : σ) (x : σ → ℝ) : + f.average (bulkCellMixture Z μ) i x = (Z : ℂ) * ∑ c, f.average (μ c) i x := by + change (∫ t, f (Function.update x i t) ∂bulkCellMixture Z μ) = _ + rw [bulkCellMixture, integral_smul_measure, ENNReal.toReal_ofReal hZ, + integral_finsetSum_measure] + · rfl + · intro c _ + exact f.slice_integrable (μ c) i x + +/-- Cell counts multiply only the approximation error. The original +normalization is applied to both the prime and Page cell measures. -/ +theorem BulkIntegrand.cellMixture_comparison {σ C : Type*} [Fintype σ] [Fintype C] + (f : BulkIntegrand σ) (Z : ℝ) (hZ : 0 ≤ Z) + (μ ν : C → Measure ℝ) [∀ c, IsFiniteMeasure (μ c)] [∀ c, IsFiniteMeasure (ν c)] + (i : σ) (ε : C → ℝ) + (hε : ∀ c x, ‖f.average (μ c) i x - f.average (ν c) i x‖ ≤ ε c) (x : σ → ℝ) : + ‖f.average (bulkCellMixture Z μ) i x - f.average (bulkCellMixture Z ν) i x‖ ≤ + Z * ∑ c, ε c := by + rw [f.average_cellMixture Z hZ, f.average_cellMixture Z hZ, ← mul_sub, + ← Finset.sum_sub_distrib, norm_mul, Complex.norm_real, Real.norm_of_nonneg hZ] + apply mul_le_mul_of_nonneg_left _ hZ + exact (norm_sum_le _ _).trans (Finset.sum_le_sum fun c _ => hε c x) + +/-- Joint cell reassembly uses bounded normalized masses, without inserting +cell counts into the main term. -/ +theorem BulkIntegrand.cellMixtures_joint_comparison {σ C : Type*} [Fintype σ] [Fintype C] + (f : BulkIntegrand σ) (Z : σ → ℝ) (hZ : ∀ i, 0 ≤ Z i) + (μ ν : σ → C → Measure ℝ) + [∀ i c, IsFiniteMeasure (μ i c)] [∀ i c, IsFiniteMeasure (ν i c)] + (order : List σ) (horder : order.Nodup) + (hμ : ∀ i ∈ order, (bulkCellMixture (Z i) (μ i)).real Set.univ ≤ 2) + (hν : ∀ i ∈ order, (bulkCellMixture (Z i) (ν i)).real Set.univ ≤ 2) + (ε : σ → C → ℝ) (hε : ∀ i ∈ order, ∀ c, 0 ≤ ε i c) + (herr : ∀ i ∈ order, ∀ c x, + ‖f.average (μ i c) i x - f.average (ν i c) i x‖ ≤ ε i c) : + ∀ x, ‖f.averages (fun i => bulkCellMixture (Z i) (μ i)) order x - + f.averages (fun i => bulkCellMixture (Z i) (ν i)) order x‖ ≤ + 2 ^ order.length * (order.map (fun i => Z i * ∑ c, ε i c)).sum := by + apply f.averages_comparison _ _ order horder hμ hν + · intro i hi + exact mul_nonneg (hZ i) (Finset.sum_nonneg fun c _ => hε i hi c) + · intro i hi x + exact f.cellMixture_comparison (Z i) (hZ i) (μ i) (ν i) i (ε i) (herr i hi) x + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCollisionSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCollisionSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..05c7cb90981661f9eec7ad9e6d94d46d168a5365 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCollisionSupport.lean @@ -0,0 +1,97 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSlotNodup +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenFrequencyAverage + +namespace OAI + +/-! # The original arithmetic support forces distinct bulk primes -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem prime_list_injective_of_pairwise {σ : Type*} (value : σ → ℕ) + (L : List σ) (hprime : ∀ i ∈ L, (value i).Prime) + (hp : (L.map value).Pairwise Nat.Coprime) : + ∀ i ∈ L, ∀ j ∈ L, value i = value j → i = j := by + have hn : (L.map value).Nodup := by + apply hp.imp_of_mem + intro a b ha hb hab + obtain ⟨i, hi, rfl⟩ := List.mem_map.mp ha + obtain ⟨j, hj, rfl⟩ := List.mem_map.mp hb + exact (Nat.coprime_primes (hprime i hi) (hprime j hj)).mp hab + exact fun i hi j hj hij => List.inj_on_of_nodup_map hn hi hj hij + +theorem buildMovingSlotData_injective_of_support {σ : Type*} + (value : σ → ℕ) (n m : ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (t : FrequencyTree ℤ n) (small : TreeLeafTuple (List σ) n) + (samples : MovingSampleSlots σ n) (outside : List ℕ) + (hprime : ∀ i, (value i).Prime) + (hs : movingRegularOutsidePairwise value outside + (buildMovingSlotData n t small (bulkSlotLeaves n m slot) samples)) : + Function.Injective (value ∘ slot) := by + let T := buildMovingSlotData n t small (bulkSlotLeaves n m slot) samples + have hp : (T.regularSlots.map value).Pairwise Nat.Coprime := by + have hroot : (T.regularSlots.map value ++ outside).Pairwise Nat.Coprime := by + cases hT : T with + | leaf s L => simpa only [T, hT, movingRegularOutsidePairwise, + MovingSlotData.regularSlots] using hs + | node s CL CR u left right => + have hs' := hs + change movingRegularOutsidePairwise value outside T at hs' + rw [hT] at hs' + exact hs'.1 + exact (List.pairwise_append.mp hroot).1 + have hm (j) : slot j ∈ T.regularSlots := by + apply (buildMovingSlotData_regular_perm n t small (bulkSlotLeaves n m slot) samples).mem_iff.mpr + exact List.mem_append_right _ ((mem_flatten_bulkSlotLeaves n m slot _).mpr ⟨j, rfl⟩) + intro i j hij + exact slot.injective (prime_list_injective_of_pairwise value T.regularSlots + (fun i _ => hprime i) hp (slot i) (hm i) (slot j) (hm j) hij) + +/-- The frequency factor vanishes on collisions before any averaging or +resampling is performed. -/ +theorem movingFrequencyPageAverage_zero_of_bulk_collision {σ : Type*} + (value : σ → ℕ) (n m : ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (t : FrequencyTree ℤ n) (small : TreeLeafTuple (List σ) n) + (samples : MovingSampleSlots σ n) (outside : List ℕ) + (hprime : ∀ i, (value i).Prime) (hbad : ¬Function.Injective (value ∘ slot)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (T : Bool → MovingSlotData σ n) + (hT : T false = buildMovingSlotData n t small (bulkSlotLeaves n m slot) samples) + (nodes : Bool → List MovingFormulaNode) (R : ℤ) + (r : ℕ) [NeZero r] (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : + movingFrequencyPageAverage value outside F E T nodes R r input Q y = 0 := by + have hsupport : ¬(∀ b, movingRegularOutsidePairwise value outside (T b) ∧ + ∀ f ∈ nodes b, f.guard.frequencyBounds) := by + intro hs + apply hbad + apply buildMovingSlotData_injective_of_support value n m slot t small samples outside hprime + rw [← hT] + exact (hs false).1 + rw [movingFrequencyPageAverage_core] + simp only [hsupport, ite_false, zero_mul] + +/-- Inserting the distinctness gate leaves the literal supported arithmetic +coefficient unchanged. -/ +theorem movingFrequencyPageAverage_collision_gate {σ : Type*} + (value : σ → ℕ) (n m : ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (t : FrequencyTree ℤ n) (small : TreeLeafTuple (List σ) n) + (samples : MovingSampleSlots σ n) (outside : List ℕ) + (hprime : ∀ i, (value i).Prime) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (T : Bool → MovingSlotData σ n) + (hT : T false = buildMovingSlotData n t small (bulkSlotLeaves n m slot) samples) + (nodes : Bool → List MovingFormulaNode) (R : ℤ) + (r : ℕ) [NeZero r] (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) (A : ℂ) : + movingFrequencyPageAverage value outside F E T nodes R r input Q y * A = + if Function.Injective (value ∘ slot) then + movingFrequencyPageAverage value outside F E T nodes R r input Q y * A else 0 := by + by_cases h : Function.Injective (value ∘ slot) + · simp only [h, ite_true] + · rw [ite_eq_right h, movingFrequencyPageAverage_zero_of_bulk_collision value n m slot + t small samples outside hprime h F E T hT nodes R r input Q y, zero_mul] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCoordinateEnumeration.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCoordinateEnumeration.lean new file mode 100644 index 0000000000000000000000000000000000000000..0556798760930f06722a975b907f18fd52d2ff03 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCoordinateEnumeration.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkCoordinateInsertion + +namespace OAI + +/-! # Enumerating the actual bulk slots leaves their product law unchanged -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical + +theorem bulkCoordinateInsert_reindex {σ J K : Type*} + (base : σ → ℝ) (e : J ↪ σ) (g : K ≃ J) (y : J → ℝ) : + bulkCoordinateInsert base (g.toEmbedding.trans e) (y ∘ g) = + bulkCoordinateInsert base e y := by + funext i + by_cases hi : ∃ j, e j = i + · obtain ⟨j, rfl⟩ := hi + obtain ⟨k, rfl⟩ := g.surjective j + change bulkCoordinateInsert base (g.toEmbedding.trans e) (y ∘ g) + ((g.toEmbedding.trans e) k) = _ + rw [bulkCoordinateInsert_at, bulkCoordinateInsert_at] + rfl + · have hk : ¬∃ k, (g.toEmbedding.trans e) k = i := by + rintro ⟨k, hk⟩ + exact hi ⟨g k, hk⟩ + simp only [bulkCoordinateInsert, dite_eq_right hi, dite_eq_right hk] + +/-- The finite enumeration may be chosen for the proof while the product +integral remains indexed by the original tree-and-word bulk coordinates. -/ +theorem BulkIntegrand.selected_bulk_integral_enum {σ J : Type*} [Fintype σ] [Fintype J] + {k : ℕ} (f : BulkIntegrand σ) (base : σ → ℝ) (e : J ↪ σ) (g : Fin k ≃ J) + (μ : σ → Measure ℝ) [∀ i, IsFiniteMeasure (μ i)] (y : J → ℝ) : + f.averages μ ((List.finRange k).map (fun j => e (g j))) (bulkCoordinateInsert base e y) = + ∫ z, f (bulkCoordinateInsert base e z) ∂Measure.pi (fun j => μ (e j)) := by + let eg := g.toEmbedding.trans e + have h := f.selected_bulk_integral base eg μ (y ∘ g) + rw [bulkCoordinateInsert_reindex] at h + refine h.trans ?_ + have he := ((measurePreserving_piCongrLeft (fun j => μ (e j)) g).symm).integral_comp' + (fun z => f (bulkCoordinateInsert base eg z)) + refine he.symm.trans ?_ + apply integral_congr_ae + exact Filter.Eventually.of_forall fun z => by + change f (bulkCoordinateInsert base eg (z ∘ g)) = f (bulkCoordinateInsert base e z) + exact congrArg f (bulkCoordinateInsert_reindex base e g z) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCoordinateInsertion.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCoordinateInsertion.lean new file mode 100644 index 0000000000000000000000000000000000000000..4974a45feb0e8e106625e90a82bef4e056550c0b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkCoordinateInsertion.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkPiIntegral + +namespace OAI + +/-! # Freeze the nonbulk coordinates and integrate the selected bulk slots -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical + +noncomputable def bulkCoordinateInsert {σ J : Type*} + (base : σ → ℝ) (e : J ↪ σ) (y : J → ℝ) (i : σ) : ℝ := + if h : ∃ j, e j = i then y h.choose else base i + +theorem bulkCoordinateInsert_at {σ J : Type*} + (base : σ → ℝ) (e : J ↪ σ) (y : J → ℝ) (j : J) : + bulkCoordinateInsert base e y (e j) = y j := by + have h : ∃ k, e k = e j := ⟨j, rfl⟩ + rw [bulkCoordinateInsert, dite_eq_left h] + congr 1 + exact e.injective h.choose_spec + +theorem bulkCoordinateInsert_update {σ J : Type*} + (base : σ → ℝ) (e : J ↪ σ) (y : J → ℝ) (j : J) (a : ℝ) : + bulkCoordinateInsert base e (Function.update y j a) = + Function.update (bulkCoordinateInsert base e y) (e j) a := by + funext i + by_cases h : ∃ k, e k = i + · obtain ⟨k, rfl⟩ := h + rw [bulkCoordinateInsert_at] + by_cases hkj : k = j + · subst k + simp + · rw [Function.update_of_ne hkj, Function.update_of_ne (fun h => hkj (e.injective h)), + bulkCoordinateInsert_at] + · have hne : i ≠ e j := fun hi => h ⟨j, hi.symm⟩ + rw [Function.update_of_ne hne] + simp only [bulkCoordinateInsert, dite_eq_right h] + +noncomputable def BulkIntegrand.pullBulk {σ J : Type*} [Fintype σ] [Fintype J] + (f : BulkIntegrand σ) (base : σ → ℝ) (e : J ↪ σ) : BulkIntegrand J where + toFun y := f (bulkCoordinateInsert base e y) + measurable := f.measurable.comp (Measurable.of_eval fun i => by + by_cases h : ∃ j, e j = i + · simpa only [bulkCoordinateInsert, dite_eq_left h] using (measurable_pi_apply h.choose : + Measurable (fun y : J → ℝ => y h.choose)) + · simpa only [bulkCoordinateInsert, dite_eq_right h] using (measurable_const : + Measurable (fun _ : J → ℝ => base i))) + bounded := by + obtain ⟨C, hC, hf⟩ := f.bounded + exact ⟨C, hC, fun y => hf _⟩ + +theorem BulkIntegrand.pullBulk_average {σ J : Type*} [Fintype σ] [Fintype J] + (f : BulkIntegrand σ) (base : σ → ℝ) (e : J ↪ σ) + (μ : Measure ℝ) [IsFiniteMeasure μ] (j : J) : + (f.average μ (e j)).pullBulk base e = (f.pullBulk base e).average μ j := by + ext y + change (∫ a, f (Function.update (bulkCoordinateInsert base e y) (e j) a) ∂μ) = + ∫ a, f (bulkCoordinateInsert base e (Function.update y j a)) ∂μ + simp_rw [bulkCoordinateInsert_update] + +theorem BulkIntegrand.pullBulk_averages {σ J : Type*} [Fintype σ] [Fintype J] + (f : BulkIntegrand σ) (base : σ → ℝ) (e : J ↪ σ) + (μ : σ → Measure ℝ) [∀ i, IsFiniteMeasure (μ i)] (l : List J) : + (f.averages μ (l.map e)).pullBulk base e = + (f.pullBulk base e).averages (fun j => μ (e j)) l := by + induction l with + | nil => rfl + | cons j l ih => simp only [List.map_cons, averages, pullBulk_average, ih] + +theorem BulkIntegrand.selected_bulk_integral {σ : Type*} [Fintype σ] + {k : ℕ} (f : BulkIntegrand σ) (base : σ → ℝ) (e : Fin k ↪ σ) + (μ : σ → Measure ℝ) [∀ i, IsFiniteMeasure (μ i)] (y : Fin k → ℝ) : + f.averages μ ((List.finRange k).map e) (bulkCoordinateInsert base e y) = + ∫ z, f (bulkCoordinateInsert base e z) ∂Measure.pi (fun j => μ (e j)) := by + have h := congrArg (fun g : BulkIntegrand (Fin k) => g y) + (f.pullBulk_averages base e μ (List.finRange k)) + rw [BulkIntegrand.averages_finRange] at h + exact h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDeletionCost.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDeletionCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..dbb90556b9c1b5b129c5603a718edbf107286fd2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDeletionCost.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Construction.PrimeRestorationDifference +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticErrorRates + +namespace OAI + +/-! # Deleted-atom costs in the actual original bulk prior -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem bulk_deleted_reciprocal_mass_le (S D : Finset ℕ) (T : ℝ) + (hlow : ∀ q ∈ S, Real.exp T ≤ (q : ℝ)) : + (∑ q ∈ S ∩ D, (q : ℝ)⁻¹) ≤ (D.card : ℝ) * Real.exp (-T) := by + calc + _ ≤ ∑ _q ∈ S ∩ D, Real.exp (-T) := by + apply Finset.sum_le_sum + intro q hq + simpa only [Real.exp_neg] using inv_anti₀ (Real.exp_pos T) + (hlow q (Finset.mem_inter.mp hq).1) + _ = ((S ∩ D).card : ℝ) * Real.exp (-T) := by + simp only [Finset.sum_const, nsmul_eq_mul] + _ ≤ _ := mul_le_mul_of_nonneg_right (by exact_mod_cast Finset.card_le_card Finset.inter_subset_right) + (Real.exp_nonneg _) + +/-- All deleted values are charged using the old normalizers. If their +total mass is at most one, the product excess is at most twice that mass. -/ +theorem bulk_deleted_product_cost {J : Type*} [Fintype J] + (S D : J → Finset ℕ) (Z : J → ℝ) (H T K : ℝ) + (hZ0 : ∀ j, 0 ≤ Z j) (hZ : ∀ j, Z j ≤ Real.exp H) + (hcard : ∀ j, (D j).card ≤ K) + (hlow : ∀ j q, q ∈ S j → Real.exp T ≤ (q : ℝ)) + (hsmall : (Fintype.card J : ℝ) * K * Real.exp (H - T) ≤ 1) : + (∏ j, (1 + Z j * ∑ q ∈ S j ∩ D j, (q : ℝ)⁻¹)) - 1 ≤ + 2 * (Fintype.card J : ℝ) * K * Real.exp (H - T) := by + let x := fun j => Z j * ∑ q ∈ S j ∩ D j, (q : ℝ)⁻¹ + have hx0 (j) : 0 ≤ x j := mul_nonneg (hZ0 j) (Finset.sum_nonneg fun _ _ => by positivity) + have hx (j) : x j ≤ K * Real.exp (H - T) := by + have hm := bulk_deleted_reciprocal_mass_le (S j) (D j) T (hlow j) + have hk : 0 ≤ K := (Nat.cast_nonneg _).trans (hcard j) + calc + _ ≤ Real.exp H * ((D j).card * Real.exp (-T)) := + mul_le_mul (hZ j) hm (Finset.sum_nonneg fun _ _ => by positivity) (Real.exp_nonneg _) + _ ≤ Real.exp H * (K * Real.exp (-T)) := by gcongr; exact hcard j + _ = K * Real.exp (H - T) := by rw [Real.exp_sub, Real.exp_neg]; ring + have hs0 : 0 ≤ ∑ j, x j := Finset.sum_nonneg fun j _ => hx0 j + have hs : (∑ j, x j) ≤ (Fintype.card J : ℝ) * K * Real.exp (H - T) := by + calc + _ ≤ ∑ _j : J, K * Real.exp (H - T) := Finset.sum_le_sum fun j _ => hx j + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring + have he := Real.abs_exp_sub_one_le (show |∑ j, x j| ≤ 1 by + rw [abs_of_nonneg hs0]; exact hs.trans hsmall) + have hp := Real.prod_one_add_le_exp_sum Finset.univ hx0 + change (∏ j, (1 + x j)) - 1 ≤ _ + have he' : Real.exp (∑ j, x j) - 1 ≤ 2 * ∑ j, x j := by + rw [abs_of_nonneg hs0] at he + exact (le_abs_self _).trans he + linarith + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDeletionRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDeletionRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..c64d23752e0d05e860e8d96521fae3562fbc2a0a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDeletionRate.lean @@ -0,0 +1,112 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkDeletionCost + +namespace OAI + +/-! # Uniform decay of the original deletion and collision costs -/ + +namespace Ostmann +open Filter +open scoped Classical BigOperators + +private theorem bulk_auxiliary_prefactor_le (C L a d H B : ℝ) + (hC : 1 ≤ C) (hL : 1 ≤ L) (ha0 : 0 ≤ a) (hd0 : 0 ≤ d) (_hB0 : 0 ≤ B) + (ha : a ≤ C * L) (hd : d ≤ Real.exp (C * L)) (hH : H ≤ C * L) + (hB : B ≤ Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L))) : + B * (a ^ 2 + 2 * a * d) * Real.exp H ≤ + Real.exp (6 * C * L ^ 2 + 6 * C * L * Real.exp ((1 / 1000 : ℝ) * L)) := by + have hC0 : 0 ≤ C := by linarith + have hL0 : 0 ≤ L := by linarith + have hae : a ≤ Real.exp (C * L) := ha.trans (by linarith [Real.add_one_le_exp (C * L)]) + have hpoly : a ^ 2 + 2 * a * d ≤ 3 * Real.exp (2 * C * L) := by + have hsq := pow_le_pow_left₀ ha0 hae 2 + have had := mul_le_mul hae hd hd0 (Real.exp_nonneg _) + rw [← Real.exp_nat_mul] at hsq + have hsq' : a ^ 2 ≤ Real.exp (2 * C * L) := by + convert hsq using 1 + congr 1 + ring + rw [← Real.exp_add] at had + have he : C * L + C * L = 2 * C * L := by ring + rw [he] at had + nlinarith [hsq'] + have hthree : (3 : ℝ) ≤ Real.exp 2 := by linarith [Real.add_one_le_exp 2] + calc + _ ≤ Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) * + (3 * Real.exp (2 * C * L)) * Real.exp (C * L) := by + gcongr + _ ≤ Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) * + (Real.exp 2 * Real.exp (2 * C * L)) * Real.exp (C * L) := by gcongr + _ ≤ _ := by + simp only [← Real.exp_add] + apply Real.exp_le_exp.mpr + have hLsq : L ≤ L ^ 2 := by nlinarith + have hCLsq : 1 ≤ C * L ^ 2 := by nlinarith + have he : 0 ≤ C * L * Real.exp ((1 / 1000 : ℝ) * L) := by positivity + nlinarith [mul_le_mul_of_nonneg_left hLsq hC0] + +/-- The cutoff precedes the bulk dimension, deletion sets, and original +normalizers. Both bad-event costs have a stronger saving than the cell error. -/ +theorem bulk_collision_deletion_numerical_rate (C : ℝ) (hC : 1 ≤ C) : + ∀ᶠ L : ℝ in atTop, ∀ a d H T B : ℝ, + 0 ≤ a → 0 ≤ d → 0 ≤ B → a ≤ C * L → d ≤ Real.exp (C * L) → H ≤ C * L → + B ≤ Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) → + Real.exp ((39 / 10000 : ℝ) * L) ≤ T → + a * d * Real.exp (H - T) ≤ Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) ∧ + B * (a ^ 2 + 2 * a * d) * Real.exp (H - T) ≤ + Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) := by + filter_upwards [arithmetic_error_absorption (1 / 1000) (39 / 10000) (2 / 1000) + (6 * C) 1 2 (by norm_num) (by norm_num) (by norm_num) (by norm_num), + eventually_ge_atTop (1 : ℝ)] with L hrate hL + intro a d H T B ha0 hd0 hB0 ha hd hH hB hT + have hB1 : (1 : ℝ) ≤ Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) := + Real.one_le_exp_iff.mpr (by + have : 0 ≤ C := by linarith + have : 0 ≤ L := by linarith + positivity) + have hp := bulk_auxiliary_prefactor_le C L a d H B hC hL ha0 hd0 hB0 ha hd hH hB + have hp1 := bulk_auxiliary_prefactor_le C L a d H 1 hC hL ha0 hd0 (by norm_num) ha hd hH hB1 + have hmass : a * d * Real.exp H ≤ + Real.exp (6 * C * L ^ 2 + 6 * C * L * Real.exp ((1 / 1000 : ℝ) * L)) := by + apply le_trans _ hp1 + simp only [one_mul] + exact mul_le_mul_of_nonneg_right (by nlinarith [mul_nonneg ha0 hd0]) (Real.exp_nonneg _) + have he : Real.exp (-T) ≤ Real.exp (-Real.exp ((39 / 10000 : ℝ) * L)) := + Real.exp_le_exp.mpr (neg_le_neg hT) + have hfinish (b : ℝ) (_hb0 : 0 ≤ b) + (hb : b * Real.exp H ≤ Real.exp + (6 * C * L ^ 2 + 6 * C * L * Real.exp ((1 / 1000 : ℝ) * L))) : + b * Real.exp (H - T) ≤ Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) := by + rw [Real.exp_sub, div_eq_mul_inv, ← Real.exp_neg, ← mul_assoc] + exact (mul_le_mul hb he (Real.exp_nonneg _) (Real.exp_nonneg _)).trans (by + simpa only [one_mul, neg_mul] using hrate) + exact ⟨hfinish (a * d) (mul_nonneg ha0 hd0) hmass, + hfinish (B * (a ^ 2 + 2 * a * d)) (by positivity) hp⟩ + +/-- The actual deleted-set expression, with all old normalizers, and the +distinctness error are absorbed together. -/ +theorem bulk_collision_deletion_rate (C : ℝ) (hC : 1 ≤ C) : + ∀ᶠ L : ℝ in atTop, ∀ (J : Type) [Fintype J] (S D : J → Finset ℕ) + (Z : J → ℝ) (H T K B : ℝ), + (∀ j, 0 ≤ Z j) → (∀ j, Z j ≤ Real.exp H) → + (∀ j, ((D j).card : ℝ) ≤ K) → 0 ≤ K → 0 ≤ B → + (Fintype.card J : ℝ) ≤ C * L → K ≤ Real.exp (C * L) → H ≤ C * L → + B ≤ Real.exp (C * L ^ 2 + C * L * Real.exp ((1 / 1000 : ℝ) * L)) → + Real.exp ((39 / 10000 : ℝ) * L) ≤ T → + (∀ j q, q ∈ S j → Real.exp T ≤ (q : ℝ)) → + B * (Fintype.card J : ℝ) ^ 2 * Real.exp (H - T) + + B * ((∏ j, (1 + Z j * ∑ q ∈ S j ∩ D j, (q : ℝ)⁻¹)) - 1) ≤ + Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) := by + filter_upwards [bulk_collision_deletion_numerical_rate C hC] with L hrate + intro J _ S D Z H T K B hZ0 hZ hcard hK hB0 hJ hKbound hH hB hT hlow + have hb := hrate (Fintype.card J) K H T B (Nat.cast_nonneg _) hK hB0 hJ hKbound hH hB hT + have hsmall : (Fintype.card J : ℝ) * K * Real.exp (H - T) ≤ 1 := + hb.1.trans (Real.exp_le_one_iff.mpr (neg_nonpos.mpr (Real.exp_nonneg _))) + have hd := bulk_deleted_product_cost S D Z H T K hZ0 hZ hcard hlow hsmall + apply le_trans (add_le_add le_rfl (mul_le_mul_of_nonneg_left hd hB0)) _ + calc + _ = B * ((Fintype.card J : ℝ) ^ 2 + 2 * (Fintype.card J : ℝ) * K) * Real.exp (H - T) := by ring + _ ≤ _ := hb.2 + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDistinctnessRemoval.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDistinctnessRemoval.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b54bf39c640d480e0038febf50479a17f09c552 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkDistinctnessRemoval.lean @@ -0,0 +1,133 @@ +import Mathlib.Analysis.Complex.Basic +import OAI.NumberTheory.Ostmann.Tree.IndependentCoordinate +import OAI.NumberTheory.Ostmann.Construction.PrimePriorDecay +import OAI.NumberTheory.Ostmann.Construction.FiniteEnumeration + +namespace OAI + +/-! # Removing bulk-prime collisions under the original independent priors -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem productPrior_pair_collision_le {A : Type*} [Fintype A] {n : ℕ} + (μ : Fin n → A → ℝ) (hμ : ∀ i a, 0 ≤ μ i a) + (hmass : ∀ i, ∑ a, μ i a = 1) (α : ℝ) (hmax : ∀ i a, μ i a ≤ α) + (i j : Fin n) (hij : i ≠ j) : + (∑ x : Fin n → A, productPrior μ x * if x i = x j then (1 : ℝ) else 0) ≤ α := by + cases n with + | zero => exact Fin.elim0 i + | succ n => + obtain ⟨t, rfl⟩ := Fin.exists_succAbove_eq hij.symm + rw [sum_productPrior_insertNth μ i] + simp only [Fin.insertNth_apply_same, Fin.insertNth_apply_succAbove] + have hs (x : Fin n → A) : + (∑ a, μ i a * if a = x t then (1 : ℝ) else 0) = μ i (x t) := by + simp only [mul_ite, mul_one, mul_zero, Finset.sum_ite_eq', Finset.mem_univ, ite_true] + simp_rw [hs] + calc + _ ≤ ∑ x : Fin n → A, productPrior (fun j => μ (i.succAbove j)) x * α := + Finset.sum_le_sum fun x _ => mul_le_mul_of_nonneg_left (hmax i (x t)) + (productPrior_nonneg _ (fun j a => hμ (i.succAbove j) a) x) + _ = α := by rw [← Finset.sum_mul, productPrior_mass _ (fun j => hmass (i.succAbove j)), one_mul] + +/-- Ordered pairs suffice; the harmless square count avoids selecting an +ordering of the actual bulk positions. -/ +theorem productPrior_noninjective_le {A : Type*} [Fintype A] {n : ℕ} + (μ : Fin n → A → ℝ) (hμ : ∀ i a, 0 ≤ μ i a) + (hmass : ∀ i, ∑ a, μ i a = 1) (α : ℝ) (hα : 0 ≤ α) + (hmax : ∀ i a, μ i a ≤ α) : + (∑ x : Fin n → A, productPrior μ x * if Function.Injective x then (0 : ℝ) else 1) ≤ + (n : ℝ) ^ 2 * α := by + let bad := fun (x : Fin n → A) (ij : Fin n × Fin n) => + if ij.1 ≠ ij.2 ∧ x ij.1 = x ij.2 then (1 : ℝ) else 0 + have hpoint (x : Fin n → A) : + (if Function.Injective x then (0 : ℝ) else 1) ≤ ∑ ij, bad x ij := by + by_cases hx : Function.Injective x + · rw [ite_eq_left hx] + exact Finset.sum_nonneg fun ij _ => by dsimp [bad]; positivity + · rw [ite_eq_right hx] + have hw : ∃ i j, i ≠ j ∧ x i = x j := by + by_contra! h + exact hx (fun i j hij => by by_contra hne; exact h i j hne hij) + obtain ⟨i, j, hij, heq⟩ := hw + calc + (1 : ℝ) = bad x (i, j) := by simp [bad, hij, heq] + _ ≤ ∑ ij, bad x ij := Finset.single_le_sum + (fun ij _ => by dsimp [bad]; positivity) (Finset.mem_univ _) + calc + _ ≤ ∑ x : Fin n → A, productPrior μ x * ∑ ij, bad x ij := + Finset.sum_le_sum fun x _ => mul_le_mul_of_nonneg_left (hpoint x) + (productPrior_nonneg μ hμ x) + _ = ∑ ij, ∑ x : Fin n → A, productPrior μ x * bad x ij := by + simp_rw [Finset.mul_sum] + rw [Finset.sum_comm] + _ ≤ ∑ _ij : Fin n × Fin n, α := by + apply Finset.sum_le_sum + intro ij _ + by_cases hij : ij.1 = ij.2 + · simpa [bad, hij] using hα + · simpa [bad, hij] using + productPrior_pair_collision_le μ hμ hmass α hmax ij.1 ij.2 hij + _ = (n : ℝ) ^ 2 * α := by simp [pow_two, mul_assoc] + +/-- Removing the distinctness gate costs its original collision probability, +even when the complex integrand includes all the retained arithmetic factors. -/ +theorem bulk_distinctness_removal {A : Type*} [Fintype A] {n : ℕ} + (μ : Fin n → A → ℝ) (hμ : ∀ i a, 0 ≤ μ i a) + (hmass : ∀ i, ∑ a, μ i a = 1) (α : ℝ) (hα : 0 ≤ α) + (hmax : ∀ i a, μ i a ≤ α) (F : (Fin n → A) → ℂ) + (B : ℝ) (hB : 0 ≤ B) (hF : ∀ x, ‖F x‖ ≤ B) : + ‖(∑ x : Fin n → A, (productPrior μ x : ℂ) * + (if Function.Injective x then F x else 0)) - + ∑ x : Fin n → A, (productPrior μ x : ℂ) * F x‖ ≤ B * (n : ℝ) ^ 2 * α := by + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ x : Fin n → A, B * (productPrior μ x * + if Function.Injective x then (0 : ℝ) else 1) := by + apply norm_sum_le_of_le + intro x _ + by_cases hx : Function.Injective x + · simp [hx] + · simp only [hx, ite_false, mul_zero, zero_sub, norm_neg, norm_mul, + Complex.norm_real, Real.norm_of_nonneg (productPrior_nonneg μ hμ x), mul_one] + simpa only [mul_comm] using mul_le_mul_of_nonneg_left (hF x) + (productPrior_nonneg μ hμ x) + _ = B * ∑ x : Fin n → A, productPrior μ x * + if Function.Injective x then (0 : ℝ) else 1 := (Finset.mul_sum _ _ _).symm + _ ≤ B * ((n : ℝ) ^ 2 * α) := mul_le_mul_of_nonneg_left + (productPrior_noninjective_le μ hμ hmass α hα hmax) hB + _ = _ := by ring + +/-- The collision estimate for the literal bulk harmonic cells. The ambient +prime set may also contain all nonbulk roles; the lower endpoint is needed +only on the support of each bulk prior. -/ +theorem original_bulk_distinctness_removal {n : ℕ} + (P : Finset ℕ) (Q : Fin n → Finset ℕ) (hQP : ∀ i, Q i ⊆ P) + (hQ : ∀ i, (∑ p ∈ Q i, (p : ℝ)⁻¹) ≠ 0) + (H T : ℝ) (hmass : ∀ i, (∑ p ∈ Q i, (p : ℝ)⁻¹)⁻¹ ≤ Real.exp H) + (hlow : ∀ i p, p ∈ Q i → Real.exp T ≤ (p : ℝ)) + (F : (Fin n → P) → ℂ) (B : ℝ) (hB : 0 ≤ B) (hF : ∀ x, ‖F x‖ ≤ B) : + ‖(∑ x : Fin n → P, (productPrior (fun i => primeSubsetPrior P (Q i)) x : ℂ) * + (if Function.Injective x then F x else 0)) - + ∑ x : Fin n → P, (productPrior (fun i => primeSubsetPrior P (Q i)) x : ℂ) * F x‖ ≤ + B * (n : ℝ) ^ 2 * Real.exp (H - T) := by + have hmax (i : Fin n) (p : P) : primeSubsetPrior P (Q i) p ≤ Real.exp (H - T) := by + by_cases hp : (p : ℕ) ∈ Q i + · exact primeSubsetPrior_le_exp P (Q i) p H T (hmass i) (hlow i p hp) + · simpa only [primeSubsetPrior, hp, ite_false] using Real.exp_nonneg (H - T) + have h := bulk_distinctness_removal (fun i => primeSubsetPrior P (Q i)) + (fun i p => primeSubsetPrior_nonneg P (Q i) p) + (fun i => primeSubsetPrior_mass P (Q i) (hQP i) (hQ i)) + (Real.exp (H - T)) (Real.exp_nonneg _) hmax F B hB hF + simp only [finite_univ_canonical] at h ⊢ + convert h using 1 + congr 2 + apply Finset.sum_congr rfl + intro x _ + congr 1 + split_ifs <;> rfl + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFourierFactors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFourierFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..bda946563ddaa9d48bf3eb0f4ca180f5657cfaff --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFourierFactors.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLeafPolynomials +import OAI.NumberTheory.Ostmann.Arithmetic.MovingRealSmooth +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFourierVariation + +namespace OAI + +/-! # Clipped Fourier factors along an original bulk-prime coordinate -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap ComplexConjugate + +noncomputable def bulkFourierFactors {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) : Fin (2 ^ n) → ClippedPolynomialFactor := + fun j => + let leaf := (movingLeafIndexEquiv n).symm j + let f := fourierPolynomialFactor (Polynomial.C X⁻¹ * T.bulkLeafPolynomials value i L R leaf) + ψ (T.leafFrequencies leaf) lo hi hlo hhi + if treeLeafTupleEquiv Bool n (transferConjugations n false) leaf then f.conjugate else f + +theorem bulkFourierFactors_degree {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (d D e : ℕ) + (hsize : T.SizeLE d) (hregular : T.RegularLengthLE D) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) (j : Fin (2 ^ n)) : + (bulkFourierFactors value i T L R ψ X lo hi hlo hhi j).polynomial.natDegree ≤ + 2 * (n * d + e) + D := by + have hp := T.bulkLeafPolynomials_degree value i L R d D e hsize hregular hL hR + ((movingLeafIndexEquiv n).symm j) + have hn : (Polynomial.C X⁻¹ * T.bulkLeafPolynomials value i L R + ((movingLeafIndexEquiv n).symm j)).natDegree ≤ 2 * (n * d + e) + D := by + exact Polynomial.natDegree_mul_le.trans (by simpa only [Polynomial.natDegree_C, zero_add] using hp) + dsimp only [bulkFourierFactors] + split_ifs <;> exact hn + +theorem bulkFourierFactors_value {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (p : ℝ) : + smoothPolynomialWeight (bulkFourierFactors value i T L R ψ X lo hi hlo hhi) (p : ℝ) = + realValueFourierWeight (Function.update value i p) T ψ X lo hi hlo hhi + (L.eval (p : ℝ)) (R.eval (p : ℝ)) := by + unfold smoothPolynomialWeight realValueFourierWeight + rw [← (movingLeafIndexEquiv n).prod_comp] + apply Finset.prod_congr rfl + intro leaf _ + have hm := T.bulkLeafPolynomials_eval value i hT L R p leaf + have he : (Polynomial.C X⁻¹ * T.bulkLeafPolynomials value i L R leaf).eval (p : ℝ) = + T.realValueLeafModuli (Function.update value i p) (L.eval (p : ℝ)) (R.eval (p : ℝ)) leaf / X := by + rw [Polynomial.eval_mul, Polynomial.eval_C, hm] + ring + simp only [bulkFourierFactors, Equiv.symm_apply_apply] + split_ifs <;> simp only [ClippedPolynomialFactor.conjugate, ClippedPolynomialFactor.value, + fourierPolynomialFactor, he, Polynomial.eval_X] + +theorem bulkFourierFactors_budget {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : T.Frequencies (fun s => |(s : ℝ)| ≤ V)) : + smoothPolynomialBudget (bulkFourierFactors value i T L R ψ X lo hi hlo hhi) ≤ + movingFourierVariationBudget ψ V lo hi n := by + unfold smoothPolynomialBudget movingFourierVariationBudget + calc + _ ≤ ∏ _j : Fin (2 ^ n), + (2 * SchwartzMap.seminorm ℝ 0 0 ψ + + (SchwartzMap.seminorm ℝ 0 0 ψ + SchwartzMap.seminorm ℝ 0 1 ψ * V) * (hi - lo)) := by + apply Finset.prod_le_prod₀ + · intro j _ + let f := bulkFourierFactors value i T L R ψ X lo hi hlo hhi j + exact add_nonneg (mul_nonneg (by norm_num) f.bound_nonneg) + (mul_nonneg f.lip_nonneg (sub_nonneg.mpr f.lo_le_hi)) + · intro j _ + have hv := T.leafFrequencies_bound V hV ((movingLeafIndexEquiv n).symm j) + have hd := mul_le_mul_of_nonneg_left hv (schwartz_profile_lip_nonneg ψ) + have he := mul_le_mul_of_nonneg_right + (add_le_add (le_rfl : SchwartzMap.seminorm ℝ 0 0 ψ ≤ SchwartzMap.seminorm ℝ 0 0 ψ) hd) + (sub_nonneg.mpr hhi) + dsimp only [bulkFourierFactors] + split_ifs <;> exact add_le_add le_rfl he + _ = _ := by simp + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyFactor.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyFactor.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ade1cc14b47bf4fb2b39b86ceba0535d1d76b41 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyFactor.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkFrequencyResidues +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSeparatedProduct + +namespace OAI + +/-! # Separate the nonperiodic prime coincidences from frequency support -/ + +namespace Ostmann +open scoped Classical ComplexConjugate + +noncomputable def movingFrequencyCore {σ : Type*} (value : σ → ℕ) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (R x y : ℤ) : ℂ := + if ∀ b, movingFrequencyGate value R (T b) x y then + movingDataWeight (F false) (E false) (T false) * + conj (movingDataWeight (F true) (E true) (T true)) else 0 + +/-- The only nonperiodic part of this factor consists of the explicit +regular-prime coincidence tests. The remaining node bounds are independent +of the numerical bulk values. -/ +theorem movingFrequencyPairFactor_core {σ : Type*} (value : σ → ℕ) + (outside : List ℕ) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (nodes : Bool → List MovingFormulaNode) + (R x y : ℤ) : + movingFrequencyPairFactor value outside F E T nodes R x y = + (if ∀ b, movingRegularOutsidePairwise value outside (T b) ∧ + (∀ f ∈ nodes b, f.guard.frequencyBounds) then (1 : ℂ) else 0) * + movingFrequencyCore value F E T R x y := by + have he : movingFrequencyPairSupport value outside T nodes R x y ↔ + (∀ b, movingRegularOutsidePairwise value outside (T b) ∧ + (∀ f ∈ nodes b, f.guard.frequencyBounds)) ∧ + (∀ b, movingFrequencyGate value R (T b) x y) := by + simp only [movingFrequencyPairSupport, Bool.forall_bool] + tauto + unfold movingFrequencyPairFactor movingFrequencyCore + rw [he] + by_cases hs : ∀ b, movingRegularOutsidePairwise value outside (T b) ∧ + (∀ f ∈ nodes b, f.guard.frequencyBounds) + · by_cases hc : ∀ b, movingFrequencyGate value R (T b) x y + · rw [ite_eq_left ⟨hs, hc⟩, ite_eq_left hs, ite_eq_left hc, one_mul] + · rw [ite_eq_right (fun h => hc h.2), ite_eq_left hs, ite_eq_right hc, mul_zero] + · rw [ite_eq_right (fun h => hs h.1), ite_eq_right hs, zero_mul] + +/-- Unlike the removed coincidence tests, the actual frequency core is +constant on the joint bulk residue cells. -/ +theorem movingFrequencyCore_values_modEq {σ : Type*} (v w : σ → ℕ) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (R : ℤ) + (hf : ∀ b, (T b).Frequencies (· ≠ 0)) + (hcomp : ∀ b, (T b).CompensationAgreement v w) + (hR : ∀ b, (T b).frequencyProduct ∣ R) + (hv : ∀ i, (v i : ℤ) ≡ (w i : ℤ) [ZMOD R ^ (n + 1)]) + (XL XR YL YR : ℤ) (hL : XL ≡ YL [ZMOD R ^ (n + 1)]) + (hRight : XR ≡ YR [ZMOD R ^ (n + 1)]) : + movingFrequencyCore v F E T R XL XR = movingFrequencyCore w F E T R YL YR := by + have he : (∀ b, movingFrequencyGate v R (T b) XL XR) ↔ + (∀ b, movingFrequencyGate w R (T b) YL YR) := + forall_congr' fun b => movingFrequencyGate_values_modEq v w R (T b) + (hf b) (hcomp b) (hR b) hv XL XR YL YR hL hRight + simp only [movingFrequencyCore, he] + +def MovingSlotData.FrequencyBounds {σ : Type*} (childBound : ℕ → ℕ) : + {n : ℕ} → MovingSlotData σ n → Prop + | _, .leaf _ _ => True + | n + 1, .node _ _ _ _ left right => + left.frequency.natAbs ≤ childBound (n + 1) ∧ + right.frequency.natAbs ≤ childBound (n + 1) ∧ + left.FrequencyBounds childBound ∧ right.FrequencyBounds childBound + +theorem MovingSlotData.formulaNodes_frequencyBounds {σ : Type*} (value : σ → ℕ) + (hv : ∀ i, value i ≠ 0) (childBound pivotBound : ℕ → ℕ) + {n : ℕ} (T : MovingSlotData σ n) (hf : T.Frequencies (· ≠ 0)) + (L R : HistoryFormula Bool) : + (∀ f ∈ T.formulaNodes value hv childBound pivotBound hf L R, + f.guard.frequencyBounds) ↔ T.FrequencyBounds childBound := by + induction T generalizing L R with + | leaf => simp [formulaNodes, FrequencyBounds] + | node s CL CR u left right ihL ihR => + simp only [formulaNodes, List.mem_cons, List.mem_append, + or_imp, forall_and, forall_eq, ihL, ihR, FrequencyBounds] + change ((_ ∧ _) ∧ _ ∧ _) ↔ (_ ∧ _ ∧ _ ∧ _) + tauto + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyRepresentative.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyRepresentative.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2954c538218434240279b1d0b887661fe105a70 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyRepresentative.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkFrequencyFactor +import OAI.NumberTheory.Ostmann.Construction.PrimeGridResidueLift + +namespace OAI + +/-! # The frequency factor evaluated on the actual bulk residue representative -/ + +namespace Ostmann +open scoped Classical + +/-- Once the nonbulk coordinates have been fixed, the frequency factor is +a function of the frequency-unit array alone. The representative does not +alter any compensation denominator. -/ +theorem movingFrequencyCore_bulk_residues {σ J : Type*} + (value : σ → ℕ) (e : J ↪ σ) (r : ℕ) [NeZero r] + (a : J → (ZMod r)ˣ) (ha : ∀ j, (value (e j) : ZMod r) = (a j : ZMod r)) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (R : ℤ) + (hf : ∀ b, (T b).Frequencies (· ≠ 0)) + (hT : ∀ b j, (T b).CompensationAbsent (e j)) + (hR : ∀ b, (T b).frequencyProduct ∣ R) (hr : R ^ (n + 1) ∣ (r : ℤ)) + (XL XR : ℤ) : + movingFrequencyCore value F E T R XL XR = + movingFrequencyCore (Function.extend e (fun j => (a j).val.val) value) F E T R XL XR := by + let w := Function.extend e (fun j => (a j).val.val) value + have hcomp (b : Bool) : (T b).CompensationAgreement value w := by + apply (T b).compensationAgreement_of_eq_off value w (Set.range e) + · rintro i ⟨j, rfl⟩ + exact hT b j + · intro i hi + exact (Function.extend_apply' _ value i hi).symm + have hv (i : σ) : (value i : ℤ) ≡ (w i : ℤ) [ZMOD R ^ (n + 1)] := by + by_cases hi : ∃ j, e j = i + · obtain ⟨j, rfl⟩ := hi + have he : (value (e j) : ℤ) ≡ ((a j).val.val : ℤ) [ZMOD (r : ℤ)] := by + apply (ZMod.intCast_eq_intCast_iff _ _ r).mp + simpa only [Int.cast_natCast, ZMod.natCast_zmod_val] using ha j + simpa only [w, e.injective.extend_apply] using he.of_dvd hr + · rw [show w i = value i from Function.extend_apply' _ value i hi] + exact movingFrequencyCore_values_modEq value w F E T R hf hcomp hR hv + XL XR XL XR (Int.ModEq.refl _) (Int.ModEq.refl _) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyResidues.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyResidues.lean new file mode 100644 index 0000000000000000000000000000000000000000..4979029a9d07f39d1e7d6447fbe7621514aa61fd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFrequencyResidues.lean @@ -0,0 +1,98 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFrequencyResidues +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSlotPolynomials + +namespace OAI + +/-! # Frequency support depends only on bulk residue classes -/ + +namespace Ostmann +open scoped Classical + +def MovingSlotData.CompensationAgreement {σ : Type*} (v w : σ → ℕ) : + {n : ℕ} → MovingSlotData σ n → Prop + | _, .leaf _ _ => True + | _, .node _ _ _ u left right => + MovingSlotReversal.naturalProduct v u = MovingSlotReversal.naturalProduct w u ∧ + left.CompensationAgreement v w ∧ right.CompensationAgreement v w + +theorem MovingSlotData.compensationAgreement_of_eq_off {σ : Type*} + (v w : σ → ℕ) (S : Set σ) {n : ℕ} (T : MovingSlotData σ n) + (hT : ∀ i ∈ S, T.CompensationAbsent i) (hvalue : ∀ i ∉ S, v i = w i) : + T.CompensationAgreement v w := by + induction T with + | leaf => trivial + | node s CL CR u left right ihL ihR => + refine ⟨?_, ihL (fun i hi => (hT i hi).2.1), ihR (fun i hi => (hT i hi).2.2)⟩ + unfold MovingSlotReversal.naturalProduct + congr 1 + apply List.map_congr_left + intro i hi + exact hvalue i (fun hS => (hT i hS).1 hi) + +theorem naturalProduct_modEq_values {σ : Type*} (v w : σ → ℕ) (M : ℤ) + (h : ∀ i, (v i : ℤ) ≡ (w i : ℤ) [ZMOD M]) (s : List σ) : + (MovingSlotReversal.naturalProduct v s : ℤ) ≡ + (MovingSlotReversal.naturalProduct w s : ℤ) [ZMOD M] := by + induction s with + | nil => exact Int.ModEq.refl _ + | cons i s ih => + simpa only [MovingSlotReversal.naturalProduct, List.map_cons, List.prod_cons, + Nat.cast_mul] using (h i).mul ih + +theorem MovingSlotReversal.signedNumerator_values_modEq {σ : Type*} + (s : MovingSlotReversal σ) (v w : σ → ℕ) (M XL XR YL YR : ℤ) + (hv : ∀ i, (v i : ℤ) ≡ (w i : ℤ) [ZMOD M]) + (hL : XL ≡ YL [ZMOD M]) (hR : XR ≡ YR [ZMOD M]) : + s.signedNumerator v XL XR ≡ s.signedNumerator w YL YR [ZMOD M] := by + exact ((hR.mul (naturalProduct_modEq_values v w M hv s.rightSlots)).mul_left _).sub + ((hL.mul (naturalProduct_modEq_values v w M hv s.leftSlots)).mul_left _) + +theorem MovingSlotReversal.frequencyPivot_values_modEq {σ : Type*} + (s : MovingSlotReversal σ) (v w : σ → ℕ) (R : ℤ) (k : ℕ) + (hs : s.rootFrequency ≠ 0) (hsR : s.rootFrequency ∣ R) + (hc : MovingSlotReversal.naturalProduct v s.compensationSlots = + MovingSlotReversal.naturalProduct w s.compensationSlots) + (XL XR YL YR : ℤ) + (hv : ∀ i, (v i : ℤ) ≡ (w i : ℤ) [ZMOD R ^ (k + 1)]) + (hL : XL ≡ YL [ZMOD R ^ (k + 1)]) (hR : XR ≡ YR [ZMOD R ^ (k + 1)]) : + s.frequencyPivot v R k XL XR ≡ s.frequencyPivot w R k YL YR [ZMOD R ^ k] := by + have hd : s.rootFrequency * R ^ k ∣ R ^ (k + 1) := by + simpa only [pow_succ, mul_comm] using mul_dvd_mul hsR (dvd_refl (R ^ k)) + have hn := s.signedNumerator_values_modEq v w _ XL XR YL YR hv hL hR + unfold frequencyPivot + rw [hc] + exact (int_modEq_ediv _ _ _ _ hs (hn.of_dvd hd)).mul_right _ + +/-- All frequency divisibility and unit tests survive simultaneous bulk +replacement. Only one frequency power is consumed at each tree level. -/ +theorem movingFrequencyGate_values_modEq {σ : Type*} (v w : σ → ℕ) (R : ℤ) + {n : ℕ} (T : MovingSlotData σ n) (hf : T.Frequencies (· ≠ 0)) + (hcomp : T.CompensationAgreement v w) (hR : T.frequencyProduct ∣ R) + (hv : ∀ i, (v i : ℤ) ≡ (w i : ℤ) [ZMOD R ^ (n + 1)]) + (XL XR YL YR : ℤ) (hL : XL ≡ YL [ZMOD R ^ (n + 1)]) + (hRight : XR ≡ YR [ZMOD R ^ (n + 1)]) : + movingFrequencyGate v R T XL XR ↔ movingFrequencyGate w R T YL YR := by + induction T generalizing XL XR YL YR with + | leaf s regular => + exact movingFrequencyLocalUnits_modEq _ _ _ _ _ _ (by simpa using hR) hL hRight + | @node n s CL CR u left right ihL ihR => + have hd := MovingSlotData.frequencyProduct_node_dvd s CL CR u left right R hR + let step := MovingSlotData.step s CL CR u left right false + have hp := step.frequencyPivot_values_modEq v w R (n + 1) hf.1 hd.1 hcomp.1 + XL XR YL YR hv hL hRight + have hpow : R ∣ R ^ (n + 1 + 1) := dvd_pow_self R (by omega) + have hn := step.signedNumerator_values_modEq v w _ XL XR YL YR hv hL hRight + have hdiv := (hn.of_dvd (hd.1.trans hpow)).dvd_iff + have hlocal := movingFrequencyLocalUnits_modEq + (MovingSlotData.node s CL CR u left right) XL XR YL YR _ (hR.trans hpow) hL hRight + have hdown : R ^ (n + 1) ∣ R ^ (n + 1 + 1) := pow_dvd_pow R (by omega) + change (_ ∧ _ ∧ _ ∧ _) ↔ (_ ∧ _ ∧ _ ∧ _) + exact and_congr hlocal (and_congr hdiv (and_congr + (ihL hf.2.1 hcomp.2.1 hd.2.1 (fun i => (hv i).of_dvd hdown) + _ _ _ _ hp (hL.of_dvd hdown)) + (ihR hf.2.2 hcomp.2.2 hd.2.2 (fun i => (hv i).of_dvd hdown) + _ _ _ _ hp (hRight.of_dvd hdown)))) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFullSupportPolynomials.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFullSupportPolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..a926e60a1d6d5a7d50560236ec78ad7fb6aaa882 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkFullSupportPolynomials.lean @@ -0,0 +1,115 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.RealBulkKernel +import OAI.NumberTheory.Ostmann.Arithmetic.BulkNodeSupportPolynomials +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSmoothRootCuts + +namespace OAI + +/-! # Root cells for every original bulk support gate -/ + +namespace Ostmann +open scoped Classical BigOperators + +noncomputable def bulkFullSupportPolynomials {σ : Type*} (value : σ → ℝ) (i : σ) + (childBound pivotBound : ℕ → ℕ) {n : ℕ} (T : MovingSlotData σ n) + (L R : Polynomial ℝ) (X lo hi : ℝ) : + Fin (T.bulkNodeSupportPolynomials value i childBound pivotBound L R).length ⊕ + (TreeLeafIndex n × Bool) → Polynomial ℝ := + Sum.elim (fun j => (T.bulkNodeSupportPolynomials value i childBound pivotBound L R)[j]) + (fun j => let M := Polynomial.C X⁻¹ * T.bulkLeafPolynomials value i L R j.1 + if j.2 then Polynomial.C hi - M else M - Polynomial.C lo) + +theorem bulkFullSupportPolynomials_eval {σ : Type*} (value : σ → ℝ) (i : σ) + (childBound pivotBound : ℕ → ℕ) {n : ℕ} (T : MovingSlotData σ n) + (hT : T.CompensationAbsent i) (L R : Polynomial ℝ) (X lo hi z : ℝ) : + (∀ j, 0 ≤ (bulkFullSupportPolynomials value i childBound pivotBound T L R X lo hi j).eval z) ↔ + realValueFullSupport (Function.update value i z) childBound pivotBound T X lo hi (L.eval z) (R.eval z) := by + have hn := T.bulkNodeSupportPolynomials_eval value i childBound pivotBound hT L R z + rw [List.forall_mem_iff_get] at hn + constructor + · intro h + refine ⟨hn.mp (fun j => h (.inl j)), ?_⟩ + intro j + have hl := h (.inr (j, false)) + have hh := h (.inr (j, true)) + simp only [bulkFullSupportPolynomials, Sum.elim_inr, Bool.false_eq_true, ite_false, + ite_true, Polynomial.eval_sub, Polynomial.eval_C, Polynomial.eval_mul, + T.bulkLeafPolynomials_eval value i hT L R z] at hl hh + exact ⟨by simpa only [sub_nonneg, div_eq_mul_inv, mul_comm] using hl, + by simpa only [sub_nonneg, div_eq_mul_inv, mul_comm] using hh⟩ + · rintro ⟨hnode, hwindow⟩ j + cases j with + | inl j => exact hn.mpr hnode j + | inr j => + rcases j with ⟨j, b⟩ + have hj := hwindow j + cases b + · simpa only [bulkFullSupportPolynomials, Sum.elim_inr, Bool.false_eq_true, ite_false, + Polynomial.eval_sub, Polynomial.eval_C, Polynomial.eval_mul, + T.bulkLeafPolynomials_eval value i hT L R z, sub_nonneg, div_eq_mul_inv, mul_comm] using hj.1 + · simpa only [bulkFullSupportPolynomials, Sum.elim_inr, ite_true, + Polynomial.eval_sub, Polynomial.eval_C, Polynomial.eval_mul, + T.bulkLeafPolynomials_eval value i hT L R z, sub_nonneg, div_eq_mul_inv, mul_comm] using hj.2 + +theorem bulkFullSupportPolynomials_degree {σ : Type*} (value : σ → ℝ) (i : σ) + (childBound pivotBound : ℕ → ℕ) {n : ℕ} (T : MovingSlotData σ n) + (L R : Polynomial ℝ) (X lo hi : ℝ) (d r e : ℕ) + (hsize : T.SizeLE d) (hregular : T.RegularLengthLE r) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) : + ∀ j, (bulkFullSupportPolynomials value i childBound pivotBound T L R X lo hi j).natDegree ≤ + 2 * (n * d + e) + r := by + intro j + cases j with + | inl j => + exact (T.bulkNodeSupportPolynomials_degree value i childBound pivotBound L R d e hsize hL hR + _ (List.getElem_mem j.isLt)).trans (by omega) + | inr j => + have hM : (Polynomial.C X⁻¹ * T.bulkLeafPolynomials value i L R j.1).natDegree ≤ + 2 * (n * d + e) + r := by + have ht := T.bulkLeafPolynomials_degree value i L R d r e hsize hregular hL hR j.1 + exact Polynomial.natDegree_mul_le.trans (by simpa only [Polynomial.natDegree_C, zero_add] using ht) + rcases j with ⟨j, b⟩ + cases b + · exact (Polynomial.natDegree_sub_le _ _).trans (by + simpa only [Polynomial.natDegree_C, max_zero] using hM) + · exact (Polynomial.natDegree_sub_le _ _).trans (by + simpa only [Polynomial.natDegree_C, zero_max] using hM) + +/-- These roots include all node ranges and terminal windows. The count is +uniform in all other real bulk values and both giant coefficients. -/ +theorem bulkFullSupport_root_cuts {σ : Type*} (value : σ → ℝ) (i : σ) + (childBound pivotBound : ℕ → ℕ) {n : ℕ} (T : MovingSlotData σ n) + (hT : T.CompensationAbsent i) (L R : Polynomial ℝ) (X lo hi : ℝ) (d r e : ℕ) + (hsize : T.SizeLE d) (hregular : T.RegularLengthLE r) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) : + ∃ S : Finset ℝ, S.card ≤ (3 * (2 ^ n - 1) + 2 * 2 ^ n) * (2 * (n * d + e) + r) ∧ + ∀ x y, rootCellCode S x = rootCellCode S y → + realValueSupportFlag (Function.update value i x) childBound pivotBound T X lo hi (L.eval x) (R.eval x) = + realValueSupportFlag (Function.update value i y) childBound pivotBound T X lo hi (L.eval y) (R.eval y) := by + let J := Fin (T.bulkNodeSupportPolynomials value i childBound pivotBound L R).length ⊕ + (TreeLeafIndex n × Bool) + let H := bulkFullSupportPolynomials value i childBound pivotBound T L R X lo hi + let S := polynomialRootCuts H + have hroot (j) (z) (hz : z ∈ (H j).roots) : z ∈ S := + Finset.mem_biUnion.mpr ⟨j, Finset.mem_univ _, Multiset.mem_toFinset.mpr hz⟩ + refine ⟨S, ?_, ?_⟩ + · apply (polynomialRootCuts_card H).trans + calc + _ ≤ ∑ _j : J, (2 * (n * d + e) + r) := Finset.sum_le_sum (fun j _ => + bulkFullSupportPolynomials_degree value i childBound pivotBound T L R X lo hi d r e + hsize hregular hL hR j) + _ = _ := by + simp only [J, Finset.sum_const, Finset.card_univ, Fintype.card_sum, Fintype.card_fin, + Fintype.card_prod, Fintype.card_bool, card_treeLeafIndex, + MovingSlotData.bulkNodeSupportPolynomials_length, smul_eq_mul] + ring + · intro x y hxy + have hp : (∀ j, 0 ≤ (H j).eval x) ↔ ∀ j, 0 ≤ (H j).eval y := + forall_congr' (fun j => polynomial_nonneg_iff_of_root_cell (H j) S (hroot j) hxy) + have hx := bulkFullSupportPolynomials_eval value i childBound pivotBound T hT L R X lo hi x + have hy := bulkFullSupportPolynomials_eval value i childBound pivotBound T hT L R X lo hi y + have he := hx.symm.trans (hp.trans hy) + exact if_congr he rfl rfl + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkHalfLogBudgetComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkHalfLogBudgetComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..d255c039e7b6d5c2230be5d47e810557ec31fec9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkHalfLogBudgetComparison.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedKernelPairComparison + +namespace OAI + +/-! # Cost of retaining the original terminal logarithmic factors -/ + +namespace Ostmann +open scoped SchwartzMap + +/-- Two half-bulk factors per leaf in each tree fit the existing derivative-root budget. -/ +theorem bulkHalfLogWeightedKernelPairBudget_le + (ψ : 𝓢(ℝ, ℂ)) (V lo hi : ℝ) (n d r e t rlog : ℕ) (B D Dlog : ℝ) + (hDlog : 0 ≤ Dlog) (ht : t ≤ 4 * 2 ^ n) (hr : rlog ≤ r) : + bulkLogWeightedKernelPairBudget ψ V lo hi n d r e t rlog B D Dlog ≤ + (2 * (2 + Dlog * (Real.exp 2 - 1)) ^ t) * + bulkKernelPairComparisonBudget ψ V lo hi n d r e B D := by + let H := 2 * (n * d + e) + r + let A := (2 ^ n + (2 ^ n - 1)) * H + let B' := (3 * (2 ^ n - 1) + 2 * 2 ^ n) * H + have htr : t * rlog ≤ 2 * B' := by + calc + _ ≤ (4 * 2 ^ n) * r := Nat.mul_le_mul ht hr + _ = 2 * ((2 * 2 ^ n) * r) := by ring + _ ≤ 2 * B' := Nat.mul_le_mul_left 2 + (Nat.mul_le_mul (by omega) + (show r ≤ H by dsimp only [H]; omega)) + have hcount : 2 * (A + B') + t * rlog + 1 ≤ 2 * (2 * (A + B') + 1) := by omega + have hcountR : ((2 * (A + B') + t * rlog + 1 : ℕ) : ℝ) ≤ + 2 * ((2 * (A + B') + 1 : ℕ) : ℝ) := by exact_mod_cast hcount + have hexp : 0 ≤ Real.exp 2 - 1 := sub_nonneg.mpr (Real.one_le_exp (by norm_num)) + have hfactor : 0 ≤ (2 + Dlog * (Real.exp 2 - 1)) ^ t := + pow_nonneg (add_nonneg (by norm_num) (mul_nonneg hDlog hexp)) _ + have h := mul_le_mul_of_nonneg_right hcountR + (mul_nonneg (sq_nonneg + (movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1))) hfactor) + change ((2 * (A + B') + t * rlog + 1 : ℕ) : ℝ) * + ((movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) ^ 2 * + (2 + Dlog * (Real.exp 2 - 1)) ^ t) ≤ _ + exact h.trans_eq (by dsimp only [bulkKernelPairComparisonBudget, A, B', H]; ring) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkIntegrands.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkIntegrands.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e3ca2bd80fe06ffaee143a8ac154416996b4812 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkIntegrands.lean @@ -0,0 +1,185 @@ +import OAI.NumberTheory.Ostmann.Tree.CoordinateAverages + +namespace OAI + +/-! # Bounded measurable bulk integrands, including sharp gates + +The sharp terminal windows need not be continuous. This small function space +retains their actual values while providing the finite-measure operations used +in the bulk comparison. +-/ + +namespace Ostmann +open MeasureTheory +open scoped Classical + +structure BulkIntegrand (σ : Type*) where + toFun : (σ → ℝ) → ℂ + measurable : Measurable toFun + bounded : ∃ C : ℝ, 0 ≤ C ∧ ∀ x, ‖toFun x‖ ≤ C + +instance {σ : Type*} : CoeFun (BulkIntegrand σ) (fun _ => (σ → ℝ) → ℂ) := ⟨BulkIntegrand.toFun⟩ + +@[ext] theorem BulkIntegrand.ext {σ : Type*} {f g : BulkIntegrand σ} + (h : ∀ x, f x = g x) : f = g := by + cases f + cases g + have he := funext h + cases he + rfl + +noncomputable def BulkIntegrand.sub {σ : Type*} (f g : BulkIntegrand σ) : BulkIntegrand σ where + toFun x := f x - g x + measurable := f.measurable.sub g.measurable + bounded := by + obtain ⟨A, hA, hf⟩ := f.bounded + obtain ⟨B, hB, hg⟩ := g.bounded + exact ⟨A + B, add_nonneg hA hB, fun x => (norm_sub_le _ _).trans (add_le_add (hf x) (hg x))⟩ + +theorem BulkIntegrand.integrable {σ : Type*} [Fintype σ] (f : BulkIntegrand σ) + (μ : Measure (σ → ℝ)) [IsFiniteMeasure μ] : Integrable f μ := by + obtain ⟨C, _, hC⟩ := f.bounded + exact ⟨f.measurable.aestronglyMeasurable, + HasFiniteIntegral.of_bounded (Filter.Eventually.of_forall hC)⟩ + +theorem BulkIntegrand.slice_integrable {σ : Type*} [Fintype σ] (f : BulkIntegrand σ) + (μ : Measure ℝ) [IsFiniteMeasure μ] (i : σ) (x : σ → ℝ) : + Integrable (fun t => f (Function.update x i t)) μ := by + obtain ⟨C, _, hC⟩ := f.bounded + exact ⟨(f.measurable.comp (continuous_const.update i continuous_id).measurable).aestronglyMeasurable, + HasFiniteIntegral.of_bounded (Filter.Eventually.of_forall fun t => hC _)⟩ + +noncomputable def BulkIntegrand.average {σ : Type*} [Fintype σ] + (μ : Measure ℝ) [IsFiniteMeasure μ] (i : σ) (f : BulkIntegrand σ) : BulkIntegrand σ where + toFun x := ∫ t, f (Function.update x i t) ∂μ + measurable := by + have hj : Measurable (fun z : (σ → ℝ) × ℝ => f (Function.update z.1 i z.2)) := + f.measurable.comp (continuous_update i).measurable + exact hj.stronglyMeasurable.integral_prod_right'.measurable + bounded := by + obtain ⟨C, hC, hf⟩ := f.bounded + refine ⟨C * μ.real Set.univ, mul_nonneg hC measureReal_nonneg, fun x => ?_⟩ + exact norm_integral_le_of_norm_le_const (Filter.Eventually.of_forall fun _t => hf _) + +theorem BulkIntegrand.average_bound {σ : Type*} [Fintype σ] + (μ : Measure ℝ) [IsFiniteMeasure μ] (i : σ) (f : BulkIntegrand σ) + (C : ℝ) (hf : ∀ x, ‖f x‖ ≤ C) (x : σ → ℝ) : + ‖f.average μ i x‖ ≤ C * μ.real Set.univ := + norm_integral_le_of_norm_le_const (Filter.Eventually.of_forall fun _t => hf _) + +theorem BulkIntegrand.average_sub {σ : Type*} [Fintype σ] + (μ : Measure ℝ) [IsFiniteMeasure μ] (i : σ) (f g : BulkIntegrand σ) : + (f.sub g).average μ i = (f.average μ i).sub (g.average μ i) := by + ext x + exact integral_sub (f.slice_integrable μ i x) (g.slice_integrable μ i x) + +theorem BulkIntegrand.average_commute {σ : Type*} [Fintype σ] + (μ ν : Measure ℝ) [IsFiniteMeasure μ] [IsFiniteMeasure ν] + (i j : σ) (hij : i ≠ j) (f : BulkIntegrand σ) : + (f.average ν j).average μ i = (f.average μ i).average ν j := by + ext x + obtain ⟨C, _, hC⟩ := f.bounded + have hj : Measurable (fun z : ℝ × ℝ => f (Function.update (Function.update x i z.1) j z.2)) := + f.measurable.comp (((show Continuous (fun _ : ℝ × ℝ => x) from continuous_const).update i + continuous_fst).update j continuous_snd).measurable + have hg : Integrable (fun z : ℝ × ℝ => f (Function.update (Function.update x i z.1) j z.2)) + (μ.prod ν) := ⟨hj.aestronglyMeasurable, + HasFiniteIntegral.of_bounded (Filter.Eventually.of_forall fun z => hC _)⟩ + have he := integral_integral_swap (μ := μ) (ν := ν) + (f := fun t s => f (Function.update (Function.update x i t) j s)) hg + change (∫ t, ∫ s, f (Function.update (Function.update x i t) j s) ∂ν ∂μ) = _ + rw [he] + apply integral_congr_ae + exact Filter.Eventually.of_forall fun s => integral_congr_ae + (Filter.Eventually.of_forall fun t => by dsimp only; rw [Function.update_comm hij]) + +noncomputable def BulkIntegrand.averages {σ : Type*} [Fintype σ] (μ : σ → Measure ℝ) + [∀ i, IsFiniteMeasure (μ i)] : List σ → BulkIntegrand σ → BulkIntegrand σ + | [], f => f + | i :: l, f => (f.averages μ l).average (μ i) i + +theorem BulkIntegrand.averages_sub {σ : Type*} [Fintype σ] (μ : σ → Measure ℝ) + [∀ i, IsFiniteMeasure (μ i)] (l : List σ) (f g : BulkIntegrand σ) : + (f.sub g).averages μ l = (f.averages μ l).sub (g.averages μ l) := by + induction l with + | nil => rfl + | cons i l ih => simp only [averages, ih, average_sub] + +theorem BulkIntegrand.averages_bound {σ : Type*} [Fintype σ] (μ : σ → Measure ℝ) + [∀ i, IsFiniteMeasure (μ i)] (l : List σ) + (hμ : ∀ i ∈ l, (μ i).real Set.univ ≤ 2) (f : BulkIntegrand σ) + (C : ℝ) (hC : 0 ≤ C) (hf : ∀ x, ‖f x‖ ≤ C) : + ∀ x, ‖f.averages μ l x‖ ≤ 2 ^ l.length * C := by + induction l with + | nil => simpa only [averages, List.length_nil, pow_zero, one_mul] using hf + | cons i l ih => + intro x + have ht := ih (fun j hj => hμ j (by simp [hj])) + calc + _ ≤ (2 ^ l.length * C) * (μ i).real Set.univ := average_bound _ _ _ _ ht x + _ ≤ (2 ^ l.length * C) * 2 := mul_le_mul_of_nonneg_left (hμ i (by simp)) (by positivity) + _ = _ := by simp only [List.length_cons, pow_succ]; ring + +theorem BulkIntegrand.averages_commute {σ : Type*} [Fintype σ] (μ : σ → Measure ℝ) + [∀ i, IsFiniteMeasure (μ i)] (ν : Measure ℝ) [IsFiniteMeasure ν] + (l : List σ) (i : σ) (hi : i ∉ l) (f : BulkIntegrand σ) : + (f.averages μ l).average ν i = (f.average ν i).averages μ l := by + induction l with + | nil => rfl + | cons j l ih => + have hij : i ≠ j := fun h => hi (by simp [h]) + have hil : i ∉ l := fun h => hi (by simp [h]) + simp only [averages, average_commute ν (μ j) i j hij, ih hil] + +/-- Pointwise product comparison, valid also for the original sharp windows. -/ +theorem BulkIntegrand.averages_comparison {σ : Type*} [Fintype σ] (μ ν : σ → Measure ℝ) + [∀ i, IsFiniteMeasure (μ i)] [∀ i, IsFiniteMeasure (ν i)] + (l : List σ) (hl : l.Nodup) + (hμ : ∀ i ∈ l, (μ i).real Set.univ ≤ 2) (hν : ∀ i ∈ l, (ν i).real Set.univ ≤ 2) + (f : BulkIntegrand σ) (ε : σ → ℝ) (hε : ∀ i ∈ l, 0 ≤ ε i) + (herr : ∀ i ∈ l, ∀ x, ‖f.average (μ i) i x - f.average (ν i) i x‖ ≤ ε i) : + ∀ x, ‖f.averages μ l x - f.averages ν l x‖ ≤ 2 ^ l.length * (l.map ε).sum := by + induction l with + | nil => simp [averages] + | cons i l ih => + obtain ⟨hi, hl⟩ := List.nodup_cons.mp hl + have hμl : ∀ j ∈ l, (μ j).real Set.univ ≤ 2 := fun j hj => hμ j (by simp [hj]) + have hνl : ∀ j ∈ l, (ν j).real Set.univ ≤ 2 := fun j hj => hν j (by simp [hj]) + have he0 := hε i (by simp) + have heSum : 0 ≤ (l.map ε).sum := List.sum_nonneg (by + intro a ha + obtain ⟨j, hj, rfl⟩ := List.mem_map.mp ha + exact hε j (by simp [hj])) + have htail := ih hl hμl hνl (fun j hj => hε j (by simp [hj])) + (fun j hj => herr j (by simp [hj])) + have hfirst (x : σ → ℝ) : + ‖(f.averages ν l).average (μ i) i x - (f.averages ν l).average (ν i) i x‖ ≤ + 2 ^ l.length * ε i := by + rw [averages_commute ν (μ i) l i hi, averages_commute ν (ν i) l i hi] + have hb := averages_bound ν l hνl ((f.average (μ i) i).sub (f.average (ν i) i)) + (ε i) he0 (herr i (by simp)) x + rw [averages_sub] at hb + exact hb + intro x + change ‖(f.averages μ l).average (μ i) i x - (f.averages ν l).average (ν i) i x‖ ≤ _ + calc + _ ≤ ‖(f.averages μ l).average (μ i) i x - (f.averages ν l).average (μ i) i x‖ + + ‖(f.averages ν l).average (μ i) i x - (f.averages ν l).average (ν i) i x‖ := + norm_sub_le_norm_sub_add_norm_sub _ _ _ + _ ≤ 2 * (2 ^ l.length * (l.map ε).sum) + 2 ^ l.length * ε i := by + apply add_le_add _ (hfirst x) + have ha := average_bound (μ i) i ((f.averages μ l).sub (f.averages ν l)) + (2 ^ l.length * (l.map ε).sum) htail x + rw [average_sub] at ha + apply ha.trans + calc + _ ≤ (2 ^ l.length * (l.map ε).sum) * 2 := + mul_le_mul_of_nonneg_left (hμ i (by simp)) (mul_nonneg (by positivity) heSum) + _ = _ := by ring + _ ≤ _ := by + simp only [List.length_cons, List.map_cons, List.sum_cons, pow_succ] + nlinarith [pow_nonneg (by norm_num : (0 : ℝ) ≤ 2) l.length] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelCellComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelCellComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..1600245dd5a87bff304f538ff6fd9cef1b4fe117 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelCellComparison.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.RealBulkKernelPair +import OAI.NumberTheory.Ostmann.Arithmetic.BulkPrimeCellMass + +namespace OAI + +/-! # Simultaneous replacement of the full arithmetic bulk kernel -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap + +/-- The full original conjugate pair, including its sharp support conditions, is compared jointly, retaining every Page +correction. The only mass side condition is a finite reciprocal-prime sum. -/ +theorem PublishedProgressionInput.bulk_kernel_cells_joint_comparison + (P : PublishedProgressionInput) {σ C : Type*} [Fintype σ] [Fintype C] + (base : σ → ℝ) (childBound pivotBound : ℕ → ℕ) (order : List σ) (horder : order.Nodup) + {n : ℕ} (T : Bool → MovingSlotData σ n) (hT : ∀ b i, i ∈ order → (T b).CompensationAbsent i) + (i₀ : σ) (hi₀ : i₀ ∈ order) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) (L R : ℝ) + (Q : ℕ) (hQ : 2 ≤ Q) (q a : σ → C → ℕ) (u v : σ → C → ℝ) (Z : σ → ℝ) (hZ : ∀ i, 0 ≤ Z i) + (hu : ∀ i c, 1 ≤ u i c) (hq : ∀ i ∈ order, ∀ c, 1 ≤ q i c) + (hqQ : ∀ i ∈ order, ∀ c, q i c ≤ Q) (ha : ∀ i ∈ order, ∀ c, (a i c).Coprime (q i c)) + (huv : ∀ i ∈ order, ∀ c, u i c ≤ v i c) (hshort : ∀ i ∈ order, ∀ c, v i c ≤ u i c + 1) + (hmass : ∀ i ∈ order, + (bulkCellMixture (Z i) (fun c => primeLogCellMeasure (q i c) (a i c) (u i c) (v i c))).real Set.univ ≤ 1) + (herror : ∀ i ∈ order, Z i * ∑ c, bulkPrimeErrorFactor P Q (u i c) ≤ 1) : + let f := bulkLogKernelPairIntegrand base order.toFinset childBound pivotBound T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i c => primeLogCellMeasure (q i c) (a i c) (u i c) (v i c) + let ν := fun i c => primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) + letI : ∀ i c, IsFiniteMeasure (ν i c) := fun i c => + finite_primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) (lt_of_lt_of_le zero_lt_one (hu i c)) + ∀ x, ‖f.averages (fun i => bulkCellMixture (Z i) (μ i)) order x - + f.averages (fun i => bulkCellMixture (Z i) (ν i)) order x‖ ≤ + 2 ^ order.length * (order.map (fun i => + Z i * ∑ c, bulkKernelPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i c))).sum := by + let f := bulkLogKernelPairIntegrand base order.toFinset childBound pivotBound T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i c => primeLogCellMeasure (q i c) (a i c) (u i c) (v i c) + let ν := fun i c => primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) + let _ : ∀ i c, IsFiniteMeasure (ν i c) := fun i c => + finite_primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) (lt_of_lt_of_le zero_lt_one (hu i c)) + have hslices (i : σ) (hiMem : i ∈ order) (c : C) (x : σ → ℝ) : + ‖f.average (μ i c) i x - f.average (ν i c) i x‖ ≤ + bulkKernelPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i c) := by + exact P.bulk_kernel_log_slice_comparison base order.toFinset childBound pivotBound T i (List.mem_toFinset.mpr hiMem) + (fun b => hT b i hiMem) ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r hsize hregular L R f + (fun _ => rfl) hQ (hq i hiMem c) (hqQ i hiMem c) (ha i hiMem c) (u i c) (v i c) (hu i c) + (huv i hiMem c) (hshort i hiMem c) x + have hν : ∀ i ∈ order, (bulkCellMixture (Z i) (ν i)).real Set.univ ≤ 2 := by + intro i hiMem + exact P.bulk_cell_page_mass_le_two Q hQ (q i) (a i) (u i) (v i) + (hq i hiMem) (hqQ i hiMem) (ha i hiMem) (hu i) (huv i hiMem) (hshort i hiMem) + (Z i) (hZ i) (hmass i hiMem) (herror i hiMem) + exact f.cellMixtures_joint_comparison Z hZ μ ν order horder + (fun i hiMem => (hmass i hiMem).trans (by norm_num)) hν _ + (fun i hiMem c => (norm_nonneg _).trans (hslices i hiMem c base)) hslices + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelCellError.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelCellError.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9e5921685e2ad62d5d8ea4665dfc39cbcbc766e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelCellError.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkWeightedCellComparison + +namespace OAI + +/-! # The explicit published-input error for all original residue cells -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap + +theorem PublishedProgressionInput.bulk_kernel_weighted_cells_comparison + (P : PublishedProgressionInput) {σ C : Type*} [Fintype σ] [Fintype C] {k n : ℕ} + (base : σ → ℝ) (S : Finset σ) (e : Fin k ↪ σ) (he : ∀ i, e i ∈ S) + (childBound pivotBound : ℕ → ℕ) (T : Bool → MovingSlotData σ n) + (hT : ∀ b i, (T b).CompensationAbsent (e i)) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) + (L R : ℝ) (f : BulkIntegrand σ) + (hf : ∀ x, f x = realValueKernelPair (bulkLogValues base S x) + childBound pivotBound T ψ X lo hi hlo hhi φ G L R) + (Q M : ℕ) [NeZero M] (hQ : 2 ≤ Q) (hM : M ≤ Q) + (u v : Fin k → C → ℝ) (hu : ∀ i c, 1 ≤ u i c) + (huv : ∀ i c, u i c ≤ v i c) (hshort : ∀ i c, v i c ≤ u i c + 1) + (hmass : ∀ i c (a : (ZMod M)ˣ), + ∑ p ∈ primeLogCellSet M a.val.val (u i c) (v i c), (p : ℝ)⁻¹ ≤ 2) + (Z : Fin k → ℝ) (hZ : ∀ i, 0 ≤ Z i) + (a : (Fin k → (ZMod M)ˣ) → ℂ) : + let K := f.pullBulk base e + let E := fun c : Fin k → C => 2 ^ k * ∑ i, + bulkKernelPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i (c i)) + ‖((∏ i, Z i : ℝ) : ℂ) * ∑ c : Fin k → C, ∑ z : Fin k → (ZMod M)ˣ, + ∫ y, (K.constMul (a z)) y ∂Measure.pi (fun i => + primeLogCellMeasure M (z i).val.val (u i (c i)) (v i (c i))) - + ((∏ i, Z i : ℝ) : ℂ) * ∑ c : Fin k → C, ∑ z : Fin k → (ZMod M)ˣ, + ∫ y, (K.constMul (a z)) y ∂Measure.pi (fun i => + primeGiantMeasure P Q M (z i).val.val (u i (c i)) (v i (c i)))‖ ≤ + (∏ i, Z i) * ∑ c : Fin k → C, ∑ z, ‖a z‖ * E c := by + let μ := fun (c : Fin k → C) (z : Fin k → (ZMod M)ˣ) i => + primeLogCellMeasure M (z i).val.val (u i (c i)) (v i (c i)) + let ν := fun (c : Fin k → C) (z : Fin k → (ZMod M)ˣ) i => + primeGiantMeasure P Q M (z i).val.val (u i (c i)) (v i (c i)) + let _ : ∀ c z i, IsFiniteMeasure (ν c z i) := fun c z i => + finite_primeGiantMeasure P Q _ _ _ _ (lt_of_lt_of_le zero_lt_one (hu i (c i))) + let E := fun c : Fin k → C => 2 ^ k * ∑ i, + bulkKernelPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i (c i)) + have herr (c : Fin k → C) (z : Fin k → (ZMod M)ˣ) : + ‖(∫ y, (f.pullBulk base e) y ∂Measure.pi (μ c z)) - + ∫ y, (f.pullBulk base e) y ∂Measure.pi (ν c z)‖ ≤ E c := by + exact P.bulk_kernel_integral_comparison base S e he childBound pivotBound T hT + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r hsize hregular L R f hf + hQ (fun _ => M) (fun i => (z i).val.val) (fun i => u i (c i)) (fun i => v i (c i)) + (fun _ => Nat.pos_of_ne_zero (NeZero.ne M)) (fun _ => hM) + (fun i => ZMod.val_coe_unit_coprime (z i)) + (fun i => hu i (c i)) (fun i => huv i (c i)) (fun i => hshort i (c i)) + (fun i => hmass i (c i) (z i)) + + have h := bulk_weighted_cell_comparison (f.pullBulk base e) a Z hZ μ ν + (fun c _ => E c) herr + dsimp only [μ, ν, E] at h ⊢ + simp only [finite_univ_canonical] at h ⊢ + exact h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelIntegralComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelIntegralComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..747a0542979777123385fbec7118c97bb7fbb4d3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelIntegralComparison.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkKernelJointComparison +import OAI.NumberTheory.Ostmann.Arithmetic.BulkCoordinateInsertion + +namespace OAI + +/-! # The actual sharp kernel comparison on the selected bulk product -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap + +theorem BulkIntegrand.integral_comparison {k : ℕ} (f : BulkIntegrand (Fin k)) + (μ ν : Fin k → Measure ℝ) + [∀ i, IsFiniteMeasure (μ i)] [∀ i, IsFiniteMeasure (ν i)] + (hμ : ∀ i, (μ i).real Set.univ ≤ 2) (hν : ∀ i, (ν i).real Set.univ ≤ 2) + (ε : Fin k → ℝ) (hε : ∀ i, 0 ≤ ε i) + (herr : ∀ i x, ‖f.average (μ i) i x - f.average (ν i) i x‖ ≤ ε i) : + ‖(∫ x, f x ∂Measure.pi μ) - ∫ x, f x ∂Measure.pi ν‖ ≤ + 2 ^ k * ∑ i, ε i := by + have h := f.averages_comparison μ ν (List.finRange k) (List.nodup_finRange k) + (fun i _ => hμ i) (fun i _ => hν i) ε (fun i _ => hε i) + (fun i _ => herr i) (fun _ => 0) + rw [f.averages_finRange, f.averages_finRange] at h + simpa only [List.length_finRange, ← List.ofFn_eq_map, List.sum_ofFn] using h + +/-- The published progression input compares the sharp paired kernel in the +actual selected coordinates, while every nonbulk coordinate remains fixed. +There is no assumption about a previously integrated slice. -/ +theorem PublishedProgressionInput.bulk_kernel_integral_comparison + (P : PublishedProgressionInput) {σ : Type*} [Fintype σ] {k n : ℕ} + (base : σ → ℝ) (S : Finset σ) (e : Fin k ↪ σ) (he : ∀ i, e i ∈ S) + (childBound pivotBound : ℕ → ℕ) (T : Bool → MovingSlotData σ n) + (hT : ∀ b i, (T b).CompensationAbsent (e i)) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) + (L R : ℝ) (f : BulkIntegrand σ) + (hf : ∀ x, f x = realValueKernelPair (bulkLogValues base S x) + childBound pivotBound T ψ X lo hi hlo hhi φ G L R) + {Q : ℕ} (hQ : 2 ≤ Q) (q a : Fin k → ℕ) (u v : Fin k → ℝ) + (hq : ∀ i, 1 ≤ q i) (hqQ : ∀ i, q i ≤ Q) (ha : ∀ i, (a i).Coprime (q i)) + (hu : ∀ i, 1 ≤ u i) (huv : ∀ i, u i ≤ v i) (hshort : ∀ i, v i ≤ u i + 1) + (hmass : ∀ i, ∑ p ∈ primeLogCellSet (q i) (a i) (u i) (v i), (p : ℝ)⁻¹ ≤ 2) : + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + ‖(∫ y, f (bulkCoordinateInsert base e y) ∂Measure.pi μ) - + ∫ y, f (bulkCoordinateInsert base e y) ∂Measure.pi ν‖ ≤ + 2 ^ k * ∑ i, bulkKernelPairComparisonBudget ψ V lo hi n d r 0 B D * + bulkPrimeErrorFactor P Q (u i) := by + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + let _ : ∀ i, IsFiniteMeasure (ν i) := fun i => + finite_primeGiantMeasure P Q _ _ _ _ (lt_of_lt_of_le zero_lt_one (hu i)) + have hs (i : Fin k) (x : σ → ℝ) := P.bulk_kernel_log_slice_comparison + base S childBound pivotBound T (e i) (he i) (fun b => hT b i) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r hsize hregular L R f hf + hQ (hq i) (hqQ i) (ha i) (u i) (v i) (hu i) (huv i) (hshort i) x + have hμ (i) : (μ i).real Set.univ ≤ 2 := by + rw [primeLogCellMeasure_mass] + exact hmass i + have hν (i) : (ν i).real Set.univ ≤ 2 := + primeGiantMeasure_mass_le_two P Q _ _ (hq i) _ _ (hu i) (huv i) (hshort i) + apply (f.pullBulk base e).integral_comparison μ ν hμ hν _ + (fun i => (norm_nonneg _).trans (hs i base)) + intro i y + have h := hs i (bulkCoordinateInsert base e y) + change ‖((f.average (μ i) (e i)).pullBulk base e) y - + ((f.average (ν i) (e i)).pullBulk base e) y‖ ≤ _ at h + simpa only [BulkIntegrand.pullBulk_average] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelJointComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelJointComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ca13bf01ffa5ac5ebe4c5be166ffcfbc9ededfb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelJointComparison.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.RealBulkKernelPair + +namespace OAI + +/-! # Simultaneous replacement of the full arithmetic bulk kernel -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap + +/-- The full original conjugate pair, including its sharp support conditions, is compared jointly, retaining every Page +correction. The only mass side condition is a finite reciprocal-prime sum. -/ +theorem PublishedProgressionInput.bulk_kernel_log_joint_comparison + (P : PublishedProgressionInput) {σ : Type*} [Fintype σ] + (base : σ → ℝ) (childBound pivotBound : ℕ → ℕ) (order : List σ) (horder : order.Nodup) + {n : ℕ} (T : Bool → MovingSlotData σ n) (hT : ∀ b i, i ∈ order → (T b).CompensationAbsent i) + (i₀ : σ) (hi₀ : i₀ ∈ order) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) (L R : ℝ) + (Q : ℕ) (hQ : 2 ≤ Q) (q a : σ → ℕ) (u v : σ → ℝ) + (hu : ∀ i, 1 ≤ u i) (hq : ∀ i ∈ order, 1 ≤ q i) + (hqQ : ∀ i ∈ order, q i ≤ Q) (ha : ∀ i ∈ order, (a i).Coprime (q i)) + (huv : ∀ i ∈ order, u i ≤ v i) (hshort : ∀ i ∈ order, v i ≤ u i + 1) + (hmass : ∀ i ∈ order, ∑ p ∈ primeLogCellSet (q i) (a i) (u i) (v i), (p : ℝ)⁻¹ ≤ 2) : + let f := bulkLogKernelPairIntegrand base order.toFinset childBound pivotBound T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + letI : ∀ i, IsFiniteMeasure (ν i) := fun i => + finite_primeGiantMeasure P Q (q i) (a i) (u i) (v i) (lt_of_lt_of_le zero_lt_one (hu i)) + ∀ x, ‖f.averages μ order x - f.averages ν order x‖ ≤ + 2 ^ order.length * (order.map (fun i => + bulkKernelPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i))).sum := by + let f := bulkLogKernelPairIntegrand base order.toFinset childBound pivotBound T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + let _ : ∀ i, IsFiniteMeasure (ν i) := fun i => + finite_primeGiantMeasure P Q (q i) (a i) (u i) (v i) (lt_of_lt_of_le zero_lt_one (hu i)) + have hslices (i : σ) (hiMem : i ∈ order) (x : σ → ℝ) : + ‖f.average (μ i) i x - f.average (ν i) i x‖ ≤ + bulkKernelPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i) := by + exact P.bulk_kernel_log_slice_comparison base order.toFinset childBound pivotBound T i (List.mem_toFinset.mpr hiMem) + (fun b => hT b i hiMem) ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r hsize hregular L R f + (fun _ => rfl) hQ (hq i hiMem) (hqQ i hiMem) (ha i hiMem) (u i) (v i) (hu i) + (huv i hiMem) (hshort i hiMem) x + have hμ : ∀ i ∈ order, (μ i).real Set.univ ≤ 2 := by + intro i hiMem + change (primeLogCellMeasure (q i) (a i) (u i) (v i)).real Set.univ ≤ 2 + rw [primeLogCellMeasure_mass] + exact hmass i hiMem + have hν : ∀ i ∈ order, (ν i).real Set.univ ≤ 2 := by + intro i hiMem + exact primeGiantMeasure_mass_le_two P Q (q i) (a i) (hq i hiMem) (u i) (v i) + (hu i) (huv i hiMem) (hshort i hiMem) + exact BulkIntegrand.averages_comparison μ ν order horder hμ hν f _ + (fun i hiMem => (norm_nonneg _).trans (hslices i hiMem base)) hslices + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelPairComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelPairComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..beca83c283833447c8b46018ad9a146437788d94 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkKernelPairComparison.lean @@ -0,0 +1,114 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkFullSupportPolynomials +import OAI.NumberTheory.Ostmann.Arithmetic.BulkPairPrimeComparison +import OAI.NumberTheory.Ostmann.Arithmetic.SmoothGatedPrimeRoots + +namespace OAI + +/-! # Prime comparison for the full original pair, with every sharp gate -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap ComplexConjugate + +noncomputable def realValueKernelPair {σ : Type*} (value : σ → ℝ) + (childBound pivotBound : ℕ → ℕ) {n : ℕ} (T : Bool → MovingSlotData σ n) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (L R : ℝ) : ℂ := + realValueKernel value childBound pivotBound (T false) ψ X lo hi hlo hhi φ G L R * + conj (realValueKernel value childBound pivotBound (T true) ψ X lo hi hlo hhi φ G L R) + +noncomputable def bulkKernelPairComparisonBudget (ψ : 𝓢(ℝ, ℂ)) (V lo hi : ℝ) + (n d r e : ℕ) (B D : ℝ) : ℝ := + ((2 * (((2 ^ n + (2 ^ n - 1)) * (2 * (n * d + e) + r)) + + ((3 * (2 ^ n - 1) + 2 * 2 ^ n) * (2 * (n * d + e) + r))) + 1 : ℕ) : ℝ) * + (movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) ^ 2 + +/-- The original node inequalities and terminal windows remain in both the +atomic prime sum and the Page integral. Their derivative-free polynomial root +cuts are included alongside all smooth derivative roots. -/ +theorem PublishedProgressionInput.bulk_kernel_pair_prime_comparison (P : PublishedProgressionInput) + {σ : Type*} (value : σ → ℝ) (i : σ) (childBound pivotBound : ℕ → ℕ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (hT : ∀ b, (T b).CompensationAbsent i) + (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r e : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) : + let H := fun y => realValueKernelPair (Function.update value i (Real.exp y)) childBound pivotBound T + ψ X lo hi hlo hhi φ G (L.eval (Real.exp y)) (R.eval (Real.exp y)) + ‖complexPrimeInterval q a u v H - + ∫ y in Set.Ioc u v, H y * (selectedPrimeLogDensity P Q q a y : ℂ)‖ ≤ + bulkKernelPairComparisonBudget ψ V lo hi n d r e B D * bulkPrimeErrorFactor P Q u := by + dsimp only + let F (b : Bool) := bulkSmoothFactors value i (T b) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip + let W := movingFourierVariationBudget ψ V lo hi n * + (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1) + let A := (2 ^ n + (2 ^ n - 1)) * (2 * (n * d + e) + r) + let B' := (3 * (2 ^ n - 1) + 2 * 2 ^ n) * (2 * (n * d + e) + r) + obtain ⟨S, hS, hrS⟩ := bulkSmoothFactors_root_cuts value i (T false) L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip d r e (hsize false) (hregular false) hL hR + obtain ⟨U, hU, hrU⟩ := bulkSmoothFactors_root_cuts value i (T true) L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip d r e (hsize true) (hregular true) hL hR + obtain ⟨S', hS', hcS⟩ := bulkFullSupport_root_cuts value i childBound pivotBound (T false) + (hT false) L R X lo hi d r e (hsize false) (hregular false) hL hR + obtain ⟨U', hU', hcU⟩ := bulkFullSupport_root_cuts value i childBound pivotBound (T true) + (hT true) L R X lo hi d r e (hsize true) (hregular true) hL hR + let V' := (S ∪ U) ∪ (S' ∪ U') + have hcard : V'.card + 1 ≤ 2 * (A + B') + 1 := by + simp only [MovingSlotData.bulkNodePolynomials_length] at hS hU + have hsu := Finset.card_union_le S U + have hsu' := Finset.card_union_le S' U' + have hall := Finset.card_union_le (S ∪ U) (S' ∪ U') + dsimp only [A, B', V'] + omega + let w := fun z => realValueSupportFlag (Function.update value i z) childBound pivotBound + (T false) X lo hi (L.eval z) (R.eval z) * + conj (realValueSupportFlag (Function.update value i z) childBound pivotBound + (T true) X lo hi (L.eval z) (R.eval z)) + have hw (z : ℝ) : ‖w z‖ ≤ 1 := by + rw [show w z = _ * conj _ from rfl, norm_mul, Complex.norm_conj] + exact (mul_le_mul (realValueSupportFlag_norm _ _ _ _ _ _ _ _ _) + (realValueSupportFlag_norm _ _ _ _ _ _ _ _ _) (norm_nonneg _) (by norm_num)).trans_eq (by norm_num) + have hconst (x y : ℝ) (hxy : rootCellCode V' x = rootCellCode V' y) : w x = w y := by + have hsxy := rootCellCode_eq_of_subset S' V' + (Finset.subset_union_left.trans Finset.subset_union_right) x y hxy + have huxy := rootCellCode_eq_of_subset U' V' + (Finset.subset_union_right.trans Finset.subset_union_right) x y hxy + change _ * conj _ = _ * conj _ + rw [hcS x y hsxy, hcU x y huxy] + have hroots (j) (z) (hz : z ∈ ((pairedPolynomialFactors (F false) (F true)) j).polynomial.derivative.roots) : z ∈ V' := + Finset.mem_union_left _ (pairedPolynomialFactors_roots (F false) (F true) S U hrS hrU j z hz) + have hbudget : smoothPolynomialBudget (pairedPolynomialFactors (F false) (F true)) ≤ W ^ 2 := by + rw [pairedPolynomialFactors_budget, pow_two] + have h0 := bulkSmoothFactors_budget value i (T false) L R ψ X lo hi V hlo hhi + (hV false) φ G B D hB hD hφ hlip + have h1 := bulkSmoothFactors_budget value i (T true) L R ψ X lo hi V hlo hhi + (hV true) φ G B D hB hD hφ hlip + exact mul_le_mul h0 h1 (smoothPolynomialBudget_nonneg _) ((smoothPolynomialBudget_nonneg _).trans h0) + have he (z : ℝ) : w z * smoothPolynomialWeight (pairedPolynomialFactors (F false) (F true)) z = + realValueKernelPair (Function.update value i z) childBound pivotBound T + ψ X lo hi hlo hhi φ G (L.eval z) (R.eval z) := by + rw [pairedPolynomialFactors_weight] + simp only [F, bulkSmoothFactors_value value i (T false) (hT false) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout z, + bulkSmoothFactors_value value i (T true) (hT true) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout z] + simp only [w, realValueKernelPair, realValueKernel, map_mul] + ring + have h := P.gated_smooth_prime_all_roots hQ hq hqQ ha u v hu huv hshort + (pairedPolynomialFactors (F false) (F true)) V' hroots w 1 (by norm_num) hw hconst + simp only [he, one_mul] at h + apply h.trans + change (V'.card + 1 : ℕ) * smoothPolynomialBudget (pairedPolynomialFactors (F false) (F true)) * + bulkPrimeErrorFactor P Q u ≤ ((2 * (A + B') + 1 : ℕ) : ℝ) * W ^ 2 * bulkPrimeErrorFactor P Q u + apply mul_le_mul_of_nonneg_right _ (by + dsimp only [bulkPrimeErrorFactor] + have := P.errorConstant_nonneg + positivity) + exact mul_le_mul (by exact_mod_cast hcard) hbudget (smoothPolynomialBudget_nonneg _) (by positivity) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLeafPolynomials.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLeafPolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..e66c8ee092064f326fcc96f7939e7e69e46a5936 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLeafPolynomials.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSlotPolynomials +import OAI.NumberTheory.Ostmann.Arithmetic.MovingUnitSampleBound +import OAI.NumberTheory.Ostmann.Arithmetic.MovingLogLeaves + +namespace OAI + +/-! # Terminal moduli as polynomials in a bulk-prime coordinate -/ + +namespace Ostmann +open scoped Classical + +noncomputable def MovingSlotData.bulkLeafPolynomials {σ : Type*} (value : σ → ℝ) (i : σ) : + {n : ℕ} → MovingSlotData σ n → Polynomial ℝ → Polynomial ℝ → + TreeLeafIndex n → Polynomial ℝ + | _, .leaf _ regular, L, R, _ => L * R * bulkSlotProduct value i regular + | _, .node s CL CR u left right, L, R, j => + let p := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial value i L R + match j with + | .inl j => left.bulkLeafPolynomials value i p L j + | .inr j => right.bulkLeafPolynomials value i p R j + +theorem MovingSlotData.bulkLeafPolynomials_eval {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (L R : Polynomial ℝ) (p : ℝ) (j : TreeLeafIndex n) : + (T.bulkLeafPolynomials value i L R j).eval (p : ℝ) = + T.realValueLeafModuli (Function.update value i p) (L.eval (p : ℝ)) (R.eval (p : ℝ)) j := by + induction T generalizing L R with + | leaf => simp only [bulkLeafPolynomials, Polynomial.eval_mul, bulkSlotProduct_eval, + realValueLeafModuli] + | node s CL CR u left right ihL ihR => + have hp := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial_eval + value i hT.1 L R p + cases j with + | inl j => simp only [bulkLeafPolynomials, realValueLeafModuli, ihL hT.2.1, hp] + | inr j => simp only [bulkLeafPolynomials, realValueLeafModuli, ihR hT.2.2, hp] + +/-- Degree grows with the fixed tree depth and the actual list lengths; +the size of a prime and every coefficient are irrelevant. -/ +theorem MovingSlotData.bulkLeafPolynomials_degree {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (d D e : ℕ) + (hsize : T.SizeLE d) (hregular : T.RegularLengthLE D) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) (j : TreeLeafIndex n) : + (T.bulkLeafPolynomials value i L R j).natDegree ≤ 2 * (n * d + e) + D := by + induction T generalizing L R e with + | leaf s regular => + change (L * R * bulkSlotProduct value i regular).natDegree ≤ _ + apply Polynomial.natDegree_mul_le.trans + have hr := bulkSlotProduct_degree value i regular + have hLR := Polynomial.natDegree_mul_le (p := L) (q := R) + change regular.length ≤ D at hregular + omega + | @node n s CL CR u left right ihL ihR => + have hp := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial_degree + value i L R d e ⟨hsize.2.1, hsize.1, hsize.2.2.1⟩ hL hR + have hLe : L.natDegree ≤ d + e := hL.trans (Nat.le_add_left _ _) + have hRe : R.natDegree ≤ d + e := hR.trans (Nat.le_add_left _ _) + have hn : n * d + (d + e) = (n + 1) * d + e := by ring + cases j with + | inl j => + simpa only [bulkLeafPolynomials, hn] using + ihL _ _ (d + e) hsize.2.2.2.1 hregular.2.1 hp hLe j + | inr j => + simpa only [bulkLeafPolynomials, hn] using + ihR _ _ (d + e) hsize.2.2.2.2 hregular.2.2 hp hRe j + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogBudgetComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogBudgetComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..2cd7e4ada7c13e467c51a014af558cbe64436c1f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogBudgetComparison.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedKernelPairComparison + +namespace OAI + +/-! # Cost of retaining the original terminal logarithmic factors -/ + +namespace Ostmann +open scoped SchwartzMap + +/-- Two trees have at most twice their leaf count in logarithmic factors. +Their additional derivative-root cuts cost at most one more copy of the +existing root budget. Only a fixed, depth-dependent variation factor remains. -/ +theorem bulkLogWeightedKernelPairBudget_le + (ψ : 𝓢(ℝ, ℂ)) (V lo hi : ℝ) (n d r e t rlog : ℕ) (B D Dlog : ℝ) + (hDlog : 0 ≤ Dlog) (ht : t ≤ 2 * 2 ^ n) (hr : rlog ≤ r) : + bulkLogWeightedKernelPairBudget ψ V lo hi n d r e t rlog B D Dlog ≤ + (2 * (2 + Dlog * (Real.exp 2 - 1)) ^ t) * + bulkKernelPairComparisonBudget ψ V lo hi n d r e B D := by + let H := 2 * (n * d + e) + r + let A := (2 ^ n + (2 ^ n - 1)) * H + let B' := (3 * (2 ^ n - 1) + 2 * 2 ^ n) * H + have htr : t * rlog ≤ 2 * A := by + calc + _ ≤ (2 * 2 ^ n) * r := Nat.mul_le_mul ht hr + _ = 2 * (2 ^ n * r) := by ring + _ ≤ 2 * A := Nat.mul_le_mul_left 2 + (Nat.mul_le_mul (Nat.le_add_right _ _) (show r ≤ H by dsimp only [H]; omega)) + have hcount : 2 * (A + B') + t * rlog + 1 ≤ 2 * (2 * (A + B') + 1) := by omega + have hcountR : ((2 * (A + B') + t * rlog + 1 : ℕ) : ℝ) ≤ + 2 * ((2 * (A + B') + 1 : ℕ) : ℝ) := by exact_mod_cast hcount + have hexp : 0 ≤ Real.exp 2 - 1 := sub_nonneg.mpr (Real.one_le_exp (by norm_num)) + have hfactor : 0 ≤ (2 + Dlog * (Real.exp 2 - 1)) ^ t := + pow_nonneg (add_nonneg (by norm_num) (mul_nonneg hDlog hexp)) _ + have h := mul_le_mul_of_nonneg_right hcountR + (mul_nonneg (sq_nonneg + (movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1))) hfactor) + change ((2 * (A + B') + t * rlog + 1 : ℕ) : ℝ) * + ((movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) ^ 2 * + (2 + Dlog * (Real.exp 2 - 1)) ^ t) ≤ _ + exact h.trans_eq (by dsimp only [bulkKernelPairComparisonBudget, A, B', H]; ring) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogContinuity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f6593c17ddae497fb70399c1c6e511b8d2e1e53 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogContinuity.lean @@ -0,0 +1,178 @@ +import Mathlib.Topology.ContinuousMap.Bounded.Normed +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSmoothFactors + +namespace OAI + +/-! # The smooth tree as a continuous function of the bulk logarithms -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap ComplexConjugate BoundedContinuousFunction + +noncomputable def bulkLogValues {σ : Type*} (base : σ → ℝ) (S : Finset σ) + (x : σ → ℝ) (i : σ) : ℝ := if i ∈ S then Real.exp (x i) else base i + +theorem bulkLogValues_update {σ : Type*} (base : σ → ℝ) (S : Finset σ) + (x : σ → ℝ) (i : σ) (hi : i ∈ S) (t : ℝ) : + bulkLogValues base S (Function.update x i t) = + Function.update (bulkLogValues base S x) i (Real.exp t) := by + funext j + by_cases hj : j = i + · subst j + simp only [bulkLogValues, hi, ite_true, Function.update_self] + · simp only [bulkLogValues, Function.update_of_ne hj] + +theorem bulkLogValues_nat {σ : Type*} (base sample : σ → ℕ) (S : Finset σ) + (hp : ∀ i ∈ S, 0 < sample i) : + bulkLogValues (fun i => (base i : ℝ)) S (fun i => Real.log (sample i)) = + (fun i => ((if i ∈ S then sample i else base i : ℕ) : ℝ)) := by + funext i + by_cases hi : i ∈ S + · simp only [bulkLogValues, hi, ite_true] + exact Real.exp_log (by exact_mod_cast hp i hi) + · simp only [bulkLogValues, hi, ite_false] + +/-- At every original prime tuple this real extension is exactly the original +moving-tree weight, including points where one of the node cutoffs vanishes. -/ +theorem realValueSmoothWeight_bulkLog_nat {σ : Type*} + (base sample : σ → ℕ) (S : Finset σ) (hp : ∀ i ∈ S, 0 < sample i) + {n : ℕ} (T : MovingSlotData σ n) (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) (G : ℕ → ℝ) (L R : ℝ) : + realValueSmoothWeight (bulkLogValues (fun i => (base i : ℝ)) S + (fun i => Real.log (sample i))) T ψ X lo hi hlo hhi φ G L R = + movingRealSmoothWeight (fun i => if i ∈ S then sample i else base i) + T ψ X lo hi hlo hhi φ G L R := by + rw [bulkLogValues_nat base sample S hp, realValueSmoothWeight_nat] + +theorem continuous_bulkLogValues {σ : Type*} (base : σ → ℝ) (S : Finset σ) (i : σ) : + Continuous (fun x => bulkLogValues base S x i) := by + unfold bulkLogValues + split_ifs + · exact Real.continuous_exp.comp (continuous_apply i) + · exact continuous_const + +theorem continuous_realSlotProduct {σ A : Type*} [TopologicalSpace A] + (value : A → σ → ℝ) (hv : ∀ i, Continuous (fun x => value x i)) (l : List σ) : + Continuous (fun x => realSlotProduct (value x) l) := by + induction l with + | nil => exact continuous_const + | cons i l ih => exact (hv i).mul ih + +theorem realSlotProduct_bulkLogValues {σ : Type*} (base : σ → ℝ) (S : Finset σ) + (l : List σ) (hl : ∀ i ∈ l, i ∉ S) (x : σ → ℝ) : + realSlotProduct (bulkLogValues base S x) l = realSlotProduct base l := by + unfold realSlotProduct + congr 1 + apply List.map_congr_left + intro i hi + exact ite_eq_right (hl i hi) + +theorem MovingSlotReversal.continuous_bulkLogPivot {σ : Type*} + (base : σ → ℝ) (S : Finset σ) (s : MovingSlotReversal σ) + (hs : ∀ i ∈ S, i ∉ s.compensationSlots) + (L R : (σ → ℝ) → ℝ) (hL : Continuous L) (hR : Continuous R) : + Continuous (fun x => s.realValuePivot (bulkLogValues base S x) (L x) (R x)) := by + have hc (x : σ → ℝ) : realSlotProduct (bulkLogValues base S x) s.compensationSlots = + realSlotProduct base s.compensationSlots := + realSlotProduct_bulkLogValues base S _ (fun i hi hS => hs i hS hi) x + simp_rw [realValuePivot, hc] + exact (((continuous_const.mul + (continuous_realSlotProduct _ (continuous_bulkLogValues base S) s.rightSlots)).mul hR).sub + ((continuous_const.mul + (continuous_realSlotProduct _ (continuous_bulkLogValues base S) s.leftSlots)).mul hL)).div_const _ + +theorem MovingSlotData.continuous_bulkLogLeafModuli {σ : Type*} + (base : σ → ℝ) (S : Finset σ) {n : ℕ} (T : MovingSlotData σ n) + (hT : ∀ i ∈ S, T.CompensationAbsent i) + (L R : (σ → ℝ) → ℝ) (hL : Continuous L) (hR : Continuous R) (j : TreeLeafIndex n) : + Continuous (fun x => T.realValueLeafModuli (bulkLogValues base S x) (L x) (R x) j) := by + induction T generalizing L R with + | leaf s regular => + exact (hL.mul hR).mul (continuous_realSlotProduct _ (continuous_bulkLogValues base S) regular) + | node s CL CR u left right ihL ihR => + have hp := (MovingSlotData.step s CL CR u left right false).continuous_bulkLogPivot + base S (fun i hi => (hT i hi).1) L R hL hR + cases j with + | inl j => exact ihL (fun i hi => (hT i hi).2.1) _ L hp hL j + | inr j => exact ihR (fun i hi => (hT i hi).2.2) _ R hp hR j + +theorem continuous_bulkLogFourierWeight {σ : Type*} (base : σ → ℝ) (S : Finset σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : ∀ i ∈ S, T.CompensationAbsent i) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (L R : (σ → ℝ) → ℝ) (hL : Continuous L) (hR : Continuous R) : + Continuous (fun x => realValueFourierWeight (bulkLogValues base S x) T ψ X lo hi hlo hhi + (L x) (R x)) := by + apply continuous_finsetProd + intro j _ + have hc := (fourierPolynomialFactor Polynomial.X ψ (T.leafFrequencies j) lo hi hlo hhi).continuous_value.comp + ((T.continuous_bulkLogLeafModuli base S hT L R hL hR j).div_const X) + dsimp only + split_ifs + · exact Complex.continuous_conj.comp hc + · exact hc + +theorem continuous_bulkLogNodeCutoff {σ : Type*} (base : σ → ℝ) (S : Finset σ) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + {n : ℕ} (T : MovingSlotData σ n) (hT : ∀ i ∈ S, T.CompensationAbsent i) + (L R : (σ → ℝ) → ℝ) (hL : Continuous L) (hR : Continuous R) : + Continuous (fun x => realValueNodeCutoff (bulkLogValues base S x) φ G T (L x) (R x)) := by + have hp (g : ℝ) : Continuous (fun x => (positiveLogCutoff φ g x : ℂ)) := by + have he (x : ℝ) := logCutoffPolynomialFactor_value Polynomial.X φ g B D hB hD hφ hlip hout x + simp only [Polynomial.eval_X] at he + exact ((logCutoffPolynomialFactor Polynomial.X φ g B D hB hD hφ hlip).continuous_value).congr he + induction T generalizing L R with + | leaf => exact continuous_const + | @node n s CL CR u left right ihL ihR => + have hc := (MovingSlotData.step s CL CR u left right false).continuous_bulkLogPivot + base S (fun i hi => (hT i hi).1) L R hL hR + exact (((hp (G (n + 1))).comp hc).mul + (ihL (fun i hi => (hT i hi).2.1) _ L hc hL)).mul + (ihR (fun i hi => (hT i hi).2.2) _ R hc hR) + +theorem continuous_bulkLogSmoothWeight {σ : Type*} (base : σ → ℝ) (S : Finset σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : ∀ i ∈ S, T.CompensationAbsent i) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (L R : (σ → ℝ) → ℝ) (hL : Continuous L) (hR : Continuous R) : + Continuous (fun x => realValueSmoothWeight (bulkLogValues base S x) T ψ X lo hi hlo hhi + φ G (L x) (R x)) := + (continuous_bulkLogFourierWeight base S T hT ψ X lo hi hlo hhi L R hL hR).mul + (continuous_bulkLogNodeCutoff base S φ G B D hB hD hφ hlip hout T hT L R hL hR) + +/-- The bound is uniform in all real bulk variables and both giant arguments. -/ +theorem realValueSmoothWeight_norm {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : T.Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) (L R : ℝ) : + ‖realValueSmoothWeight value T ψ X lo hi hlo hhi φ G L R‖ ≤ + movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1) := by + have he := bulkSmoothFactors_value value i T hT (Polynomial.C L) (Polynomial.C R) + ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout (value i) + simp only [Function.update_eq_self, Polynomial.eval_C] at he + rw [← he] + exact (smoothPolynomialWeight_norm _ _).trans + (bulkSmoothFactors_budget value i T _ _ ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip) + +noncomputable def bulkLogSmoothFunction {σ : Type*} (base : σ → ℝ) (S : Finset σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : ∀ i ∈ S, T.CompensationAbsent i) + (i : σ) (hiS : i ∈ S) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (hV : T.Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) (L R : ℝ) : (σ → ℝ) →ᵇ ℂ := + BoundedContinuousFunction.ofNormedAddCommGroup _ + (continuous_bulkLogSmoothWeight base S T hT ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout + (fun _ => L) (fun _ => R) continuous_const continuous_const) + (movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) + (fun x => realValueSmoothWeight_norm (bulkLogValues base S x) i T (hT i hiS) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogJointComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogJointComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..593990673cc3d6775676cd86c2c96f3702ed220d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogJointComparison.lean @@ -0,0 +1,71 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogSliceComparison + +namespace OAI + +/-! # Joint replacement of the original bulk-prime samples + +Every slice error is derived from the published progression estimate. The +commuting coordinate averages give the full product comparison with the +retained Page measures; no independence of a conditionally sampled weight is +assumed. +-/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap BoundedContinuousFunction + +/-- Product comparison for the actual smooth tree, on arbitrary distinct bulk +coordinates and arbitrary residue cells. -/ +theorem PublishedProgressionInput.bulk_log_joint_comparison + (P : PublishedProgressionInput) {σ : Type*} [Fintype σ] + (base : σ → ℝ) (order : List σ) (horder : order.Nodup) + {n : ℕ} (T : MovingSlotData σ n) (hT : ∀ i ∈ order, T.CompensationAbsent i) + (i₀ : σ) (hi₀ : i₀ ∈ order) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (hV : T.Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : T.SizeLE d) (hregular : T.RegularLengthLE r) (L R : ℝ) + (Q : ℕ) (hQ : 2 ≤ Q) (q a : σ → ℕ) (u v : σ → ℝ) + (hu : ∀ i, 1 ≤ u i) (hq : ∀ i ∈ order, 1 ≤ q i) + (hqQ : ∀ i ∈ order, q i ≤ Q) (ha : ∀ i ∈ order, (a i).Coprime (q i)) + (huv : ∀ i ∈ order, u i ≤ v i) (hshort : ∀ i ∈ order, v i ≤ u i + 1) + (hmass : ∀ i ∈ order, ∑ p ∈ primeLogCellSet (q i) (a i) (u i) (v i), (p : ℝ)⁻¹ ≤ 2) : + let f := bulkLogSmoothFunction base order.toFinset T + (fun i hi => hT i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + letI : ∀ i, IsFiniteMeasure (ν i) := fun i => + finite_primeGiantMeasure P Q (q i) (a i) (u i) (v i) (lt_of_lt_of_le zero_lt_one (hu i)) + ‖coordinateAverages μ order f - coordinateAverages ν order f‖ ≤ + 2 ^ order.length * (order.map (fun i => + bulkSmoothComparisonBudget ψ V lo hi n d r B D * bulkPrimeErrorFactor P Q (u i))).sum := by + let f := bulkLogSmoothFunction base order.toFinset T + (fun i hi => hT i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + let _ : ∀ i, IsFiniteMeasure (ν i) := fun i => + finite_primeGiantMeasure P Q (q i) (a i) (u i) (v i) (lt_of_lt_of_le zero_lt_one (hu i)) + have hslices (i : σ) (hiMem : i ∈ order) : + ‖coordinateAverage (μ i) i f - coordinateAverage (ν i) i f‖ ≤ + bulkSmoothComparisonBudget ψ V lo hi n d r B D * bulkPrimeErrorFactor P Q (u i) := by + exact P.bulk_log_slice_comparison base order.toFinset T i (List.mem_toFinset.mpr hiMem) + (hT i hiMem) ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r hsize hregular L R f + (fun _ => rfl) hQ (hq i hiMem) (hqQ i hiMem) (ha i hiMem) (u i) (v i) (hu i) (huv i hiMem) (hshort i hiMem) + apply coordinateAverages_comparison μ ν order horder + · intro i hi + change (primeLogCellMeasure (q i) (a i) (u i) (v i)).real Set.univ ≤ 2 + rw [primeLogCellMeasure_mass] + exact hmass i hi + · intro i hi + exact primeGiantMeasure_mass_le_two P Q (q i) (a i) (hq i hi) (u i) (v i) + (hu i) (huv i hi) (hshort i hi) + · intro i hi + exact (norm_nonneg _).trans (hslices i hi) + · exact hslices + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogPairComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogPairComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..b255c4dacb290bf296505f22b840ec4bce3193f3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogPairComparison.lean @@ -0,0 +1,135 @@ +import Mathlib.Topology.ContinuousMap.Bounded.Star +import OAI.NumberTheory.Ostmann.Arithmetic.BulkPairPrimeComparison +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogJointComparison + +namespace OAI + +/-! # Simultaneous prime replacement for the actual conjugate history pair -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap ComplexConjugate BoundedContinuousFunction + +noncomputable def bulkLogSmoothPairFunction {σ : Type*} (base : σ → ℝ) (S : Finset σ) + {n : ℕ} (T : Bool → MovingSlotData σ n) + (hT : ∀ b i, i ∈ S → (T b).CompensationAbsent i) (i : σ) (hiS : i ∈ S) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) (L R : ℝ) : (σ → ℝ) →ᵇ ℂ := + bulkLogSmoothFunction base S (T false) (hT false) i hiS ψ X lo hi V hlo hhi (hV false) + φ G B D hB hD hφ hlip hout L R * + star (bulkLogSmoothFunction base S (T true) (hT true) i hiS ψ X lo hi V hlo hhi (hV true) + φ G B D hB hD hφ hlip hout L R) + +theorem PublishedProgressionInput.bulk_log_pair_slice_comparison + (P : PublishedProgressionInput) {σ : Type*} [Fintype σ] + (base : σ → ℝ) (S : Finset σ) {n : ℕ} (T : Bool → MovingSlotData σ n) + (i : σ) (hiS : i ∈ S) (hT : ∀ b, (T b).CompensationAbsent i) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) + (L R : ℝ) (f : (σ → ℝ) →ᵇ ℂ) + (hf : ∀ x, f x = realValueSmoothPair (bulkLogValues base S x) T ψ X lo hi hlo hhi φ G L R) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) : + letI := finite_primeGiantMeasure P Q q a u v (lt_of_lt_of_le zero_lt_one hu) + ‖coordinateAverage (primeLogCellMeasure q a u v) i f - + coordinateAverage (primeGiantMeasure P Q q a u v) i f‖ ≤ + bulkPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q u := by + let _ := finite_primeGiantMeasure P Q q a u v (lt_of_lt_of_le zero_lt_one hu) + have hpoint (x : σ → ℝ) : + ‖coordinateAverage (primeLogCellMeasure q a u v) i f x - + coordinateAverage (primeGiantMeasure P Q q a u v) i f x‖ ≤ + bulkPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q u := by + let value := bulkLogValues base S x + let H := fun y => realValueSmoothPair (Function.update value i (Real.exp y)) T + ψ X lo hi hlo hhi φ G L R + have hprime : coordinateAverage (primeLogCellMeasure q a u v) i f x = + complexPrimeInterval q a u v H := by + rw [coordinateAverage_apply] + change (∫ t, coordinateSlice f i x t ∂primeLogCellMeasure q a u v) = _ + rw [primeLogCellMeasure_integral] + unfold primeLogCellSet complexPrimeInterval + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : p.Prime ∧ Nat.ModEq q p a + · rw [ite_eq_left hp, ite_eq_left hp] + change f (Function.update x i (Real.log p)) * _ = H (Real.log p) * _ + rw [hf, bulkLogValues_update base S x i hiS] + · rw [ite_eq_right hp, ite_eq_right hp] + have hpage : coordinateAverage (primeGiantMeasure P Q q a u v) i f x = + ∫ y in Set.Ioc u v, H y * (selectedPrimeLogDensity P Q q a y : ℂ) := by + rw [coordinateAverage_apply, primeGiantMeasure_integral P Q q a u v (by linarith)] + apply setIntegral_congr_fun measurableSet_Ioc + intro y _ + dsimp only + rw [hf, bulkLogValues_update base S x i hiS] + rw [hprime, hpage] + have h := P.bulk_pair_prime_comparison value i T hT (Polynomial.C L) (Polynomial.C R) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r 0 hsize hregular + (by simp) (by simp) hQ hq hqQ ha u v hu huv hshort + simpa only [Polynomial.eval_C] using h + exact (BoundedContinuousFunction.norm_le ((norm_nonneg _).trans (hpoint (fun _ => 0)))).mpr hpoint + +/-- The original conjugate pair is compared jointly, retaining every Page +correction. The only mass side condition is a finite reciprocal-prime sum. -/ +theorem PublishedProgressionInput.bulk_log_pair_joint_comparison + (P : PublishedProgressionInput) {σ : Type*} [Fintype σ] + (base : σ → ℝ) (order : List σ) (horder : order.Nodup) + {n : ℕ} (T : Bool → MovingSlotData σ n) (hT : ∀ b i, i ∈ order → (T b).CompensationAbsent i) + (i₀ : σ) (hi₀ : i₀ ∈ order) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) (L R : ℝ) + (Q : ℕ) (hQ : 2 ≤ Q) (q a : σ → ℕ) (u v : σ → ℝ) + (hu : ∀ i, 1 ≤ u i) (hq : ∀ i ∈ order, 1 ≤ q i) + (hqQ : ∀ i ∈ order, q i ≤ Q) (ha : ∀ i ∈ order, (a i).Coprime (q i)) + (huv : ∀ i ∈ order, u i ≤ v i) (hshort : ∀ i ∈ order, v i ≤ u i + 1) + (hmass : ∀ i ∈ order, ∑ p ∈ primeLogCellSet (q i) (a i) (u i) (v i), (p : ℝ)⁻¹ ≤ 2) : + let f := bulkLogSmoothPairFunction base order.toFinset T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + letI : ∀ i, IsFiniteMeasure (ν i) := fun i => + finite_primeGiantMeasure P Q (q i) (a i) (u i) (v i) (lt_of_lt_of_le zero_lt_one (hu i)) + ‖coordinateAverages μ order f - coordinateAverages ν order f‖ ≤ + 2 ^ order.length * (order.map (fun i => + bulkPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i))).sum := by + let f := bulkLogSmoothPairFunction base order.toFinset T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let μ := fun i => primeLogCellMeasure (q i) (a i) (u i) (v i) + let ν := fun i => primeGiantMeasure P Q (q i) (a i) (u i) (v i) + let _ : ∀ i, IsFiniteMeasure (ν i) := fun i => + finite_primeGiantMeasure P Q (q i) (a i) (u i) (v i) (lt_of_lt_of_le zero_lt_one (hu i)) + have hslices (i : σ) (hiMem : i ∈ order) : + ‖coordinateAverage (μ i) i f - coordinateAverage (ν i) i f‖ ≤ + bulkPairComparisonBudget ψ V lo hi n d r 0 B D * bulkPrimeErrorFactor P Q (u i) := by + exact P.bulk_log_pair_slice_comparison base order.toFinset T i (List.mem_toFinset.mpr hiMem) + (fun b => hT b i hiMem) ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r hsize hregular L R f + (fun _ => rfl) hQ (hq i hiMem) (hqQ i hiMem) (ha i hiMem) (u i) (v i) (hu i) + (huv i hiMem) (hshort i hiMem) + apply coordinateAverages_comparison μ ν order horder + · intro i hiMem + change (primeLogCellMeasure (q i) (a i) (u i) (v i)).real Set.univ ≤ 2 + rw [primeLogCellMeasure_mass] + exact hmass i hiMem + · intro i hiMem + exact primeGiantMeasure_mass_le_two P Q (q i) (a i) (hq i hiMem) (u i) (v i) + (hu i) (huv i hiMem) (hshort i hiMem) + · intro i hiMem + exact (norm_nonneg _).trans (hslices i hiMem) + · exact hslices + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogSliceComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogSliceComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..6fe8f7c86e49a0c0ba3d6fadcdfd746d2b851a47 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogSliceComparison.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogContinuity +import OAI.NumberTheory.Ostmann.Arithmetic.RealBulkPrimeComparison +import OAI.NumberTheory.Ostmann.Construction.PrimeLogCellMeasure + +namespace OAI + +/-! # Actual prime and Page averages of a bulk coordinate -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap BoundedContinuousFunction + +noncomputable def bulkSmoothComparisonBudget (ψ : 𝓢(ℝ, ℂ)) (V lo hi : ℝ) + (n d r : ℕ) (B D : ℝ) : ℝ := + (((2 ^ n + (2 ^ n - 1)) * (2 * (n * d) + r) + 1 : ℕ) : ℝ) * + (movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) + +noncomputable def bulkPrimeErrorFactor (P : PublishedProgressionInput) (Q : ℕ) (u : ℝ) : ℝ := + 18 * P.errorConstant * Real.exp (-P.decay * Real.sqrt u) + + Real.exp (-P.kappa * u / Real.log (4 * (Q : ℝ))) + 2 * Real.exp (-u) + +/-- An actual one-coordinate comparison, uniformly in the remaining real bulk +logarithms. The finite prime measure includes both boundary conventions exactly. -/ +theorem PublishedProgressionInput.bulk_log_slice_comparison + (P : PublishedProgressionInput) {σ : Type*} [Fintype σ] + (base : σ → ℝ) (S : Finset σ) {n : ℕ} (T : MovingSlotData σ n) + (i : σ) (hiS : i ∈ S) (hT : T.CompensationAbsent i) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : T.Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : T.SizeLE d) (hregular : T.RegularLengthLE r) + (L R : ℝ) (f : (σ → ℝ) →ᵇ ℂ) + (hf : ∀ x, f x = realValueSmoothWeight (bulkLogValues base S x) T ψ X lo hi hlo hhi φ G L R) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) : + let _ := finite_primeGiantMeasure P Q q a u v (by linarith : 0 < u) + ‖coordinateAverage (primeLogCellMeasure q a u v) i f - + coordinateAverage (primeGiantMeasure P Q q a u v) i f‖ ≤ + bulkSmoothComparisonBudget ψ V lo hi n d r B D * bulkPrimeErrorFactor P Q u := by + let _ := finite_primeGiantMeasure P Q q a u v (by linarith : 0 < u) + have hpoint (x : σ → ℝ) : + ‖coordinateAverage (primeLogCellMeasure q a u v) i f x - + coordinateAverage (primeGiantMeasure P Q q a u v) i f x‖ ≤ + bulkSmoothComparisonBudget ψ V lo hi n d r B D * bulkPrimeErrorFactor P Q u := by + let value := bulkLogValues base S x + have hprime : coordinateAverage (primeLogCellMeasure q a u v) i f x = + realBulkPrimeSmoothSum value i T (Polynomial.C L) (Polynomial.C R) + ψ X lo hi hlo hhi φ G q a u v := by + rw [coordinateAverage_apply] + change (∫ t, coordinateSlice f i x t ∂primeLogCellMeasure q a u v) = _ + rw [primeLogCellMeasure_integral] + unfold realBulkPrimeSmoothSum + apply Finset.sum_congr rfl + intro p hp + have hp0 : (0 : ℝ) < p := by + have hpprime : p.Prime := (Finset.mem_filter.mp hp).2.1 + exact_mod_cast hpprime.pos + change f (Function.update x i (Real.log p)) * _ = _ + rw [hf, bulkLogValues_update base S x i hiS, Real.exp_log hp0] + simp only [Polynomial.eval_C, value] + have hpage : coordinateAverage (primeGiantMeasure P Q q a u v) i f x = + ∫ y in Set.Ioc u v, + smoothPolynomialWeight (bulkSmoothFactors value i T (Polynomial.C L) (Polynomial.C R) + ψ X lo hi hlo hhi φ G B D hB hD hφ hlip) (Real.exp y) * + (selectedPrimeLogDensity P Q q a y : ℂ) := by + rw [coordinateAverage_apply, primeGiantMeasure_integral P Q q a u v (by linarith)] + apply setIntegral_congr_fun measurableSet_Ioc + intro y _ + dsimp only + rw [hf, bulkLogValues_update base S x i hiS, + bulkSmoothFactors_value value i T hT _ _ ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout] + simp only [Polynomial.eval_C, value] + rw [hprime, hpage] + have h := P.real_bulk_prime_comparison value i T hT (Polynomial.C L) (Polynomial.C R) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r 0 hsize hregular + (by simp) (by simp) hQ hq hqQ ha u v hu huv hshort + simpa only [bulkSmoothComparisonBudget, bulkPrimeErrorFactor, + MovingSlotData.bulkNodePolynomials_length, add_zero] using h + have hnonneg := (norm_nonneg _).trans (hpoint (fun _ => 0)) + exact (BoundedContinuousFunction.norm_le hnonneg).mpr hpoint + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedCellComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedCellComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..26e29196153b26a00d8db95e30a60a64eb0d30a2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedCellComparison.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedSlice +import OAI.NumberTheory.Ostmann.Arithmetic.BulkKernelCellComparison + +namespace OAI + +/-! # Joint Page replacement with the actual bulk logarithmic weights -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap + +/-- The original signed conjugate pair and all terminal bulk log cutoffs are +compared jointly. Every Page correction and sharp support gate is retained. -/ +theorem PublishedProgressionInput.bulk_log_weighted_cells_joint_comparison + (P : PublishedProgressionInput) {σ C : Type*} [Fintype σ] [Fintype C] + (base : σ → ℝ) (childBound pivotBound : ℕ → ℕ) (order : List σ) (horder : order.Nodup) + {n : ℕ} (T : Bool → MovingSlotData σ n) (hT : ∀ b i, i ∈ order → (T b).CompensationAbsent i) + (i₀ : σ) (hi₀ : i₀ ∈ order) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) (L R : ℝ) + (Q : ℕ) (hQ : 2 ≤ Q) (q a : σ → C → ℕ) (u v : σ → C → ℝ) (Z : σ → ℝ) (hZ : ∀ i, 0 ≤ Z i) + (hu : ∀ i c, 1 ≤ u i c) (hq : ∀ i ∈ order, ∀ c, 1 ≤ q i c) + (hqQ : ∀ i ∈ order, ∀ c, q i c ≤ Q) (ha : ∀ i ∈ order, ∀ c, (a i c).Coprime (q i c)) + (huv : ∀ i ∈ order, ∀ c, u i c ≤ v i c) (hshort : ∀ i ∈ order, ∀ c, v i c ≤ u i c + 1) + (hmass : ∀ i ∈ order, + (bulkCellMixture (Z i) (fun c => primeLogCellMeasure (q i c) (a i c) (u i c) (v i c))).real Set.univ ≤ 1) + (herror : ∀ i ∈ order, Z i * ∑ c, bulkPrimeErrorFactor P Q (u i c) ≤ 1) + {t : ℕ} (slots : Fin t → List σ) (cb Dlog : ℝ) (hDlog : 0 ≤ Dlog) + (hloglip : ∀ x y, |logCellProfile x - logCellProfile y| ≤ Dlog * |x - y|) + (rlog : ℕ) (hslots : ∀ j, (slots j).length ≤ rlog) : + let f := (bulkLogKernelPairIntegrand base order.toFinset childBound pivotBound T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R).withLogCutoffs + base order.toFinset cb slots + let μ := fun i c => primeLogCellMeasure (q i c) (a i c) (u i c) (v i c) + let ν := fun i c => primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) + letI : ∀ i c, IsFiniteMeasure (ν i c) := fun i c => + finite_primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) (lt_of_lt_of_le zero_lt_one (hu i c)) + ∀ x, ‖f.averages (fun i => bulkCellMixture (Z i) (μ i)) order x - + f.averages (fun i => bulkCellMixture (Z i) (ν i)) order x‖ ≤ + 2 ^ order.length * (order.map (fun i => + Z i * ∑ c, bulkLogWeightedKernelPairBudget ψ V lo hi n d r 0 t rlog B D Dlog * bulkPrimeErrorFactor P Q (u i c))).sum := by + let f₀ := bulkLogKernelPairIntegrand base order.toFinset childBound pivotBound T + (fun b i hi => hT b i (List.mem_toFinset.mp hi)) i₀ (List.mem_toFinset.mpr hi₀) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout L R + let f := f₀.withLogCutoffs base order.toFinset cb slots + let μ := fun i c => primeLogCellMeasure (q i c) (a i c) (u i c) (v i c) + let ν := fun i c => primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) + let _ : ∀ i c, IsFiniteMeasure (ν i c) := fun i c => + finite_primeGiantMeasure P Q (q i c) (a i c) (u i c) (v i c) (lt_of_lt_of_le zero_lt_one (hu i c)) + have hslices (i : σ) (hiMem : i ∈ order) (c : C) (x : σ → ℝ) : + ‖f.average (μ i c) i x - f.average (ν i c) i x‖ ≤ + bulkLogWeightedKernelPairBudget ψ V lo hi n d r 0 t rlog B D Dlog * bulkPrimeErrorFactor P Q (u i c) := by + exact P.bulk_log_weighted_kernel_slice_comparison base order.toFinset childBound pivotBound T i (List.mem_toFinset.mpr hiMem) + (fun b => hT b i hiMem) ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r hsize hregular L R f₀ + (fun _ => rfl) slots cb Dlog hDlog hloglip rlog hslots hQ (hq i hiMem c) (hqQ i hiMem c) (ha i hiMem c) (u i c) (v i c) (hu i c) + (huv i hiMem c) (hshort i hiMem c) x + have hν : ∀ i ∈ order, (bulkCellMixture (Z i) (ν i)).real Set.univ ≤ 2 := by + intro i hiMem + exact P.bulk_cell_page_mass_le_two Q hQ (q i) (a i) (u i) (v i) + (hq i hiMem) (hqQ i hiMem) (ha i hiMem) (hu i) (huv i hiMem) (hshort i hiMem) + (Z i) (hZ i) (hmass i hiMem) (herror i hiMem) + exact f.cellMixtures_joint_comparison Z hZ μ ν order horder + (fun i hiMem => (hmass i hiMem).trans (by norm_num)) hν _ + (fun i hiMem c => (norm_nonneg _).trans (hslices i hiMem c base)) hslices + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedIntegrand.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedIntegrand.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb6ce1ffa350d96f0946daeb6f40bab2c3c2bae9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedIntegrand.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedKernelPairComparison +import OAI.NumberTheory.Ostmann.Arithmetic.RealBulkKernelPair + +namespace OAI + +/-! # Bounded measurable bulk integrands retaining the initial cutoffs -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +theorem continuous_bulkLogCutoffWeight {σ A : Type*} [TopologicalSpace A] + (value : A → σ → ℝ) (hvalue : ∀ i, Continuous (fun x => value x i)) + (cb : ℝ) (slots : List σ) : + Continuous (fun x => (bulkLogCutoffWeight (value x) cb slots : ℂ)) := by + obtain ⟨D, hD, hlip⟩ := logCellProfile_lipschitz + let f := logCutoffPolynomialFactor Polynomial.X logCellProfile cb 1 D zero_le_one hD + (fun x => by rw [abs_of_nonneg (logCellProfile_nonneg x)]; exact logCellProfile_le_one x) hlip + have hf : Continuous (fun z => (positiveLogCutoff logCellProfile cb z : ℂ)) := by + apply f.continuous_value.congr + intro z + simpa only [f, Polynomial.eval_X] using + logCutoffPolynomialFactor_value Polynomial.X logCellProfile cb 1 D zero_le_one hD + (fun x => by rw [abs_of_nonneg (logCellProfile_nonneg x)]; exact logCellProfile_le_one x) + hlip logCellProfile_zero_outside z + exact hf.comp (continuous_realSlotProduct value hvalue slots) + +noncomputable def BulkIntegrand.withLogCutoffs {σ : Type*} [Fintype σ] {t : ℕ} + (f : BulkIntegrand σ) (base : σ → ℝ) (S : Finset σ) (cb : ℝ) + (slots : Fin t → List σ) : BulkIntegrand σ where + toFun x := ((∏ j, bulkLogCutoffWeight (bulkLogValues base S x) cb (slots j) : ℝ) : ℂ) * f x + measurable := by + have hcont : Continuous (fun x => + ∏ j, (bulkLogCutoffWeight (bulkLogValues base S x) cb (slots j) : ℂ)) := + continuous_finsetProd _ (fun j _ => continuous_bulkLogCutoffWeight + (bulkLogValues base S) (continuous_bulkLogValues base S) cb (slots j)) + convert hcont.measurable.mul f.measurable using 1 + ext x + exact congrArg (fun z : ℂ => z * f x) (Complex.ofReal_prod _ _) + bounded := by + obtain ⟨C, hC, hf⟩ := f.bounded + refine ⟨C, hC, fun x => ?_⟩ + have hnonneg : 0 ≤ ∏ j, bulkLogCutoffWeight (bulkLogValues base S x) cb (slots j) := + Finset.prod_nonneg (fun j _ => (bulkLogCutoffWeight_bounds _ _ _).1) + have hle : (∏ j, bulkLogCutoffWeight (bulkLogValues base S x) cb (slots j)) ≤ 1 := + Finset.prod_le_one₀ (fun j _ => (bulkLogCutoffWeight_bounds _ _ _).1) + (fun j _ => (bulkLogCutoffWeight_bounds _ _ _).2) + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg hnonneg] + exact (mul_le_of_le_one_left (norm_nonneg _) hle).trans (hf x) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedKernelPairComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedKernelPairComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..19f0f170c1c062e0466a0496c2947bc0fb8a2737 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedKernelPairComparison.lean @@ -0,0 +1,142 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkKernelPairComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkLogFactors + +namespace OAI + +/-! # Joint prime comparison retaining the initial bulk logarithmic cutoffs -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap ComplexConjugate + +noncomputable def bulkLogWeightedKernelPairBudget (ψ : 𝓢(ℝ, ℂ)) (V lo hi : ℝ) + (n d r e t rlog : ℕ) (B D Dlog : ℝ) : ℝ := + ((2 * (((2 ^ n + (2 ^ n - 1)) * (2 * (n * d + e) + r)) + + ((3 * (2 ^ n - 1) + 2 * 2 ^ n) * (2 * (n * d + e) + r))) + t * rlog + 1 : ℕ) : ℝ) * + ((movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) ^ 2 * + (2 + Dlog * (Real.exp 2 - 1)) ^ t) + +/-- The signed pair keeps every initial bulk log-sum factor. Its additional +root and variation costs are explicit, and independent of the prime values. -/ +theorem PublishedProgressionInput.bulk_log_weighted_kernel_pair_prime_comparison (P : PublishedProgressionInput) + {σ : Type*} (value : σ → ℝ) (i : σ) (childBound pivotBound : ℕ → ℕ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (hT : ∀ b, (T b).CompensationAbsent i) + (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r e : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) + {t : ℕ} (slots : Fin t → List σ) (cb Dlog : ℝ) (hDlog : 0 ≤ Dlog) + (hloglip : ∀ x y, |logCellProfile x - logCellProfile y| ≤ Dlog * |x - y|) + (rlog : ℕ) (hslots : ∀ j, (slots j).length ≤ rlog) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) : + let H := fun y => ((∏ j, bulkLogCutoffWeight + (Function.update value i (Real.exp y)) cb (slots j) : ℝ) : ℂ) * realValueKernelPair (Function.update value i (Real.exp y)) childBound pivotBound T + ψ X lo hi hlo hhi φ G (L.eval (Real.exp y)) (R.eval (Real.exp y)) + ‖complexPrimeInterval q a u v H - + ∫ y in Set.Ioc u v, H y * (selectedPrimeLogDensity P Q q a y : ℂ)‖ ≤ + bulkLogWeightedKernelPairBudget ψ V lo hi n d r e t rlog B D Dlog * bulkPrimeErrorFactor P Q u := by + dsimp only + let F (b : Bool) := bulkSmoothFactors value i (T b) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip + let W := movingFourierVariationBudget ψ V lo hi n * + (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1) + let A := (2 ^ n + (2 ^ n - 1)) * (2 * (n * d + e) + r) + let B' := (3 * (2 ^ n - 1) + 2 * 2 ^ n) * (2 * (n * d + e) + r) + obtain ⟨S, hS, hrS⟩ := bulkSmoothFactors_root_cuts value i (T false) L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip d r e (hsize false) (hregular false) hL hR + obtain ⟨U, hU, hrU⟩ := bulkSmoothFactors_root_cuts value i (T true) L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip d r e (hsize true) (hregular true) hL hR + obtain ⟨S', hS', hcS⟩ := bulkFullSupport_root_cuts value i childBound pivotBound (T false) + (hT false) L R X lo hi d r e (hsize false) (hregular false) hL hR + obtain ⟨U', hU', hcU⟩ := bulkFullSupport_root_cuts value i childBound pivotBound (T true) + (hT true) L R X lo hi d r e (hsize true) (hregular true) hL hR + let E := bulkLogCutoffFactors value i cb Dlog hDlog hloglip slots + obtain ⟨Eroots, hEroots, hrE⟩ := bulkLogCutoffFactors_roots value i cb Dlog hDlog hloglip slots rlog hslots + let V' := ((S ∪ U) ∪ (S' ∪ U')) ∪ Eroots + have hcard : V'.card + 1 ≤ 2 * (A + B') + t * rlog + 1 := by + simp only [MovingSlotData.bulkNodePolynomials_length] at hS hU + have hsu := Finset.card_union_le S U + have hsu' := Finset.card_union_le S' U' + have hall := Finset.card_union_le (S ∪ U) (S' ∪ U') + have hextra := Finset.card_union_le ((S ∪ U) ∪ (S' ∪ U')) Eroots + dsimp only [A, B', V'] + omega + let w := fun z => realValueSupportFlag (Function.update value i z) childBound pivotBound + (T false) X lo hi (L.eval z) (R.eval z) * + conj (realValueSupportFlag (Function.update value i z) childBound pivotBound + (T true) X lo hi (L.eval z) (R.eval z)) + have hw (z : ℝ) : ‖w z‖ ≤ 1 := by + rw [show w z = _ * conj _ from rfl, norm_mul, Complex.norm_conj] + exact (mul_le_mul (realValueSupportFlag_norm _ _ _ _ _ _ _ _ _) + (realValueSupportFlag_norm _ _ _ _ _ _ _ _ _) (norm_nonneg _) (by norm_num)).trans_eq (by norm_num) + have hconst (x y : ℝ) (hxy : rootCellCode V' x = rootCellCode V' y) : w x = w y := by + have hsxy := rootCellCode_eq_of_subset S' V' + (Finset.subset_union_left.trans (Finset.subset_union_right.trans Finset.subset_union_left)) x y hxy + have huxy := rootCellCode_eq_of_subset U' V' + (Finset.subset_union_right.trans (Finset.subset_union_right.trans Finset.subset_union_left)) x y hxy + change _ * conj _ = _ * conj _ + rw [hcS x y hsxy, hcU x y huxy] + have hroots (j) (z) (hz : z ∈ ((Fin.append + (pairedPolynomialFactors (F false) (F true)) E) j).polynomial.derivative.roots) : z ∈ V' := by + revert hz + refine Fin.addCases ?_ ?_ j + · intro j hj + simp only [Fin.append_left] at hj + exact Finset.mem_union_left _ (Finset.mem_union_left _ + (pairedPolynomialFactors_roots (F false) (F true) S U hrS hrU j z hj)) + · intro j hj + simp only [Fin.append_right] at hj + exact Finset.mem_union_right _ (hrE j z hj) + have hbudget0 : smoothPolynomialBudget (pairedPolynomialFactors (F false) (F true)) ≤ W ^ 2 := by + rw [pairedPolynomialFactors_budget, pow_two] + have h0 := bulkSmoothFactors_budget value i (T false) L R ψ X lo hi V hlo hhi + (hV false) φ G B D hB hD hφ hlip + have h1 := bulkSmoothFactors_budget value i (T true) L R ψ X lo hi V hlo hhi + (hV true) φ G B D hB hD hφ hlip + exact mul_le_mul h0 h1 (smoothPolynomialBudget_nonneg _) ((smoothPolynomialBudget_nonneg _).trans h0) + have hbudget : smoothPolynomialBudget (Fin.append + (pairedPolynomialFactors (F false) (F true)) E) ≤ + W ^ 2 * (2 + Dlog * (Real.exp 2 - 1)) ^ t := by + have happ : smoothPolynomialBudget (Fin.append + (pairedPolynomialFactors (F false) (F true)) E) = + smoothPolynomialBudget (pairedPolynomialFactors (F false) (F true)) * + smoothPolynomialBudget E := by + unfold smoothPolynomialBudget + rw [Fin.prod_univ_add] + simp only [Fin.append_left, Fin.append_right] + have hE : smoothPolynomialBudget E = (2 + Dlog * (Real.exp 2 - 1)) ^ t := + bulkLogCutoffFactors_budget value i cb Dlog hDlog hloglip slots + rw [happ, ← hE] + exact mul_le_mul_of_nonneg_right hbudget0 (smoothPolynomialBudget_nonneg E) + have he (z : ℝ) : w z * smoothPolynomialWeight (Fin.append (pairedPolynomialFactors (F false) (F true)) E) z = + ((∏ j, bulkLogCutoffWeight (Function.update value i z) cb (slots j) : ℝ) : ℂ) * + realValueKernelPair (Function.update value i z) childBound pivotBound T + ψ X lo hi hlo hhi φ G (L.eval z) (R.eval z) := by + have happ : smoothPolynomialWeight (Fin.append (pairedPolynomialFactors (F false) (F true)) E) z = + smoothPolynomialWeight (pairedPolynomialFactors (F false) (F true)) z * smoothPolynomialWeight E z := by + simp only [smoothPolynomialWeight, Fin.prod_univ_add, Fin.append_left, Fin.append_right] + rw [happ, pairedPolynomialFactors_weight, + show smoothPolynomialWeight E z = _ from bulkLogCutoffFactors_weight value i cb Dlog hDlog hloglip slots z] + simp only [F, bulkSmoothFactors_value value i (T false) (hT false) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout z, + bulkSmoothFactors_value value i (T true) (hT true) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout z] + simp only [w, realValueKernelPair, realValueKernel, map_mul] + ring + have h := P.gated_smooth_prime_all_roots hQ hq hqQ ha u v hu huv hshort + (Fin.append (pairedPolynomialFactors (F false) (F true)) E) V' hroots w 1 (by norm_num) hw hconst + simp only [he, one_mul] at h + apply h.trans + change (V'.card + 1 : ℕ) * smoothPolynomialBudget (Fin.append (pairedPolynomialFactors (F false) (F true)) E) * + bulkPrimeErrorFactor P Q u ≤ ((2 * (A + B') + t * rlog + 1 : ℕ) : ℝ) * + (W ^ 2 * (2 + Dlog * (Real.exp 2 - 1)) ^ t) * bulkPrimeErrorFactor P Q u + apply mul_le_mul_of_nonneg_right _ (by + dsimp only [bulkPrimeErrorFactor] + have := P.errorConstant_nonneg + positivity) + exact mul_le_mul (by exact_mod_cast hcard) hbudget (smoothPolynomialBudget_nonneg _) (by positivity) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcd1259ca045feb5dcf33def75aeded1b92c4e61 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedNorm.lean @@ -0,0 +1,25 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedIntegrand + +namespace OAI + +/-! # Norm bounds after retaining the original bulk cutoffs -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem BulkIntegrand.withLogCutoffs_norm_le {σ : Type*} [Fintype σ] {t : ℕ} + (f : BulkIntegrand σ) (base : σ → ℝ) (S : Finset σ) (cb : ℝ) + (slots : Fin t → List σ) (x : σ → ℝ) : + ‖f.withLogCutoffs base S cb slots x‖ ≤ ‖f x‖ := by + have hn : 0 ≤ ∏ j, bulkLogCutoffWeight (bulkLogValues base S x) cb (slots j) := + Finset.prod_nonneg (fun j _ => (bulkLogCutoffWeight_bounds _ _ _).1) + have hle : (∏ j, bulkLogCutoffWeight (bulkLogValues base S x) cb (slots j)) ≤ 1 := + Finset.prod_le_one₀ (fun j _ => (bulkLogCutoffWeight_bounds _ _ _).1) + (fun j _ => (bulkLogCutoffWeight_bounds _ _ _).2) + change ‖((_ : ℝ) : ℂ) * f x‖ ≤ _ + rw [norm_mul, Complex.norm_real, Real.norm_of_nonneg hn] + exact mul_le_of_le_one_left (norm_nonneg _) hle + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedSlice.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedSlice.lean new file mode 100644 index 0000000000000000000000000000000000000000..7082ab3c80ec3098f08c744313c426d981be001d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkLogWeightedSlice.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedIntegrand + +namespace OAI + +/-! # One original bulk prime cell with all terminal logarithmic weights -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap + +/-- The full sharp paired kernel has the same derived one-coordinate Page +comparison, uniformly in every other real bulk coordinate. -/ +theorem PublishedProgressionInput.bulk_log_weighted_kernel_slice_comparison + (P : PublishedProgressionInput) {σ : Type*} [Fintype σ] + (base : σ → ℝ) (S : Finset σ) (childBound pivotBound : ℕ → ℕ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (i : σ) (hiS : i ∈ S) + (hT : ∀ b, (T b).CompensationAbsent i) + (ψ : 𝓢(ℝ, ℂ)) (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) + (L R : ℝ) (f : BulkIntegrand σ) + (hf : ∀ x, f x = realValueKernelPair (bulkLogValues base S x) childBound pivotBound T ψ X lo hi hlo hhi φ G L R) + {t : ℕ} (slots : Fin t → List σ) (cb Dlog : ℝ) (hDlog : 0 ≤ Dlog) + (hloglip : ∀ x y, |logCellProfile x - logCellProfile y| ≤ Dlog * |x - y|) + (rlog : ℕ) (hslots : ∀ j, (slots j).length ≤ rlog) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) (x : σ → ℝ) : + letI := finite_primeGiantMeasure P Q q a u v (lt_of_lt_of_le zero_lt_one hu) + ‖(f.withLogCutoffs base S cb slots).average (primeLogCellMeasure q a u v) i x - + (f.withLogCutoffs base S cb slots).average (primeGiantMeasure P Q q a u v) i x‖ ≤ + bulkLogWeightedKernelPairBudget ψ V lo hi n d r 0 t rlog B D Dlog * bulkPrimeErrorFactor P Q u := by + let _ := finite_primeGiantMeasure P Q q a u v (lt_of_lt_of_le zero_lt_one hu) + let f' := f.withLogCutoffs base S cb slots + let value := bulkLogValues base S x + let H := fun y => ((∏ j, bulkLogCutoffWeight + (Function.update value i (Real.exp y)) cb (slots j) : ℝ) : ℂ) * realValueKernelPair (Function.update value i (Real.exp y)) childBound pivotBound T + ψ X lo hi hlo hhi φ G L R + have hH (y : ℝ) : f' (Function.update x i y) = H y := by + change ((∏ j, bulkLogCutoffWeight (bulkLogValues base S (Function.update x i y)) cb (slots j) : ℝ) : ℂ) * + f (Function.update x i y) = H y + rw [hf, bulkLogValues_update base S x i hiS] + rw [f'.average_prime_eq_interval q a u v i x H hH, + f'.average_page P Q q a u v (lt_of_lt_of_le zero_lt_one hu) i x] + simp_rw [hH] + have h := P.bulk_log_weighted_kernel_pair_prime_comparison value i childBound pivotBound T hT (Polynomial.C L) (Polynomial.C R) + ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip hout d r 0 hsize hregular + (by simp) (by simp) slots cb Dlog hDlog hloglip rlog hslots hQ hq hqQ ha u v hu huv hshort + simpa only [Polynomial.eval_C] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodeFactors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodeFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e854b730a3d36b644d4b1ad1fa4318ae0e856be --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodeFactors.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkNodePolynomials +import OAI.NumberTheory.Ostmann.Arithmetic.MovingNodeCutoffFactor + +namespace OAI + +/-! # The original node cutoffs with one free bulk coordinate -/ + +namespace Ostmann +open scoped Classical BigOperators + +noncomputable def bulkNodeFactors {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) : + Fin (T.bulkNodePolynomials value i L R).length → ClippedPolynomialFactor := fun j => + let f := (T.bulkNodePolynomials value i L R)[j] + logCutoffPolynomialFactor f.2 φ (G f.1) B D hB hD hφ hlip + +theorem bulkNodeFactors_value {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (L R : Polynomial ℝ) (φ : ℝ → ℝ) (G : ℕ → ℝ) + (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) (p : ℝ) : + smoothPolynomialWeight (bulkNodeFactors value i T L R φ G B D hB hD hφ hlip) (p : ℝ) = + realValueNodeCutoff (Function.update value i p) φ G T (L.eval (p : ℝ)) (R.eval (p : ℝ)) := by + unfold smoothPolynomialWeight + simp only [bulkNodeFactors, logCutoffPolynomialFactor_value _ _ _ _ _ _ _ hφ hlip hout] + rw [← T.bulkNodePolynomials_value value i φ G hT L R p] + exact (Fin.prod_ofFn _).symm.trans (congrArg List.prod + (List.ofFn_getElem_eq_map (T.bulkNodePolynomials value i L R) + (fun f => (positiveLogCutoff φ (G f.1) (f.2.eval (p : ℝ)) : ℂ)))) + +theorem bulkNodeFactors_budget {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) : + smoothPolynomialBudget (bulkNodeFactors value i T L R φ G B D hB hD hφ hlip) = + (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1) := by + unfold smoothPolynomialBudget + simp only [bulkNodeFactors, logCutoffPolynomialFactor_budget, Finset.prod_const, + Finset.card_univ, Fintype.card_fin, T.bulkNodePolynomials_length] + +theorem bulkNodeFactors_degree {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (d e : ℕ) (hsize : T.SizeLE d) (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) + (j : Fin (T.bulkNodePolynomials value i L R).length) : + (bulkNodeFactors value i T L R φ G B D hB hD hφ hlip j).polynomial.natDegree ≤ n * d + e := + T.bulkNodePolynomials_degree value i L R d e hsize hL hR _ (List.getElem_mem j.isLt) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodePolynomials.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodePolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..8aa5bf3e3c2e9b047bed285d1201568be5ed7dd9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodePolynomials.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLeafPolynomials +import OAI.NumberTheory.Ostmann.Arithmetic.MovingCutoffPolynomials + +namespace OAI + +/-! # Every node cutoff in the same bulk-prime polynomial coordinate -/ + +namespace Ostmann +open scoped Classical BigOperators + +noncomputable def MovingSlotData.bulkNodePolynomials {σ : Type*} (value : σ → ℝ) (i : σ) : + {n : ℕ} → MovingSlotData σ n → Polynomial ℝ → Polynomial ℝ → List (ℕ × Polynomial ℝ) + | _, .leaf _ _, _, _ => [] + | n + 1, .node s CL CR u left right, L, R => + let p := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial value i L R + (n + 1, p) :: (left.bulkNodePolynomials value i p L ++ right.bulkNodePolynomials value i p R) + +theorem MovingSlotData.bulkNodePolynomials_length {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) : + (T.bulkNodePolynomials value i L R).length = 2 ^ n - 1 := by + induction T generalizing L R with + | leaf => rfl + | @node n s CL CR u left right ihL ihR => + simp only [bulkNodePolynomials, List.length_cons, List.length_append, ihL, ihR, pow_succ] + have := Nat.one_le_two_pow (n := n) + omega + +theorem MovingSlotData.bulkNodePolynomials_degree {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (d e : ℕ) + (hsize : T.SizeLE d) (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) : + ∀ f ∈ T.bulkNodePolynomials value i L R, f.2.natDegree ≤ n * d + e := by + induction T generalizing L R e with + | leaf => simp [bulkNodePolynomials] + | @node n s CL CR u left right ihL ihR => + have hp := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial_degree + value i L R d e ⟨hsize.2.1, hsize.1, hsize.2.2.1⟩ hL hR + have hLe : L.natDegree ≤ d + e := hL.trans (Nat.le_add_left _ _) + have hRe : R.natDegree ≤ d + e := hR.trans (Nat.le_add_left _ _) + intro f hf + rcases List.mem_cons.mp hf with hf | hf + · subst f + exact hp.trans (by rw [Nat.succ_mul]; omega) + · have hn : n * d + (d + e) = (n + 1) * d + e := by ring + rcases List.mem_append.mp hf with hf | hf + · simpa only [hn] using ihL _ _ (d + e) hsize.2.2.2.1 hp hLe f hf + · simpa only [hn] using ihR _ _ (d + e) hsize.2.2.2.2 hp hRe f hf + +theorem MovingSlotData.bulkNodePolynomials_value {σ : Type*} (value : σ → ℝ) (i : σ) + (φ : ℝ → ℝ) (G : ℕ → ℝ) {n : ℕ} (T : MovingSlotData σ n) + (hT : T.CompensationAbsent i) (L R : Polynomial ℝ) (p : ℝ) : + ((T.bulkNodePolynomials value i L R).map + (fun f => (positiveLogCutoff φ (G f.1) (f.2.eval (p : ℝ)) : ℂ))).prod = + realValueNodeCutoff (Function.update value i p) φ G T + (L.eval (p : ℝ)) (R.eval (p : ℝ)) := by + induction T generalizing L R with + | leaf => rfl + | node s CL CR u left right ihL ihR => + have hp := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial_eval + value i hT.1 L R p + simp only [bulkNodePolynomials, List.map_cons, List.map_append, List.prod_cons, + List.prod_append, ihL hT.2.1, ihR hT.2.2, hp, realValueNodeCutoff] + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodeSupportPolynomials.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodeSupportPolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4d244340393508c59264bc573acb5b074acfabf --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkNodeSupportPolynomials.lean @@ -0,0 +1,115 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.RealNodeSupport +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSlotPolynomials +import OAI.NumberTheory.Ostmann.Characters.PolynomialCellSupports + +namespace OAI + +/-! # Exact polynomial inequalities for all original bulk node supports -/ + +namespace Ostmann +open scoped Classical + +noncomputable def MovingSlotReversal.bulkCompositePolynomial {σ : Type*} + (s : MovingSlotReversal σ) (value : σ → ℝ) (i : σ) (L R : Polynomial ℝ) : Polynomial ℝ := + { s with compensationSlots := [] }.bulkPivotPolynomial value i L R + +theorem MovingSlotReversal.bulkCompositePolynomial_eval {σ : Type*} + (s : MovingSlotReversal σ) (value : σ → ℝ) (i : σ) (L R : Polynomial ℝ) (z : ℝ) : + (s.bulkCompositePolynomial value i L R).eval z = + s.realCompositePivot (Function.update value i z) (L.eval z) (R.eval z) := by + rw [bulkCompositePolynomial, bulkPivotPolynomial_eval _ _ _ (by simp) L R z] + simp only [realValuePivot, realCompositePivot, realSlotProduct, List.map_nil, List.prod_nil, mul_one] + +theorem MovingSlotReversal.bulkCompositePolynomial_degree {σ : Type*} + (s : MovingSlotReversal σ) (value : σ → ℝ) (i : σ) (L R : Polynomial ℝ) + (d e : ℕ) (hs : s.lengthLE d) (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) : + (s.bulkCompositePolynomial value i L R).natDegree ≤ d + e := + bulkPivotPolynomial_degree _ value i L R d e ⟨hs.1, hs.2.1, by simp⟩ hL hR + +noncomputable def MovingSlotData.bulkNodeSupportPolynomials {σ : Type*} + (value : σ → ℝ) (i : σ) (childBound pivotBound : ℕ → ℕ) : + {n : ℕ} → MovingSlotData σ n → Polynomial ℝ → Polynomial ℝ → List (Polynomial ℝ) + | _, .leaf _ _, _, _ => [] + | n + 1, .node s CL CR u left right, L, R => + let step := MovingSlotData.step s CL CR u left right false + let Q := step.bulkCompositePolynomial value i L R + let p := step.bulkPivotPolynomial value i L R + [Q - Polynomial.C 1, Polynomial.C (pivotBound (n + 1) : ℝ) - Q, + R * bulkSlotProduct value i CR - + Polynomial.C ((2 * pivotBound (n + 1) * childBound (n + 1) + 1 : ℕ) : ℝ)] ++ + (left.bulkNodeSupportPolynomials value i childBound pivotBound p L ++ + right.bulkNodeSupportPolynomials value i childBound pivotBound p R) + +theorem MovingSlotData.bulkNodeSupportPolynomials_eval {σ : Type*} + (value : σ → ℝ) (i : σ) (childBound pivotBound : ℕ → ℕ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (L R : Polynomial ℝ) (z : ℝ) : + (∀ P ∈ T.bulkNodeSupportPolynomials value i childBound pivotBound L R, 0 ≤ P.eval z) ↔ + realValueNodeSupport (Function.update value i z) childBound pivotBound T (L.eval z) (R.eval z) := by + induction T generalizing L R with + | leaf => simp [bulkNodeSupportPolynomials, realValueNodeSupport] + | node s CL CR u left right ihL ihR => + have hp := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial_eval + value i hT.1 L R z + simp only [bulkNodeSupportPolynomials, List.forall_mem_append, List.forall_mem_cons, + List.not_mem_nil, IsEmpty.forall_iff, + Polynomial.eval_sub, Polynomial.eval_C, Polynomial.eval_mul, bulkSlotProduct_eval, + MovingSlotReversal.bulkCompositePolynomial_eval, + ihL hT.2.1, ihR hT.2.2, hp, realValueNodeSupport, sub_nonneg] + tauto + +theorem MovingSlotData.bulkNodeSupportPolynomials_length {σ : Type*} + (value : σ → ℝ) (i : σ) (childBound pivotBound : ℕ → ℕ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) : + (T.bulkNodeSupportPolynomials value i childBound pivotBound L R).length = 3 * (2 ^ n - 1) := by + induction T generalizing L R with + | leaf => rfl + | @node n s CL CR u left right ihL ihR => + simp only [bulkNodeSupportPolynomials, List.length_append, List.length_cons, + List.length_nil, ihL, ihR, pow_succ] + have := Nat.one_le_two_pow (n := n) + omega + +/-- Every inequality has degree bounded by the depth times the actual slot +length. No coefficient-size assumption is needed. -/ +theorem MovingSlotData.bulkNodeSupportPolynomials_degree {σ : Type*} + (value : σ → ℝ) (i : σ) (childBound pivotBound : ℕ → ℕ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (d e : ℕ) + (hsize : T.SizeLE d) (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) : + ∀ P ∈ T.bulkNodeSupportPolynomials value i childBound pivotBound L R, P.natDegree ≤ n * d + e := by + induction T generalizing L R e with + | leaf => simp [bulkNodeSupportPolynomials] + | @node n s CL CR u left right ihL ihR => + have hs : (MovingSlotData.step s CL CR u left right false).lengthLE d := + ⟨hsize.2.1, hsize.1, hsize.2.2.1⟩ + have hp := (MovingSlotData.step s CL CR u left right false).bulkPivotPolynomial_degree + value i L R d e hs hL hR + have hQ := (MovingSlotData.step s CL CR u left right false).bulkCompositePolynomial_degree + value i L R d e hs hL hR + have hLR := Polynomial.natDegree_mul_le (p := R) (q := bulkSlotProduct value i CR) + have hCR := (bulkSlotProduct_degree value i CR).trans hsize.2.1 + have hLe : L.natDegree ≤ d + e := hL.trans (Nat.le_add_left _ _) + have hRe : R.natDegree ≤ d + e := hR.trans (Nat.le_add_left _ _) + have hn : n * d + (d + e) = (n + 1) * d + e := by ring + intro P hP + simp only [bulkNodeSupportPolynomials, List.mem_append, List.mem_cons, List.not_mem_nil, + or_false] at hP + rcases hP with (rfl | rfl | rfl) | hP | hP + · have hd := Polynomial.natDegree_sub_le + ((MovingSlotData.step s CL CR u left right false).bulkCompositePolynomial value i L R) (Polynomial.C 1) + simp only [Polynomial.natDegree_C, max_zero] at hd + exact hd.trans (hQ.trans (by omega)) + · have hd := Polynomial.natDegree_sub_le (Polynomial.C (pivotBound (n + 1) : ℝ)) + ((MovingSlotData.step s CL CR u left right false).bulkCompositePolynomial value i L R) + simp only [Polynomial.natDegree_C, zero_max] at hd + exact hd.trans (hQ.trans (by omega)) + · have hd := Polynomial.natDegree_sub_le (R * bulkSlotProduct value i CR) + (Polynomial.C ((2 * pivotBound (n + 1) * childBound (n + 1) + 1 : ℕ) : ℝ)) + simp only [Polynomial.natDegree_C, max_zero] at hd + exact hd.trans (hLR.trans (by omega)) + · simpa only [hn] using ihL _ _ (d + e) hsize.2.2.2.1 hp hLe P hP + · simpa only [hn] using ihR _ _ (d + e) hsize.2.2.2.2 hp hRe P hP + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPageProductIntegral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPageProductIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..84a35b2e686b2c2bdbf788caa3b6e62ee8fc4cb0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPageProductIntegral.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.ZeroDensity.BulkProductDensity + +namespace OAI + +/-! # The full Page density inside one product integral -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +theorem bulk_page_product_integral {J : Type*} [Fintype J] + (P : PublishedProgressionInput) (Q : ℕ) (q a : J → ℕ) (u v : J → ℝ) + (hu : ∀ j, 0 < u j) (f : (J → ℝ) → ℂ) : + (∫ x, f x ∂Measure.pi (fun j => primeGiantMeasure P Q (q j) (a j) (u j) (v j))) = + ∫ x, f x * ∏ j, (selectedPrimeLogDensity P Q (q j) (a j) (x j) : ℂ) + ∂Measure.pi (fun j => volume.restrict (Set.Ioc (u j) (v j))) := by + let μ : J → Measure ℝ := fun j => volume.restrict (Set.Ioc (u j) (v j)) + let ρ : J → ℝ → ℝ := fun j x => max (selectedPrimeLogDensity P Q (q j) (a j) x) 0 + have hρ (j : J) : Measurable (ρ j) := (measurable_selectedPrimeLogDensity P Q (q j) (a j)).max measurable_const + have hi (j : J) : Integrable (ρ j) (μ j) := by + have hb : Integrable (selectedPrimeLogDensity P Q (q j) (a j)) (μ j) := + selectedPrimeLogDensity_integrable P Q (q j) (a j) (u j) (v j) (hu j) + apply hb.congr + filter_upwards [ae_restrict_mem measurableSet_Ioc] with x hx + exact (max_eq_left (selectedPrimeLogDensity_nonneg P Q (q j) (a j) + (u j) (v j) (hu j).le x hx)).symm + have hpos (j : J) (x : ℝ) : 0 ≤ ρ j x := le_max_right _ _ + have he (j : J) : (μ j).withDensity (fun x => ENNReal.ofReal (ρ j x)) = + primeGiantMeasure P Q (q j) (a j) (u j) (v j) := by + unfold primeGiantMeasure intervalDensityMeasure + congr 1 + funext x + dsimp only [ρ] + rw [ENNReal.ofReal_max, ENNReal.ofReal_zero] + exact max_eq_left bot_le + have h := bulk_integral_product_density μ ρ hρ hi hpos f + simp only [he] at h + refine h.trans (integral_congr_ae ?_) + have hm : ∀ᵐ x ∂Measure.pi μ, ∀ j, x j ∈ Set.Ioc (u j) (v j) := + Filter.eventually_all.mpr (fun j => + (Measure.tendsto_eval_ae_ae (μ := μ) (i := j)).eventually (ae_restrict_mem measurableSet_Ioc)) + filter_upwards [hm] with x hx + congr 1 + rw [Complex.ofReal_prod] + apply Finset.prod_congr rfl + intro j _ + congr 1 + exact max_eq_left (selectedPrimeLogDensity_nonneg P Q (q j) (a j) (u j) (v j) + (hu j).le (x j) (hx j)) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPageProjection.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPageProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ec80cf40e788ca17fdb31122f3f11f3ff8132c0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPageProjection.lean @@ -0,0 +1,39 @@ +import Mathlib.Algebra.BigOperators.Associated +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResidueCRT +import OAI.NumberTheory.Ostmann.ZeroDensity.PageConductorProjection + +namespace OAI + +/-! # The deleted conductor prime removes every spectator Page factor -/ + +namespace Ostmann +open scoped Classical BigOperators + +/-- The prescribed single prime exclusion makes the Page correction depend +only on the frequency block. Multiplicities in that block are retained. -/ +theorem bulk_page_projection {I : Type*} [Fintype I] + (z : Option PrimitiveRealZero) (r cutoff : ℕ) (p : I → ℕ) + (hr : 0 < r) (hrcutoff : r < cutoff) + (hp : ∀ i, (p i).Prime) (hlarge : ∀ i, cutoff ≤ p i) + (hexcluded : ∀ e, z = some e → ∀ q, + deletedConductorPrime e.modulus cutoff = some q → ∀ i, q ≠ p i) : + pageAtModulus (∏ i, bulkResidueModuli r p i) z = pageAtModulus r z := by + have hprod : (∏ i, bulkResidueModuli r p i) = r * ∏ i, p i := by + rw [Fintype.prod_sum_type] + simp only [bulkResidueModuli, Fintype.prod_unique] + rw [hprod] + apply pageAtModulus_mul_eq z r (∏ i, p i) cutoff + · intro q hq hqr + exact (Nat.le_of_dvd hr hqr).trans_lt hrcutoff + · intro q hq hqp + obtain ⟨i, _, hqi⟩ := (hq.prime.dvd_finsetProd_iff p).mp hqp + have heq := (Nat.prime_dvd_prime_iff_eq hq (hp i)).mp hqi + simpa only [heq] using hlarge i + · intro e he q hq hqp + obtain ⟨i, _, hqi⟩ := ((deletedConductorPrime_spec hq).1.prime.dvd_finsetProd_iff p).mp hqp + exact hexcluded e he q hq i + ((Nat.prime_dvd_prime_iff_eq (deletedConductorPrime_spec hq).1 (hp i)).mp hqi) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPairPrimeComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPairPrimeComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c1c74710fe02151fb9f39d7adf792a80accceba --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPairPrimeComparison.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogSliceComparison +import OAI.NumberTheory.Ostmann.Arithmetic.MovingKernelPair + +namespace OAI + +/-! # The actual conjugate history pair in a bulk-prime slice -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators SchwartzMap ComplexConjugate + +noncomputable def realValueSmoothPair {σ : Type*} (value : σ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) (G : ℕ → ℝ) (L R : ℝ) : ℂ := + realValueSmoothWeight value (T false) ψ X lo hi hlo hhi φ G L R * + conj (realValueSmoothWeight value (T true) ψ X lo hi hlo hhi φ G L R) + +noncomputable def bulkPairComparisonBudget (ψ : 𝓢(ℝ, ℂ)) (V lo hi : ℝ) + (n d r e : ℕ) (B D : ℝ) : ℝ := + ((2 * ((2 ^ n + (2 ^ n - 1)) * (2 * (n * d + e) + r)) + 1 : ℕ) : ℝ) * + (movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) ^ 2 + +/-- Both trees retain their actual shared bulk coordinate. Conjugation doubles +the root budget and squares the smooth budget, without any new analytic input. -/ +theorem PublishedProgressionInput.bulk_pair_prime_comparison (P : PublishedProgressionInput) + {σ : Type*} (value : σ → ℝ) (i : σ) {n : ℕ} (T : Bool → MovingSlotData σ n) + (hT : ∀ b, (T b).CompensationAbsent i) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : ∀ b, (T b).Frequencies (fun s => |(s : ℝ)| ≤ V)) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r e : ℕ) (hsize : ∀ b, (T b).SizeLE d) (hregular : ∀ b, (T b).RegularLengthLE r) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) : + let H := fun y => realValueSmoothPair (Function.update value i (Real.exp y)) T + ψ X lo hi hlo hhi φ G (L.eval (Real.exp y)) (R.eval (Real.exp y)) + ‖complexPrimeInterval q a u v H - + ∫ y in Set.Ioc u v, H y * (selectedPrimeLogDensity P Q q a y : ℂ)‖ ≤ + bulkPairComparisonBudget ψ V lo hi n d r e B D * bulkPrimeErrorFactor P Q u := by + dsimp only + let F (b : Bool) := bulkSmoothFactors value i (T b) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip + let W := movingFourierVariationBudget ψ V lo hi n * + (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1) + let K := (2 ^ n + (2 ^ n - 1)) * (2 * (n * d + e) + r) + obtain ⟨S, hS, hrS⟩ := bulkSmoothFactors_root_cuts value i (T false) L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip d r e (hsize false) (hregular false) hL hR + obtain ⟨U, hU, hrU⟩ := bulkSmoothFactors_root_cuts value i (T true) L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip d r e (hsize true) (hregular true) hL hR + have hcard : (S ∪ U).card + 1 ≤ 2 * K + 1 := by + simp only [MovingSlotData.bulkNodePolynomials_length] at hS hU + have hc := Finset.card_union_le S U + dsimp only [K] + omega + have hbudget : smoothPolynomialBudget (pairedPolynomialFactors (F false) (F true)) ≤ W ^ 2 := by + rw [pairedPolynomialFactors_budget, pow_two] + have h0 := bulkSmoothFactors_budget value i (T false) L R ψ X lo hi V hlo hhi + (hV false) φ G B D hB hD hφ hlip + have h1 := bulkSmoothFactors_budget value i (T true) L R ψ X lo hi V hlo hhi + (hV true) φ G B D hB hD hφ hlip + exact mul_le_mul h0 h1 (smoothPolynomialBudget_nonneg _) ((smoothPolynomialBudget_nonneg _).trans h0) + have he (z : ℝ) : smoothPolynomialWeight (pairedPolynomialFactors (F false) (F true)) z = + realValueSmoothPair (Function.update value i z) T ψ X lo hi hlo hhi φ G (L.eval z) (R.eval z) := by + rw [pairedPolynomialFactors_weight] + exact congrArg₂ (fun a b => a * conj b) + (bulkSmoothFactors_value value i (T false) (hT false) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout z) + (bulkSmoothFactors_value value i (T true) (hT true) L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout z) + have h := P.smooth_prime_all_roots hQ hq hqQ ha u v hu huv hshort + (pairedPolynomialFactors (F false) (F true)) (S ∪ U) + (pairedPolynomialFactors_roots (F false) (F true) S U hrS hrU) + simp only [he] at h + apply h.trans + change ((S ∪ U).card + 1 : ℕ) * smoothPolynomialBudget (pairedPolynomialFactors (F false) (F true)) * + bulkPrimeErrorFactor P Q u ≤ ((2 * K + 1 : ℕ) : ℝ) * W ^ 2 * bulkPrimeErrorFactor P Q u + apply mul_le_mul_of_nonneg_right _ (by + dsimp only [bulkPrimeErrorFactor] + have := P.errorConstant_nonneg + positivity) + exact mul_le_mul (by exact_mod_cast hcard) hbudget (smoothPolynomialBudget_nonneg _) (by positivity) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPiIntegral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPiIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..25f11f500f32a4da9d362986a4992ef9f6af4bd9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPiIntegral.lean @@ -0,0 +1,103 @@ +import Mathlib.MeasureTheory.Integral.Pi +import Mathlib.Data.List.FinRange +import OAI.NumberTheory.Ostmann.Arithmetic.BulkIntegrands + +namespace OAI + +/-! # The joint bulk integral in ordinary finite product coordinates -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +noncomputable def BulkIntegrand.headSlice {n : ℕ} + (f : BulkIntegrand (Fin (n + 1))) (a : ℝ) : BulkIntegrand (Fin n) where + toFun x := f (Fin.cons a x) + measurable := f.measurable.comp (Measurable.of_eval (fun i => by + refine Fin.cases ?_ (fun j => ?_) i + · exact measurable_const + · exact measurable_pi_apply j)) + bounded := by + obtain ⟨C, hC, hf⟩ := f.bounded + exact ⟨C, hC, fun x => hf _⟩ + +theorem fin_cons_update {n : ℕ} (a b : ℝ) (x : Fin n → ℝ) (i : Fin n) : + (show Fin (n + 1) → ℝ from Fin.cons a + (@Function.update (Fin n) (fun _ => ℝ) (Classical.decEq _) x i b)) = + @Function.update (Fin (n + 1)) (fun _ => ℝ) (Classical.decEq _) + (Fin.cons a x) i.succ b := by + funext j + refine Fin.cases ?_ (fun j => ?_) j + · simp [Function.update, Ne.symm (Fin.succ_ne_zero i)] + · by_cases hj : j = i + · subst j; simp [Function.update] + · simp [Function.update, hj] + +theorem BulkIntegrand.headSlice_average {n : ℕ} (f : BulkIntegrand (Fin (n + 1))) + (μ : Measure ℝ) [IsFiniteMeasure μ] (i : Fin n) (a : ℝ) : + (f.average μ i.succ).headSlice a = (f.headSlice a).average μ i := by + ext x + dsimp only [headSlice, average] + apply integral_congr_ae + exact Filter.Eventually.of_forall fun b => congrArg f (fin_cons_update a b x i).symm + +theorem BulkIntegrand.headSlice_averages {n : ℕ} (f : BulkIntegrand (Fin (n + 1))) + (μ : Fin (n + 1) → Measure ℝ) [∀ i, IsFiniteMeasure (μ i)] + (l : List (Fin n)) (a : ℝ) : + (f.averages μ (l.map Fin.succ)).headSlice a = + (f.headSlice a).averages (fun i => μ i.succ) l := by + induction l with + | nil => rfl + | cons i l ih => simp only [List.map_cons, averages, headSlice_average, ih] + +/-- Finite-measure Fubini, with the first coordinate displayed explicitly. -/ +theorem BulkIntegrand.integral_headSlice {n : ℕ} (f : BulkIntegrand (Fin (n + 1))) + (μ : Fin (n + 1) → Measure ℝ) [∀ i, IsFiniteMeasure (μ i)] : + (∫ x, f x ∂Measure.pi μ) = + ∫ a, ∫ x, f.headSlice a x ∂Measure.pi (fun i => μ i.succ) ∂μ 0 := by + let e := MeasurableEquiv.piFinSuccAbove (fun _ : Fin (n + 1) => ℝ) 0 + have he := (measurePreserving_piFinSuccAbove μ 0).symm + have hi := (he.integrable_comp_emb e.symm.measurableEmbedding).mpr (f.integrable (Measure.pi μ)) + rw [← he.integral_comp' (fun x => f x)] + change (∫ z, (f ∘ e.symm) z ∂(μ 0).prod (Measure.pi (fun j => μ (Fin.succAbove 0 j)))) = _ + rw [integral_prod (f ∘ e.symm) hi] + congr 1 + funext a + apply integral_congr_ae + exact Filter.Eventually.of_forall fun x => by + simp only [e, MeasurableEquiv.piFinSuccAbove_symm_apply, Fin.insertNthEquiv, + Fin.insertNth_zero, headSlice, Function.comp_apply, Equiv.coe_fn_mk, cast_eq] + +theorem BulkIntegrand.averages_finRange {n : ℕ} (f : BulkIntegrand (Fin n)) + (μ : Fin n → Measure ℝ) [∀ i, IsFiniteMeasure (μ i)] (x : Fin n → ℝ) : + f.averages μ (List.finRange n) x = ∫ y, f y ∂Measure.pi μ := by + induction n with + | zero => + have hf (y : Fin 0 → ℝ) : f y = f x := congrArg f (Subsingleton.elim _ _) + simp only [List.finRange_zero, averages] + simp_rw [hf] + have hm : (Measure.pi μ).real Set.univ = 1 := by + rw [Measure.real, Measure.pi_univ] + simp + simp only [integral_const, Complex.real_smul, hm, Complex.ofReal_one, one_mul] + | succ n ih => + rw [f.integral_headSlice μ, List.finRange_succ] + dsimp only [averages, average] + apply integral_congr_ae + refine Filter.Eventually.of_forall fun a => ?_ + have hx : @Function.update (Fin (n + 1)) (fun _ => ℝ) (Classical.decEq _) + x 0 a = Fin.cons a (fun i => x i.succ) := by + funext j + refine Fin.cases ?_ (fun j => ?_) j <;> simp + dsimp only + calc + _ = (f.averages μ ((List.finRange n).map Fin.succ)) (Fin.cons a (fun i => x i.succ)) := + congrArg (fun z => (f.averages μ ((List.finRange n).map Fin.succ)) z) hx + _ = _ := by + change ((f.averages μ ((List.finRange n).map Fin.succ)).headSlice a) (fun i => x i.succ) = _ + rw [f.headSlice_averages] + exact ih _ _ _ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeAtoms.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeAtoms.lean new file mode 100644 index 0000000000000000000000000000000000000000..bae67bc6da7949137d80402509901f54f04182d7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeAtoms.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkAtomicProduct +import OAI.NumberTheory.Ostmann.Construction.PrimeLogCellMeasure + +namespace OAI + +/-! # Expanding the actual joint prime cells on the common sample space -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +noncomputable def primeCellAtomWeight (q a : ℕ) (u v : ℝ) (p : ℕ) : ℝ := + if p ∈ primeLogCellSet q a u v then (p : ℝ)⁻¹ else 0 + +theorem primeCellAtomWeight_nonneg (q a : ℕ) (u v : ℝ) (p : ℕ) : + 0 ≤ primeCellAtomWeight q a u v p := by + unfold primeCellAtomWeight + split_ifs <;> positivity + +theorem primeLogCellMeasure_ambient (P : Finset ℕ) (q a : ℕ) (u v : ℝ) + (hP : primeLogCellSet q a u v ⊆ P) : + primeLogCellMeasure q a u v = + ∑ p : P, ENNReal.ofReal (primeCellAtomWeight q a u v p) • Measure.dirac (Real.log (p : ℕ)) := by + have hs : P.filter (fun p => p ∈ primeLogCellSet q a u v) = primeLogCellSet q a u v := by + ext p + exact ⟨fun h => (Finset.mem_filter.mp h).2, + fun h => Finset.mem_filter.mpr ⟨hP h, h⟩⟩ + rw [Finset.sum_coe_sort P (fun p => ENNReal.ofReal (primeCellAtomWeight q a u v p) • + Measure.dirac (Real.log p))] + unfold primeLogCellMeasure + rw [← hs, Finset.sum_filter] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : p ∈ primeLogCellSet q a u v <;> simp [primeCellAtomWeight, hp] + +/-- This equality retains each original atom and all residue restrictions; +there is no replacement by an independent uniform prime sample. -/ +theorem BulkIntegrand.integral_prime_cell_product {J : Type*} [Fintype J] + (f : BulkIntegrand J) (P : Finset ℕ) (q a : J → ℕ) (u v : J → ℝ) + (hP : ∀ j, primeLogCellSet (q j) (a j) (u j) (v j) ⊆ P) : + (∫ y, f y ∂Measure.pi (fun j => primeLogCellMeasure (q j) (a j) (u j) (v j))) = + ∑ x : J → P, ((∏ j, primeCellAtomWeight (q j) (a j) (u j) (v j) (x j) : ℝ) : ℂ) * + f (fun j => Real.log (x j : ℕ)) := by + simp_rw [primeLogCellMeasure_ambient P _ _ _ _ (hP _)] + exact f.integral_atomic_product _ _ (fun j x => primeCellAtomWeight_nonneg _ _ _ _ x) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeCellMass.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeCellMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..cdce0f228f90cd67166eecde219344ed145fa2c5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeCellMass.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkCellMixtures +import OAI.NumberTheory.Ostmann.Arithmetic.BulkLogSliceComparison + +namespace OAI + +/-! # Mass control for the normalized union of actual prime cells -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +noncomputable def bulkConstant {σ : Type*} (c : ℂ) : BulkIntegrand σ where + toFun _ := c + measurable := measurable_const + bounded := ⟨‖c‖, norm_nonneg _, fun _ => le_rfl⟩ + +theorem bulkConstant_average_one {σ : Type*} [Fintype σ] + (μ : Measure ℝ) [IsFiniteMeasure μ] (i : σ) (x : σ → ℝ) : + (bulkConstant (σ := σ) 1).average μ i x = (μ.real Set.univ : ℂ) := by + change (∫ _t : ℝ, (1 : ℂ) ∂μ) = _ + simp only [integral_const, Complex.real_smul, mul_one] + +theorem primeLogCell_page_mass_error (P : PublishedProgressionInput) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) : + |(primeLogCellMeasure q a u v).real Set.univ - + (primeGiantMeasure P Q q a u v).real Set.univ| ≤ bulkPrimeErrorFactor P Q u := by + rw [primeLogCellMeasure_mass, sum_primeLogCellSet_reciprocal, + primeGiantMeasure, intervalDensityMeasure_mass u v _ + (selectedPrimeLogDensity_integrable P Q q a u v (by linarith)) + (selectedPrimeLogDensity_nonneg P Q q a u v (by linarith))] + have h := P.uniform_log_interval hQ hq hqQ ha hu huv hshort + exact h.trans (le_add_of_nonneg_right (by positivity : 0 ≤ 2 * Real.exp (-u))) + +/-- If the original normalized prime law has mass at most one, the ideal +Page law has mass at most two once its derived interval error is at most one. -/ +theorem PublishedProgressionInput.bulk_cell_page_mass_le_two + (P : PublishedProgressionInput) {C : Type*} [Fintype C] + (Q : ℕ) (hQ : 2 ≤ Q) (q a : C → ℕ) (u v : C → ℝ) + (hq : ∀ c, 1 ≤ q c) (hqQ : ∀ c, q c ≤ Q) (ha : ∀ c, (a c).Coprime (q c)) + (hu : ∀ c, 1 ≤ u c) (huv : ∀ c, u c ≤ v c) (hshort : ∀ c, v c ≤ u c + 1) + (Z : ℝ) (hZ : 0 ≤ Z) + (hmass : (bulkCellMixture Z (fun c => primeLogCellMeasure (q c) (a c) (u c) (v c))).real Set.univ ≤ 1) + (herror : Z * ∑ c, bulkPrimeErrorFactor P Q (u c) ≤ 1) : + (bulkCellMixture Z (fun c => primeGiantMeasure P Q (q c) (a c) (u c) (v c))).real Set.univ ≤ 2 := by + let μ := fun c => primeLogCellMeasure (q c) (a c) (u c) (v c) + let ν := fun c => primeGiantMeasure P Q (q c) (a c) (u c) (v c) + let _ : ∀ c, IsFiniteMeasure (ν c) := fun c => + finite_primeGiantMeasure P Q (q c) (a c) (u c) (v c) (by linarith [hu c]) + have hc (c : C) (x : Unit → ℝ) : + ‖(bulkConstant (σ := Unit) 1).average (μ c) () x - + (bulkConstant (σ := Unit) 1).average (ν c) () x‖ ≤ bulkPrimeErrorFactor P Q (u c) := by + rw [bulkConstant_average_one, bulkConstant_average_one, ← Complex.ofReal_sub, + Complex.norm_real, Real.norm_eq_abs] + exact primeLogCell_page_mass_error P hQ (hq c) (hqQ c) (ha c) (u c) (v c) (hu c) (huv c) (hshort c) + have h := (bulkConstant (σ := Unit) 1).cellMixture_comparison Z hZ μ ν () + (fun c => bulkPrimeErrorFactor P Q (u c)) hc (fun _ => 0) + rw [bulkConstant_average_one, bulkConstant_average_one, ← Complex.ofReal_sub, + Complex.norm_real, Real.norm_eq_abs] at h + have hh := (abs_le.mp (h.trans herror)).1 + change (bulkCellMixture Z μ).real Set.univ ≤ 1 at hmass + change (bulkCellMixture Z ν).real Set.univ ≤ 2 + linarith + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f0da29473073e948261301dbc01934ffa0306d1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeComparison.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSmoothRootCuts +import OAI.NumberTheory.Ostmann.Construction.PrimeLogGrid + +namespace OAI + +/-! # Published progression comparison for an actual varying bulk prime -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap +open MeasureTheory + +noncomputable def bulkPrimeSmoothSum {σ : Type*} (value : σ → ℕ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (q a : ℕ) (u v : ℝ) : ℂ := + ∑ p ∈ primeLogCellSet q a u v, + movingRealSmoothWeight (Function.update value i p) T ψ X lo hi hlo hhi φ G + (L.eval (p : ℝ)) (R.eval (p : ℝ)) * ((p : ℝ)⁻¹ : ℂ) + +theorem bulkPrimeSmoothSum_polynomial {σ : Type*} (value : σ → ℕ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) (G : ℕ → ℝ) + (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) (q a : ℕ) (u v : ℝ) : + bulkPrimeSmoothSum value i T L R ψ X lo hi hlo hhi φ G q a u v = + complexPrimeInterval q a u v (fun y => smoothPolynomialWeight + (bulkSmoothFactors (fun j => (value j : ℝ)) i T L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip) (Real.exp y)) := by + unfold bulkPrimeSmoothSum primeLogCellSet complexPrimeInterval + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : p.Prime ∧ Nat.ModEq q p a + · rw [ite_eq_left hp, ite_eq_left hp] + dsimp only + rw [Real.exp_log (show (0 : ℝ) < p by exact_mod_cast hp.1.pos)] + rw [bulkSmoothFactors_nat_value value i T hT L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout p] + · rw [ite_eq_right hp, ite_eq_right hp] + +/-- Only Montgomery--Vaughan's published progression input is used. The real +integral is the polynomial extension proved equal to the original sampling +expression at every prime, with all endpoint primes retained. -/ +theorem PublishedProgressionInput.bulk_prime_comparison (P : PublishedProgressionInput) + {σ : Type*} (value : σ → ℕ) (i : σ) {n : ℕ} (T : MovingSlotData σ n) + (hT : T.CompensationAbsent i) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : T.Frequencies (fun s => |(s : ℝ)| ≤ V)) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) + (d r e : ℕ) (hsize : T.SizeLE d) (hregular : T.RegularLengthLE r) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) : + let F := bulkSmoothFactors (fun j => (value j : ℝ)) i T L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip + let K := (2 ^ n + (T.bulkNodePolynomials (fun j => (value j : ℝ)) i L R).length) * (2 * (n * d + e) + r) + ‖bulkPrimeSmoothSum value i T L R ψ X lo hi hlo hhi φ G q a u v - + ∫ y in Set.Ioc u v, smoothPolynomialWeight F (Real.exp y) * + (selectedPrimeLogDensity P Q q a y : ℂ)‖ ≤ + (K + 1 : ℕ) * + (movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1)) * + (18 * P.errorConstant * Real.exp (-P.decay * Real.sqrt u) + + Real.exp (-P.kappa * u / Real.log (4 * (Q : ℝ))) + 2 * Real.exp (-u)) := by + dsimp only + obtain ⟨S, hcard, hroots⟩ := bulkSmoothFactors_root_cuts (fun j => (value j : ℝ)) i T L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip d r e hsize hregular hL hR + rw [bulkPrimeSmoothSum_polynomial value i T hT L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip hout] + apply (P.smooth_prime_all_roots hQ hq hqQ ha u v hu huv hshort _ S hroots).trans + have hC := P.errorConstant_nonneg + apply mul_le_mul_of_nonneg_right _ (by positivity) + apply mul_le_mul + · exact_mod_cast Nat.add_le_add_right hcard 1 + · exact bulkSmoothFactors_budget (fun j => (value j : ℝ)) i T L R ψ X lo hi V hlo hhi hV φ G B D hB hD hφ hlip + · exact smoothPolynomialBudget_nonneg _ + · positivity + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeIntegrands.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeIntegrands.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ed4a6366517563959caf8e6458243eff288036c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkPrimeIntegrands.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkIntegrands +import OAI.NumberTheory.Ostmann.Construction.PrimeLogCellMeasure + +namespace OAI + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +theorem BulkIntegrand.average_prime {σ : Type*} [Fintype σ] (f : BulkIntegrand σ) + (q a : ℕ) (u v : ℝ) (i : σ) (x : σ → ℝ) : + f.average (primeLogCellMeasure q a u v) i x = + ∑ p ∈ primeLogCellSet q a u v, + f (Function.update x i (Real.log p)) * ((p : ℝ)⁻¹ : ℂ) := by + change (∫ t, f (Function.update x i t) ∂primeLogCellMeasure q a u v) = _ + unfold primeLogCellMeasure + rw [integral_finsetSum_measure] + · apply Finset.sum_congr rfl + intro p _ + rw [integral_smul_measure, integral_dirac, ENNReal.toReal_ofReal (by positivity), + Complex.real_smul, mul_comm] + simp only [Complex.ofReal_inv, Complex.ofReal_natCast] + · intro p _ + exact f.slice_integrable _ i x + +theorem BulkIntegrand.average_prime_eq_interval {σ : Type*} [Fintype σ] (f : BulkIntegrand σ) + (q a : ℕ) (u v : ℝ) (i : σ) (x : σ → ℝ) (H : ℝ → ℂ) + (hH : ∀ y, f (Function.update x i y) = H y) : + f.average (primeLogCellMeasure q a u v) i x = complexPrimeInterval q a u v H := by + rw [f.average_prime] + unfold primeLogCellSet complexPrimeInterval + rw [Finset.sum_filter] + apply Finset.sum_congr rfl + intro p _ + by_cases hp : p.Prime ∧ Nat.ModEq q p a + · rw [ite_eq_left hp, ite_eq_left hp, hH] + · rw [ite_eq_right hp, ite_eq_right hp] + +theorem BulkIntegrand.average_page {σ : Type*} [Fintype σ] (f : BulkIntegrand σ) + (P : PublishedProgressionInput) (Q q a : ℕ) (u v : ℝ) (hu : 0 < u) + (i : σ) (x : σ → ℝ) : + letI := finite_primeGiantMeasure P Q q a u v hu + f.average (primeGiantMeasure P Q q a u v) i x = + ∫ y in Set.Ioc u v, f (Function.update x i y) * (selectedPrimeLogDensity P Q q a y : ℂ) := by + exact primeGiantMeasure_integral P Q q a u v hu.le _ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkProductMixtures.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkProductMixtures.lean new file mode 100644 index 0000000000000000000000000000000000000000..dea141d0d12e8963e48a303a452f1764ecc6441e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkProductMixtures.lean @@ -0,0 +1,41 @@ +import Mathlib.MeasureTheory.Integral.Pi +import OAI.NumberTheory.Ostmann.Arithmetic.BulkCellMixtures + +namespace OAI + +/-! # Exact reassembly of the joint bulk cells -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +/-- Expanding all cell mixtures counts each joint box once and keeps the +original product of harmonic normalization constants. -/ +theorem bulk_product_mixtures {J C : Type*} [Fintype J] [Fintype C] + (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (μ : J → C → Measure ℝ) [∀ j c, IsFiniteMeasure (μ j c)] : + Measure.pi (fun j => bulkCellMixture (Z j) (μ j)) = + ENNReal.ofReal (∏ j, Z j) • ∑ c : J → C, Measure.pi (fun j => μ j (c j)) := by + apply Measure.pi_eq + intro s hs + simp only [Measure.smul_apply, Measure.finsetSum_apply, Measure.pi_pi, + bulkCellMixture, smul_eq_mul] + rw [ENNReal.ofReal_prod_of_nonneg (fun j _ => hZ j), Finset.prod_mul_distrib, + Fintype.prod_sum] + +/-- The exact joint integral corresponding to the original normalized cell +mixture; cell counts enter through a sum of integrals, not as a main-term loss. -/ +theorem BulkIntegrand.integral_product_mixtures {J C : Type*} [Fintype J] [Fintype C] + (f : BulkIntegrand J) (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (μ : J → C → Measure ℝ) [∀ j c, IsFiniteMeasure (μ j c)] : + (∫ x, f x ∂Measure.pi (fun j => bulkCellMixture (Z j) (μ j))) = + ((∏ j, Z j : ℝ) : ℂ) * ∑ c : J → C, ∫ x, f x ∂Measure.pi (fun j => μ j (c j)) := by + rw [bulk_product_mixtures Z hZ μ, integral_smul_measure, + ENNReal.toReal_ofReal (Finset.prod_nonneg fun j _ => hZ j), Complex.real_smul, + integral_finsetSum_measure] + intro c _ + exact f.integrable _ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkRegularSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkRegularSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbe156820c9874967152f251995b168a47521bc0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkRegularSupport.lean @@ -0,0 +1,67 @@ +import Mathlib.Data.List.Pairwise +import Mathlib.Data.Nat.Prime.Basic +import OAI.NumberTheory.Ostmann.Arithmetic.MovingRegularSlots + +namespace OAI + +/-! # Keep nonbulk coprimalities when bulk collisions are removed -/ + +namespace Ostmann +open scoped Classical + +theorem pairwise_split_bulk {α : Type*} (R : α → α → Prop) + (bulk : α → Bool) (L : List α) + (hcross : ∀ a ∈ L, ∀ b ∈ L, bulk a ≠ bulk b → R a b) : + L.Pairwise R ↔ (L.filter bulk).Pairwise R ∧ (L.filter fun a => !(bulk a)).Pairwise R := by + constructor + · intro h + exact ⟨h.filter bulk, h.filter (fun a => !(bulk a))⟩ + · induction L with + | nil => simp + | cons a L ih => + rintro ⟨hb, hs⟩ + have htail := ih (fun b hb c hc => hcross b (List.mem_cons_of_mem a hb) + c (List.mem_cons_of_mem a hc)) + cases ha : bulk a with + | false => + simp only [List.filter_cons, ha, Bool.not_false, Bool.false_eq_true, ite_false, + ite_true, List.pairwise_cons] at hb hs + refine List.pairwise_cons.mpr ⟨?_, htail ⟨hb, hs.2⟩⟩ + intro b hbL + cases hbB : bulk b with + | false => exact hs.1 b (List.mem_filter.mpr ⟨hbL, by simp [hbB]⟩) + | true => exact hcross a List.mem_cons_self b (List.mem_cons_of_mem a hbL) (by simp [ha, hbB]) + | true => + simp only [List.filter_cons, ha, Bool.not_true, Bool.false_eq_true, ite_false, + ite_true, List.pairwise_cons] at hb hs + refine List.pairwise_cons.mpr ⟨?_, htail ⟨hb.2, hs⟩⟩ + intro b hbL + cases hbB : bulk b with + | false => exact hcross a List.mem_cons_self b (List.mem_cons_of_mem a hbL) (by simp [ha, hbB]) + | true => exact hb.1 b (List.mem_filter.mpr ⟨hbL, hbB⟩) + +/-- Under the original distinct-bulk event, all bulk coprimality tests are +automatic. The nonbulk tests are retained exactly. -/ +theorem prime_list_pairwise_iff_nonbulk {σ : Type*} (value : σ → ℕ) + (bulk : σ → Bool) (L : List σ) + (hprime : ∀ i ∈ L, (value i).Prime) + (hnodup : (L.filter bulk).Nodup) + (hinj : ∀ i j, bulk i = true → bulk j = true → value i = value j → i = j) + (hcross : ∀ i ∈ L, ∀ j ∈ L, bulk i ≠ bulk j → value i ≠ value j) : + (L.map value).Pairwise Nat.Coprime ↔ + ((L.filter fun i => !(bulk i)).map value).Pairwise Nat.Coprime := by + rw [List.pairwise_map, List.pairwise_map] + have hb : (L.filter bulk).Pairwise (fun i j => (value i).Coprime (value j)) := by + apply hnodup.imp_of_mem + intro i j hi hj hij + obtain ⟨hiL, hiB⟩ := List.mem_filter.mp hi + obtain ⟨hjL, hjB⟩ := List.mem_filter.mp hj + exact (Nat.coprime_primes (hprime i hiL) (hprime j hjL)).mpr + (fun h => hij (hinj i j hiB hjB h)) + rw [pairwise_split_bulk _ bulk L (fun i hi j hj h => + (Nat.coprime_primes (hprime i hi) (hprime j hj)).mpr (hcross i hi j hj h))] + exact and_iff_right hb + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueAbsolute.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueAbsolute.lean new file mode 100644 index 0000000000000000000000000000000000000000..441f075713dacc4f45c9d0c74f377c47ffe2124d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueAbsolute.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenSpectatorAbsolute +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResiduePageBound + +namespace OAI + +/-! # Nonnegative norm comparison after bulk CRT separation -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem uniform_equiv_product_average_real {A B C : Type*} + [Fintype A] [Fintype B] [Fintype C] + (e : A ≃ B × C) (f : B → ℝ) (g : C → ℝ) : + (Fintype.card A : ℝ)⁻¹ * (∑ a, f (e a).1 * g (e a).2) = + ((Fintype.card B : ℝ)⁻¹ * ∑ b, f b) * + ((Fintype.card C : ℝ)⁻¹ * ∑ c, g c) := by + rw [e.sum_comp (fun z => f z.1 * g z.2), Fintype.card_congr e, + Fintype.card_prod, Nat.cast_mul, mul_inv_rev, Fintype.sum_prod_type] + simp_rw [← Finset.mul_sum] + rw [← Finset.sum_mul] + ring + +/-- Page factors at every original bulk slot cost at most two. The frequency +and spectator averages still retain their independent CRT coordinates. -/ +theorem bulk_residue_absolute_mean_le {I J : Type*} [Fintype I] [Fintype J] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) (Y : J → ℝ) (hY : ∀ j, 0 ≤ Y j) + (F : (J → (ZMod r)ˣ) → ℂ) (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) + (B : ℝ) (hB : 0 ≤ B) (C : I → ℝ) + (hF : (Fintype.card (J → (ZMod r)ˣ) : ℝ)⁻¹ * ∑ a, ‖F a‖ ≤ B) + (hG : ∀ i, (Fintype.card (J → (ZMod (p i))ˣ) : ℝ)⁻¹ * ∑ a, ‖G i a‖ ≤ C i) : + (Fintype.card (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) : ℝ)⁻¹ * + (∑ x : J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ, + ‖(F (bulkResidueEquiv r p hc x).1 * + ∏ j, pageGiantWeight P Q (∏ i, bulkResidueModuli r p i) (x j).val.val (Y j)) * + ∏ i, G i ((bulkResidueEquiv r p hc x).2 i)‖) ≤ + (2 : ℝ) ^ Fintype.card J * (B * ∏ i, C i) := by + let e := bulkResidueEquiv (J := J) r p hc + have hpage (x : J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) : + ‖∏ j, pageGiantWeight P Q (∏ i, bulkResidueModuli r p i) (x j).val.val (Y j)‖ ≤ + (2 : ℝ) ^ Fintype.card J := by + rw [norm_prod] + exact (Finset.prod_le_prod₀ (fun _ _ => norm_nonneg _) (fun j _ => + pageGiantWeight_norm_le_two P Q _ _ _ (hY j))).trans_eq (by simp) + have hspec := product_uniform_mean_le (fun i a => ‖G i a‖) (fun _ _ => norm_nonneg _) + C hG + have hspec0 : 0 ≤ (Fintype.card (∀ i, J → (ZMod (p i))ˣ) : ℝ)⁻¹ * + ∑ a : ∀ i, J → (ZMod (p i))ˣ, ∏ i, ‖G i (a i)‖ := by positivity + calc + _ ≤ (Fintype.card (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) : ℝ)⁻¹ * + ∑ x : J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ, + (2 : ℝ) ^ Fintype.card J * (‖F (e x).1‖ * ∏ i, ‖G i ((e x).2 i)‖) := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + apply Finset.sum_le_sum + intro x _ + have hgn : 0 ≤ ∏ i, ‖G i ((e x).2 i)‖ := Finset.prod_nonneg fun _ _ => norm_nonneg _ + have hp := mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (hpage x) (norm_nonneg (F (e x).1))) hgn + simpa only [norm_mul, norm_prod, mul_assoc, mul_comm, mul_left_comm] using hp + _ = (2 : ℝ) ^ Fintype.card J * + (((Fintype.card (J → (ZMod r)ˣ) : ℝ)⁻¹ * ∑ a, ‖F a‖) * + ((Fintype.card (∀ i, J → (ZMod (p i))ˣ) : ℝ)⁻¹ * + ∑ a : ∀ i, J → (ZMod (p i))ˣ, ∏ i, ‖G i (a i)‖)) := by + rw [← Finset.mul_sum, ← mul_assoc, mul_comm _ ((2 : ℝ) ^ Fintype.card J), mul_assoc] + rw [uniform_equiv_product_average_real e (fun a => ‖F a‖) (fun a => ∏ i, ‖G i (a i)‖)] + _ ≤ _ := mul_le_mul_of_nonneg_left (mul_le_mul hF hspec hspec0 hB) (by positivity) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueCRT.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueCRT.lean new file mode 100644 index 0000000000000000000000000000000000000000..402425b1159068c2d8b205e0cf9325bf0d5568a5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueCRT.lean @@ -0,0 +1,107 @@ +import OAI.NumberTheory.Ostmann.ZeroDensity.PageRegularAverage +import OAI.NumberTheory.Ostmann.Construction.SpectatorBulkComparison + +namespace OAI + +/-! # Exact bulk residue separation, with Page terms in the frequency block -/ + +namespace Ostmann +open scoped Classical BigOperators + +/-- The only moduli remaining after the internal line comparison. -/ +def bulkResidueModuli {I : Type*} (r : ℕ) (p : I → ℕ) : Unit ⊕ I → ℕ + | .inl _ => r + | .inr i => p i + +def bulkResidueAssemble {I : Type*} (r : ℕ) (p : I → ℕ) + (f : (ZMod r)ˣ) (g : ∀ i, (ZMod (p i))ˣ) : + ∀ i, (ZMod (bulkResidueModuli r p i))ˣ + | .inl _ => f + | .inr i => g i + +/-- Simultaneous CRT on all bulk slots, transposed into one frequency block +and one block for each spectator. -/ +noncomputable def bulkResidueEquiv {I J : Type*} [Fintype I] + (r : ℕ) (p : I → ℕ) + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) : + (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) ≃ + (J → (ZMod r)ˣ) × (∀ i, J → (ZMod (p i))ˣ) where + toFun x := (fun j => crtUnitEquiv (bulkResidueModuli r p) hc (x j) (.inl ()), + fun i j => crtUnitEquiv (bulkResidueModuli r p) hc (x j) (.inr i)) + invFun z j := (crtUnitEquiv (bulkResidueModuli r p) hc).symm + (bulkResidueAssemble r p (z.1 j) (fun i => z.2 i j)) + left_inv x := by + funext j + apply (crtUnitEquiv (bulkResidueModuli r p) hc).injective + rw [MulEquiv.apply_symm_apply] + funext i + rcases i with u | i + · cases u; rfl + · rfl + right_inv z := by + apply Prod.ext + · funext j + exact congrFun ((crtUnitEquiv (bulkResidueModuli r p) hc).apply_symm_apply _) (.inl ()) + · funext i j + exact congrFun ((crtUnitEquiv (bulkResidueModuli r p) hc).apply_symm_apply _) (.inr i) + +theorem bulkResidueEquiv_frequency_modEq {I J : Type*} [Fintype I] + (r : ℕ) [NeZero r] (p : I → ℕ) + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (x : J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) (j : J) : + Nat.ModEq r (x j).val.val ((bulkResidueEquiv r p hc x).1 j).val.val := by + apply (ZMod.natCast_eq_natCast_iff _ _ r).mp + simp only [ZMod.natCast_zmod_val] + change ((x j).val.val : ZMod r) = + ((show (ZMod r)ˣ from crtUnitEquiv (bulkResidueModuli r p) hc (x j) (.inl ())) : ZMod r) + rw [crtUnitEquiv_apply] + change ((x j).val.val : ZMod r) = + (ZMod.castHom (Finset.dvd_prod_of_mem (bulkResidueModuli r p) (Finset.mem_univ (Sum.inl () : Unit ⊕ I))) + (ZMod r)) (x j).val + have h := congrArg + (ZMod.castHom (Finset.dvd_prod_of_mem (bulkResidueModuli r p) (Finset.mem_univ (Sum.inl () : Unit ⊕ I))) + (ZMod r)) (ZMod.natCast_zmod_val (x j).val) + simpa only [map_natCast] using h + +/-- The conductor deletion confines every retained Page factor to the +frequency residue array. -/ +theorem bulkResidueEquiv_page {I J : Type*} [Fintype I] + (r : ℕ) [NeZero r] (p : I → ℕ) + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) + (hpage : pageAtModulus (∏ i, bulkResidueModuli r p i) (selectedPageZero P Q) = + pageAtModulus r (selectedPageZero P Q)) + (x : J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) (j : J) (y : ℝ) : + pageGiantWeight P Q (∏ i, bulkResidueModuli r p i) (x j).val.val y = + pageGiantWeight P Q r ((bulkResidueEquiv r p hc x).1 j).val.val y := by + calc + _ = pageGiantWeight P Q r (x j).val.val y := by simp only [pageGiantWeight, hpage] + _ = _ := pageGiantWeight_modEq P Q r _ _ (bulkResidueEquiv_frequency_modEq r p hc x j) y + +/-- Exact joint factorization, for arbitrary complex frequency amplitudes. +The spectator main terms have no residue-count or partition-count loss. -/ +theorem bulk_residue_page_average {I J : Type*} [Fintype I] [Fintype J] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) + (hpage : pageAtModulus (∏ i, bulkResidueModuli r p i) (selectedPageZero P Q) = + pageAtModulus r (selectedPageZero P Q)) + (y : J → ℝ) (F : (J → (ZMod r)ˣ) → ℂ) (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) : + (Fintype.card (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) : ℂ)⁻¹ * + (∑ x, (F (bulkResidueEquiv r p hc x).1 * + ∏ j, pageGiantWeight P Q (∏ i, bulkResidueModuli r p i) (x j).val.val (y j)) * + ∏ i, G i ((bulkResidueEquiv r p hc x).2 i)) = + ((Fintype.card (J → (ZMod r)ˣ) : ℂ)⁻¹ * + ∑ a, F a * ∏ j, pageGiantWeight P Q r (a j).val.val (y j)) * + ∏ i, ((Fintype.card (J → (ZMod (p i))ˣ) : ℂ)⁻¹ * ∑ b, G i b) := by + simp_rw [bulkResidueEquiv_page r p hc P Q hpage] + rw [uniform_equiv_product_average (bulkResidueEquiv (J := J) r p hc) + (fun a => F a * ∏ j, pageGiantWeight P Q r (a j).val.val (y j)) + (fun b => ∏ i, G i (b i)), product_uniform_mean_complex] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueCoprime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueCoprime.lean new file mode 100644 index 0000000000000000000000000000000000000000..294beda9e87b2751a67effa104af9d7d7ae8aef1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueCoprime.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.ZeroDensity.BulkProgressionCutoff + +namespace OAI + +/-! # CRT coprimality for the actual frequency and spectator moduli -/ + +namespace Ostmann +open Filter +open scoped Classical BigOperators + +theorem bulkResidueModuli_pairwise {I : Type*} (r : ℕ) (p : I → ℕ) + (hp : ∀ i, (p i).Prime) (hinj : Function.Injective p) + (hcop : ∀ i, r.Coprime (p i)) : + Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j)) := by + intro i j hij + rcases i with u | i <;> rcases j with v | j + · cases u + cases v + exact False.elim (hij rfl) + · exact hcop j + · exact (hcop i).symm + · apply (Nat.coprime_primes (hp i) (hp j)).mpr + exact fun he => hij (congrArg Sum.inr (hinj he)) + +theorem bulkResidueModuli_pairwise_of_lt {I : Type*} (r : ℕ) (hr : 0 < r) + (p : I → ℕ) (hp : ∀ i, (p i).Prime) (hinj : Function.Injective p) + (hrp : ∀ i, r < p i) : + Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j)) := by + apply bulkResidueModuli_pairwise r p hp hinj + intro i + exact ((hp i).coprime_iff_not_dvd.mpr (Nat.not_dvd_of_pos_of_lt hr (hrp i))).symm + +theorem bulkResidueModulus_positive {I : Type*} [Fintype I] (r : ℕ) (hr : 0 < r) + (p : I → ℕ) (hp : ∀ i, 0 < p i) : 0 < ∏ i, bulkResidueModuli r p i := by + apply Finset.prod_pos + intro i _ + rcases i with u | i + · exact hr + · exact hp i + +/-- The split-prime lower range eventually exceeds every fixed-depth +frequency modulus; this supplies the cross-block CRT coprimality. -/ +theorem frequency_modulus_lt_spectators (F K a : ℝ) + (hF : 0 ≤ F) (hK : 0 ≤ K) (ha : 0 < a) : + ∀ᶠ L : ℝ in atTop, ∀ (m r : ℕ) (p : Fin m → ℕ), + (m : ℝ) ≤ K * L → (r : ℝ) ≤ Real.exp (F * m) → + (∀ i, Real.exp (Real.exp (a * L)) ≤ (p i : ℝ)) → ∀ i, r < p i := by + filter_upwards [arithmetic_exponent_absorption 0 a 0 (F * K + 1) 1 1 ha ha ha (by norm_num), + eventually_ge_atTop (1 : ℝ)] with L hrate hL + intro m r p hm hr hp i + have hL0 : 0 ≤ L := by linarith + have hexp : F * K * L < Real.exp (a * L) := by + simp only [zero_mul, Real.exp_zero, mul_one, pow_one] at hrate + nlinarith [mul_nonneg (mul_nonneg hF hK) hL0] + have hri : (r : ℝ) < p i := + (hr.trans (Real.exp_le_exp.mpr (by nlinarith [mul_le_mul_of_nonneg_left hm hF]))).trans_lt + ((Real.exp_lt_exp.mpr hexp).trans_le (hp i)) + exact_mod_cast hri + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueIntegral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..69ba5861329aaeef89d731c0ca86034179bac307 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueIntegral.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkPageProductIntegral +import OAI.NumberTheory.Ostmann.Arithmetic.BulkIntegrands + +namespace OAI + +/-! # Keeping residue sums inside the real bulk integral -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +/-- The full bounded sharp kernel is integrable against the product density. -/ +theorem BulkIntegrand.page_density_integrable {J : Type*} [Fintype J] + (f : BulkIntegrand J) (P : PublishedProgressionInput) (Q : ℕ) + (q a : J → ℕ) (u v : J → ℝ) (hu : ∀ j, 0 < u j) : + Integrable (fun x => f x * ∏ j, (selectedPrimeLogDensity P Q (q j) (a j) (x j) : ℂ)) + (Measure.pi (fun j => volume.restrict (Set.Ioc (u j) (v j)))) := by + have hp : Integrable (fun x : J → ℝ => ∏ j, (selectedPrimeLogDensity P Q (q j) (a j) (x j) : ℂ)) + (Measure.pi (fun j => volume.restrict (Set.Ioc (u j) (v j)))) := by + exact Integrable.fintype_prod (f := fun j x => + (selectedPrimeLogDensity P Q (q j) (a j) x : ℂ)) + (fun j => (selectedPrimeLogDensity_integrable P Q (q j) (a j) (u j) (v j) (hu j)).ofReal) + obtain ⟨C, _, hC⟩ := f.bounded + exact hp.bdd_mul f.measurable.aestronglyMeasurable (Filter.Eventually.of_forall hC) + +/-- Residue classes are summed inside the real integral. In particular there +is no number-of-boxes factor on the main term. -/ +theorem bulk_page_residue_integral {J Z : Type*} [Fintype J] [Fintype Z] + (P : PublishedProgressionInput) (Q : ℕ) (q : J → ℕ) (a : Z → J → ℕ) + (u v : J → ℝ) (hu : ∀ j, 0 < u j) (f : Z → BulkIntegrand J) : + (∑ z, ∫ x, f z x ∂Measure.pi (fun j => primeGiantMeasure P Q (q j) (a z j) (u j) (v j))) = + ∫ x, ∑ z, f z x * ∏ j, (selectedPrimeLogDensity P Q (q j) (a z j) (x j) : ℂ) + ∂Measure.pi (fun j => volume.restrict (Set.Ioc (u j) (v j))) := by + simp_rw [bulk_page_product_integral P Q q _ u v hu] + exact (integral_finsetSum _ (fun z _ => (f z).page_density_integrable P Q q (a z) u v hu)).symm + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueMixtures.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueMixtures.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe248a0b9ae45bee360dd58e36f2c5096987b88f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResidueMixtures.lean @@ -0,0 +1,27 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkProductMixtures +import OAI.NumberTheory.Ostmann.Arithmetic.BulkCoordinateEnumeration + +namespace OAI + +/-! # Exact joint cell and residue reconstruction -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +/-- Sum the residue classes before estimating. The common original +normalization stays outside the sum, and the cell boxes are counted once. -/ +theorem bulk_residue_mixture_integral {J C R : Type*} + [Fintype J] [Fintype C] [Fintype R] + (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (μ : R → J → C → Measure ℝ) [∀ z j c, IsFiniteMeasure (μ z j c)] + (f : R → BulkIntegrand J) : + (∑ z, ∫ y, f z y ∂Measure.pi (fun j => bulkCellMixture (Z j) (μ z j))) = + ((∏ j, Z j : ℝ) : ℂ) * ∑ c : J → C, ∑ z, + ∫ y, f z y ∂Measure.pi (fun j => μ z j (c j)) := by + simp_rw [BulkIntegrand.integral_product_mixtures _ Z hZ] + rw [← Finset.mul_sum, Finset.sum_comm] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResiduePageBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResiduePageBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..7340401313199772961791dbd258170443d3db6e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkResiduePageBound.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResidueCRT + +namespace OAI + +/-! # Norm bound after exact bulk CRT separation -/ + +namespace Ostmann +open scoped Classical BigOperators + +noncomputable def bulkFrequencyPageMean {J : Type*} [Fintype J] + (P : PublishedProgressionInput) (Q r : ℕ) [NeZero r] + (y : J → ℝ) (F : (J → (ZMod r)ˣ) → ℂ) : ℂ := + (Fintype.card (J → (ZMod r)ˣ) : ℂ)⁻¹ * + ∑ a, F a * ∏ j, pageGiantWeight P Q r (a j).val.val (y j) + +noncomputable def bulkSpectatorMean {J : Type*} [Fintype J] + (p : ℕ) [NeZero p] (G : (J → (ZMod p)ˣ) → ℂ) : ℂ := + (Fintype.card (J → (ZMod p)ˣ) : ℂ)⁻¹ * ∑ b, G b + +noncomputable def bulkResiduePageMean {I J : Type*} [Fintype I] [Fintype J] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) (y : J → ℝ) + (F : (J → (ZMod r)ˣ) → ℂ) (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) : ℂ := + (Fintype.card (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) : ℂ)⁻¹ * + (∑ x, (F (bulkResidueEquiv r p hc x).1 * + ∏ j, pageGiantWeight P Q (∏ i, bulkResidueModuli r p i) (x j).val.val (y j)) * + ∏ i, G i ((bulkResidueEquiv r p hc x).2 i)) + +theorem bulk_residue_page_bound {I J : Type*} [Fintype I] [Fintype J] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) + (hpage : pageAtModulus (∏ i, bulkResidueModuli r p i) (selectedPageZero P Q) = + pageAtModulus r (selectedPageZero P Q)) + (y : J → ℝ) (F : (J → (ZMod r)ˣ) → ℂ) (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) + (δ : ℝ) (hlocal : ∀ i, ‖bulkSpectatorMean (p i) (G i)‖ ≤ δ) : + ‖bulkResiduePageMean r p hc P Q y F G‖ ≤ + ‖bulkFrequencyPageMean P Q r y F‖ * δ ^ Fintype.card I := by + have he : (Fintype.card (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) : ℂ)⁻¹ * + (∑ x, (F (bulkResidueEquiv r p hc x).1 * + ∏ j, pageGiantWeight P Q (∏ i, bulkResidueModuli r p i) (x j).val.val (y j)) * + ∏ i, G i ((bulkResidueEquiv r p hc x).2 i)) = + bulkFrequencyPageMean P Q r y F * ∏ i, bulkSpectatorMean (p i) (G i) := + bulk_residue_page_average r p hc P Q hpage y F G + have hs : ‖∏ i, bulkSpectatorMean (p i) (G i)‖ ≤ δ ^ Fintype.card I := by + rw [norm_prod] + calc + _ ≤ ∏ _i : I, δ := Finset.prod_le_prod₀ (fun _ _ => norm_nonneg _) (fun i _ => hlocal i) + _ = _ := by simp only [Finset.prod_const, Finset.card_univ] + calc + _ = ‖bulkFrequencyPageMean P Q r y F * ∏ i, bulkSpectatorMean (p i) (G i)‖ := congrArg norm he + _ = ‖bulkFrequencyPageMean P Q r y F‖ * ‖∏ i, bulkSpectatorMean (p i) (G i)‖ := norm_mul _ _ + _ ≤ _ := mul_le_mul_of_nonneg_left hs (norm_nonneg _) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSeparatedKernelBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSeparatedKernelBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..f53732caf2ac9f689e8cc686ec7552bfb73a2d74 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSeparatedKernelBound.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSignedBoxBound +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResidueMixtures + +namespace OAI + +/-! # Integrating a separated kernel over the original bulk cell mixtures -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +noncomputable def BulkIntegrand.constMul {J : Type*} + (f : BulkIntegrand J) (a : ℂ) : BulkIntegrand J where + toFun y := a * f y + measurable := measurable_const.mul f.measurable + bounded := by + obtain ⟨C, hC, hf⟩ := f.bounded + exact ⟨‖a‖ * C, mul_nonneg (norm_nonneg _) hC, fun y => by + simpa only [norm_mul] using mul_le_mul_of_nonneg_left (hf y) (norm_nonneg a)⟩ + +theorem bulk_separated_kernel_bound {I J C : Type*} [Fintype I] [Fintype J] [Fintype C] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) + (hpage : pageAtModulus (∏ i, bulkResidueModuli r p i) (selectedPageZero P Q) = + pageAtModulus r (selectedPageZero P Q)) + (u v : J → C → ℝ) (hu : ∀ j c, 0 < u j c) + (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (hmass : ∀ j, Z j * ∑ c, ∫ x in Set.Ioc (u j c) (v j c), (x : ℝ)⁻¹ ≤ 2) + (K : BulkIntegrand J) (F : (J → (ZMod r)ˣ) → ℂ) + (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) + (W A δ : ℝ) (hW : 0 ≤ W) (hA : 0 ≤ A) (hδ : 0 ≤ δ) + (hK : ∀ y, ‖K y‖ ≤ W) (hF : ∀ a, ‖F a‖ ≤ A) + (hlocal : ∀ i, ‖(Fintype.card (J → (ZMod (p i))ˣ) : ℂ)⁻¹ * ∑ z, G i z‖ ≤ δ) : + let H := fun z => K.constMul (F (bulkResidueEquiv r p hc z).1 * + ∏ i, G i ((bulkResidueEquiv r p hc z).2 i)) + ‖∑ z, ∫ y, H z y ∂Measure.pi (fun j => bulkCellMixture (Z j) + (fun c => primeGiantMeasure P Q (∏ i, bulkResidueModuli r p i) + (z j).val.val (u j c) (v j c)))‖ ≤ + (W * A) * 4 ^ Fintype.card J * δ ^ Fintype.card I := by + let H := fun (z : J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) => + K.constMul (F (bulkResidueEquiv r p hc z).1 * ∏ i, G i ((bulkResidueEquiv r p hc z).2 i)) + let μ := fun (z : J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) j c => + primeGiantMeasure P Q (∏ i, bulkResidueModuli r p i) (z j).val.val (u j c) (v j c) + let _ : ∀ z j c, IsFiniteMeasure (μ z j c) := fun z j c => + finite_primeGiantMeasure P Q _ _ _ _ (hu j c) + change ‖∑ z, ∫ y, H z y ∂Measure.pi (fun j => bulkCellMixture (Z j) (μ z j))‖ ≤ _ + rw [bulk_residue_mixture_integral Z hZ μ H] + apply bulk_signed_box_bound r p hc P Q hpage u v hu Z hZ hmass + (fun _ y a => K y * F a) G (W * A) δ (mul_nonneg hW hA) hδ + · intro _ y _ a + rw [norm_mul] + exact mul_le_mul (hK y) (hF a) (norm_nonneg _) hW + · exact hlocal + · intro _ z y + change (F _ * ∏ i, G i _) * K y = (K y * F _) * ∏ i, G i _ + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSeparatedPrimeBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSeparatedPrimeBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..7eb1ac33a74b72fbdb3290ad81a2a6454d86e9c5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSeparatedPrimeBound.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.RestoredBulkSignedBound + +namespace OAI + +/-! # The separated signed bound under the restored original prime weights -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +theorem bulk_separated_prime_bound {I J C : Type*} + [Fintype I] [Fintype J] [Fintype C] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (primes : Finset ℕ) (u v : J → C → ℝ) (hu : ∀ j c, 0 < u j c) + (c₀ : C × (ZMod (∏ i, bulkResidueModuli r p i))ˣ) + (hP : ∀ j, primeCellSupport (∏ i, bulkResidueModuli r p i) + (fun c : C × (ZMod (∏ i, bulkResidueModuli r p i))ˣ => c.2.val.val) + (fun c => u j c.1) (fun c => v j c.1) ⊆ primes) + (hsep : ∀ j (c d : C × (ZMod (∏ i, bulkResidueModuli r p i))ˣ), c ≠ d → + ¬Nat.ModEq (∏ i, bulkResidueModuli r p i) c.2.val.val d.2.val.val ∨ + v j c.1 ≤ u j d.1 ∨ v j d.1 ≤ u j c.1) + (D : J → Finset ℕ) + (hD : ∀ j, (∑ q ∈ primeCellSupport (∏ i, bulkResidueModuli r p i) + (fun c : C × (ZMod (∏ i, bulkResidueModuli r p i))ˣ => c.2.val.val) + (fun c => u j c.1) (fun c => v j c.1) \ D j, (q : ℝ)⁻¹) ≠ 0) + (K : BulkIntegrand J) (F : (J → (ZMod r)ˣ) → ℂ) + (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) + (W A δ : ℝ) (hW : 0 ≤ W) (hA : 0 ≤ A) (hδ : 0 ≤ δ) + (hK : ∀ y, ‖K y‖ ≤ W) (hF : ∀ a, ‖F a‖ ≤ A) + (hlocal : ∀ i, ‖(Fintype.card (J → (ZMod (p i))ˣ) : ℂ)⁻¹ * ∑ z, G i z‖ ≤ δ) + (input : PublishedProgressionInput) (Q : ℕ) + (hpage : pageAtModulus (∏ i, bulkResidueModuli r p i) (selectedPageZero input Q) = + pageAtModulus r (selectedPageZero input Q)) + (err : (J → C) → (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) → ℝ) + (herror : ∀ c z, + ‖(∫ y, K y ∂Measure.pi (fun j => primeLogCellMeasure (∏ i, bulkResidueModuli r p i) + (z j).val.val (u j (c j)) (v j (c j)))) - + ∫ y, K y ∂Measure.pi (fun j => primeGiantMeasure input Q (∏ i, bulkResidueModuli r p i) + (z j).val.val (u j (c j)) (v j (c j)))‖ ≤ err c z) : + let M := ∏ i, bulkResidueModuli r p i + let S := fun j => primeCellSupport M (fun c : C × (ZMod M)ˣ => c.2.val.val) + (fun c => u j c.1) (fun c => v j c.1) + let Z := fun j => (∑ q ∈ S j \ D j, (q : ℝ)⁻¹)⁻¹ + let label := fun (x : J → primes) j => primeCellLabel M + (fun c : C × (ZMod M)ˣ => c.2.val.val) (fun c => u j c.1) (fun c => v j c.1) c₀ (x j) + let a := fun z => F (bulkResidueEquiv r p hc z).1 * ∏ i, G i ((bulkResidueEquiv r p hc z).2 i) + (∀ j, Z j * ∑ c, ∫ x in Set.Ioc (u j c) (v j c), (x : ℝ)⁻¹ ≤ 2) → + ‖∑ x : J → primes, + ((∏ j, (if (x j : ℕ) ∈ S j then Z j * (x j : ℝ)⁻¹ else 0) : ℝ) : ℂ) * + (a (fun j => (label x j).2) * K (fun j => Real.log (x j : ℕ)))‖ ≤ + (W * A) * 4 ^ Fintype.card J * δ ^ Fintype.card I + + (∏ j, Z j) * ∑ c : J → C, ∑ z, ‖a z‖ * err c z := by + dsimp only + intro hmass + apply restored_bulk_prime_bound primes _ u v hu c₀ hP hsep D hD K + (fun z => F (bulkResidueEquiv r p hc z).1 * ∏ i, G i ((bulkResidueEquiv r p hc z).2 i)) + input Q err herror ((W * A) * 4 ^ Fintype.card J * δ ^ Fintype.card I) + exact bulk_separated_kernel_bound r p hc input Q hpage u v hu _ + (fun j => by positivity) hmass K F G W A δ hW hA hδ hK hF hlocal + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSignedBoxBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSignedBoxBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0d83c084e9a5e8a584aab96de9f2bc118da719b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSignedBoxBound.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSignedIntegralBound +import OAI.NumberTheory.Ostmann.Arithmetic.BulkBoxReassembly +import OAI.NumberTheory.Ostmann.Construction.HarmonicBoxMass + +namespace OAI + +/-! # Reassembling the signed bulk integral over all original cells -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +/-- Summing all boxes with their original harmonic normalization costs only +an exponential in the number of slots. The spectator gain is retained. -/ +theorem bulk_signed_box_bound {I J C : Type*} [Fintype I] [Fintype J] [Fintype C] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) + (hpage : pageAtModulus (∏ i, bulkResidueModuli r p i) (selectedPageZero P Q) = + pageAtModulus r (selectedPageZero P Q)) + (u v : J → C → ℝ) (hu : ∀ j c, 0 < u j c) + (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (hmass : ∀ j, Z j * ∑ c, ∫ x in Set.Ioc (u j c) (v j c), (x : ℝ)⁻¹ ≤ 2) + (F : (J → C) → (J → ℝ) → (J → (ZMod r)ˣ) → ℂ) + (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) (A δ : ℝ) (hA : 0 ≤ A) (hδ : 0 ≤ δ) + (hF : ∀ c y, (∀ j, y j ∈ Set.Ioc (u j (c j)) (v j (c j))) → ∀ a, ‖F c y a‖ ≤ A) + (hlocal : ∀ i, ‖(Fintype.card (J → (ZMod (p i))ˣ) : ℂ)⁻¹ * ∑ z, G i z‖ ≤ δ) + (f : (J → C) → (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) → BulkIntegrand J) + (hf : ∀ c z y, f c z y = F c y (bulkResidueEquiv r p hc z).1 * + ∏ i, G i ((bulkResidueEquiv r p hc z).2 i)) : + ‖((∏ j, Z j : ℝ) : ℂ) * ∑ c : J → C, ∑ z, ∫ y, f c z y ∂Measure.pi (fun j => + primeGiantMeasure P Q (∏ i, bulkResidueModuli r p i) (z j).val.val (u j (c j)) (v j (c j)))‖ ≤ + A * 4 ^ Fintype.card J * δ ^ Fintype.card I := by + let H := fun j c => ∫ x in Set.Ioc (u j c) (v j c), (x : ℝ)⁻¹ + have hH (j : J) (c : C) : 0 ≤ H j c := by + apply integral_nonneg_of_ae + filter_upwards [ae_restrict_mem measurableSet_Ioc] with x hx + exact inv_nonneg.mpr ((hu j c).trans hx.1).le + let E := fun c : J → C => ∑ z, ∫ y, f c z y ∂Measure.pi (fun j => + primeGiantMeasure P Q (∏ i, bulkResidueModuli r p i) (z j).val.val (u j (c j)) (v j (c j))) + have hE (c : J → C) : ‖E c‖ ≤ ((A * 2 ^ Fintype.card J) * δ ^ Fintype.card I) * + ∏ j, H j (c j) := + bulk_signed_integral_bound r p hc P Q hpage (fun j => u j (c j)) (fun j => v j (c j)) + (fun j => hu j (c j)) (F c) G A δ hA hδ (hF c) hlocal (f c) (hf c) + have h := bulk_box_sum_bound Z hZ H hH hmass ((A * 2 ^ Fintype.card J) * δ ^ Fintype.card I) + (mul_nonneg (mul_nonneg hA (by positivity)) (pow_nonneg hδ _)) E hE + refine h.trans_eq ?_ + rw [show (4 : ℝ) = 2 * 2 by norm_num, mul_pow] + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSignedIntegralBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSignedIntegralBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..964eff2e7fa94667c6778a5db97e0ad75e5a603e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSignedIntegralBound.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResidueIntegral +import OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkPageBound +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSeparatedAverageNorm + +namespace OAI + +/-! # Integrating the good-matching bulk gain with the retained Page factor -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +theorem bulk_frequency_page_mean_le {J : Type*} [Fintype J] + (P : PublishedProgressionInput) (Q r : ℕ) [NeZero r] + (y : J → ℝ) (hy : ∀ j, 0 ≤ y j) (F : (J → (ZMod r)ˣ) → ℂ) + (C : ℝ) (hC : 0 ≤ C) (hF : ∀ a, ‖F a‖ ≤ C) : + ‖bulkFrequencyPageMean P Q r y F‖ ≤ C * 2 ^ Fintype.card J := by + have hc : (Fintype.card (J → (ZMod r)ˣ) : ℝ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + unfold bulkFrequencyPageMean + rw [norm_mul, norm_inv, Complex.norm_natCast] + calc + _ ≤ (Fintype.card (J → (ZMod r)ˣ) : ℝ)⁻¹ * ∑ _a : J → (ZMod r)ˣ, C * 2 ^ Fintype.card J := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro a _ + rw [norm_mul, norm_prod] + apply mul_le_mul (hF a) _ (Finset.prod_nonneg fun j _ => norm_nonneg _) hC + calc + _ ≤ ∏ _j : J, (2 : ℝ) := Finset.prod_le_prod₀ (fun j _ => norm_nonneg _) + (fun j _ => pageGiantWeight_norm_le_two P Q r (a j).val.val (y j) (hy j)) + _ = _ := by simp only [Finset.prod_const, Finset.card_univ] + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + rw [← mul_assoc, inv_mul_cancel₀ hc, one_mul] + +theorem bulk_signed_integral_bound {I J : Type*} [Fintype I] [Fintype J] + (r : ℕ) [NeZero r] (p : I → ℕ) [∀ i, NeZero (p i)] + [NeZero (∏ i, bulkResidueModuli r p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (P : PublishedProgressionInput) (Q : ℕ) + (hpage : pageAtModulus (∏ i, bulkResidueModuli r p i) (selectedPageZero P Q) = + pageAtModulus r (selectedPageZero P Q)) + (u v : J → ℝ) (hu : ∀ j, 0 < u j) + (F : (J → ℝ) → (J → (ZMod r)ˣ) → ℂ) + (G : ∀ i, (J → (ZMod (p i))ˣ) → ℂ) (C δ : ℝ) (hC : 0 ≤ C) (hδ : 0 ≤ δ) + (hF : ∀ y, (∀ j, y j ∈ Set.Ioc (u j) (v j)) → ∀ a, ‖F y a‖ ≤ C) + (hlocal : ∀ i, ‖(Fintype.card (J → (ZMod (p i))ˣ) : ℂ)⁻¹ * ∑ z, G i z‖ ≤ δ) + (f : (J → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) → BulkIntegrand J) + (hf : ∀ z y, f z y = F y (bulkResidueEquiv r p hc z).1 * + ∏ i, G i ((bulkResidueEquiv r p hc z).2 i)) : + ‖∑ z, ∫ y, f z y ∂Measure.pi (fun j => + primeGiantMeasure P Q (∏ i, bulkResidueModuli r p i) (z j).val.val (u j) (v j))‖ ≤ + (C * 2 ^ Fintype.card J) * δ ^ Fintype.card I * + ∏ j, ∫ x in Set.Ioc (u j) (v j), (x : ℝ)⁻¹ := by + let μ : J → Measure ℝ := fun j => volume.restrict (Set.Ioc (u j) (v j)) + have hi (j : J) : Integrable (fun x : ℝ => x⁻¹) (μ j) := by + have hc : ContinuousOn (fun x : ℝ => x⁻¹) (Set.Icc (u j) (v j)) := + continuousOn_inv₀.mono (fun x hx => ne_of_gt (lt_of_lt_of_le (hu j) hx.1)) + exact hc.integrableOn_Icc.mono_set Set.Ioc_subset_Icc_self + have hp : Integrable (fun y : J → ℝ => ∏ j, (y j)⁻¹) (Measure.pi μ) := + Integrable.fintype_prod hi + rw [bulk_page_residue_integral P Q (fun _ => ∏ i, bulkResidueModuli r p i) + (fun z j => (z j).val.val) u v hu f] + have hb : ∀ᵐ y ∂Measure.pi μ, + ‖∑ z, f z y * ∏ j, (selectedPrimeLogDensity P Q (∏ i, bulkResidueModuli r p i) + (z j).val.val (y j) : ℂ)‖ ≤ + ((C * 2 ^ Fintype.card J) * δ ^ Fintype.card I) * ∏ j, (y j)⁻¹ := by + have hm : ∀ᵐ y ∂Measure.pi μ, ∀ j, y j ∈ Set.Ioc (u j) (v j) := + Filter.eventually_all.mpr (fun j => + (Measure.tendsto_eval_ae_ae (μ := μ) (i := j)).eventually (ae_restrict_mem measurableSet_Ioc)) + filter_upwards [hm] with y hy + have hny (j : J) : 0 < y j := (hu j).trans (hy j).1 + simp_rw [hf] + have hb := bulk_prime_density_norm r p hc P Q hpage y (F y) G δ hlocal + have hw := bulk_frequency_page_mean_le P Q r y (fun j => (hny j).le) (F y) C hC (hF y hy) + have he (j : J) : ‖(y j : ℂ)⁻¹‖ = (y j)⁻¹ := by + rw [norm_inv, Complex.norm_real, Real.norm_of_nonneg (hny j).le] + simp_rw [he] at hb + exact hb.trans (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right hw (pow_nonneg hδ _)) + (Finset.prod_nonneg fun j _ => inv_nonneg.mpr (hny j).le)) + have hn := norm_integral_le_of_norm_le + (hp.const_mul ((C * 2 ^ Fintype.card J) * δ ^ Fintype.card I)) hb + simpa only [integral_const_mul, integral_fintype_prod_eq_prod] using hn + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotFieldBridge.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotFieldBridge.lean new file mode 100644 index 0000000000000000000000000000000000000000..036a13e2127d37dd85863c0ed91edbc20179db06 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotFieldBridge.lean @@ -0,0 +1,92 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFieldDiagram +import OAI.NumberTheory.Ostmann.Construction.SpectatorBulkComparison + +namespace OAI + +/-! # The original labelled bulk slots produce the quartet leaf arrays -/ + +namespace Ostmann +open scoped Classical BigOperators ComplexConjugate + +theorem treeNaturalLift_iff_indexed {q : ℕ} (n : ℕ) + (x : TreeLeafTuple ℕ n) (y : TreeLeafTuple (ZMod q)ˣ n) : + TreeNaturalLift n x y ↔ ∀ j : TreeLeafIndex n, + (treeLeafTupleEquiv ℕ n x j : ZMod q) = (treeLeafTupleEquiv (ZMod q)ˣ n y j : ZMod q) := by + induction n with + | zero => + constructor + · intro h _; exact h + · intro h; exact h () + | succ n ih => + constructor + · rintro ⟨hL, hR⟩ (j | j) + · exact (ih x.1 y.1).mp hL j + · exact (ih x.2 y.2).mp hR j + · intro h + exact ⟨(ih x.1 y.1).mpr (fun j => h (.inl j)), + (ih x.2 y.2).mpr (fun j => h (.inr j))⟩ + +theorem movingSlotValues_indexed {σ : Type*} (value : σ → ℕ) (n : ℕ) + (s : TreeLeafTuple (List σ) n) (j : TreeLeafIndex n) : + treeLeafTupleEquiv ℕ n (movingSlotValues value n s) j = + MovingSlotReversal.naturalProduct value (treeLeafTupleEquiv (List σ) n s j) := by + induction n with + | zero => rfl + | succ n ih => + cases j with + | inl j => exact ih s.1 j + | inr j => exact ih s.2 j + +noncomputable def bulkSlotLeaves {σ : Type*} (n m : ℕ) + (slot : TreeLeafIndex n × Fin m → σ) : TreeLeafTuple (List σ) n := + (treeLeafTupleEquiv (List σ) n).symm (fun j => List.ofFn (fun i => slot (j, i))) + +theorem bulkSlotLeaves_naturalLift {σ : Type*} {q : ℕ} (value : σ → ℕ) + (n m : ℕ) (slot : TreeLeafIndex n × Fin m → σ) + (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) + (hz : ∀ j, (value (slot j) : ZMod q) = (z j : ZMod q)) : + TreeNaturalLift n (movingSlotValues value n (bulkSlotLeaves n m slot)) + ((treeLeafTupleEquiv (ZMod q)ˣ n).symm (bulkBlockProduct z)) := by + rw [treeNaturalLift_iff_indexed] + intro j + rw [movingSlotValues_indexed] + simp only [bulkSlotLeaves, Equiv.apply_symm_apply, MovingSlotReversal.naturalProduct, + List.map_ofFn, List.prod_ofFn, Nat.cast_prod, bulkBlockProduct, Units.coe_prod] + exact Finset.prod_congr rfl (fun i _ => hz (j, i)) + +/-- The same labelled slot map is used in both histories, with precisely the +specified permutation. The rational diagrams are chosen before the bulk primes. -/ +theorem moving_field_pair_bulk_slots {σ : Type*} {q : ℕ} [Fact q.Prime] + (value : σ → ℕ) (n m : ℕ) (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (hfreq : ∀ side, movingGiantFrequencyUnits q n (t side)) + (hsmall : ∀ side, ((treeLeafProduct n (movingSlotValues value n (small side)) : ℕ) : ZMod q) ≠ 0) + (hsamples : ∀ side, ((samples side).values value).UnitsAt q) + (D A B : Bool → (ZMod q)ˣ) : + ∃ d : Bool → SpectatorDiagram q n, + (∀ side, (d side).conjugations = transferConjugations n false) ∧ + ∀ (g : ZMod q → ℂ) (slot : TreeLeafIndex n × Fin m → σ) + (e : Equiv.Perm (TreeLeafIndex n × Fin m)) (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ), + (∀ j, (value (slot j) : ZMod q) = (z j : ZMod q)) → + movingModularSpectator value q g (D false) + (buildMovingSlotData n (t false) (small false) (bulkSlotLeaves n m slot) (samples false)) + (A false) (B false) * + conj (movingModularSpectator value q g (D true) + (buildMovingSlotData n (t true) (small true) (bulkSlotLeaves n m (slot ∘ e.symm)) (samples true)) + (A true) (B true)) = + (d false).bulkValue g z * conj ((d true).bulkValue g (z ∘ e.symm)) := by + obtain ⟨d, hc, hd⟩ := moving_field_pair_diagrams value n t small samples hfreq hsmall hsamples D A B + refine ⟨d, hc, ?_⟩ + intro g slot e z hz + let bulk := fun b : Bool => if b then bulkSlotLeaves n m (slot ∘ e.symm) else bulkSlotLeaves n m slot + let Z := fun b : Bool => if b then (treeLeafTupleEquiv (ZMod q)ˣ n).symm (bulkBlockProduct (z ∘ e.symm)) + else (treeLeafTupleEquiv (ZMod q)ˣ n).symm (bulkBlockProduct z) + have hlift (b : Bool) : TreeNaturalLift n (movingSlotValues value n (bulk b)) (Z b) := by + cases b + · exact bulkSlotLeaves_naturalLift value n m slot z hz + · exact bulkSlotLeaves_naturalLift value n m (slot ∘ e.symm) (z ∘ e.symm) (fun j => hz (e.symm j)) + exact hd g bulk Z hlift + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotNodup.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotNodup.lean new file mode 100644 index 0000000000000000000000000000000000000000..b42e61c689cc7b9afdb4f174269de173d8541bce --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotNodup.lean @@ -0,0 +1,116 @@ +import Mathlib.Data.List.FinRange +import OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkNodup +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSlotFieldBridge + +namespace OAI + +/-! # Distinct selected bulk labels in the concrete leaf constructor -/ + +namespace Ostmann +open scoped Classical + +theorem mem_flatten_bulkSlotLeaves {σ : Type*} (n m : ℕ) + (slot : TreeLeafIndex n × Fin m → σ) (i : σ) : + i ∈ flattenMovingSlots n (bulkSlotLeaves n m slot) ↔ ∃ j, slot j = i := by + induction n with + | zero => + change i ∈ List.ofFn (fun j => slot ((), j)) ↔ ∃ j, slot j = i + rw [List.mem_ofFn] + constructor + · rintro ⟨j, hj⟩; exact ⟨((), j), hj⟩ + · rintro ⟨⟨u, j⟩, hj⟩; cases u; exact ⟨j, hj⟩ + | succ n ih => + change i ∈ (flattenMovingSlots n (bulkSlotLeaves n m (fun j => slot (.inl j.1, j.2))) ++ + flattenMovingSlots n (bulkSlotLeaves n m (fun j => slot (.inr j.1, j.2)))) ↔ _ + rw [List.mem_append, ih, ih] + constructor + · rintro (⟨j, hj⟩ | ⟨j, hj⟩) + · exact ⟨(.inl j.1, j.2), hj⟩ + · exact ⟨(.inr j.1, j.2), hj⟩ + · rintro ⟨⟨j | j, k⟩, h⟩ + · exact Or.inl ⟨(j, k), h⟩ + · exact Or.inr ⟨(j, k), h⟩ + +theorem bulkSlotLeaves_nodup {σ : Type*} (n m : ℕ) + (slot : TreeLeafIndex n × Fin m → σ) (hinj : Function.Injective slot) : + (flattenMovingSlots n (bulkSlotLeaves n m slot)).Nodup := by + induction n with + | zero => + apply List.nodup_ofFn_ofInjective + intro i j h + exact congrArg Prod.snd (hinj h) + | succ n ih => + change (flattenMovingSlots n (bulkSlotLeaves n m (fun j => slot (.inl j.1, j.2))) ++ + flattenMovingSlots n (bulkSlotLeaves n m (fun j => slot (.inr j.1, j.2)))).Nodup + refine List.nodup_append.mpr ⟨ih _ ?_, ih _ ?_, ?_⟩ + · intro i j h + have h' := hinj h + have hi : i.1 = j.1 := Sum.inl.inj + (congrArg (fun x : TreeLeafIndex (n + 1) × Fin m => x.1) h') + have hj : i.2 = j.2 := congrArg (fun x : TreeLeafIndex (n + 1) × Fin m => x.2) h' + exact Prod.ext hi hj + · intro i j h + have h' := hinj h + have hi : i.1 = j.1 := Sum.inr.inj + (congrArg (fun x : TreeLeafIndex (n + 1) × Fin m => x.1) h') + have hj : i.2 = j.2 := congrArg (fun x : TreeLeafIndex (n + 1) × Fin m => x.2) h' + exact Prod.ext hi hj + · intro a ha b hb hab + obtain ⟨j, hj⟩ := (mem_flatten_bulkSlotLeaves n m _ a).mp ha + obtain ⟨k, hk⟩ := (mem_flatten_bulkSlotLeaves n m _ b).mp hb + have h' := congrArg Prod.fst (hinj (hj.trans (hab.trans hk.symm))) + cases h' + +theorem buildMovingSlotData_root_bulk_nodup {σ : Type*} (n m : ℕ) + (bulk : σ → Bool) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (hbulk : ∀ j, bulk (slot j) = true) + (t : FrequencyTree ℤ n) (small : TreeLeafTuple (List σ) n) + (samples : MovingSampleSlots σ n) + (hsmall : ∀ i ∈ flattenMovingSlots n small, bulk i = false) : + ((buildMovingSlotData n t small (bulkSlotLeaves n m slot) samples).regularSlots.filter bulk).Nodup := by + have hs : (flattenMovingSlots n small).filter bulk = [] := by + apply List.filter_eq_nil_iff.mpr + intro i hi + simp [hsmall i hi] + have hb : (flattenMovingSlots n (bulkSlotLeaves n m slot)).filter bulk = + flattenMovingSlots n (bulkSlotLeaves n m slot) := by + apply List.filter_eq_self.mpr + intro i hi + obtain ⟨j, rfl⟩ := (mem_flatten_bulkSlotLeaves n m slot i).mp hi + exact hbulk j + have hp := (buildMovingSlotData_regular_perm n t small (bulkSlotLeaves n m slot) samples).filter bulk + rw [List.filter_append, hs, List.nil_append, hb] at hp + exact hp.nodup_iff.mpr (bulkSlotLeaves_nodup n m slot slot.injective) + +theorem buildMovingSlotData_bulk_nodup {σ : Type*} (n m : ℕ) + (bulk : σ → Bool) (tier : σ → ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (hbulk : ∀ j, bulk (slot j) = true) (htier : ∀ i, bulk i = true → n ≤ tier i) + (t : FrequencyTree ℤ n) (small : TreeLeafTuple (List σ) n) + (samples : MovingSampleSlots σ n) + (hsmall : ∀ i ∈ flattenMovingSlots n small, bulk i = false) + (hsmallTier : ∀ i ∈ flattenMovingSlots n small, n ≤ tier i) + (hsamples : samples.Levels tier) : + ∀ L ∈ (buildMovingSlotData n t small (bulkSlotLeaves n m slot) samples).regularLists, + (L.filter bulk).Nodup := by + have hlevels := buildMovingSlotData_levels tier n t small (bulkSlotLeaves n m slot) samples + hsmallTier (fun i hi => by + obtain ⟨j, rfl⟩ := (mem_flatten_bulkSlotLeaves n m slot i).mp hi + exact htier _ (hbulk j)) hsamples + apply MovingSlotData.regularLists_bulk_nodup bulk _ + (buildMovingSlotData_regular_coherent n t small (bulkSlotLeaves n m slot) samples) + · intro i hi + exact MovingSlotData.compensationAbsent_of_levels tier _ hlevels i (htier i hi) + · exact buildMovingSlotData_root_bulk_nodup n m bulk slot hbulk t small samples hsmall + +theorem bulk_value_injective {σ J : Type*} (value : σ → ℕ) (bulk : σ → Bool) + (slot : J → σ) (hcover : ∀ i, bulk i = true → ∃ j, slot j = i) + (hinj : Function.Injective (value ∘ slot)) : + ∀ i j, bulk i = true → bulk j = true → value i = value j → i = j := by + intro i j hi hj hv + obtain ⟨a, rfl⟩ := hcover i hi + obtain ⟨b, rfl⟩ := hcover j hj + exact congrArg slot (hinj hv) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotPolynomials.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotPolynomials.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb7455cd9e5cd4cc0deec5ecd7f9c3290cfca06e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSlotPolynomials.lean @@ -0,0 +1,112 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.RealSlotEvaluation +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSampleSizes + +namespace OAI + +/-! # Polynomial dependence on one original bulk-prime slot -/ + +namespace Ostmann +open scoped Classical + +/-- A bulk coordinate never occurs in any compensation denominator. -/ +def MovingSlotData.CompensationAbsent {σ : Type*} (i : σ) : + {n : ℕ} → MovingSlotData σ n → Prop + | _, .leaf _ _ => True + | _, .node _ _ _ u left right => + i ∉ u ∧ left.CompensationAbsent i ∧ right.CompensationAbsent i + +theorem MovingSlotData.compensationAbsent_of_levels {σ : Type*} + (tier : σ → ℕ) {n : ℕ} (T : MovingSlotData σ n) + (hT : T.Levels tier) (i : σ) (hi : n ≤ tier i) : T.CompensationAbsent i := by + induction T with + | leaf => trivial + | @node n s CL CR u left right ihL ihR => + refine ⟨?_, ihL hT.2.2.2.1 (by omega), ihR hT.2.2.2.2 (by omega)⟩ + intro hu + have := hT.2.2.1 i hu + omega + +noncomputable def bulkSlotProduct {σ : Type*} (value : σ → ℝ) + (i : σ) (slots : List σ) : Polynomial ℝ := + (slots.map (fun j => if j = i then Polynomial.X else Polynomial.C (value j))).prod + +theorem bulkSlotProduct_eval {σ : Type*} (value : σ → ℝ) + (i : σ) (slots : List σ) (p : ℝ) : + (bulkSlotProduct value i slots).eval p = + realSlotProduct (Function.update value i p) slots := by + induction slots with + | nil => simp [bulkSlotProduct, realSlotProduct] + | cons j slots ih => + by_cases hji : j = i + · subst j + simp only [bulkSlotProduct, List.map_cons, List.prod_cons, Polynomial.eval_mul, + ite_true, Polynomial.eval_X, realSlotProduct, + Function.update_self] at * + exact congrArg (p * ·) ih + · simp only [bulkSlotProduct, List.map_cons, List.prod_cons, Polynomial.eval_mul, + ite_eq_right hji, Polynomial.eval_C, realSlotProduct, + Function.update_of_ne hji] at * + exact congrArg (value j * ·) ih + +theorem bulkSlotProduct_degree {σ : Type*} (value : σ → ℝ) + (i : σ) (slots : List σ) : (bulkSlotProduct value i slots).natDegree ≤ slots.length := by + induction slots with + | nil => simp [bulkSlotProduct] + | cons j slots ih => + change ((if j = i then Polynomial.X else Polynomial.C (value j)) * + bulkSlotProduct value i slots).natDegree ≤ slots.length + 1 + have hj : (if j = i then Polynomial.X else Polynomial.C (value j)).natDegree ≤ 1 := by + split_ifs <;> simp + exact Polynomial.natDegree_mul_le.trans (by omega) + +theorem realSlotProduct_update_of_absent {σ : Type*} (value : σ → ℝ) + (i : σ) (slots : List σ) (hi : i ∉ slots) (p : ℝ) : + realSlotProduct (Function.update value i p) slots = + realSlotProduct value slots := by + unfold realSlotProduct + congr 1 + apply List.map_congr_left + intro j hj + apply Function.update_of_ne + intro h + subst j + exact hi hj + +noncomputable def MovingSlotReversal.bulkPivotPolynomial {σ : Type*} + (s : MovingSlotReversal σ) (value : σ → ℝ) (i : σ) + (L R : Polynomial ℝ) : Polynomial ℝ := + Polynomial.C (((s.rootFrequency : ℝ) * + realSlotProduct value s.compensationSlots)⁻¹) * + (Polynomial.C (s.leftFrequency : ℝ) * bulkSlotProduct value i s.rightSlots * R - + Polynomial.C (s.rightFrequency : ℝ) * bulkSlotProduct value i s.leftSlots * L) + +theorem MovingSlotReversal.bulkPivotPolynomial_eval {σ : Type*} + (s : MovingSlotReversal σ) (value : σ → ℝ) (i : σ) + (hi : i ∉ s.compensationSlots) (L R : Polynomial ℝ) (p : ℝ) : + (s.bulkPivotPolynomial value i L R).eval p = + s.realValuePivot (Function.update value i p) (L.eval p) (R.eval p) := by + simp only [bulkPivotPolynomial, Polynomial.eval_mul, Polynomial.eval_sub, Polynomial.eval_C, + bulkSlotProduct_eval, realValuePivot, realSlotProduct_update_of_absent value i _ hi, div_eq_mul_inv] + ring + +theorem MovingSlotReversal.bulkPivotPolynomial_degree {σ : Type*} + (s : MovingSlotReversal σ) (value : σ → ℝ) (i : σ) + (L R : Polynomial ℝ) (d e : ℕ) (hs : s.lengthLE d) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) : + (s.bulkPivotPolynomial value i L R).natDegree ≤ d + e := by + apply Polynomial.natDegree_mul_le.trans + simp only [Polynomial.natDegree_C, zero_add] + apply (Polynomial.natDegree_sub_le _ _).trans + apply max_le + · exact Polynomial.natDegree_mul_le.trans (Nat.add_le_add + (Polynomial.natDegree_mul_le.trans (by + simpa only [Polynomial.natDegree_C, zero_add] using + (bulkSlotProduct_degree value i s.rightSlots).trans hs.1)) hR) + · exact Polynomial.natDegree_mul_le.trans (Nat.add_le_add + (Polynomial.natDegree_mul_le.trans (by + simpa only [Polynomial.natDegree_C, zero_add] using + (bulkSlotProduct_degree value i s.leftSlots).trans hs.2.1)) hL) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSmoothFactors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSmoothFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..561afcd49cb1ae075cef51d3343ee11200a914e1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSmoothFactors.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkFourierFactors +import OAI.NumberTheory.Ostmann.Arithmetic.BulkNodeFactors + +namespace OAI + +/-! # Full smooth bulk-coordinate factor and its finite variation budget -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap + +noncomputable def bulkSmoothFactors {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) : + Fin (2 ^ n + (T.bulkNodePolynomials value i L R).length) → ClippedPolynomialFactor := + Fin.append (bulkFourierFactors value i T L R ψ X lo hi hlo hhi) + (bulkNodeFactors value i T L R φ G B D hB hD hφ hlip) + +theorem bulkSmoothFactors_value {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) (G : ℕ → ℝ) + (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) (p : ℝ) : + smoothPolynomialWeight (bulkSmoothFactors value i T L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip) + (p : ℝ) = realValueSmoothWeight (Function.update value i p) T ψ X lo hi hlo hhi φ G + (L.eval (p : ℝ)) (R.eval (p : ℝ)) := by + simp only [smoothPolynomialWeight, bulkSmoothFactors, Fin.prod_univ_add, + Fin.append_left, Fin.append_right] + exact congrArg₂ (· * ·) (bulkFourierFactors_value value i T hT L R ψ X lo hi hlo hhi p) + (bulkNodeFactors_value value i T hT L R φ G B D hB hD hφ hlip hout p) + +theorem bulkSmoothFactors_budget {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi V : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) + (hV : T.Frequencies (fun s => |(s : ℝ)| ≤ V)) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) : + smoothPolynomialBudget (bulkSmoothFactors value i T L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip) ≤ + movingFourierVariationBudget ψ V lo hi n * (2 * B + D * (Real.exp 2 - 1)) ^ (2 ^ n - 1) := by + change smoothPolynomialBudget (Fin.append _ _) ≤ _ + simp only [smoothPolynomialBudget, Fin.prod_univ_add, Fin.append_left, Fin.append_right] + change smoothPolynomialBudget (bulkFourierFactors value i T L R ψ X lo hi hlo hhi) * + smoothPolynomialBudget (bulkNodeFactors value i T L R φ G B D hB hD hφ hlip) ≤ _ + rw [bulkNodeFactors_budget] + apply mul_le_mul_of_nonneg_right (bulkFourierFactors_budget value i T L R ψ X lo hi V hlo hhi hV) + have hE := Real.one_le_exp (show (0 : ℝ) ≤ 2 by norm_num) + positivity + +/-- Specialization back to the exact natural-prime samples. -/ +theorem bulkSmoothFactors_nat_value {σ : Type*} (value : σ → ℕ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (hT : T.CompensationAbsent i) + (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) + (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) (G : ℕ → ℝ) + (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (hout : ∀ x, 1 ≤ |x| → φ x = 0) (p : ℕ) : + smoothPolynomialWeight (bulkSmoothFactors (fun j => (value j : ℝ)) i T L R ψ X lo hi + hlo hhi φ G B D hB hD hφ hlip) (p : ℝ) = + movingRealSmoothWeight (Function.update value i p) T ψ X lo hi hlo hhi φ G + (L.eval (p : ℝ)) (R.eval (p : ℝ)) := by + have hv : Function.update (fun j => (value j : ℝ)) i (p : ℝ) = + (fun j => (Function.update value i p j : ℝ)) := by + funext j + by_cases hj : j = i + · subst j; simp only [Function.update_self] + · simp only [Function.update_of_ne hj] + rw [bulkSmoothFactors_value (fun j => (value j : ℝ)) i T hT L R ψ X lo hi hlo hhi + φ G B D hB hD hφ hlip hout (p : ℝ), hv, realValueSmoothWeight_nat] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSmoothRootCuts.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSmoothRootCuts.lean new file mode 100644 index 0000000000000000000000000000000000000000..e80df74ae74b453e6386e737e003027edf338eab --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSmoothRootCuts.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSmoothFactors +import OAI.NumberTheory.Ostmann.Arithmetic.SmoothPrimeAllRoots + +namespace OAI + +/-! # A complete finite root bound for the bulk-coordinate smooth factor -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap + +/-- All cuts are constructed derivative roots of actual bulk polynomials. +Their number depends on degree, never on coefficient height or prime values. -/ +theorem bulkSmoothFactors_root_cuts {σ : Type*} (value : σ → ℝ) (i : σ) + {n : ℕ} (T : MovingSlotData σ n) (L R : Polynomial ℝ) (ψ : 𝓢(ℝ, ℂ)) + (X lo hi : ℝ) (hlo : 1 ≤ lo) (hhi : lo ≤ hi) (φ : ℝ → ℝ) + (G : ℕ → ℝ) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (hφ : ∀ x, |φ x| ≤ B) (hlip : ∀ x y, |φ x - φ y| ≤ D * |x - y|) + (d r e : ℕ) (hsize : T.SizeLE d) (hregular : T.RegularLengthLE r) + (hL : L.natDegree ≤ e) (hR : R.natDegree ≤ e) : + ∃ S : Finset ℝ, + S.card ≤ (2 ^ n + (T.bulkNodePolynomials value i L R).length) * (2 * (n * d + e) + r) ∧ + ∀ j z, z ∈ (bulkSmoothFactors value i T L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip j).polynomial.derivative.roots → z ∈ S := by + let F := bulkSmoothFactors value i T L R ψ X lo hi hlo hhi φ G B D hB hD hφ hlip + let H := 2 * (n * d + e) + r + let S := polynomialRootCuts (fun j => (F j).polynomial.derivative) + have hd (j) : (F j).polynomial.natDegree ≤ H := by + refine Fin.addCases ?_ ?_ j + · intro j + simp only [F, bulkSmoothFactors, Fin.append_left] + exact bulkFourierFactors_degree value i T L R ψ X lo hi hlo hhi d r e hsize hregular hL hR j + · intro j + simp only [F, bulkSmoothFactors, Fin.append_right] + have h := bulkNodeFactors_degree value i T L R φ G B D hB hD hφ hlip d e hsize hL hR j + exact h.trans (by dsimp only [H]; omega) + have hdr (j) : (F j).polynomial.derivative.natDegree ≤ H := + (Polynomial.natDegree_derivative_le _).trans ((Nat.sub_le _ _).trans (hd j)) + refine ⟨S, ?_, ?_⟩ + · apply (polynomialRootCuts_card _).trans + calc + _ ≤ ∑ _j, H := Finset.sum_le_sum (fun j _ => hdr j) + _ = _ := by simp [H] + · intro j z hz + exact Finset.mem_biUnion.mpr ⟨j, Finset.mem_univ _, Multiset.mem_toFinset.mpr hz⟩ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSpectatorNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSpectatorNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ef37a81a14bd49ec63fdc1cd5776a4d8e7d9320 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSpectatorNorm.lean @@ -0,0 +1,92 @@ +import OAI.NumberTheory.Ostmann.Construction.SpectatorBulkComparison +import OAI.NumberTheory.Ostmann.Tree.UniformGroupReduction + +namespace OAI + +/-! # Absolute bounds under the original independent bulk-slot law -/ + +namespace Ostmann +open scoped Classical BigOperators ComplexConjugate + +def bulkBlockProductHom {L G : Type*} [Fintype L] [CommGroup G] (m : ℕ) : + (L × Fin m → G) →* (L → G) where + toFun := bulkBlockProduct + map_one' := by ext; simp [bulkBlockProduct] + map_mul' x y := by ext; simp [bulkBlockProduct, Finset.prod_mul_distrib] + +theorem bulkBlockProductHom_surjective {L G : Type*} [Fintype L] [CommGroup G] + {m : ℕ} (hm : 0 < m) : Function.Surjective (bulkBlockProductHom (L := L) (G := G) m) := by + intro y + let j₀ : Fin m := ⟨0, hm⟩ + refine ⟨fun s => if s.2 = j₀ then y s.1 else 1, ?_⟩ + ext l + simp [bulkBlockProductHom, bulkBlockProduct] + +/-- A nonempty set of independent slots gives a uniform product in each +leaf. This is the marginal used before exposing any frequency conditions. -/ +theorem bulkBlockProduct_average {L G : Type*} [Fintype L] [CommGroup G] [Fintype G] + {m : ℕ} (hm : 0 < m) (F : (L → G) → ℝ) : + (Fintype.card (L × Fin m → G) : ℝ)⁻¹ * ∑ x : L × Fin m → G, F (bulkBlockProduct x) = + (Fintype.card (L → G) : ℝ)⁻¹ * ∑ y, F y := + surjective_group_average (bulkBlockProductHom m) (bulkBlockProductHom_surjective hm) F + +theorem SpectatorDiagram.bulk_l2_bound {p n m : ℕ} [Fact p.Prime] + (d : SpectatorDiagram p n) (hp : 3 ≤ p) (hm : 0 < m) + (g : ZMod p → ℂ) (hg : g 0 = 0) + (henergy : ∑ x : ZMod p, ‖g x‖ ^ 2 ≤ (p : ℝ)) : + (∑ x : TreeLeafIndex n × Fin m → (ZMod p)ˣ, ‖d.bulkValue g x‖ ^ 2) / + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod p)ˣ) : ℝ) ≤ (3 : ℝ) ^ (2 ^ n) := by + change (∑ x, ‖indexedRationalAmplitude g d.D d.tree d.XL d.XR d.conjugations + (bulkBlockProduct x)‖ ^ 2) / _ ≤ _ + have h := bulkBlockProduct_average (L := TreeLeafIndex n) (G := (ZMod p)ˣ) (m := m) hm + (fun x => ‖indexedRationalAmplitude g d.D d.tree d.XL d.XR d.conjugations x‖ ^ 2) + have hb := indexedRationalAmplitude_l2_bound hp g hg henergy d.D d.tree d.XL d.XR d.conjugations + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at h hb ⊢ + rw [div_eq_mul_inv, mul_comm] + calc + _ = _ := h + _ ≤ _ := by + rw [mul_comm, ← div_eq_mul_inv] + exact hb + +theorem spectator_bulk_absolute_le {p n m : ℕ} [Fact p.Prime] + (hp : 3 ≤ p) (hm : 0 < m) (g : ZMod p → ℂ) (hg : g 0 = 0) + (henergy : ∑ x : ZMod p, ‖g x‖ ^ 2 ≤ (p : ℝ)) + (d₁ d₂ : SpectatorDiagram p n) (e : Equiv.Perm (TreeLeafIndex n × Fin m)) : + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod p)ˣ) : ℝ)⁻¹ * + ∑ x, ‖d₁.bulkValue g x * conj (d₂.bulkValue g (x ∘ e.symm))‖ ≤ (3 : ℝ) ^ (2 ^ n) := by + let E : (TreeLeafIndex n × Fin m → (ZMod p)ˣ) ≃ + (TreeLeafIndex n × Fin m → (ZMod p)ˣ) := + { toFun := fun x => x ∘ e.symm + invFun := fun x => x ∘ e + left_inv := by intro x; ext j; simp + right_inv := by intro x; ext j; simp } + have hsum := E.sum_comp (fun x => ‖d₂.bulkValue g x‖ ^ 2) + have h₂ := d₂.bulk_l2_bound hp hm g hg henergy + rw [← hsum] at h₂ + have h := uniform_absolute_pair_le + (fun x => d₁.bulkValue g x) (fun x => d₂.bulkValue g (x ∘ e.symm)) + ((3 : ℝ) ^ (2 ^ n)) (d₁.bulk_l2_bound hp hm g hg henergy) h₂ + simpa only [div_eq_mul_inv, mul_comm, starRingEnd_apply] using h + +/-- All spectators retain the paper's `3^(r m)` bound under the bulk-slot +law, even for an arbitrary matching of the two assignments. -/ +theorem spectator_bulk_product_absolute_le {I : Type*} [Fintype I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] (n m : ℕ) (hm : 0 < m) + (hp : ∀ i, 3 ≤ p i) (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, ∑ x : ZMod (p i), ‖g i x‖ ^ 2 ≤ (p i : ℝ)) + (d₁ d₂ : ∀ i, SpectatorDiagram (p i) n) + (e : Equiv.Perm (TreeLeafIndex n × Fin m)) : + (Fintype.card (∀ i, TreeLeafIndex n × Fin m → (ZMod (p i))ˣ) : ℝ)⁻¹ * + (∑ x : ∀ i, TreeLeafIndex n × Fin m → (ZMod (p i))ˣ, ∏ i, ‖(d₁ i).bulkValue (g i) (x i) * + conj ((d₂ i).bulkValue (g i) (x i ∘ e.symm))‖) ≤ + (3 : ℝ) ^ (2 ^ n * Fintype.card I) := by + have h := product_uniform_mean_le + (fun i x => ‖(d₁ i).bulkValue (g i) x * conj ((d₂ i).bulkValue (g i) (x ∘ e.symm))‖) + (fun _ _ => norm_nonneg _) (fun _ => (3 : ℝ) ^ (2 ^ n)) + (fun i => spectator_bulk_absolute_le (hp i) hm (g i) (hg i) (henergy i) (d₁ i) (d₂ i) e) + simpa only [Finset.prod_const, Finset.card_univ, ← pow_mul] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSpectatorPageBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSpectatorPageBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..698fd9c17ff802dcdb9157ba2acd3fdf551b257b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSpectatorPageBound.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResiduePageBound +import OAI.NumberTheory.Ostmann.Construction.NormalizedSpectatorComparison + +namespace OAI + +/-! # The actual normalized spectator gain used in the bulk Page average -/ + +namespace Ostmann +open scoped Classical BigOperators ComplexConjugate + +/-- The numerical quartet estimate gives the local hypothesis of +`bulk_residue_page_bound`, for the actual balanced residue transform. -/ +theorem normalized_bulk_spectator_mean_le {p : ℕ} [Fact p.Prime] + (hp : 3 ≤ p) (n m : ℕ) (hm : 0 < m) + (e : Equiv.Perm (TreeLeafIndex (n + 2) × Fin m)) + (hgood : 4 * Fintype.card (arrangementGraph m e).ConnectedComponent ≤ + 3 * Fintype.card (TreeLeafIndex (n + 2))) + (S : Finset (ZMod p)) (hlo : (1 / 3 : ℝ) ≤ residueDensity S) + (hhi : residueDensity S ≤ 2 / 3) (hS : S.Nonempty) (hSp : S.card < p) + (β ε : ℝ) (hε : 0 ≤ ε) (hε1 : ε ≤ 1) + (hprincipal : 3 / Real.sqrt (p : ℝ) ≤ ε) (hβ : 2 * β ≤ ε) + (hbias : ∀ (χ : MulChar (ZMod p) ℂ), χ ≠ 1 → ∀ a : ZMod p, + ‖(S.card : ℂ)⁻¹ * ∑ x ∈ S, χ⁻¹ (-a - x)‖ ≤ β) + (d₁ d₂ : SpectatorDiagram p (n + 2)) (cL cR : TreeLeafIndex n → Bool) + (hconj : ∀ j, quartetBlockEquiv Bool n d₁.conjugations j = + ((cL j, !(cL j)), (cR j, !(cR j)))) + (δ : ℝ) (hδ : 0 ≤ δ) + (hnum : quartetTreeConstant n * (ε ^ 2 + Real.sqrt (3 / (p : ℝ))) ≤ δ ^ 2) : + ‖(Fintype.card (TreeLeafIndex (n + 2) × Fin m → (ZMod p)ˣ) : ℂ)⁻¹ * + (∑ x : TreeLeafIndex (n + 2) × Fin m → (ZMod p)ˣ, + d₁.bulkValue (normalizedResidueTransform S) x * + conj (d₂.bulkValue (normalizedResidueTransform S) (x ∘ e.symm)))‖ ≤ δ := by + apply (sq_le_sq₀ (norm_nonneg _) hδ).mp + exact (normalized_spectator_bulk_comparison hp n m hm e hgood S hlo hhi hS hSp + β ε hε hε1 hprincipal hβ hbias d₁ d₂ cL cR hconj).trans hnum + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkStatisticBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkStatisticBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..df915d58fa0dcad0a7f343466878e2d64bf4272f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkStatisticBound.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.SymmetrizedPairBound + +namespace OAI + +/-! # Finite assembly of the final bulk symmetrization estimate + +The paired arithmetic estimates bound the constructed history amplitude. +-/ + +namespace Ostmann + +open scoped BigOperators Classical + +theorem bulkSymmetrize_energy_bound {A : Type*} [Fintype A] {r m : ℕ} + (hr : 1 ≤ r) (hm : 1 ≤ m) (μ : (Fin r × Fin m → A) → ℝ) + (F : (Fin r × Fin m → A) → ℂ) (B E : ℝ) (hB : 0 ≤ B) (hE : 0 ≤ E) + (hpair : ∀ e f : Equiv.Perm (Fin r × Fin m), + ‖∑ x, (μ x : ℂ) * + (F (permuteBulk e x) * star (F (permuteBulk f x)))‖ ≤ + if BadBulkArrangement (e⁻¹ * f) then B else E) : + (∑ x, μ x * ‖bulkSymmetrize F x‖ ^ 2) ≤ + ((r + 1) * r ^ (2 * r) : ℕ) * + Real.exp ((r : ℝ) * m * (-(3 / 4 : ℝ) * Real.log r + 5 / 4)) * B + E := by + have h := finiteFamilyAverage_good_bad_bound μ + (fun e x => F (permuteBulk e x)) BadBulkArrangement B E hE hpair + change (∑ x, μ x * ‖bulkSymmetrize F x‖ ^ 2) ≤ _ at h + apply h.trans + apply add_le_add _ le_rfl + apply mul_le_mul_of_nonneg_right _ hB + simpa only [card_bulkPerm] using badBulkArrangement_fraction_bound hr hm + +theorem bulkSymmetrized_statistic_bound {A : Type*} [Fintype A] {r m : ℕ} + (hr : 1 ≤ r) (hm : 1 ≤ m) (μ : A → ℝ) (hμ : ∀ a, 0 ≤ μ a) + (G F : (Fin r × Fin m → A) → ℂ) + (hG : ∀ e x, G (permuteBulk e x) = G x) + (R B E : ℝ) (hR : 0 ≤ R) (hB : 0 ≤ B) (hE : 0 ≤ E) + (hregular : (∑ x, identicalBulkPrior μ x * ‖G x‖ ^ 2) ≤ R) + (hpair : ∀ e f : Equiv.Perm (Fin r × Fin m), + ‖∑ x, (identicalBulkPrior μ x : ℂ) * + (F (permuteBulk e x) * star (F (permuteBulk f x)))‖ ≤ + if BadBulkArrangement (e⁻¹ * f) then B else E) : + ‖∑ x, (identicalBulkPrior μ x : ℂ) * G x * F x‖ ^ 2 ≤ + R * (((r + 1) * r ^ (2 * r) : ℕ) * + Real.exp ((r : ℝ) * m * (-(3 / 4 : ℝ) * Real.log r + 5 / 4)) * B + E) := by + rw [← bulkSymmetrize_statistic μ G F hG] + apply (bulkSymmetrize_cauchy μ hμ G F).trans + exact mul_le_mul hregular + (bulkSymmetrize_energy_bound hr hm (identicalBulkPrior μ) F B E hB hE hpair) + (Finset.sum_nonneg fun x _ => mul_nonneg + (Finset.prod_nonneg fun i _ => hμ (x i)) (sq_nonneg _)) hR + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSymmetrization.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSymmetrization.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f47ed8f045d86e2d2c9dda4c1ef4dc7b67b3602 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkSymmetrization.lean @@ -0,0 +1,93 @@ +import Mathlib.Data.Fintype.Perm +import Mathlib.Data.Fintype.Pi +import OAI.NumberTheory.Ostmann.Preliminaries.TransferCauchy + +namespace OAI + +/-! # Symmetrization under the identical original bulk priors -/ + +namespace Ostmann + +open scoped BigOperators Classical + +def permuteBulk {I A : Type*} (e : Equiv.Perm I) (x : I → A) : I → A := + x ∘ e.symm + +def bulkArrayEquiv {I A : Type*} (e : Equiv.Perm I) : (I → A) ≃ (I → A) where + toFun := permuteBulk e + invFun := permuteBulk e.symm + left_inv x := by funext i; simp [permuteBulk] + right_inv x := by funext i; simp [permuteBulk] + +noncomputable def identicalBulkPrior {I A : Type*} [Fintype I] + (μ : A → ℝ) (x : I → A) : ℝ := ∏ i, μ (x i) + +theorem identicalBulkPrior_permute {I A : Type*} [Fintype I] + (μ : A → ℝ) (e : Equiv.Perm I) (x : I → A) : + identicalBulkPrior μ (permuteBulk e x) = identicalBulkPrior μ x := by + exact e.symm.prod_comp (fun i => μ (x i)) + +theorem bulk_value_product_permute {I A M : Type*} [Fintype I] [CommMonoid M] + (h : A → M) (e : Equiv.Perm I) (x : I → A) : + (∏ i, h (permuteBulk e x i)) = ∏ i, h (x i) := + e.symm.prod_comp (fun i => h (x i)) + +noncomputable def bulkSymmetrize {I A : Type*} [Fintype I] [DecidableEq I] + (F : (I → A) → ℂ) (x : I → A) : ℂ := + (Fintype.card (Equiv.Perm I) : ℂ)⁻¹ * ∑ e : Equiv.Perm I, F (permuteBulk e x) + +/-- The statistic is unchanged even if all bins and history restrictions +are carried by F and have no permutation invariance. -/ +theorem bulkSymmetrize_statistic {I A : Type*} [Fintype I] [DecidableEq I] [Fintype A] + (μ : A → ℝ) (G F : (I → A) → ℂ) + (hG : ∀ e x, G (permuteBulk e x) = G x) : + (∑ x : I → A, (identicalBulkPrior μ x : ℂ) * G x * bulkSymmetrize F x) = + ∑ x : I → A, (identicalBulkPrior μ x : ℂ) * G x * F x := by + have hc : (Fintype.card (Equiv.Perm I) : ℂ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + have hs (e : Equiv.Perm I) : + (∑ x : I → A, (identicalBulkPrior μ x : ℂ) * G x * F (permuteBulk e x)) = + ∑ x : I → A, (identicalBulkPrior μ x : ℂ) * G x * F x := by + have h := (bulkArrayEquiv (A := A) e).sum_comp + (fun x => (identicalBulkPrior μ x : ℂ) * G x * F x) + simpa only [bulkArrayEquiv, Equiv.coe_fn_mk, identicalBulkPrior_permute, hG] using h + unfold bulkSymmetrize + simp only [Finset.mul_sum] + simp_rw [show ∀ (x : I → A) (e : Equiv.Perm I), + (identicalBulkPrior μ x : ℂ) * G x * + ((Fintype.card (Equiv.Perm I) : ℂ)⁻¹ * F (permuteBulk e x)) = + (Fintype.card (Equiv.Perm I) : ℂ)⁻¹ * + ((identicalBulkPrior μ x : ℂ) * G x * F (permuteBulk e x)) by intros; ring] + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum, hs] + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + field_simp + +/-- Weighted Cauchy--Schwarz at the final symmetrized statistic. -/ +theorem bulkSymmetrize_cauchy {I A : Type*} [Fintype I] [DecidableEq I] [Fintype A] + (μ : A → ℝ) (hμ : ∀ a, 0 ≤ μ a) (G F : (I → A) → ℂ) : + ‖∑ x : I → A, (identicalBulkPrior μ x : ℂ) * G x * bulkSymmetrize F x‖ ^ 2 ≤ + (∑ x : I → A, identicalBulkPrior μ x * ‖G x‖ ^ 2) * + ∑ x : I → A, identicalBulkPrior μ x * ‖bulkSymmetrize F x‖ ^ 2 := by + have hp (x : I → A) : 0 ≤ identicalBulkPrior μ x := + Finset.prod_nonneg (fun i _ => hμ (x i)) + have hs (x : I → A) : Real.sqrt (identicalBulkPrior μ x) ^ 2 = + identicalBulkPrior μ x := Real.sq_sqrt (hp x) + have h := complex_pairing_sq_le + (fun x : I → A => (Real.sqrt (identicalBulkPrior μ x) : ℂ) * G x) + (fun x : I → A => (Real.sqrt (identicalBulkPrior μ x) : ℂ) * bulkSymmetrize F x) + have hprod (x : I → A) : + ((Real.sqrt (identicalBulkPrior μ x) : ℂ) * G x) * + ((Real.sqrt (identicalBulkPrior μ x) : ℂ) * bulkSymmetrize F x) = + (identicalBulkPrior μ x : ℂ) * G x * bulkSymmetrize F x := by + have hcast := congrArg (fun t : ℝ => (t : ℂ)) (hs x) + push_cast at hcast + calc + _ = ((Real.sqrt (identicalBulkPrior μ x) : ℂ) ^ 2) * G x * bulkSymmetrize F x := by ring + _ = _ := by rw [hcast] + simpa only [hprod, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (Real.sqrt_nonneg _), mul_pow, hs] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedCellComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedCellComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..b17903389ea775106e1ac6f72dd153db468950a6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedCellComparison.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkKernelIntegralComparison +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSeparatedKernelBound + +namespace OAI + +/-! # Keep all cell and residue costs in the prime replacement error -/ + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +/-- A residue-dependent arithmetic coefficient is held fixed during prime +replacement. Its absolute value only multiplies the replacement error. -/ +theorem bulk_weighted_cell_comparison {J C R : Type*} + [Fintype J] [Fintype C] [Fintype R] + (K : BulkIntegrand J) (a : R → ℂ) (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (μ ν : (J → C) → R → J → Measure ℝ) + [∀ c z j, IsFiniteMeasure (μ c z j)] [∀ c z j, IsFiniteMeasure (ν c z j)] + (E : (J → C) → R → ℝ) + (hE : ∀ c z, ‖(∫ y, K y ∂Measure.pi (μ c z)) - + ∫ y, K y ∂Measure.pi (ν c z)‖ ≤ E c z) : + ‖((∏ j, Z j : ℝ) : ℂ) * ∑ c : J → C, ∑ z, + ∫ y, (K.constMul (a z)) y ∂Measure.pi (μ c z) - + ((∏ j, Z j : ℝ) : ℂ) * ∑ c : J → C, ∑ z, + ∫ y, (K.constMul (a z)) y ∂Measure.pi (ν c z)‖ ≤ + (∏ j, Z j) * ∑ c : J → C, ∑ z, ‖a z‖ * E c z := by + have hprod : 0 ≤ ∏ j, Z j := Finset.prod_nonneg fun j _ => hZ j + simp only [BulkIntegrand.constMul, integral_const_mul] + rw [← mul_sub, norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hprod] + apply mul_le_mul_of_nonneg_left _ hprod + rw [← Finset.sum_sub_distrib] + apply norm_sum_le_of_le + intro c _ + rw [← Finset.sum_sub_distrib] + apply norm_sum_le_of_le + intro z _ + rw [← mul_sub, norm_mul] + exact mul_le_mul_of_nonneg_left (hE c z) (norm_nonneg _) + +/-- Combine the separately derived signed main term and replacement error. -/ +theorem bulk_weighted_cell_bound {J C R : Type*} + [Fintype J] [Fintype C] [Fintype R] + (K : BulkIntegrand J) (a : R → ℂ) (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (μ ν : (J → C) → R → J → Measure ℝ) + [∀ c z j, IsFiniteMeasure (μ c z j)] [∀ c z j, IsFiniteMeasure (ν c z j)] + (E : (J → C) → R → ℝ) + (hE : ∀ c z, ‖(∫ y, K y ∂Measure.pi (μ c z)) - + ∫ y, K y ∂Measure.pi (ν c z)‖ ≤ E c z) + (B : ℝ) + (hmain : ‖((∏ j, Z j : ℝ) : ℂ) * ∑ c : J → C, ∑ z, + ∫ y, (K.constMul (a z)) y ∂Measure.pi (ν c z)‖ ≤ B) : + ‖((∏ j, Z j : ℝ) : ℂ) * ∑ c : J → C, ∑ z, + ∫ y, (K.constMul (a z)) y ∂Measure.pi (μ c z)‖ ≤ + B + (∏ j, Z j) * ∑ c : J → C, ∑ z, ‖a z‖ * E c z := by + have he := bulk_weighted_cell_comparison K a Z hZ μ ν E hE + rw [norm_sub_rev] at he + exact (norm_le_norm_add_norm_sub _ _).trans (add_le_add hmain he) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedCost.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf051766fbb3d29fac662a7cf076a8c220bed062 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedCost.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkWeightedErrorBudget +import OAI.NumberTheory.Ostmann.Construction.SpectatorBulkScale + +namespace OAI + +/-! # The full bulk cell and residue count fits the progression budget -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem bulk_weighted_cost_le_exp {J Cell : Type*} [Fintype J] [Fintype Cell] + (M : ℕ) [NeZero M] (Z : J → ℝ) (A B C L : ℝ) + (hC : 1 ≤ C) (hL : 1 ≤ L) (hZ0 : ∀ j, 0 ≤ Z j) (hA0 : 0 ≤ A) (hB0 : 0 ≤ B) + (hJ : (Fintype.card J : ℝ) ≤ C * L) (hZ : ∀ j, Z j ≤ Real.exp (C * L)) + (hcell : (Fintype.card Cell : ℝ) ≤ Real.exp (Real.exp ((14 / 10000 : ℝ) * L))) + (hunit : (Fintype.card (ZMod M)ˣ : ℝ) ≤ Real.exp (Real.exp ((12 / 10000 : ℝ) * L))) + (hA : A ≤ Real.exp (C * L * Real.exp ((1 / 1000 : ℝ) * L))) + (hB : B ≤ Real.exp (C * L ^ 2)) : + (∏ j, Z j) * (Fintype.card Cell : ℝ) ^ Fintype.card J * + (Fintype.card (ZMod M)ˣ : ℝ) ^ Fintype.card J * A * + 2 ^ Fintype.card J * (Fintype.card J : ℝ) * B ≤ + Real.exp (8 * C ^ 2 * L ^ 2 + 8 * C ^ 2 * L * Real.exp ((14 / 10000 : ℝ) * L)) := by + have hC0 : 0 ≤ C := by linarith + have hL0 : 0 ≤ L := by linarith + have hCL : 0 ≤ C * L := mul_nonneg hC0 hL0 + have hLsq : L ≤ L ^ 2 := by nlinarith + have hCeq : C ≤ C ^ 2 := by nlinarith + have hbig : Real.exp ((12 / 10000 : ℝ) * L) ≤ Real.exp ((14 / 10000 : ℝ) * L) := + Real.exp_le_exp.mpr (by nlinarith) + have hsmall : Real.exp ((1 / 1000 : ℝ) * L) ≤ Real.exp ((14 / 10000 : ℝ) * L) := + Real.exp_le_exp.mpr (by nlinarith) + have hz : (∏ j, Z j) ≤ Real.exp (C ^ 2 * L ^ 2) := by + calc + _ ≤ ∏ _j : J, Real.exp (C * L) := Finset.prod_le_prod₀ (fun j _ => hZ0 j) (fun j _ => hZ j) + _ = Real.exp ((Fintype.card J : ℝ) * (C * L)) := by + rw [Finset.prod_const, Finset.card_univ, ← Real.exp_nat_mul] + _ ≤ _ := Real.exp_le_exp.mpr (by nlinarith [mul_le_mul_of_nonneg_right hJ hCL]) + have hp (x : ℝ) (hx0 : 0 ≤ x) (hx : x ≤ Real.exp (Real.exp ((14 / 10000 : ℝ) * L))) : + x ^ Fintype.card J ≤ Real.exp (C * L * Real.exp ((14 / 10000 : ℝ) * L)) := by + apply (pow_le_pow_left₀ hx0 hx _).trans + rw [← Real.exp_nat_mul] + exact Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_right hJ (Real.exp_nonneg _)) + have hc := hp _ (Nat.cast_nonneg _) hcell + have hu := hp _ (Nat.cast_nonneg _) (hunit.trans (Real.exp_le_exp.mpr hbig)) + have ha : A ≤ Real.exp (C * L * Real.exp ((14 / 10000 : ℝ) * L)) := + hA.trans (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hsmall hCL)) + have htwo : (2 : ℝ) ^ Fintype.card J ≤ Real.exp (C * L ^ 2) := by + have he : (2 : ℝ) ≤ Real.exp 1 := by linarith [Real.add_one_le_exp 1] + apply (pow_le_pow_left₀ (by norm_num) he _).trans + rw [← Real.exp_nat_mul] + apply Real.exp_le_exp.mpr + nlinarith [mul_le_mul_of_nonneg_left hLsq hC0] + have hj : (Fintype.card J : ℝ) ≤ Real.exp (C * L ^ 2) := by + apply hJ.trans + have he := Real.add_one_le_exp (C * L) + exact (by linarith : C * L ≤ Real.exp (C * L)).trans + (Real.exp_le_exp.mpr (mul_le_mul_of_nonneg_left hLsq hC0)) + calc + _ ≤ Real.exp (C ^ 2 * L ^ 2) * + Real.exp (C * L * Real.exp ((14 / 10000 : ℝ) * L)) * + Real.exp (C * L * Real.exp ((14 / 10000 : ℝ) * L)) * + Real.exp (C * L * Real.exp ((14 / 10000 : ℝ) * L)) * + Real.exp (C * L ^ 2) * Real.exp (C * L ^ 2) * Real.exp (C * L ^ 2) := by + gcongr + _ ≤ _ := by + simp only [← Real.exp_add] + apply Real.exp_le_exp.mpr + have h₁ := mul_le_mul_of_nonneg_right + (show C ^ 2 + 3 * C ≤ 8 * C ^ 2 by nlinarith) (sq_nonneg L) + have h₂ := mul_le_mul_of_nonneg_right + (show 3 * C ≤ 8 * C ^ 2 by nlinarith) (mul_nonneg hL0 (Real.exp_nonneg ((14 / 10000 : ℝ) * L))) + nlinarith + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedErrorBudget.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedErrorBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab9f95f876f4a7abfe74b83ca57fe0d369635fb7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedErrorBudget.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.IndexedBulkCellError +import OAI.NumberTheory.Ostmann.ZeroDensity.BulkProgressionRate + +namespace OAI + +/-! # Counting the actual cells and residues in the bulk comparison error -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap + +theorem bulkPrimeErrorFactor_nonneg (P : PublishedProgressionInput) (Q : ℕ) (u : ℝ) : + 0 ≤ bulkPrimeErrorFactor P Q u := by + unfold bulkPrimeErrorFactor + have := P.errorConstant_nonneg + positivity + +theorem bulkPrimeErrorFactor_antitone (P : PublishedProgressionInput) {Q : ℕ} (hQ : 2 ≤ Q) + {u v : ℝ} (huv : u ≤ v) : bulkPrimeErrorFactor P Q v ≤ bulkPrimeErrorFactor P Q u := by + have hlog : 0 < Real.log (4 * (Q : ℝ)) := by + apply Real.log_pos + have : (2 : ℝ) ≤ Q := by exact_mod_cast hQ + linarith + have hroot : -P.decay * Real.sqrt v ≤ -P.decay * Real.sqrt u := + mul_le_mul_of_nonpos_left (Real.sqrt_le_sqrt huv) (neg_nonpos.mpr P.decay_pos.le) + have hpage : -P.kappa * v / Real.log (4 * (Q : ℝ)) ≤ + -P.kappa * u / Real.log (4 * (Q : ℝ)) := by + apply div_le_div_of_nonneg_right _ hlog.le + exact mul_le_mul_of_nonpos_left huv (neg_nonpos.mpr P.kappa_pos.le) + unfold bulkPrimeErrorFactor + exact add_le_add + (add_le_add + (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr hroot) + (mul_nonneg (by norm_num) P.errorConstant_nonneg)) + (Real.exp_le_exp.mpr hpage)) + (mul_le_mul_of_nonneg_left (Real.exp_le_exp.mpr (neg_le_neg huv)) (by norm_num)) + +theorem bulkKernelPairComparisonBudget_nonneg (ψ : 𝓢(ℝ, ℂ)) (V lo hi : ℝ) + (n d r e : ℕ) (B D : ℝ) : 0 ≤ bulkKernelPairComparisonBudget ψ V lo hi n d r e B D := by + unfold bulkKernelPairComparisonBudget + positivity + +/-- Every residue and real cell in the actual comparison is counted here; +only the smallest lower endpoint is used for the progression saving. -/ +theorem bulk_weighted_error_budget {J Cell : Type*} [Fintype J] [Fintype Cell] + (P : PublishedProgressionInput) {Q M : ℕ} [NeZero M] (hQ : 2 ≤ Q) + (Z : J → ℝ) (hZ : ∀ j, 0 ≤ Z j) + (a : (J → (ZMod M)ˣ) → ℂ) (A : ℝ) (hA : 0 ≤ A) (ha : ∀ z, ‖a z‖ ≤ A) + (u : J → Cell → ℝ) (T : ℝ) (hu : ∀ j c, T ≤ u j c) + (B : ℝ) (hB : 0 ≤ B) : + (∏ j, Z j) * ∑ c : J → Cell, ∑ z : J → (ZMod M)ˣ, ‖a z‖ * + (2 ^ Fintype.card J * ∑ j, B * bulkPrimeErrorFactor P Q (u j (c j))) ≤ + ((∏ j, Z j) * (Fintype.card Cell : ℝ) ^ Fintype.card J * + (Fintype.card (ZMod M)ˣ : ℝ) ^ Fintype.card J * A * + 2 ^ Fintype.card J * (Fintype.card J : ℝ) * B) * bulkPrimeErrorFactor P Q T := by + have hpoint (c : J → Cell) : + 2 ^ Fintype.card J * ∑ j, B * bulkPrimeErrorFactor P Q (u j (c j)) ≤ + 2 ^ Fintype.card J * (Fintype.card J : ℝ) * B * bulkPrimeErrorFactor P Q T := by + apply le_trans (mul_le_mul_of_nonneg_left (Finset.sum_le_sum fun j _ => + mul_le_mul_of_nonneg_left (bulkPrimeErrorFactor_antitone P hQ (hu j (c j))) hB) (by positivity)) + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + ring_nf + rfl + calc + _ ≤ (∏ j, Z j) * ∑ _c : J → Cell, ∑ _z : J → (ZMod M)ˣ, + A * (2 ^ Fintype.card J * (Fintype.card J : ℝ) * B * bulkPrimeErrorFactor P Q T) := by + apply mul_le_mul_of_nonneg_left _ (Finset.prod_nonneg fun j _ => hZ j) + apply Finset.sum_le_sum + intro c _ + apply Finset.sum_le_sum + intro z _ + exact mul_le_mul (ha z) (hpoint c) + (mul_nonneg (by positivity) (Finset.sum_nonneg fun j _ => + mul_nonneg hB (bulkPrimeErrorFactor_nonneg P Q (u j (c j))))) hA + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, Fintype.card_fun, Nat.cast_pow, nsmul_eq_mul] + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedErrorRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedErrorRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ed9d8dfeb1241803ffca8eb3e428087ede9c1d8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/BulkWeightedErrorRate.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkWeightedCost + +namespace OAI + +/-! # Uniform decay of the full weighted bulk replacement error -/ + +namespace Ostmann +open Filter +open scoped Classical BigOperators + +/-- The cutoff is chosen before the finite cell sets, modulus and original +normalizers. Their literal bounds include every joint box and residue. -/ +theorem PublishedProgressionInput.bulk_weighted_error_rate + (P : PublishedProgressionInput) (C : ℝ) (hC : 1 ≤ C) : + ∀ᶠ L : ℝ in atTop, ∀ (J Cell : Type) [Fintype J] [Fintype Cell] + (M Q : ℕ) [NeZero M], 2 ≤ Q → + Real.log (4 * (Q : ℝ)) ≤ 2 * Real.exp ((12 / 10000 : ℝ) * L) → + ∀ (Z : J → ℝ) (a : (J → (ZMod M)ˣ) → ℂ) (A B T : ℝ), + (∀ j, 0 ≤ Z j) → 0 ≤ A → 0 ≤ B → + (Fintype.card J : ℝ) ≤ C * L → + (∀ j, Z j ≤ Real.exp (C * L)) → + (Fintype.card Cell : ℝ) ≤ Real.exp (Real.exp ((14 / 10000 : ℝ) * L)) → + (Fintype.card (ZMod M)ˣ : ℝ) ≤ Real.exp (Real.exp ((12 / 10000 : ℝ) * L)) → + A ≤ Real.exp (C * L * Real.exp ((1 / 1000 : ℝ) * L)) → + B ≤ Real.exp (C * L ^ 2) → + (∀ z, ‖a z‖ ≤ A) → + Real.exp ((39 / 10000 : ℝ) * L) ≤ T → + ∀ u : J → Cell → ℝ, (∀ j c, T ≤ u j c) → + (∏ j, Z j) * ∑ c : J → Cell, ∑ z : J → (ZMod M)ˣ, ‖a z‖ * + (2 ^ Fintype.card J * ∑ j, B * bulkPrimeErrorFactor P Q (u j (c j))) ≤ + Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) := by + filter_upwards [P.bulk_full_progression_budget_rate (8 * C ^ 2) 2, + eventually_ge_atTop (1 : ℝ)] with L hrate hL + intro J Cell _ _ M Q _ hQ hlog Z a A B T hZ0 hA0 hB0 hJ hZ hcell hunit hA hB ha hT u hu + let V := (∏ j, Z j) * (Fintype.card Cell : ℝ) ^ Fintype.card J * + (Fintype.card (ZMod M)ˣ : ℝ) ^ Fintype.card J * A * + 2 ^ Fintype.card J * (Fintype.card J : ℝ) * B + have hV : V ≤ Real.exp (8 * C ^ 2 * L ^ 2 + + 8 * C ^ 2 * L * Real.exp ((14 / 10000 : ℝ) * L)) := + bulk_weighted_cost_le_exp M Z A B C L hC hL hZ0 hA0 hB0 hJ hZ hcell hunit hA hB + exact (bulk_weighted_error_budget P hQ Z hZ0 a A hA0 ha u T hu B hB0).trans + (hrate Q hQ hlog T V hT hV) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTInternalLines.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTInternalLines.lean new file mode 100644 index 0000000000000000000000000000000000000000..9665f0b3f663c46e846e9252b923976c433630a8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTInternalLines.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CRTLineAverage +import OAI.NumberTheory.Ostmann.Arithmetic.InternalLineProbability + +namespace OAI + +/-! # Integrating all repeated internal-prime line systems by CRT -/ + +namespace Ostmann + +open scoped BigOperators Classical + +private theorem indicator_probability {X : Type*} [Fintype X] (P : X → Prop) : + (Fintype.card X : ℝ)⁻¹ * (∑ x, if P x then (1 : ℝ) else 0) = + (Fintype.card {x : X // P x} : ℝ) / Fintype.card X := by + rw [Fintype.card_subtype] + simp only [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul, mul_one] + exact mul_comm _ _ + +theorem crt_unit_lineSystems_probability {I : Type*} [Fintype I] [DecidableEq I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] [∀ i, NeZero (p i)] [NeZero (∏ i, p i)] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (J : I → Type*) (a b : ∀ i, J i → ZMod (p i)) (j₀ : ∀ i, J i) + (hrow : ∀ i, a i (j₀ i) ≠ 0 ∨ b i (j₀ i) ≠ 0) : + (Fintype.card ((ZMod (∏ i, p i))ˣ × (ZMod (∏ i, p i))ˣ) : ℝ)⁻¹ * + (∑ z, ∏ i, if ∀ j, a i j * (crtUnitPairEquiv p hc z i).1 + + b i j * (crtUnitPairEquiv p hc z i).2 = 0 then (1 : ℝ) else 0) = + ∏ i, if unitLineFeasible (a i) (b i) (j₀ i) then + (Fintype.card (ZMod (p i))ˣ : ℝ)⁻¹ else 0 := by + rw [crt_unit_pair_average p hc + (fun i z => if ∀ j, a i j * z.1 + b i j * z.2 = 0 then (1 : ℝ) else 0)] + apply Finset.prod_congr rfl + intro i _ + rw [indicator_probability] + exact unit_lineSystem_probability (a i) (b i) (j₀ i) (hrow i) + +theorem crt_external_lineSystems_probability {I : Type*} [Fintype I] [DecidableEq I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] [∀ i, NeZero (p i)] [NeZero (∏ i, p i)] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (J : I → Type*) (a b : ∀ i, J i → ZMod (p i)) (j₀ : ∀ i, J i) + (hrow : ∀ i, a i (j₀ i) ≠ 0 ∨ b i (j₀ i) ≠ 0) : + (Fintype.card (ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) : ℝ)⁻¹ * + (∑ z, ∏ i, if ∀ j, a i j * (crtExternalPairEquiv p hc z i).1 + + b i j * (crtExternalPairEquiv p hc z i).2 = 0 then (1 : ℝ) else 0) = + ∏ i, if externalLineFeasible (a i) (b i) (j₀ i) then (p i : ℝ)⁻¹ else 0 := by + rw [crt_external_pair_average p hc + (fun i z => if ∀ j, a i j * z.1 + b i j * z.2 = 0 then (1 : ℝ) else 0)] + apply Finset.prod_congr rfl + intro i _ + rw [indicator_probability] + exact external_lineSystem_probability (a i) (b i) (j₀ i) (hrow i) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTLineAverage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTLineAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..796419889c56c00f580c6da8cc6657f9bc846a9c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTLineAverage.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CRTResidueAverage +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticLines + +namespace OAI + +/-! # Joint CRT factorization in the two giant environments -/ + +namespace Ostmann + +open scoped BigOperators + +theorem uniform_equiv_pi_average {I A : Type*} [Fintype I] [DecidableEq I] + [Fintype A] {X : I → Type*} [∀ i, Fintype (X i)] + (e : A ≃ ∀ i, X i) (f : ∀ i, X i → ℝ) : + (Fintype.card A : ℝ)⁻¹ * (∑ a, ∏ i, f i (e a i)) = + ∏ i, (Fintype.card (X i) : ℝ)⁻¹ * ∑ x, f i x := by + classical + rw [e.sum_comp (fun x => ∏ i, f i (x i)), Fintype.card_congr e, Fintype.card_pi] + rw [← Fintype.prod_sum] + simp only [Nat.cast_prod, Finset.prod_mul_distrib, Finset.prod_inv_distrib] + +noncomputable def crtUnitPairEquiv {I : Type*} [Fintype I] (a : I → ℕ) + (hc : Pairwise (fun i j => (a i).Coprime (a j))) : + ((ZMod (∏ i, a i))ˣ × (ZMod (∏ i, a i))ˣ) ≃ + (∀ i, (ZMod (a i))ˣ × (ZMod (a i))ˣ) := + ((crtUnitEquiv a hc).toEquiv.prodCongr (crtUnitEquiv a hc).toEquiv).trans + (Equiv.arrowProdEquivProdArrow I (fun i => (ZMod (a i))ˣ) + (fun i => (ZMod (a i))ˣ)).symm + +noncomputable def crtExternalPairEquiv {I : Type*} [Fintype I] (a : I → ℕ) + (hc : Pairwise (fun i j => (a i).Coprime (a j))) : + (ZMod (∏ i, a i) × (ZMod (∏ i, a i))ˣ) ≃ + (∀ i, ZMod (a i) × (ZMod (a i))ˣ) := + ((ZMod.prodEquivPi a hc).toEquiv.prodCongr (crtUnitEquiv a hc).toEquiv).trans + (Equiv.arrowProdEquivProdArrow I (fun i => ZMod (a i)) + (fun i => (ZMod (a i))ˣ)).symm + +theorem crtUnitPairEquiv_apply {I : Type*} [Fintype I] (a : I → ℕ) + (hc : Pairwise (fun i j => (a i).Coprime (a j))) + (u v : (ZMod (∏ i, a i))ˣ) (i : I) : + crtUnitPairEquiv a hc (u, v) i = (crtUnitEquiv a hc u i, crtUnitEquiv a hc v i) := rfl + +theorem crtExternalPairEquiv_apply {I : Type*} [Fintype I] (a : I → ℕ) + (hc : Pairwise (fun i j => (a i).Coprime (a j))) + (u : ZMod (∏ i, a i)) (v : (ZMod (∏ i, a i))ˣ) (i : I) : + crtExternalPairEquiv a hc (u, v) i = (ZMod.prodEquivPi a hc u i, crtUnitEquiv a hc v i) := rfl + +/-- The local line tests multiply when both giant coordinates are unit residues. -/ +theorem crt_unit_pair_average {I : Type*} [Fintype I] [DecidableEq I] + (a : I → ℕ) [∀ i, NeZero (a i)] [NeZero (∏ i, a i)] + (hc : Pairwise (fun i j => (a i).Coprime (a j))) + (f : ∀ i, (ZMod (a i))ˣ × (ZMod (a i))ˣ → ℝ) : + (Fintype.card ((ZMod (∏ i, a i))ˣ × (ZMod (∏ i, a i))ˣ) : ℝ)⁻¹ * + (∑ z, ∏ i, f i (crtUnitPairEquiv a hc z i)) = + ∏ i, (Fintype.card ((ZMod (a i))ˣ × (ZMod (a i))ˣ) : ℝ)⁻¹ * ∑ z, f i z := + uniform_equiv_pi_average (crtUnitPairEquiv a hc) f + +/-- The same exact factorization with the first giant an external integer. -/ +theorem crt_external_pair_average {I : Type*} [Fintype I] [DecidableEq I] + (a : I → ℕ) [∀ i, NeZero (a i)] [NeZero (∏ i, a i)] + (hc : Pairwise (fun i j => (a i).Coprime (a j))) + (f : ∀ i, ZMod (a i) × (ZMod (a i))ˣ → ℝ) : + (Fintype.card (ZMod (∏ i, a i) × (ZMod (∏ i, a i))ˣ) : ℝ)⁻¹ * + (∑ z, ∏ i, f i (crtExternalPairEquiv a hc z i)) = + ∏ i, (Fintype.card (ZMod (a i) × (ZMod (a i))ˣ) : ℝ)⁻¹ * ∑ z, f i z := + uniform_equiv_pi_average (crtExternalPairEquiv a hc) f + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTLineProbabilities.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTLineProbabilities.lean new file mode 100644 index 0000000000000000000000000000000000000000..88edaeb9bb1aa13e7805f4e3f2ba1ef08da4e729 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTLineProbabilities.lean @@ -0,0 +1,57 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CRTLineAverage + +namespace OAI + +/-! # Exact products of the internal-prime line probabilities -/ + +namespace Ostmann + +open scoped BigOperators + +private theorem uniform_indicator_probability {X : Type*} [Fintype X] + (P : X → Prop) [DecidablePred P] : + (Fintype.card X : ℝ)⁻¹ * (∑ x, if P x then (1 : ℝ) else 0) = + (Fintype.card {x : X // P x} : ℝ) / Fintype.card X := by + have h : (∑ x, if P x then (1 : ℝ) else 0) = (Fintype.card {x : X // P x} : ℝ) := by + rw [Fintype.card_subtype] + simp only [← Finset.sum_filter, Finset.sum_const, nsmul_eq_mul, mul_one] + rw [h, div_eq_mul_inv, mul_comm] + +/-- In the prime environment every feasible local line contributes exactly +`1/(p-1)`, and the factors multiply over all distinct internal primes. -/ +theorem crt_unit_lines_probability {I : Type*} [Fintype I] [DecidableEq I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] [∀ i, NeZero (p i)] [NeZero (∏ i, p i)] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (a b : ∀ i, (ZMod (p i))ˣ) : + (Fintype.card ((ZMod (∏ i, p i))ˣ × (ZMod (∏ i, p i))ˣ) : ℝ)⁻¹ * + (∑ z, ∏ i, if a i * (crtUnitPairEquiv p hc z i).1 = + b i * (crtUnitPairEquiv p hc z i).2 then (1 : ℝ) else 0) = + ∏ i, (Fintype.card (ZMod (p i))ˣ : ℝ)⁻¹ := by + classical + rw [crt_unit_pair_average p hc (fun i z => if a i * z.1 = b i * z.2 then (1 : ℝ) else 0)] + apply Finset.prod_congr rfl + intro i _ + rw [uniform_indicator_probability] + exact unitLine_probability (a i) (b i) + +/-- In the external-integer environment every feasible line contributes +`1/p`, including a zero second coefficient. -/ +theorem crt_external_lines_probability {I : Type*} [Fintype I] [DecidableEq I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] [∀ i, NeZero (p i)] [NeZero (∏ i, p i)] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (a : ∀ i, (ZMod (p i))ˣ) (b : ∀ i, ZMod (p i)) : + (Fintype.card (ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) : ℝ)⁻¹ * + (∑ z, ∏ i, if (a i : ZMod (p i)) * (crtExternalPairEquiv p hc z i).1 = + b i * (crtExternalPairEquiv p hc z i).2 then (1 : ℝ) else 0) = + ∏ i, (p i : ℝ)⁻¹ := by + classical + rw [crt_external_pair_average p hc + (fun i z => if (a i : ZMod (p i)) * z.1 = b i * z.2 then (1 : ℝ) else 0)] + apply Finset.prod_congr rfl + intro i _ + rw [uniform_indicator_probability] + exact externalLine_probability (a i) (b i) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTPhaseLift.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTPhaseLift.lean new file mode 100644 index 0000000000000000000000000000000000000000..55578696f80c7c01e90d859bf99a20e2004d904c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTPhaseLift.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Characters.CRTFourier +import OAI.NumberTheory.Ostmann.QuadraticCenter.RealQuadraticPhase + +namespace OAI + +/-! # Identifying the CRT phase with the common real translation -/ + +namespace Ostmann + +theorem crt_translation_phase {d M : ℕ} [NeZero d] [NeZero M] + (h : d.Coprime M) (t : ZMod M) (h₀ u : ℤ) + (hlift : (d : ℤ) ∣ (t.val : ℤ) + (M : ℤ) * h₀) : + ZMod.stdAddChar (t * ((d : ZMod M)⁻¹ * (u : ZMod M))) = + realAdditivePhase ((((t.val : ℝ) / M + h₀) * u) / d) := by + obtain ⟨k, hk⟩ := hlift + have hd : IsUnit (d : ZMod M) := (ZMod.isUnit_iff_coprime d M).mpr h + have hkmod : (d : ZMod M) * (k : ZMod M) = t := by + have hh := congrArg (fun z : ℤ => (z : ZMod M)) hk + simpa only [Int.cast_add, Int.cast_mul, Int.cast_natCast, ZMod.natCast_self, + zero_mul, add_zero, ZMod.natCast_zmod_val] using hh.symm + have hkinv : (d : ZMod M)⁻¹ * t = (k : ZMod M) := by + rw [← hkmod, ← mul_assoc, ZMod.inv_mul_of_unit _ hd, one_mul] + have harg : t * ((d : ZMod M)⁻¹ * (u : ZMod M)) = ((k * u : ℤ) : ZMod M) := by + rw [Int.cast_mul, ← hkinv] + ring + have hkreal : (t.val : ℝ) + (M : ℝ) * h₀ = (d : ℝ) * k := by exact_mod_cast hk + have hreal : (((t.val : ℝ) / M + h₀) * u) / d = ((k * u : ℤ) : ℝ) / M := by + have hdR : (d : ℝ) ≠ 0 := by exact_mod_cast NeZero.ne d + have hMR : (M : ℝ) ≠ 0 := by exact_mod_cast NeZero.ne M + calc + _ = ((t.val : ℝ) + M * h₀) * u / ((M : ℝ) * d) := by field_simp + _ = _ := by rw [hkreal]; push_cast; field_simp + rw [harg, hreal, ZMod.stdAddChar_coe] + unfold realAdditivePhase + congr 1 + push_cast + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTResidueAverage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTResidueAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..f656ecddd4bb9e7ee1ed7e59acb424acfa08519a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CRTResidueAverage.lean @@ -0,0 +1,49 @@ +import Mathlib.Data.ZMod.QuotientRing +import Mathlib.Algebra.Group.Pi.Units +import Mathlib.Algebra.Group.Units.Equiv +import Mathlib.Data.Fintype.BigOperators +import Mathlib.Basic.Real.Basic + +namespace OAI + +/-! # Exact independent residue averages from the Chinese remainder theorem -/ + +namespace Ostmann + +open scoped BigOperators + +/-- CRT on the actual unit residue classes, including prime-square moduli. -/ +noncomputable def crtUnitEquiv {I : Type*} [Fintype I] (a : I → ℕ) + (hc : Pairwise (fun i j => (a i).Coprime (a j))) : + (ZMod (∏ i, a i))ˣ ≃* (∀ i, (ZMod (a i))ˣ) := + (Units.mapEquiv (ZMod.prodEquivPi a hc).toMulEquiv).trans MulEquiv.piUnits + +theorem crtUnitEquiv_apply {I : Type*} [Fintype I] (a : I → ℕ) + (hc : Pairwise (fun i j => (a i).Coprime (a j))) + (u : (ZMod (∏ i, a i))ˣ) (i : I) : + crtUnitEquiv a hc u i = Units.map + ((ZMod.castHom (Finset.dvd_prod_of_mem a (Finset.mem_univ i)) (ZMod (a i))).toMonoidHom) u := by + apply Units.ext + change ZMod.prodEquivPi a hc (u : ZMod (∏ i, a i)) i = _ + exact ZMod.prodEquivPi_apply a hc u i + +/-- Uniform CRT unit residues factor exactly into independent local uniform +unit residues; no equidistribution hypothesis is used in this finite step. -/ +theorem crt_unit_average {I : Type*} [Fintype I] [DecidableEq I] + (a : I → ℕ) [∀ i, NeZero (a i)] [NeZero (∏ i, a i)] + (hc : Pairwise (fun i j => (a i).Coprime (a j))) + (f : ∀ i, (ZMod (a i))ˣ → ℝ) : + (Fintype.card (ZMod (∏ i, a i))ˣ : ℝ)⁻¹ * + (∑ u : (ZMod (∏ i, a i))ˣ, ∏ i, f i (crtUnitEquiv a hc u i)) = + ∏ i, (Fintype.card (ZMod (a i))ˣ : ℝ)⁻¹ * ∑ u : (ZMod (a i))ˣ, f i u := by + classical + have hsum := (crtUnitEquiv a hc).toEquiv.sum_comp (fun u => ∏ i, f i (u i)) + change (∑ u : (ZMod (∏ i, a i))ˣ, ∏ i, f i (crtUnitEquiv a hc u i)) = + (∑ u : ∀ i, (ZMod (a i))ˣ, ∏ i, f i (u i)) at hsum + rw [hsum, Fintype.card_congr (crtUnitEquiv a hc).toEquiv, Fintype.card_pi] + rw [← Fintype.prod_sum] + simp only [Nat.cast_prod, Finset.prod_mul_distrib, Finset.prod_inv_distrib] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulk.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulk.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa71c8f959f9298ea3fd0ba134ae4fc9fa88c666 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulk.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkDecode +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkSamples + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk +open Construction Conclusion HistoryBulkProducts HistoryLinearization HistoryResidueRegular + +theorem decodeHistory_leaf_bulkValues (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (path : Tree.Leaves l) : + bulkValues (leafStateAt (decodeHistory sources (Template.initial m k) V l a c) path).small= + List.ofFn (bulkSamples sources m k l x (orderedLeafIndex l path)) := by + have ha : Template.Matches (Template.current (Template.initial m k) l) a.small := by + rw [hx] + exact Template.assignedSlots_matches _ _ _ + rw [decodeHistory_bulkValues _ _ _ _ _ _ _ ha,hx,bulkValues_assignedSlots,bulkBlock_rows] + +theorem decodeHistory_leaf_bulkProduct (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (path : Tree.Leaves l) : + bulkProduct (leafStateAt (decodeHistory sources (Template.initial m k) V l a c) path).small= + ∏ i, bulkSamples sources m k l x (orderedLeafIndex l path) i := by + change (bulkValues _).prod=_ + rw [decodeHistory_leaf_bulkValues _ _ _ _ _ _ _ _ hx,List.prod_ofFn] + +theorem decodeHistory_leafBulk_coe {q : ℕ} [Fact q.Prime] + (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (hr : Regular q (decodeHistory sources (Template.initial m k) V l a c)) + (path : Tree.Leaves l) : + (HistoryTreeParameters.leafBulk _ hr path : ZMod q)= + ∏ i, (bulkSamples sources m k l x (orderedLeafIndex l path) i : ZMod q) := by + rw [HistoryTreeParameters.leafBulk_coe,decodeHistory_leaf_bulkProduct _ _ _ _ _ _ _ _ hx] + simp only [Nat.cast_prod] + +theorem bulkSamples_permuted (b k l : ℕ) (bulk : PrimeSource) + (top : Fin 3→PrimeSource) (comp : Fin k→Fin 2→PrimeSource) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b))) + (x : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) (u : Fin (2^l) × Fin (2*b)) : + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l + (leafBulkAssignmentPermutation b k l bulk top comp σ x) u.1 u.2= + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l x (σ u).1 (σ u).2 := by + exact leafBulkAssignmentPermutation_leaf_val b k l bulk top comp σ x u + +theorem decodeHistory_leaf_bulkProduct_permuted (b k : ℕ) (bulk : PrimeSource) + (top : Fin 3→PrimeSource) (comp : Fin k→Fin 2→PrimeSource) (V : ℕ→ℕ) + (l : ℕ) (a : State) + (c : HistoryChoices (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b))) + (x : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (hx : a.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + (leafBulkAssignmentPermutation b k l bulk top comp σ x)) + (path : Tree.Leaves l) : + bulkProduct (leafStateAt (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a c) path).small= + ∏ i : Fin (2*b), bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l x + (σ (orderedLeafIndex l path,i)).1 (σ (orderedLeafIndex l path,i)).2 := by + refine (decodeHistory_leaf_bulkProduct (initialSourceFamily b k bulk top comp) + (2*b) k V l a c (leafBulkAssignmentPermutation b k l bulk top comp σ x) hx path).trans ?_ + apply Finset.prod_congr rfl + intro i hi + exact bulkSamples_permuted b k l bulk top comp σ x (orderedLeafIndex l path,i) + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e832175ca927103e8313ac665f6beebf98e22d5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkBasic.lean @@ -0,0 +1,101 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryTreeLeaves +import OAI.NumberTheory.Ostmann.Conclusion.BulkPositionPermutation +import OAI.NumberTheory.Ostmann.Construction.CanonicalSourceLabels +import OAI.NumberTheory.Ostmann.Construction.DiagonalRegroupingCounterpart + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk +open Construction Conclusion HistoryBulkProducts HistoryLinearization + +def bulkValues (xs : List SmallSlot) : List ℕ := + (xs.filter (fun q => decide (q.role=.bulk))).map SmallSlot.value + +@[simp] theorem bulkValues_append (xs ys : List SmallSlot) : + bulkValues (xs++ys)=bulkValues xs++bulkValues ys := by + simp [bulkValues] + +theorem bulkValues_length_of_matches {T : List SourceSlot} {xs : List SmallSlot} + (h : Template.Matches T xs) : + (bulkValues xs).length=Template.countRole T .bulk := by + have he := congrArg (fun zs : List (SlotRole × ℕ) => + (zs.filter (fun q => decide (q.1=.bulk))).length) h + simpa [bulkValues,Template.countRole,List.filter_map,Function.comp_def] using he + +theorem bulkValues_reinsert (j : ℕ) (T : List SourceSlot) (u h : List SmallSlot) + (hu : Template.Matches (Template.extracted j T) u) + (hh : Template.Matches (Template.remainder j T) h) : + bulkValues (Template.reinsert j T u h)=bulkValues h := by + have he := (reinsert_role_filters j T u h hu hh).2 + have hp : (fun q : SmallSlot => decide (q.role=.bulk) && + decide (q.role≠.compensation j))=(fun q => decide (q.role=.bulk)) := by + funext q + by_cases hq : q.role=.bulk <;> simp [hq] + unfold bulkValues + conv_rhs => rw [←he,List.filter_filter,hp] + +theorem bulkValues_halves (xs : List SmallSlot) (n N : ℕ) + (hn : (bulkValues (xs.take n)).length=N) : + bulkValues (xs.take n)=(bulkValues xs).take N ∧ + bulkValues (xs.drop n)=(bulkValues xs).drop N := by + have he : bulkValues xs=bulkValues (xs.take n)++bulkValues (xs.drop n) := by + rw [←bulkValues_append,List.take_append_drop] + constructor <;> rw [he,←hn] <;> simp + +theorem bulkLeafTemplate_filter_bulk (m k l : ℕ) : + (bulkLeafTemplate m k l).filter (fun q => decide (q.role=.bulk))=initialBulkSlots m := by + have ht : (bulkLeafTail m k l).filter (fun q => decide (q.role=.bulk))=[] := by + apply List.filter_eq_nil_iff.mpr + intro q hq + simp [bulkLeafTail_not_bulk m k l q hq] + have hi : (initialBulkSlots m).filter (fun q => decide (q.role=.bulk))=initialBulkSlots m := by + apply List.filter_eq_self.mpr + intro q hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + rfl + simp only [bulkLeafTemplate,List.filter_append,ht,hi,List.append_nil] + +theorem current_count_bulk (m k l : ℕ) : + Template.countRole (Template.current (Template.initial m k) l) .bulk=2^l*m := by + simp [Template.countRole,current_eq_bulkLeafBlocks,List.filter_flatten, + bulkLeafTemplate_filter_bulk,List.length_flatten] + +theorem remainder_count_bulk (m k l : ℕ) : + Template.countRole (Template.remainder (l+1) + (Template.current (Template.initial m k) l)) .bulk=2^l*m := by + rw [Template.countRole_remainder _ _ _ (by simp),current_count_bulk] + +def orderedLeafIndex : (l : ℕ) → Tree.Leaves l ≃ Fin (2^l) + | 0 => by + change (Fin 0 → Bool) ≃ Fin 1 + exact Equiv.ofUnique _ _ + | l+1 => (Fin.consEquiv (fun _ : Fin (l+1) => Bool)).symm |>.trans + ((Equiv.boolProdEquivSum (Tree.Leaves l)).trans + ((Equiv.sumCongr (orderedLeafIndex l) (orderedLeafIndex l)).trans + (finSumFinEquiv.trans (finCongr (by omega))))) + +@[simp] theorem orderedLeafIndex_zero (p : Tree.Leaves 0) : + (orderedLeafIndex 0 p).val=0 := by omega + +@[simp] theorem orderedLeafIndex_left (l : ℕ) (p : Tree.Leaves l) : + (orderedLeafIndex (l+1) (Fin.cons false p)).val=(orderedLeafIndex l p).val := by + simp [orderedLeafIndex,Equiv.boolProdEquivSum,finSumFinEquiv] + +@[simp] theorem orderedLeafIndex_right (l : ℕ) (p : Tree.Leaves l) : + (orderedLeafIndex (l+1) (Fin.cons true p)).val=2^l+(orderedLeafIndex l p).val := by + simp [orderedLeafIndex,Equiv.boolProdEquivSum,finSumFinEquiv,Nat.add_comm] + +def bulkBlock (m : ℕ) : (l : ℕ) → Tree.Leaves l → List ℕ → List ℕ + | 0, _, xs => xs + | l+1, p, xs => if p 0 then bulkBlock m l (Fin.tail p) (xs.drop (2^l*m)) + else bulkBlock m l (Fin.tail p) (xs.take (2^l*m)) + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkCoupled.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkCoupled.lean new file mode 100644 index 0000000000000000000000000000000000000000..3ce8d58a3b1ccac75e704573a75d2d9a8dc0d143 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkCoupled.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkHaar +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkUnits + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk +open Construction Conclusion HistoryResidueRegular + +variable {q : ℕ} [Fact q.Prime] +variable (b k : ℕ) (bulk : PrimeSource) + (top : Fin 3→PrimeSource) (comp : Fin k→Fin 2→PrimeSource) (V : ℕ→ℕ) + (l : ℕ) (a a' : State) + (c c' : HistoryChoices (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b))) + (x : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (hx : a.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x) + (hx' : a'.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + (leafBulkAssignmentPermutation b k l bulk top comp σ x)) + (hr : Regular q (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a c)) + (hr' : Regular q (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a' c')) + +include hx hx' + +theorem decodeHistory_leafBulk_pair : + (HistoryTreeParameters.leafBulk _ hr,HistoryTreeParameters.leafBulk _ hr')= + orderedProducts σ (bulkUnits (initialSourceFamily b k bulk top comp) + (2*b) k V l a c x hx hr) := by + apply Prod.ext + · funext path + exact decodeHistory_leafBulk (initialSourceFamily b k bulk top comp) + (2*b) k V l a c x hx hr path + · funext path + exact decodeHistory_leafBulk_permuted b k bulk top comp V l a a' c c' σ x hx hx' hr hr' path + +theorem decodeHistory_leafBulk_pair_eq_slotLeaves : + (HistoryTreeParameters.leafBulk _ hr,HistoryTreeParameters.leafBulk _ hr')= + PermutationDiagramComparison.slotLeaves (haarPermutation σ) + (haarSamples (bulkUnits (initialSourceFamily b k bulk top comp) + (2*b) k V l a c x hx hr)) := + (decodeHistory_leafBulk_pair b k bulk top comp V l a a' c c' σ x hx hx' hr hr').trans + (orderedProducts_eq_slotLeaves σ _) + +theorem decodeHistory_leafBulk_pair_eq_coupled (hm : 0<2*b) : + (HistoryTreeParameters.leafBulk _ hr,HistoryTreeParameters.leafBulk _ hr')= + (TreePermutationHaar.coupledEquiv (haarPermutation σ) hm + (PermutationHaar.toCoupled (haarPermutation σ) hm + (haarSamples (bulkUnits (initialSourceFamily b k bulk top comp) + (2*b) k V l a c x hx hr)))).val := by + exact (decodeHistory_leafBulk_pair b k bulk top comp V l a a' c c' σ x hx hx' hr hr').trans + (orderedProducts_eq_leafPairEquiv σ _) + +theorem decodeHistory_leafBulk_pair_coupled (hm : 0<2*b) : + (TreePermutationHaar.leftPartition (haarPermutation σ)).coupled + (TreePermutationHaar.rightPartition (haarPermutation σ) hm) + (HistoryTreeParameters.leafBulk _ hr,HistoryTreeParameters.leafBulk _ hr') := by + rw [decodeHistory_leafBulk_pair b k bulk top comp V l a a' c c' σ x hx hx' hr hr'] + exact orderedProducts_coupled σ hm _ + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkDecode.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkDecode.lean new file mode 100644 index 0000000000000000000000000000000000000000..a55995835c0549b1286d75d0ffa66a39d2ccbf44 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkDecode.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk +open Construction Conclusion HistoryLinearization + +theorem decodeHistory_bulkValues (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (ha : Template.Matches (Template.current (Template.initial m k) l) a.small) + (path : Tree.Leaves l) : + bulkValues (leafStateAt (decodeHistory sources (Template.initial m k) V l a c) path).small= + bulkBlock m l path (bulkValues a.small) := by + induction l generalizing a with + | zero => rfl + | succ l ih => + let T := Template.current (Template.initial m k) l + let n := (Template.remainder (l+1) T).length + let u := assignedSlots sources (Template.extracted (l+1) T) c.2.2.1 + have hh := Template.matches_halves (Template.remainder (l+1) T) a.small ha + have hu := Template.assignedSlots_matches sources (Template.extracted (l+1) T) c.2.2.1 + have hn : (bulkValues (a.small.take n)).length=2^l*m := + (bulkValues_length_of_matches hh.1).trans (remainder_count_bulk m k l) + have hb := bulkValues_halves a.small n (2^l*m) hn + simp only [decodeHistory,leafStateAt,bulkBlock] + split_ifs with hp + · rw [ih _ c.2.2.2.2 (Template.reinsert_matches _ _ _ _ hu hh.2)] + change bulkBlock m l (Fin.tail path) (bulkValues (Template.reinsert (l+1) T u + (a.small.drop n))) = _ + rw [bulkValues_reinsert _ _ _ _ hu hh.2,hb.2] + · rw [ih _ c.2.2.2.1 (Template.reinsert_matches _ _ _ _ hu hh.1)] + change bulkBlock m l (Fin.tail path) (bulkValues (Template.reinsert (l+1) T u + (a.small.take n))) = _ + rw [bulkValues_reinsert _ _ _ _ hu hh.1,hb.1] + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkHaar.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkHaar.lean new file mode 100644 index 0000000000000000000000000000000000000000..9ce729506d81929a1eec0d25135263f3fa82abcc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkHaar.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkBasic +import OAI.NumberTheory.Ostmann.Arithmetic.PermutationDiagramComparisonProducts +import OAI.NumberTheory.Ostmann.Arithmetic.TreePermutationHaar + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +def addressChange (l : ℕ) : Equiv.Perm (Fin (2^l)) := + (TreePermutationHaar.leafIndex l).symm.trans (orderedLeafIndex l) + +def slotChange (l m : ℕ) : Equiv.Perm (Fin (2^l) × Fin m) := + (addressChange l).prodCongr (Equiv.refl _) + +def haarPermutation {l m : ℕ} (σ : Equiv.Perm (Fin (2^l) × Fin m)) : + Equiv.Perm (Fin (2^l) × Fin m) := + (slotChange l m).trans (σ.symm.trans (slotChange l m).symm) + +def haarSamples {l m : ℕ} {G : Type*} (samples : Fin (2^l) × Fin m→G) : + Fin (2^l) × Fin m→G := samples ∘ slotChange l m + +@[simp] theorem haarSamples_left {l m : ℕ} {G : Type*} + (samples : Fin (2^l) × Fin m→G) (path : Tree.Leaves l) (i : Fin m) : + haarSamples samples (TreePermutationHaar.leafIndex l path,i)= + samples (orderedLeafIndex l path,i) := by + simp [haarSamples,slotChange,addressChange] + +@[simp] theorem haarSamples_right {l m : ℕ} {G : Type*} + (σ : Equiv.Perm (Fin (2^l) × Fin m)) + (samples : Fin (2^l) × Fin m→G) (path : Tree.Leaves l) (i : Fin m) : + haarSamples samples ((haarPermutation σ).symm (TreePermutationHaar.leafIndex l path,i))= + samples (σ (orderedLeafIndex l path,i)) := by + change samples (slotChange l m ((slotChange l m).symm + (σ (slotChange l m (TreePermutationHaar.leafIndex l path,i)))))=_ + rw [Equiv.apply_symm_apply] + simp [slotChange,addressChange] + +def orderedProducts {l m : ℕ} {G : Type*} [CommMonoid G] + (σ : Equiv.Perm (Fin (2^l) × Fin m)) (samples : Fin (2^l) × Fin m→G) : + (Tree.Leaves l→G) × (Tree.Leaves l→G) := + ((fun path => ∏i, samples (orderedLeafIndex l path,i)), + (fun path => ∏i, samples (σ (orderedLeafIndex l path,i)))) + +theorem orderedProducts_eq_haar_rows {l m : ℕ} {G : Type*} [CommMonoid G] + (σ : Equiv.Perm (Fin (2^l) × Fin m)) (samples : Fin (2^l) × Fin m→G) : + orderedProducts σ samples= + ((fun path => ∏i, haarSamples samples (TreePermutationHaar.leafIndex l path,i)), + (fun path => ∏i, haarSamples samples + ((haarPermutation σ).symm (TreePermutationHaar.leafIndex l path,i)))) := by + simp [orderedProducts] + +theorem orderedProducts_eq_slotLeaves {l m : ℕ} {F : Type*} [Field F] + (σ : Equiv.Perm (Fin (2^l) × Fin m)) (samples : Fin (2^l) × Fin m→Fˣ) : + orderedProducts σ samples= + PermutationDiagramComparison.slotLeaves (haarPermutation σ) (haarSamples samples) := + orderedProducts_eq_haar_rows σ samples + +theorem orderedProducts_eq_leafPairEquiv {l m : ℕ} {F : Type*} [Field F] + (σ : Equiv.Perm (Fin (2^l) × Fin m)) (samples : Fin (2^l) × Fin m→Fˣ) : + orderedProducts σ samples=TreePermutationHaar.leafPairEquiv + (PermutationHaar.products (haarPermutation σ) (haarSamples samples)) := + (orderedProducts_eq_slotLeaves σ samples).trans + (PermutationDiagramComparison.slotLeaves_eq_leafPairEquiv _ _) + +theorem orderedProducts_coupled {l m : ℕ} {F : Type*} [Field F] + (σ : Equiv.Perm (Fin (2^l) × Fin m)) (hm : 0 < m) + (samples : Fin (2^l) × Fin m→Fˣ) : + (TreePermutationHaar.leftPartition (haarPermutation σ)).coupled + (TreePermutationHaar.rightPartition (haarPermutation σ) hm) (orderedProducts σ samples) := by + rw [orderedProducts_eq_leafPairEquiv] + exact (TreePermutationHaar.coupledEquiv (haarPermutation σ) hm + (PermutationHaar.toCoupled (haarPermutation σ) hm (haarSamples samples))).property + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkRows.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkRows.lean new file mode 100644 index 0000000000000000000000000000000000000000..9050c10129ac7e70512ba6671fe9529fd5e0e216 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkRows.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk +open Construction Conclusion + +def rows {n m : ℕ} (f : Fin n → Fin m → ℕ) : List ℕ := + (List.ofFn (fun b => List.ofFn (f b))).flatten + +@[simp] theorem rows_length {n m : ℕ} (f : Fin n → Fin m → ℕ) : + (rows f).length=n*m := by + simp [rows,List.length_flatten,List.map_ofFn,Function.comp_def] + +theorem rows_split {n m : ℕ} (f : Fin (n+n) → Fin m → ℕ) : + rows f=rows (fun b : Fin n => f (b.castLE (Nat.le_add_right n n))) ++ + rows (fun b : Fin n => f (b.natAdd n)) := by + unfold rows + rw [List.ofFn_add,List.flatten_append] + +theorem bulkBlock_rows (m l : ℕ) (path : Tree.Leaves l) + (f : Fin (2^l) → Fin m → ℕ) : + bulkBlock m l path (rows f)=List.ofFn (f (orderedLeafIndex l path)) := by + induction l with + | zero => + have hz : orderedLeafIndex 0 path=(0:Fin 1) := by ext; simp + simp [bulkBlock,rows,hz] + | succ l ih => + have hn : 2^(l+1)=2^l+2^l := by omega + let f' : Fin (2^l+2^l) → Fin m → ℕ := fun b => f (Fin.cast hn.symm b) + have he : rows f=rows f' := by + unfold rows + rw [List.ofFn_congr hn] + rw [he,rows_split] + have hl := rows_length (fun b : Fin (2^l) => f' (b.castLE (Nat.le_add_right _ _))) + simp only [bulkBlock] + split_ifs with hp + · rw [←hl,List.drop_left,ih] + congr 1 + apply congrArg f + apply Fin.ext + have hepath : path=Fin.cons true (Fin.tail path) := by + simpa only [hp] using (Fin.cons_self_tail path).symm + rw [hepath,orderedLeafIndex_right] + rfl + · rw [←hl,List.take_left,ih] + congr 1 + apply congrArg f + apply Fin.ext + have hp' : path 0=false := Bool.eq_false_iff.mpr hp + have hepath : path=Fin.cons false (Fin.tail path) := by + simpa only [hp'] using (Fin.cons_self_tail path).symm + rw [hepath,orderedLeafIndex_left] + rfl + +theorem bulkValues_ofFn_prefix {d m : ℕ} (hm : m≤d) (f : Fin d→SmallSlot) + (hf : ∀ i : Fin d, (f i).role = SlotRole.bulk ↔ i.val < m) : + bulkValues (List.ofFn f)=List.ofFn (fun i : Fin m => (f (i.castLE hm)).value) := by + have hd : d=m+(d-m) := by omega + have he := List.ofFn_congr hd f + rw [he,List.ofFn_add,bulkValues_append] + have hl : (List.ofFn (fun i : Fin m => + f (Fin.cast hd.symm (i.castLE (Nat.le_add_right m (d-m)))))).filter + (fun q => decide (q.role=.bulk)) = + List.ofFn (fun i : Fin m => f (Fin.cast hd.symm + (i.castLE (Nat.le_add_right m (d-m))))) := by + apply List.filter_eq_self.mpr + intro q hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + exact decide_eq_true ((hf _).mpr i.isLt) + have hr : (List.ofFn (fun i : Fin (d-m) => + f (Fin.cast hd.symm (i.natAdd m)))).filter + (fun q => decide (q.role=.bulk))=[] := by + apply List.filter_eq_nil_iff.mpr + intro q hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + simp [hf] + simp only [bulkValues,hl,hr,List.map_nil,List.append_nil,List.map_ofFn] + rfl + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkSamples.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkSamples.lean new file mode 100644 index 0000000000000000000000000000000000000000..5668c4d1197fa5790e44832ee68bcbd3826bf194 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkSamples.lean @@ -0,0 +1,71 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkRows + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk +open Construction Conclusion + +def bulkSamples (sources : SourceFamily) (m k l : ℕ) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (b : Fin (2^l)) (i : Fin m) : ℕ := + (x ((currentBulkPositionEquiv m k l).symm (b,i)).val).val + +theorem assignedSlots_blocks (sources : SourceFamily) (m k l : ℕ) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) : + assignedSlots sources (Template.current (Template.initial m k) l) x= + (List.ofFn (fun b : Fin (2^l) => List.ofFn + (fun i : Fin (bulkLeafTemplate m k l).length => + let j := (currentPositionBlockEquiv m k l).symm (b,i) + ({role := (Template.current (Template.initial m k) l)[j].role, + value := (x j).val, + origin := (Template.current (Template.initial m k) l)[j].origin} : SmallSlot)))).flatten := by + unfold assignedSlots Template.sample + rw [List.ofFn_congr (current_bulk_block_length m k l),List.ofFn_mul] + apply congrArg List.flatten + apply congrArg List.ofFn + funext b + apply congrArg List.ofFn + funext i + have he (j : Fin (2^l*(bulkLeafTemplate m k l).length)) + (hj : j.val=b.val*(bulkLeafTemplate m k l).length+i.val) : + Fin.cast (current_bulk_block_length m k l).symm j= + (currentPositionBlockEquiv m k l).symm (b,i) := by + apply Fin.ext + simpa using hj + simp only [he] + congr 1 + apply congrArg (fun j => (x j).val) + exact he _ rfl + +theorem bulkValues_flatten (xs : List (List SmallSlot)) : + bulkValues xs.flatten=(xs.map bulkValues).flatten := by + simp only [bulkValues,List.filter_flatten,List.map_flatten,List.map_map] + rfl + +theorem bulkValues_assignedSlots (sources : SourceFamily) (m k l : ℕ) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) : + bulkValues (assignedSlots sources (Template.current (Template.initial m k) l) x)= + rows (bulkSamples sources m k l x) := by + rw [assignedSlots_blocks,bulkValues_flatten,List.map_ofFn] + unfold rows + apply congrArg List.flatten + apply congrArg List.ofFn + funext b + change bulkValues (List.ofFn (fun i : Fin (bulkLeafTemplate m k l).length => + ({role := (Template.current (Template.initial m k) l)[(currentPositionBlockEquiv m k l).symm (b,i)].role, + value := (x ((currentPositionBlockEquiv m k l).symm (b,i))).val, + origin := (Template.current (Template.initial m k) l)[(currentPositionBlockEquiv m k l).symm (b,i)].origin} : SmallSlot)))=_ + rw [bulkValues_ofFn_prefix (bulkLeafTemplate_length_ge m k l) _ (by + intro i + simp only [Fin.getElem_fin,currentPositionBlockEquiv_get] + exact bulkLeafTemplate_bulk_iff m k l i)] + rfl + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkUnits.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkUnits.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8fc4b0019ecd8d13c4799183e43f28b0b6c6461 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CanonicalHistoryLeafBulkUnits.lean @@ -0,0 +1,99 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.CanonicalHistoryLeafBulk +open Construction Conclusion HistoryResidueRegular + +variable {q : ℕ} [Fact q.Prime] + +theorem bulkSamples_ne_zero (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (hr : Regular q (decodeHistory sources (Template.initial m k) V l a c)) + (u : Fin (2^l) × Fin m) : + (bulkSamples sources m k l x u.1 u.2 : ZMod q)≠0 := by + apply value_ne_zero hr + rw [decodeHistory_root] + simp only [State.values,List.mem_cons] + right; right + rw [hx] + change _ ∈ (List.ofFn (fun i => + ({role := (Template.current (Template.initial m k) l)[i].role, + value := (x i).val, + origin := (Template.current (Template.initial m k) l)[i].origin} : SmallSlot))).map SmallSlot.value + rw [List.map_ofFn] + exact List.mem_ofFn.mpr ⟨((currentBulkPositionEquiv m k l).symm u).val,rfl⟩ + +def bulkUnits (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (hr : Regular q (decodeHistory sources (Template.initial m k) V l a c)) + (u : Fin (2^l) × Fin m) : (ZMod q)ˣ := + Units.mk0 _ (bulkSamples_ne_zero sources m k V l a c x hx hr u) + +@[simp] theorem bulkUnits_coe (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (hr : Regular q (decodeHistory sources (Template.initial m k) V l a c)) + (u : Fin (2^l) × Fin m) : + (bulkUnits sources m k V l a c x hx hr u : ZMod q)= + (bulkSamples sources m k l x u.1 u.2 : ZMod q) := rfl + +theorem decodeHistory_leafBulk (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) + (l : ℕ) (a : State) (c : HistoryChoices sources (Template.initial m k) V l) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (hr : Regular q (decodeHistory sources (Template.initial m k) V l a c)) + (path : Tree.Leaves l) : + HistoryTreeParameters.leafBulk _ hr path= + ∏ i, bulkUnits sources m k V l a c x hx hr (orderedLeafIndex l path,i) := by + apply Units.ext + rw [decodeHistory_leafBulk_coe _ _ _ _ _ _ _ _ hx] + change _=(Units.coeHom (ZMod q)) (∏ i, + bulkUnits sources m k V l a c x hx hr (orderedLeafIndex l path,i)) + rw [map_prod] + rfl + +theorem decodeHistory_leafBulk_permuted (b k : ℕ) (bulk : PrimeSource) + (top : Fin 3→PrimeSource) (comp : Fin k→Fin 2→PrimeSource) (V : ℕ→ℕ) + (l : ℕ) (a a' : State) + (c c' : HistoryChoices (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b))) + (x : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (hx : a.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x) + (hx' : a'.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + (leafBulkAssignmentPermutation b k l bulk top comp σ x)) + (hr : Regular q (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a c)) + (hr' : Regular q (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a' c')) (path : Tree.Leaves l) : + HistoryTreeParameters.leafBulk _ hr' path= + ∏ i, bulkUnits (initialSourceFamily b k bulk top comp) (2*b) k V l a c x hx hr + (σ (orderedLeafIndex l path,i)) := by + apply Units.ext + rw [decodeHistory_leafBulk_coe _ _ _ _ _ _ _ _ hx'] + change _=(Units.coeHom (ZMod q)) (∏ i, + bulkUnits (initialSourceFamily b k bulk top comp) (2*b) k V l a c x hx hr + (σ (orderedLeafIndex l path,i))) + rw [map_prod] + apply Finset.prod_congr rfl + intro i hi + exact congrArg (fun n : ℕ => (n : ZMod q)) + (bulkSamples_permuted b k l bulk top comp σ x (orderedLeafIndex l path,i)) + +end Ostmann.Arithmetic.CanonicalHistoryLeafBulk + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CellDifferenceGCD.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CellDifferenceGCD.lean new file mode 100644 index 0000000000000000000000000000000000000000..afec246b6b414ebd7a6c09a9774af672436f046d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CellDifferenceGCD.lean @@ -0,0 +1,86 @@ +import Mathlib.Algebra.GCDMonoid.Finset +import Mathlib.Algebra.GCDMonoid.Nat +import Mathlib.Data.Int.GCD +import OAI.NumberTheory.Ostmann.Preliminaries.CyclicSumsetCover + +namespace OAI + +/-! # GCD normalization of cell differences + +Finite cell differences divided by their gcd generate every cyclic quotient. +Reducing a set contained in `[0,s]` modulo `s` loses at most the upper endpoint. +-/ + +namespace Ostmann + +open scoped BigOperators + +private theorem nat_gcd_mem_subgroup {q : ℕ} (H : AddSubgroup (ZMod q)) + (a b : ℕ) (ha : (a : ZMod q) ∈ H) (hb : (b : ZMod q) ∈ H) : + (a.gcd b : ZMod q) ∈ H := by + have he : (a.gcd b : ZMod q) = + (Nat.gcdA a b) • (a : ZMod q) + (Nat.gcdB a b) • (b : ZMod q) := by + have hh := congrArg (fun z : ℤ => (z : ZMod q)) (Nat.gcd_eq_gcd_ab a b) + simpa [zsmul_eq_mul, mul_comm] using hh + rw [he] + exact H.add_mem (H.zsmul_mem ha _) (H.zsmul_mem hb _) + +private theorem finset_gcd_mem_subgroup {q : ℕ} (H : AddSubgroup (ZMod q)) + (A : Finset ℕ) (hA : ∀ a ∈ A, (a : ZMod q) ∈ H) : + ((A.gcd id : ℕ) : ZMod q) ∈ H := by + induction A using Finset.induction_on with + | empty => simp + | @insert a A ha ih => + rw [Finset.gcd_insert] + exact nat_gcd_mem_subgroup H a (A.gcd id) (hA a (Finset.mem_insert_self _ _)) + (ih (fun b hb => hA b (Finset.mem_insert_of_mem hb))) + +/-- A gcd-one set of nonnegative integers generates every cyclic quotient. -/ +theorem cyclic_closure_of_gcd_one (A : Finset ℕ) (hA : A.gcd id = 1) (q : ℕ) : + AddSubgroup.closure ((A.image (fun a : ℕ => (a : ZMod q)) : Finset (ZMod q)) : Set (ZMod q)) = ⊤ := by + let H := AddSubgroup.closure ((A.image (fun a : ℕ => (a : ZMod q)) : Finset (ZMod q)) : Set (ZMod q)) + have h1 : (1 : ZMod q) ∈ H := by + have hh := finset_gcd_mem_subgroup H A (fun a ha => + AddSubgroup.subset_closure (Finset.mem_image.mpr ⟨a, ha, rfl⟩)) + simpa [hA] using hh + apply top_unique + intro x _ + obtain ⟨z, rfl⟩ := ZMod.intCast_surjective x + change (z : ZMod q) ∈ H + simpa only [zsmul_one] using H.zsmul_mem h1 z + +/-- GCD normalization gives the required generating set without a primitivity +assumption on the original cell indices. -/ +theorem normalized_cyclic_closure (A : Finset ℕ) (a : ℕ) (ha : a ∈ A) (ha0 : a ≠ 0) + (q : ℕ) : + AddSubgroup.closure + ((A.image (fun b => b / A.gcd id)).image (fun b : ℕ => (b : ZMod q)) : Set (ZMod q)) = ⊤ := by + apply cyclic_closure_of_gcd_one + rw [Finset.gcd_image] + exact Finset.gcd_div_id_eq_one ha ha0 + +/-- The only collision introduced on `[0,s]` by reduction modulo `s` is +between the two endpoints. -/ +theorem card_residue_image_lower (A : Finset ℕ) (s : ℕ) (_hs : 0 < s) + (hbound : ∀ a ∈ A, a ≤ s) : + A.card ≤ (A.image (fun a : ℕ => (a : ZMod s))).card + 1 := by + have hinj : Set.InjOn (fun a : ℕ => (a : ZMod s)) (A.erase s) := by + intro a ha b hb hab + have hat : a < s := lt_of_le_of_ne (hbound a (Finset.mem_of_mem_erase ha)) + (Finset.ne_of_mem_erase ha) + have hbt : b < s := lt_of_le_of_ne (hbound b (Finset.mem_of_mem_erase hb)) + (Finset.ne_of_mem_erase hb) + have hh := (ZMod.natCast_eq_natCast_iff' a b s).mp hab + simpa only [Nat.mod_eq_of_lt hat, Nat.mod_eq_of_lt hbt] using hh + have hc := Finset.card_image_iff.mpr hinj + have hle := Finset.card_le_card (Finset.image_subset_image + (f := fun a : ℕ => (a : ZMod s)) (Finset.erase_subset s A)) + rw [hc] at hle + by_cases hmem : s ∈ A + · have he := Finset.card_erase_add_one hmem + omega + · simpa [Finset.erase_eq_of_notMem hmem] using hle.trans (Nat.le_succ _) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedCoefficientFlags.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedCoefficientFlags.lean new file mode 100644 index 0000000000000000000000000000000000000000..56422d2ffda43b4bcb61327f9f5304e60a32402f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedCoefficientFlags.lean @@ -0,0 +1,138 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryFieldEvaluation +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySymbolicScope +import OAI.NumberTheory.Ostmann.Characters.RationalHistoryDegree + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.ClearedCoefficientFlags +open Characters.RationalHistory MvPolynomial HistorySymbolicScope +variable {ι K : Type*} [Field K] + +def leftCoefficient (a b : Expr ι) : MvPolynomial ι ℤ := a.numerator*b.denominator +def rightCoefficient (a b : Expr ι) : MvPolynomial ι ℤ := b.numerator*a.denominator +def commonDenominator (a b : Expr ι) : MvPolynomial ι ℤ := a.denominator*b.denominator + +def minor (a b c d : Expr ι) : MvPolynomial ι ℤ := + leftCoefficient a b*rightCoefficient c d-rightCoefficient a b*leftCoefficient c d + +theorem coefficients_cleared (a b : Expr ι) (x : ι → K) + (ha : a.FieldRegularAt x) (hb : b.FieldRegularAt x) : + eval₂ (Int.castRingHom K) x (commonDenominator a b) ≠ 0 ∧ + eval₂ (Int.castRingHom K) x (leftCoefficient a b) = + eval₂ (Int.castRingHom K) x (commonDenominator a b)*a.fieldEval x ∧ + eval₂ (Int.castRingHom K) x (rightCoefficient a b) = + eval₂ (Int.castRingHom K) x (commonDenominator a b)*b.fieldEval x := by + obtain ⟨ha0,hea⟩ := a.field_cleared x ha + obtain ⟨hb0,heb⟩ := b.field_cleared x hb + simp only [commonDenominator,leftCoefficient,rightCoefficient,eval₂_mul] + refine ⟨mul_ne_zero ha0 hb0,?_,?_⟩ + · rw [← hea] + ring + · rw [← heb] + ring + +theorem linear_zero_iff (a b : Expr ι) (x : ι → K) + (ha : a.FieldRegularAt x) (hb : b.FieldRegularAt x) (X Y : K) : + eval₂ (Int.castRingHom K) x (leftCoefficient a b)*X+ + eval₂ (Int.castRingHom K) x (rightCoefficient a b)*Y=0 ↔ + a.fieldEval x*X+b.fieldEval x*Y=0 := by + obtain ⟨h0,ha,hb⟩ := coefficients_cleared a b x ha hb + rw [ha,hb,mul_assoc,mul_assoc,← mul_add] + exact mul_eq_zero.trans (or_iff_right h0) + +theorem row_nonzero_iff (a b : Expr ι) (x : ι → K) + (ha : a.FieldRegularAt x) (hb : b.FieldRegularAt x) : + (eval₂ (Int.castRingHom K) x (leftCoefficient a b) ≠ 0 ∨ + eval₂ (Int.castRingHom K) x (rightCoefficient a b) ≠ 0) ↔ + a.fieldEval x ≠ 0 ∨ b.fieldEval x ≠ 0 := by + obtain ⟨h0,ha,hb⟩ := coefficients_cleared a b x ha hb + rw [ha,hb] + simp only [ne_eq,mul_eq_zero,h0,false_or] + +theorem minor_cleared (a b c d : Expr ι) (x : ι → K) + (ha : a.FieldRegularAt x) (hb : b.FieldRegularAt x) + (hc : c.FieldRegularAt x) (hd : d.FieldRegularAt x) : + eval₂ (Int.castRingHom K) x (minor a b c d) = + (eval₂ (Int.castRingHom K) x (commonDenominator a b)* + eval₂ (Int.castRingHom K) x (commonDenominator c d))* + (a.fieldEval x*d.fieldEval x-b.fieldEval x*c.fieldEval x) := by + obtain ⟨_,h1,h2⟩ := coefficients_cleared a b x ha hb + obtain ⟨_,h3,h4⟩ := coefficients_cleared c d x hc hd + simp only [minor,eval₂_sub,eval₂_mul,h1,h2,h3,h4] + ring + +theorem minor_zero_iff (a b c d : Expr ι) (x : ι → K) + (ha : a.FieldRegularAt x) (hb : b.FieldRegularAt x) + (hc : c.FieldRegularAt x) (hd : d.FieldRegularAt x) : + eval₂ (Int.castRingHom K) x (minor a b c d)=0 ↔ + a.fieldEval x*d.fieldEval x-b.fieldEval x*c.fieldEval x=0 := by + rw [minor_cleared a b c d x ha hb hc hd] + exact mul_eq_zero.trans (or_iff_right (mul_ne_zero + (coefficients_cleared a b x ha hb).1 (coefficients_cleared c d x hc hd).1)) + +theorem coefficient_degrees (a b : Expr ι) : + (leftCoefficient a b).totalDegree ≤ a.atomCount+b.atomCount ∧ + (rightCoefficient a b).totalDegree ≤ a.atomCount+b.atomCount ∧ + (commonDenominator a b).totalDegree ≤ a.atomCount+b.atomCount := by + refine ⟨(totalDegree_mul _ _).trans (Nat.add_le_add a.fraction_degree_le.1 b.fraction_degree_le.2), + ?_,(totalDegree_mul _ _).trans (Nat.add_le_add a.fraction_degree_le.2 b.fraction_degree_le.2)⟩ + exact (totalDegree_mul _ _).trans (by + simpa only [Nat.add_comm] using + (Nat.add_le_add b.fraction_degree_le.1 a.fraction_degree_le.2)) + +theorem minor_degree (a b c d : Expr ι) : + (minor a b c d).totalDegree ≤ a.atomCount+b.atomCount+(c.atomCount+d.atomCount) := by + unfold minor + rw [sub_eq_add_neg] + apply (totalDegree_add _ _).trans + apply max_le + · exact (totalDegree_mul _ _).trans + (Nat.add_le_add (coefficient_degrees a b).1 (coefficient_degrees c d).2.1) + · rw [totalDegree_neg] + exact (totalDegree_mul _ _).trans + (Nat.add_le_add (coefficient_degrees a b).2.1 (coefficient_degrees c d).1) + +def PolynomialAbove [DecidableEq ι] (level : ι → ℕ) (t : ℕ) + (P : MvPolynomial ι ℤ) : Prop := ∀ i ∈ P.vars, t < level i + +theorem polynomialAbove_mul [DecidableEq ι] {level : ι → ℕ} {t : ℕ} + {P Q : MvPolynomial ι ℤ} (hP : PolynomialAbove level t P) + (hQ : PolynomialAbove level t Q) : PolynomialAbove level t (P*Q) := by + intro i hi + rcases Finset.mem_union.mp (vars_mul P Q hi) with hi | hi + · exact hP i hi + · exact hQ i hi + +theorem fraction_above [DecidableEq ι] (level : ι → ℕ) (t : ℕ) + (a : Expr ι) (ha : Above level t a) : + PolynomialAbove level t a.numerator ∧ PolynomialAbove level t a.denominator := + ⟨fun i hi => above_atoms a ha i (a.fraction_vars_subset.1 hi), + fun i hi => above_atoms a ha i (a.fraction_vars_subset.2 hi)⟩ + +theorem coefficients_above [DecidableEq ι] (level : ι → ℕ) (t : ℕ) + (a b : Expr ι) (ha : Above level t a) (hb : Above level t b) : + PolynomialAbove level t (leftCoefficient a b) ∧ + PolynomialAbove level t (rightCoefficient a b) ∧ + PolynomialAbove level t (commonDenominator a b) := + ⟨polynomialAbove_mul (fraction_above level t a ha).1 (fraction_above level t b hb).2, + polynomialAbove_mul (fraction_above level t b hb).1 (fraction_above level t a ha).2, + polynomialAbove_mul (fraction_above level t a ha).2 (fraction_above level t b hb).2⟩ + +theorem minor_above [DecidableEq ι] (level : ι → ℕ) (t : ℕ) + (a b c d : Expr ι) (ha : Above level t a) (hb : Above level t b) + (hc : Above level t c) (hd : Above level t d) : + PolynomialAbove level t (minor a b c d) := by + have h1 := coefficients_above level t a b ha hb + have h2 := coefficients_above level t c d hc hd + intro i hi + rcases Finset.mem_union.mp ((vars_sub_subset (p := leftCoefficient a b*rightCoefficient c d) + (q := rightCoefficient a b*leftCoefficient c d)) hi) with hi | hi + · exact polynomialAbove_mul h1.1 h2.2.1 i hi + · exact polynomialAbove_mul h1.2.1 h2.1 i hi + +end Ostmann.Arithmetic.ClearedCoefficientFlags + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedHistoryBounds.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedHistoryBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc4f2b7e729f443f93673a5bc84edfcf25cd2de5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedHistoryBounds.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ClearedHistoryPivot + +namespace OAI + +/-! # Degree and value control survives clearing every history denominator -/ + +namespace Ostmann.ClearedHistoryValue + +open scoped BigOperators Classical + +variable {σ : Type*} + +def Bounded (F : ClearedHistoryValue σ) (x : σ → ℝ) (H : ℝ) : Prop := + |MvPolynomial.eval₂ (Int.castRingHom ℝ) x F.numerator| ≤ H ∧ |(F.denominator : ℝ)| ≤ H + +theorem bounded_variable (i : σ) (x : σ → ℝ) (H : ℝ) (hH : 1 ≤ H) (hx : |x i| ≤ H) : + (ofVariable i).Bounded x H := by + exact ⟨by simpa only [Bounded, ofVariable, MvPolynomial.eval₂_X] using hx, + by simpa only [ofVariable, Int.cast_one, abs_one] using hH⟩ + +theorem bounded_constant (a : ℤ) (x : σ → ℝ) (H : ℝ) (hH : 1 ≤ H) (ha : |(a : ℝ)| ≤ H) : + (constant a).Bounded x H := by + exact ⟨by simpa only [constant, MvPolynomial.eval₂_C, Int.coe_castRingHom] using ha, + by simpa only [constant, Int.cast_one, abs_one] using hH⟩ + +theorem bounded_prod {I : Type*} (S : Finset I) (f : I → ClearedHistoryValue σ) + (x : σ → ℝ) (H : I → ℝ) (hf : ∀ i ∈ S, (f i).Bounded x (H i)) : + (prod S f).Bounded x (∏ i ∈ S, H i) := by + constructor + · change |MvPolynomial.eval₂ (Int.castRingHom ℝ) x (∏ i ∈ S, (f i).numerator)| ≤ _ + change |(MvPolynomial.eval₂Hom (Int.castRingHom ℝ) x) (∏ i ∈ S, (f i).numerator)| ≤ _ + rw [map_prod, Finset.abs_prod] + exact Finset.prod_le_prod₀ (fun _ _ => abs_nonneg _) (fun i hi => (hf i hi).1) + · change |((∏ i ∈ S, (f i).denominator : ℤ) : ℝ)| ≤ _ + rw [Int.cast_prod, Finset.abs_prod] + exact Finset.prod_le_prod₀ (fun _ _ => abs_nonneg _) (fun i hi => (hf i hi).2) + +/-- No coefficient-height estimate is assumed. The exact two products in the +substitution give a value bound that is valid at every real assignment. -/ +theorem bounded_pivot (left right : ClearedHistoryValue σ) (v w s : ℤ) (hs : s ≠ 0) + (x : σ → ℝ) (HL HR : ℝ) (hL : left.Bounded x HL) (hR : right.Bounded x HR) : + (pivot left right v w s hs).Bounded x + ((|(v : ℝ)| + |(w : ℝ)| + |(s : ℝ)|) * HL * HR) := by + have hHL : 0 ≤ HL := (abs_nonneg _).trans hL.2 + have hHR : 0 ≤ HR := (abs_nonneg _).trans hR.2 + have hprod : 0 ≤ HL * HR := mul_nonneg hHL hHR + have hleft : |(v : ℝ) * (left.denominator : ℝ) * + MvPolynomial.eval₂ (Int.castRingHom ℝ) x right.numerator| ≤ |(v : ℝ)| * HL * HR := by + rw [abs_mul, abs_mul] + exact mul_le_mul (mul_le_mul_of_nonneg_left hL.2 (abs_nonneg _)) hR.1 + (abs_nonneg _) (mul_nonneg (abs_nonneg _) hHL) + have hright : |(w : ℝ) * (right.denominator : ℝ) * + MvPolynomial.eval₂ (Int.castRingHom ℝ) x left.numerator| ≤ |(w : ℝ)| * HR * HL := by + rw [abs_mul, abs_mul] + exact mul_le_mul (mul_le_mul_of_nonneg_left hR.2 (abs_nonneg _)) hL.1 + (abs_nonneg _) (mul_nonneg (abs_nonneg _) hHR) + constructor + · change |MvPolynomial.eval₂ (Int.castRingHom ℝ) x + (MvPolynomial.C (v * left.denominator) * right.numerator - + MvPolynomial.C (w * right.denominator) * left.numerator)| ≤ _ + simp only [MvPolynomial.eval₂_sub, MvPolynomial.eval₂_mul, MvPolynomial.eval₂_C, + Int.coe_castRingHom, Int.cast_mul] + apply (abs_sub _ _).trans + nlinarith [mul_nonneg (abs_nonneg (s : ℝ)) hprod] + · change |((s * left.denominator * right.denominator : ℤ) : ℝ)| ≤ _ + rw [Int.cast_mul, Int.cast_mul, abs_mul, abs_mul] + have hd := mul_le_mul (mul_le_mul_of_nonneg_left hL.2 (abs_nonneg (s : ℝ))) hR.2 + (abs_nonneg (right.denominator : ℝ)) (mul_nonneg (abs_nonneg (s : ℝ)) hHL) + nlinarith [mul_nonneg (abs_nonneg (v : ℝ)) hprod, + mul_nonneg (abs_nonneg (w : ℝ)) hprod] + +theorem zero_variable_value_bound (F : ClearedHistoryValue σ) (i : σ) (x : σ → ℤ) (H : ℝ) + (hF : F.Bounded (fun j => ((Function.update x i 0) j : ℝ)) H) : + |((MvPolynomial.eval₂Hom (RingHom.id ℤ) x + (zeroHistoryVariable i F.numerator) : ℤ) : ℝ)| ≤ H := by + rw [zeroHistoryVariable_eval] + have he := MvPolynomial.map_eval₂Hom (RingHom.id ℤ) (Function.update x i 0) + (Int.castRingHom ℝ) F.numerator + have he' : ((MvPolynomial.eval₂Hom (RingHom.id ℤ) (Function.update x i 0) F.numerator : ℤ) : ℝ) = + MvPolynomial.eval₂ (Int.castRingHom ℝ) (fun j => ((Function.update x i 0) j : ℝ)) F.numerator := by + simpa [Int.castRingHom] using he + rw [he'] + exact hF.1 + +end Ostmann.ClearedHistoryValue + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedHistoryPivot.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedHistoryPivot.lean new file mode 100644 index 0000000000000000000000000000000000000000..150bfb12188a727b62d8dcbb7f66f48f566152e5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedHistoryPivot.lean @@ -0,0 +1,115 @@ +import OAI.NumberTheory.Ostmann.Construction.HistoryCoprimalityRemoval +import OAI.NumberTheory.Ostmann.Construction.HistoryPolynomialSpecialization + +namespace OAI + +/-! # Constructed integer numerators for the recursive pivot substitutions -/ + +namespace Ostmann + +open scoped BigOperators Classical + +structure ClearedHistoryValue (σ : Type*) where + numerator : MvPolynomial σ ℤ + denominator : ℤ + denominator_ne_zero : denominator ≠ 0 + +namespace ClearedHistoryValue + +variable {σ : Type*} + +noncomputable def ofVariable (i : σ) : ClearedHistoryValue σ := ⟨MvPolynomial.X i, 1, one_ne_zero⟩ + +noncomputable def constant (a : ℤ) : ClearedHistoryValue σ := ⟨MvPolynomial.C a, 1, one_ne_zero⟩ + +noncomputable def prod {I : Type*} (S : Finset I) (f : I → ClearedHistoryValue σ) : + ClearedHistoryValue σ := + ⟨∏ i ∈ S, (f i).numerator, ∏ i ∈ S, (f i).denominator, + Finset.prod_ne_zero_iff.mpr (fun i _ => (f i).denominator_ne_zero)⟩ + +/-- This is exactly `(v * right - w * left) / s`, with integer clearing of +all previously inserted denominators. -/ +noncomputable def pivot (left right : ClearedHistoryValue σ) (v w s : ℤ) (hs : s ≠ 0) : + ClearedHistoryValue σ := + ⟨MvPolynomial.C (v * left.denominator) * right.numerator - + MvPolynomial.C (w * right.denominator) * left.numerator, + s * left.denominator * right.denominator, + mul_ne_zero (mul_ne_zero hs left.denominator_ne_zero) right.denominator_ne_zero⟩ + +noncomputable def eval (F : ClearedHistoryValue σ) (x : σ → ℚ) : ℚ := + MvPolynomial.eval₂ (Int.castRingHom ℚ) x F.numerator / F.denominator + +theorem eval_variable (i : σ) (x : σ → ℚ) : (ofVariable i).eval x = x i := by + simp only [eval, ofVariable, MvPolynomial.eval₂_X, Int.cast_one, div_one] + +theorem eval_constant (a : ℤ) (x : σ → ℚ) : (constant a).eval x = a := by + simp only [eval, constant, MvPolynomial.eval₂_C, Int.cast_one, div_one] + rfl + +theorem eval_prod {I : Type*} (S : Finset I) (f : I → ClearedHistoryValue σ) (x : σ → ℚ) : + (prod S f).eval x = ∏ i ∈ S, (f i).eval x := by + simp only [eval, prod, MvPolynomial.eval₂_eq_eval_map, map_prod, Finset.prod_div_distrib] + push_cast + rfl + +theorem eval_pivot (left right : ClearedHistoryValue σ) (v w s : ℤ) (hs : s ≠ 0) + (x : σ → ℚ) : + (pivot left right v w s hs).eval x = (v * right.eval x - w * left.eval x) / s := by + have hL : (left.denominator : ℚ) ≠ 0 := Int.cast_ne_zero.mpr left.denominator_ne_zero + have hR : (right.denominator : ℚ) ≠ 0 := Int.cast_ne_zero.mpr right.denominator_ne_zero + have hS : (s : ℚ) ≠ 0 := Int.cast_ne_zero.mpr hs + simp only [eval, pivot, MvPolynomial.eval₂_sub, MvPolynomial.eval₂_mul, + MvPolynomial.eval₂_C, Int.coe_castRingHom, Int.cast_mul] + field_simp + +theorem degree_prod {I : Type*} (S : Finset I) (f : I → ClearedHistoryValue σ) : + (prod S f).numerator.totalDegree ≤ ∑ i ∈ S, (f i).numerator.totalDegree := + MvPolynomial.totalDegree_finsetProd _ _ + +theorem degree_pivot (left right : ClearedHistoryValue σ) (v w s : ℤ) (hs : s ≠ 0) : + (pivot left right v w s hs).numerator.totalDegree ≤ + max left.numerator.totalDegree right.numerator.totalDegree := by + apply (MvPolynomial.totalDegree_sub _ _).trans + apply max_le + · exact (MvPolynomial.totalDegree_mul _ _).trans (by + simp only [MvPolynomial.totalDegree_C, zero_add] + exact le_max_right _ _) + · exact (MvPolynomial.totalDegree_mul _ _).trans (by + simp only [MvPolynomial.totalDegree_C, zero_add] + exact le_max_left _ _) + +/-- A prime absent from the small-frequency denominator remains absent after +the next substitution. -/ +theorem denominator_pivot_unit (left right : ClearedHistoryValue σ) + (v w s : ℤ) (hs : s ≠ 0) (p : ℕ) (hp : p.Prime) + (hL : ¬p ∣ left.denominator.natAbs) (hR : ¬p ∣ right.denominator.natAbs) + (hS : ¬p ∣ s.natAbs) : ¬p ∣ (pivot left right v w s hs).denominator.natAbs := by + simp only [pivot, Int.natAbs_mul, hp.dvd_mul, hL, hR, hS, or_self, not_false_eq_true] + +/-- Polynomial evaluation at an integer assignment is the numerator of the +actual rational value. The equality is useful on the integrality support. -/ +theorem integer_value_cleared (F : ClearedHistoryValue σ) (x : σ → ℤ) (y : ℤ) + (hy : F.eval (fun i => (x i : ℚ)) = y) : + MvPolynomial.eval₂Hom (RingHom.id ℤ) x F.numerator = F.denominator * y := by + have hden : (F.denominator : ℚ) ≠ 0 := Int.cast_ne_zero.mpr F.denominator_ne_zero + have he : (MvPolynomial.eval₂Hom (RingHom.id ℤ) x F.numerator : ℚ) = + MvPolynomial.eval₂ (Int.castRingHom ℚ) (fun i => (x i : ℚ)) F.numerator := by + simpa [Int.castRingHom] using + (MvPolynomial.map_eval₂Hom (RingHom.id ℤ) x (Int.castRingHom ℚ) F.numerator) + apply Int.cast_injective (α := ℚ) + rw [he, Int.cast_mul] + have hh := (div_eq_iff hden).mp hy + simpa only [mul_comm] using hh + +theorem prime_coprime_integer_value (F : ClearedHistoryValue σ) (x : σ → ℤ) + (p : ℕ) (hp : p.Prime) (hd : ¬p ∣ F.denominator.natAbs) (y : ℤ) + (hy : F.eval (fun i => (x i : ℚ)) = y) : + p.Coprime y.natAbs ↔ ¬p ∣ (MvPolynomial.eval₂Hom (RingHom.id ℤ) x F.numerator).natAbs := by + rw [hp.coprime_iff_not_dvd, prime_dvd_cleared_iff p hp _ F.denominator y + (F.integer_value_cleared x y hy) hd] + +end ClearedHistoryValue + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedPolynomialRanges.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedPolynomialRanges.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3b60ad6a6b140dde631d43541d89c57a3a53709 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ClearedPolynomialRanges.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Characters.PolynomialRangeGuards +import OAI.NumberTheory.Ostmann.Construction.HistoryPolynomialSpecialization + +namespace OAI + +/-! # Exact polynomial guards for ranges of reconstructed rational integers -/ + +namespace Ostmann + +open scoped BigOperators Classical + +noncomputable def clearedIntervalPolynomials (P : Polynomial ℝ) (d lo hi : ℝ) : + Fin 2 → Polynomial ℝ := + ![Polynomial.C d * (P - Polynomial.C (lo * d)), + Polynomial.C d * (Polynomial.C (hi * d) - P)] + +def clearedIntervalKeep (code : Fin 2 → Bool) : Bool := code 0 && code 1 + +theorem cleared_interval_test (N d lo hi : ℝ) (hd : d ≠ 0) : + (0 ≤ d * (N - lo * d) ∧ 0 ≤ d * (hi * d - N)) ↔ N / d ∈ Set.Icc lo hi := by + have hsq : 0 < d ^ 2 := sq_pos_of_ne_zero hd + have hl : d * (N - lo * d) = d ^ 2 * (N / d - lo) := by field_simp + have hu : d * (hi * d - N) = d ^ 2 * (hi - N / d) := by field_simp + rw [hl, hu, mul_nonneg_iff_of_pos_left hsq, mul_nonneg_iff_of_pos_left hsq] + exact ⟨fun h => ⟨sub_nonneg.mp h.1, sub_nonneg.mp h.2⟩, + fun h => ⟨sub_nonneg.mpr h.1, sub_nonneg.mpr h.2⟩⟩ + +theorem clearedIntervalKeep_iff (P : Polynomial ℝ) (d lo hi x : ℝ) (hd : d ≠ 0) : + clearedIntervalKeep (polynomialSupportCode (clearedIntervalPolynomials P d lo hi) x) = true ↔ + P.eval x / d ∈ Set.Icc lo hi := by + simp only [clearedIntervalKeep, Bool.and_eq_true, polynomialSupportCode, + decide_eq_true_eq, clearedIntervalPolynomials, Matrix.cons_val_zero, + Matrix.cons_val_one, Polynomial.eval_mul, Polynomial.eval_sub, Polynomial.eval_C] + exact cleared_interval_test (P.eval x) d lo hi hd + +theorem clearedIntervalPolynomials_degree (P : Polynomial ℝ) (d lo hi : ℝ) : + (∑ j, (clearedIntervalPolynomials P d lo hi j).natDegree) ≤ 2 * P.natDegree := by + have hleft : (Polynomial.C d * (P - Polynomial.C (lo * d))).natDegree ≤ P.natDegree := + Polynomial.natDegree_mul_le.trans (by + simpa only [Polynomial.natDegree_C, zero_add, max_eq_left (Nat.zero_le _)] using + Polynomial.natDegree_sub_le P (Polynomial.C (lo * d))) + have hright : (Polynomial.C d * (Polynomial.C (hi * d) - P)).natDegree ≤ P.natDegree := + Polynomial.natDegree_mul_le.trans (by + simpa only [Polynomial.natDegree_C, zero_add, max_eq_right (Nat.zero_le _)] using + Polynomial.natDegree_sub_le (Polynomial.C (hi * d)) P) + simp only [Fin.sum_univ_two, clearedIntervalPolynomials, Matrix.cons_val_zero, Matrix.cons_val_one] + omega + +/-- Fixing the other primes gives the literal range test on the cleared +history numerator. Denominator signs require no separate cases. -/ +theorem specialized_cleared_interval_test {σ : Type*} (P : MvPolynomial σ ℤ) + (a : σ → ℝ) (i : σ) (d lo hi x : ℝ) (hd : d ≠ 0) : + clearedIntervalKeep (polynomialSupportCode + (clearedIntervalPolynomials (specializeHistoryVariable a i P) d lo hi) x) = true ↔ + MvPolynomial.eval₂ (Int.castRingHom ℝ) (Function.update a i x) P / d ∈ Set.Icc lo hi := by + rw [clearedIntervalKeep_iff _ d lo hi x hd, specializeHistoryVariable_eval] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CommonHistoryPeriod.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CommonHistoryPeriod.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2ccc670e43e26f2b9040fd0e9a6adc936ab590b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CommonHistoryPeriod.lean @@ -0,0 +1,93 @@ +import Mathlib.Data.Nat.GCD.BigOperators +import OAI.NumberTheory.Ostmann.Arithmetic.ReconstructionTestBounds + +namespace OAI + +/-! # A nonzero common modulus constructed from the actual small frequencies -/ + +namespace Ostmann + +def historyFrequencyBase (frequencies : List ℤ) : ℕ := (frequencies.map Int.natAbs).prod + +def historyFrequencyPeriod (frequencies : List ℤ) (degree : ℕ) : ℕ := + historyFrequencyBase frequencies ^ degree + +theorem historyFrequencyBase_pos (frequencies : List ℤ) + (h : ∀ s ∈ frequencies, s ≠ 0) : 0 < historyFrequencyBase frequencies := by + induction frequencies with + | nil => simp [historyFrequencyBase] + | cons s rest ih => + simp only [historyFrequencyBase, List.map_cons, List.prod_cons] + exact Nat.mul_pos (Int.natAbs_pos.mpr (h s (by simp))) + (ih (fun t ht => h t (by simp [ht]))) + +theorem historyFrequencyPeriod_pos (frequencies : List ℤ) (degree : ℕ) + (h : ∀ s ∈ frequencies, s ≠ 0) : 0 < historyFrequencyPeriod frequencies degree := + pow_pos (historyFrequencyBase_pos frequencies h) degree + +theorem frequency_dvd_historyFrequencyBase (frequencies : List ℤ) (s : ℤ) + (hs : s ∈ frequencies) : s ∣ (historyFrequencyBase frequencies : ℤ) := by + apply Int.dvd_natCast.mpr + exact List.dvd_prod (List.mem_map.mpr ⟨s, hs, rfl⟩) + +theorem prime_coprime_historyFrequencyPeriod (frequencies : List ℤ) (degree p : ℕ) + (hp : p.Prime) (hsmall : ∀ s ∈ frequencies, 0 < s.natAbs ∧ s.natAbs < p) : + p.Coprime (historyFrequencyPeriod frequencies degree) := by + apply Nat.Coprime.pow_right + apply Nat.coprime_list_prod_right_iff.mpr + intro n hn + obtain ⟨s, hs, rfl⟩ := List.mem_map.mp hn + exact hp.coprime_iff_not_dvd.mpr (Nat.not_dvd_of_pos_of_lt (hsmall s hs).1 (hsmall s hs).2) + +theorem constructed_history_test_period {σ : Type*} (steps : List (HistoryPivotStep σ)) + (frequencies : List ℤ) (C : ℕ) (hC : 1 ≤ C) + (hsteps : ∀ step ∈ steps, step.s ∈ frequencies) + (hsize : ∀ step ∈ steps, step.left.length + step.right.length + 4 ≤ C) + (s : ℤ) (hs : s ∈ frequencies) (F : HistoryFormula σ) + (hF : F ∈ reconstructionTests steps HistoryFormula.prime) : + F.cleared.denominator * s ∣ + (historyFrequencyPeriod frequencies (C ^ steps.length + 1) : ℤ) := by + simpa only [historyFrequencyPeriod, Nat.cast_pow] using + reconstructionTests_prime_period steps (historyFrequencyBase frequencies) s C hC + (fun step hstep => frequency_dvd_historyFrequencyBase frequencies step.s (hsteps step hstep)) + hsize (frequency_dvd_historyFrequencyBase frequencies s hs) F hF + +theorem constructed_history_test_period_of_dvd {σ : Type*} (steps : List (HistoryPivotStep σ)) + (frequencies : List ℤ) (C : ℕ) (hC : 1 ≤ C) + (hsteps : ∀ step ∈ steps, step.s ∈ frequencies) + (hsize : ∀ step ∈ steps, step.left.length + step.right.length + 4 ≤ C) + (s : ℤ) (hs : s ∣ (historyFrequencyBase frequencies : ℤ)) (F : HistoryFormula σ) + (hF : F ∈ reconstructionTests steps HistoryFormula.prime) : + F.cleared.denominator * s ∣ + (historyFrequencyPeriod frequencies (C ^ steps.length + 1) : ℤ) := by + simpa only [historyFrequencyPeriod, Nat.cast_pow] using + reconstructionTests_prime_period steps (historyFrequencyBase frequencies) s C hC + (fun step hstep => frequency_dvd_historyFrequencyBase frequencies step.s (hsteps step hstep)) + hsize hs F hF + +theorem historyFrequencyPeriod_le (frequencies : List ℤ) (V degree : ℕ) + (hV : ∀ s ∈ frequencies, s.natAbs ≤ V) : + historyFrequencyPeriod frequencies degree ≤ V ^ (frequencies.length * degree) := by + have hb : historyFrequencyBase frequencies ≤ V ^ frequencies.length := by + induction frequencies with + | nil => simp [historyFrequencyBase] + | cons s rest ih => + simp only [historyFrequencyBase, List.map_cons, List.prod_cons, List.length_cons, pow_succ] + exact (Nat.mul_le_mul (hV s (by simp)) + (ih (fun t ht => hV t (by simp [ht])))).trans_eq (Nat.mul_comm _ _) + exact (Nat.pow_le_pow_left hb degree).trans_eq (pow_mul V frequencies.length degree).symm + +theorem constructed_history_test_period_of_length {σ : Type*} + (steps : List (HistoryPivotStep σ)) (frequencies : List ℤ) (C N : ℕ) (hC : 1 ≤ C) + (hlen : steps.length ≤ N) (hsteps : ∀ step ∈ steps, step.s ∈ frequencies) + (hsize : ∀ step ∈ steps, step.left.length + step.right.length + 4 ≤ C) + (s : ℤ) (hs : s ∣ (historyFrequencyBase frequencies : ℤ)) (F : HistoryFormula σ) + (hF : F ∈ reconstructionTests steps HistoryFormula.prime) : + F.cleared.denominator * s ∣ (historyFrequencyPeriod frequencies (C ^ N + 1) : ℤ) := by + have hd := constructed_history_test_period_of_dvd steps frequencies C hC hsteps hsize s hs F hF + simp only [historyFrequencyPeriod, Nat.cast_pow] at hd ⊢ + exact hd.trans (pow_dvd_pow _ (Nat.add_le_add_right (pow_le_pow_right₀ hC hlen) 1)) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CommonRootMesh.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CommonRootMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4965bb875526d77ea7b013e2513a80da9309220 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CommonRootMesh.lean @@ -0,0 +1,125 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.RootCellPrimeComparison +import OAI.NumberTheory.Ostmann.Arithmetic.RootCellIntegerComparison + +namespace OAI + +/-! # One explicit root mesh for all residue classes -/ + +namespace Ostmann +open scoped BigOperators Classical +open MeasureTheory + +noncomputable def rootMeshWeight {k : ℕ} (F : Fin k → ClippedPolynomialFactor) + (w : ℝ → ℂ) (s : ℕ → ℝ) (j : ℕ) (y : ℝ) : ℂ := + w (Real.exp ((s j + s (j + 1)) / 2)) * smoothPolynomialWeight F (Real.exp y) + +theorem rootMeshWeight_continuous {k : ℕ} (F : Fin k → ClippedPolynomialFactor) + (w : ℝ → ℂ) (s : ℕ → ℝ) (j : ℕ) : Continuous (rootMeshWeight F w s j) := + continuous_const.mul ((continuous_smoothPolynomialWeight F).comp Real.continuous_exp) + +theorem rootMeshWeight_variation {k : ℕ} (F : Fin k → ClippedPolynomialFactor) + (w : ℝ → ℂ) (S : Finset ℝ) + (hroots : ∀ i r, r ∈ (F i).polynomial.derivative.roots → r ∈ S) + (s : ℕ → ℝ) (N : ℕ) + (hfree : ∀ j < N, ∀ r ∈ S, r ∉ Set.Ioo (Real.exp (s j)) (Real.exp (s (j + 1)))) + (j : ℕ) (hj : j < N) (r : ℕ → ℝ) (hr : Monotone r) (M : ℕ) + (hr0 : r 0 = s j) (hrM : r M = s (j + 1)) : + discreteVariation (fun l => rootMeshWeight F w s j (r l)) M ≤ + ‖w (Real.exp ((s j + s (j + 1)) / 2))‖ * smoothPolynomialBudget F := by + unfold rootMeshWeight + rw [discreteVariation_const_mul] + apply mul_le_mul_of_nonneg_left _ (norm_nonneg _) + apply smoothPolynomialWeight_variation_no_roots F (fun l => Real.exp (r l)) + (Real.exp_monotone.comp hr) M + intro i x hx hxin + apply hfree j hj x (hroots i x hx) + refine ⟨?_, ?_⟩ + · simpa only [hr0] using hxin.1 + · have hlast : Real.exp (r (M - 1)) ≤ Real.exp (s (j + 1)) := by + rw [← hrM] + exact Real.exp_le_exp.mpr (hr (Nat.sub_le M 1)) + exact hxin.2.trans_le hlast + +theorem rootMeshWeight_bound {k : ℕ} (F : Fin k → ClippedPolynomialFactor) + (w : ℝ → ℂ) (C : ℝ) (hC : 0 ≤ C) (hw : ∀ x, ‖w x‖ ≤ C) + (s : ℕ → ℝ) (j : ℕ) (y : ℝ) : + ‖w (Real.exp y) * smoothPolynomialWeight F (Real.exp y) - rootMeshWeight F w s j y‖ ≤ + 2 * C * smoothPolynomialBudget F := by + calc + _ ≤ ‖w (Real.exp y) * smoothPolynomialWeight F (Real.exp y)‖ + + ‖rootMeshWeight F w s j y‖ := norm_sub_le _ _ + _ ≤ C * smoothPolynomialBudget F + C * smoothPolynomialBudget F := by + simp only [rootMeshWeight, norm_mul] + exact add_le_add + (mul_le_mul (hw _) (smoothPolynomialWeight_norm F _) (norm_nonneg _) hC) + (mul_le_mul (hw _) (smoothPolynomialWeight_norm F _) (norm_nonneg _) hC) + _ = _ := by ring + +theorem rootMeshWeight_eq {k : ℕ} (F : Fin k → ClippedPolynomialFactor) + (w : ℝ → ℂ) (S : Finset ℝ) + (hconst : ∀ x y, rootCellCode S x = rootCellCode S y → w x = w y) + (s : ℕ → ℝ) (N : ℕ) + (hfree : ∀ j < N, ∀ r ∈ S, r ∉ Set.Ioo (Real.exp (s j)) (Real.exp (s (j + 1)))) + (j : ℕ) (hj : j < N) (y : ℝ) (hy : y ∈ Set.Ioo (s j) (s (j + 1))) : + w (Real.exp y) * smoothPolynomialWeight F (Real.exp y) = rootMeshWeight F w s j y := by + unfold rootMeshWeight + congr 1 + apply hconst + apply rootCellCode_eq_of_root_free S (Real.exp (s j)) (Real.exp (s (j + 1))) + (Real.exp y) (Real.exp ((s j + s (j + 1)) / 2)) (hfree j hj) + · exact ⟨Real.exp_lt_exp.mpr hy.1, Real.exp_lt_exp.mpr hy.2⟩ + · constructor <;> apply Real.exp_lt_exp.mpr <;> linarith [hy.1, hy.2] + +/-- The mesh is supplied before the residue class and coefficient. -/ +theorem PublishedProgressionInput.common_root_mesh_prime_comparison (P : PublishedProgressionInput) + (S : Finset ℝ) (s : ℕ → ℝ) (hs : Monotone s) (N : ℕ) + (hfree : ∀ j < N, ∀ r ∈ S, r ∉ Set.Ioo (Real.exp (s j)) (Real.exp (s (j + 1)))) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (hu : 1 ≤ s 0) (hshort : s N ≤ s 0 + 1) + {k : ℕ} (F : Fin k → ClippedPolynomialFactor) + (hroots : ∀ i r, r ∈ (F i).polynomial.derivative.roots → r ∈ S) + (w : ℝ → ℂ) (C : ℝ) (hC : 0 ≤ C) (hw : ∀ x, ‖w x‖ ≤ C) + (hconst : ∀ x y, rootCellCode S x = rootCellCode S y → w x = w y) : + ‖complexPrimeInterval q a (s 0) (s N) + (fun y => w (Real.exp y) * smoothPolynomialWeight F (Real.exp y)) - + ∑ j ∈ Finset.range N, ∫ y in Set.Ioc (s j) (s (j + 1)), + rootMeshWeight F w s j y * (selectedPrimeLogDensity P Q q a y : ℂ)‖ ≤ + ∑ j ∈ Finset.range N, + (‖w (Real.exp ((s j + s (j + 1)) / 2))‖ * smoothPolynomialBudget F * + (18 * P.errorConstant * Real.exp (-P.decay * Real.sqrt (s j)) + + Real.exp (-P.kappa * s j / Real.log (4 * (Q : ℝ)))) + + 2 * C * smoothPolynomialBudget F * Real.exp (-(s j))) := by + apply P.piecewise_prime_comparison hQ hq hqQ ha s hs N hu hshort + _ (rootMeshWeight F w s) _ _ + · exact fun j _ => (rootMeshWeight_continuous F w s j).continuousOn + · exact fun j hj r hr M hr0 hrM => rootMeshWeight_variation F w S hroots s N hfree j hj r hr M hr0 hrM + · exact fun _ _ => mul_nonneg (mul_nonneg (by positivity) hC) (smoothPolynomialBudget_nonneg F) + · exact fun j _ y _ => rootMeshWeight_bound F w C hC hw s j y + · exact fun j hj y hy => rootMeshWeight_eq F w S hconst s N hfree j hj y hy + +theorem common_root_mesh_integer_comparison + (S : Finset ℝ) (s : ℕ → ℝ) (hs : Monotone s) (N : ℕ) + (hfree : ∀ j < N, ∀ r ∈ S, r ∉ Set.Ioo (Real.exp (s j)) (Real.exp (s (j + 1)))) + (q a : ℕ) (hq : 0 < q) (G : ℝ) + {k : ℕ} (F : Fin k → ClippedPolynomialFactor) + (hroots : ∀ i r, r ∈ (F i).polynomial.derivative.roots → r ∈ S) + (w : ℝ → ℂ) (C : ℝ) (hC : 0 ≤ C) (hw : ∀ x, ‖w x‖ ≤ C) + (hconst : ∀ x y, rootCellCode S x = rootCellCode S y → w x = w y) : + ‖complexIntegerInterval q a (s 0) (s N) G + (fun y => w (Real.exp y) * smoothPolynomialWeight F (Real.exp y)) - + ∑ j ∈ Finset.range N, ∫ y in Set.Ioc (s j) (s (j + 1)), + rootMeshWeight F w s j y * (integerLogDensity q G y : ℂ)‖ ≤ + ∑ j ∈ Finset.range N, + (‖w (Real.exp ((s j + s (j + 1)) / 2))‖ * smoothPolynomialBudget F * + (2 * Real.exp (-G)) + 2 * C * smoothPolynomialBudget F * Real.exp (-G)) := by + apply piecewise_integer_comparison q a hq G s hs N + _ (rootMeshWeight F w s) _ _ + · exact fun j _ => (rootMeshWeight_continuous F w s j).continuousOn + · exact fun j hj r hr M hr0 hrM => rootMeshWeight_variation F w S hroots s N hfree j hj r hr M hr0 hrM + · exact fun _ _ => mul_nonneg (mul_nonneg (by positivity) hC) (smoothPolynomialBudget_nonneg F) + · exact fun j _ y _ => rootMeshWeight_bound F w C hC hw s j y + · exact fun j hj y hy => rootMeshWeight_eq F w S hconst s N hfree j hj y hy + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedHistoryEnergy.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedHistoryEnergy.lean new file mode 100644 index 0000000000000000000000000000000000000000..6374a9509074fea7e013f6361306920b7ea7a99a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedHistoryEnergy.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.SampledHistoryEnergy +import OAI.NumberTheory.Ostmann.Construction.CompensatedAdaptiveSupport + +namespace OAI + +/-! # Original prime sampling with compensation-divided arithmetic pivots -/ + +namespace Ostmann + +open scoped BigOperators Classical + +/-- No new support probability is assumed: it is computed from the literal +integer reversal equations of each nonzero sampled history. -/ +theorem compensated_history_square_sum_le (P : Finset ℕ) (S : Finset ℤ) (V n k : ℕ) + (R : FrequencyTree S n → ℕ) [∀ t, NeZero (R t ^ (k + 2))] + (D : FrequencyTree S n → PivotDependencyScheme (2 ^ n - 1)) + (U : FrequencyTree S n → Fin (2 ^ n - 1) → ℤ) + (hU : ∀ t i, IsCoprime (U t i) (R t : ℤ)) + (hdepth : ∀ t i, (D t).depth i ≤ k) + (hs : ∀ t i, ((D t).frequencies i).root ≠ 0) + (hsR : ∀ t i, ((D t).frequencies i).root.natAbs ∣ R t) + (T : TreeLeafIndex n → Finset ℕ) + (hunit : ∀ t, ∀ p : P, (p : ℕ).Coprime (R t ^ (k + 2))) + (pivots : FrequencyTree S n → (TreeLeafIndex n → P) → Fin (2 ^ n - 1) → ℤ) + (W : FrequencyTree S n → (TreeLeafIndex n → P) → ℂ) + (B : ℝ) (hB : 0 ≤ B) + (hsize : ∀ t x, ‖W t x‖ ^ 2 ≤ B * frequencyLeafWeight (singleFrequencyLeaf S V) n t) + (hvalid : ∀ t x, W t x ≠ 0 → + (sampledPrimeHistory P (R t ^ (k + 2)) n (hunit t) x (pivots t x)).compensatedValid (D t) (U t)) : + (∑ t, ∑ x, (∏ i, primeSubsetPrior P (T i) (x i)) * ‖W t x‖ ^ 2) ≤ + B * harmonicHistorySupportSum P S V n (fun t => R t ^ (k + 2)) T hunit + (fun t => compensatedAdaptiveData n (R t) k (D t) (U t) (hs t) (hsR t)) := by + unfold harmonicHistorySupportSum + rw [Finset.mul_sum] + apply Finset.sum_le_sum + intro t _ + rw [← mul_assoc, Finset.mul_sum] + apply Finset.sum_le_sum + intro x _ + have hμ : 0 ≤ ∏ i, primeSubsetPrior P (T i) (x i) := + Finset.prod_nonneg (fun i _ => primeSubsetPrior_nonneg P (T i) (x i)) + by_cases hw : W t x = 0 + · simp only [hw, norm_zero, zero_pow (by decide : 2 ≠ 0), mul_zero] + exact mul_nonneg (mul_nonneg hB (frequencyLeafWeight_nonneg _ + (fun _ => by unfold singleFrequencyLeaf; split_ifs <;> norm_num) n t)) + (mul_nonneg hμ (singleArithmeticLeafSupport_nonneg n _ _)) + · have hp := compensatedAdaptiveData_actual_support n (R t) k (D t) (U t) (hU t) (hdepth t) (hs t) (hsR t) + (sampledPrimeHistory P (R t ^ (k + 2)) n (hunit t) x (pivots t x)) (hvalid t x hw) + rw [sampledPrimeHistory_residue] at hp + rw [hp, mul_one] + calc + _ ≤ (∏ i, primeSubsetPrior P (T i) (x i)) * + (B * frequencyLeafWeight (singleFrequencyLeaf S V) n t) := + mul_le_mul_of_nonneg_left (hsize t x) hμ + _ = _ := by ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedHistoryRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedHistoryRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c9a5e1ad7575565f9c01d8ee196fef4032da8de --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedHistoryRate.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompensatedHistoryEnergy +import OAI.NumberTheory.Ostmann.Arithmetic.HarmonicHistoryRates + +namespace OAI + +/-! # Original-prior squared-history rate from integer reversals -/ + +namespace Ostmann + +open Filter +open scoped BigOperators Classical + +theorem compensatedAdaptiveData_history_frequencies (S : Finset ℤ) (n R k : ℕ) + (t : FrequencyTree S n) (D : PivotDependencyScheme (2 ^ n - 1)) (U : Fin (2 ^ n - 1) → ℤ) + (hs : ∀ i, (D.frequencies i).root ≠ 0) + (hsR : ∀ i, (D.frequencies i).root.natAbs ∣ R) + (hfreq : ∀ i, D.frequencies i = singleTreeNodeFrequencies S n t i.val) + (total : (ZMod (R ^ (k + 2)))ˣ) (past : List (ZMod (R ^ (k + 2)))ˣ) + (d : ArithmeticSplitData (R ^ (k + 2))) + (hd : compensatedAdaptiveData n R k D U hs hsR total past = some d) : + d.hasFrequencies (singleTreeNodeFrequencies S n t past.length) := by + by_cases hj : past.length < 2 ^ n - 1 + · have h := compensatedAdaptiveData_frequencies n R k D U hs hsR total past hj d hd + rwa [hfreq] at h + · simp only [compensatedAdaptiveData, hj, dite_false] at hd + cases hd + +/-- This is the squared-history estimate with actual prime sampling and +actual integer integrality/unit conditions. The adaptive-support event is +constructed, and is not an additional hypothesis. -/ +theorem compensated_history_square_rate (n k : ℕ) (K C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∀ N V : ℕ, ∀ Δ : ℝ, ∀ P : Finset ℕ, ∀ S : Finset ℤ, + (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + ∀ R : FrequencyTree S n → ℕ, ∀ [_hQ : ∀ t, NeZero (R t ^ (k + 2))], + ∀ D : FrequencyTree S n → PivotDependencyScheme (2 ^ n - 1), + ∀ U : FrequencyTree S n → Fin (2 ^ n - 1) → ℤ, + (∀ t i, IsCoprime (U t i) (R t : ℤ)) → + (∀ t i, (D t).depth i ≤ k) → + ∀ _hs : ∀ t i, ((D t).frequencies i).root ≠ 0, + ∀ _hsR : ∀ t i, ((D t).frequencies i).root.natAbs ∣ R t, + (∀ t i, (D t).frequencies i = singleTreeNodeFrequencies S n t i.val) → + ∀ T : TreeLeafIndex n → Finset ℕ, ∀ h J : TreeLeafIndex n → ℕ, + ∀ hunit : ∀ t, ∀ p : P, (p : ℕ).Coprime (R t ^ (k + 2)), + (∀ t i, R t ^ (k + 2) ≤ 2 ^ h i) → + (∀ i p, p ∈ T i → 2 ^ h i ≤ p ∧ p < 2 ^ (h i + J i)) → + ∀ a C₁ L : ℝ, 0 < a → 1 ≤ L → + (∀ i, a ≤ ∑ p ∈ T i, (p : ℝ)⁻¹) → + (∀ i, (J i : ℝ) ≤ Real.exp (C₁ * L)) → + ∀ pivots : FrequencyTree S n → (TreeLeafIndex n → P) → Fin (2 ^ n - 1) → ℤ, + ∀ W : FrequencyTree S n → (TreeLeafIndex n → P) → ℂ, + (∀ t x, ‖W t x‖ ^ 2 ≤ Real.exp (-(2 ^ n : ℕ) * Δ + K) * + frequencyLeafWeight (singleFrequencyLeaf S V) n t) → + (∀ t x, W t x ≠ 0 → + (sampledPrimeHistory P (R t ^ (k + 2)) n (hunit t) x (pivots t x)).compensatedValid (D t) (U t)) → + (∑ t, ∑ x, (∏ i, primeSubsetPrior P (T i) (x i)) * ‖W t x‖ ^ 2) ≤ + Real.exp ((C₁ + max (Real.log (3 / a)) 0) * (2 ^ n : ℕ) * L + ε * m) := by + filter_upwards [harmonic_history_support_rate n K C ε hC hε] with m hm + intro N V Δ P S hN hV hS R _hQ D U hU hdepth hs hsR hfreq T h J hunit hsmall hrange + a C₁ L ha hL hmass hJ pivots W hsize hvalid + have hb := compensated_history_square_sum_le P S V n k R D U hU hdepth hs hsR T hunit pivots W + (Real.exp (-(2 ^ n : ℕ) * Δ + K)) (Real.exp_pos _).le hsize hvalid + exact hb.trans (hm N V Δ P S hN hV hS (fun t => R t ^ (k + 2)) T h J hunit hsmall hrange + a C₁ L ha hL hmass hJ (fun t => compensatedAdaptiveData n (R t) k (D t) (U t) (hs t) (hsR t)) + (fun t => compensatedAdaptiveData_history_frequencies S n (R t) k t (D t) (U t) (hs t) (hsR t) (hfreq t))) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedPairSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedPairSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..301ab9801e3c411634e01eb4a8b7f789cf9a6492 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedPairSupport.lean @@ -0,0 +1,99 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.MovingAdaptiveSupport +import OAI.NumberTheory.Ostmann.Arithmetic.WeightedArithmeticSupport + +namespace OAI + +/-! # Paired adaptive support on the same original bulk variables -/ + +namespace Ostmann +open scoped Classical + +def pairArithmeticData {Q : ℕ} (d e : Option (ArithmeticSplitData Q)) : + Option (ArithmeticSplitData Q × ArithmeticSplitData Q) := + match d, e with + | some d, some e => some (d, e) + | _, _ => none + +theorem pairArithmeticData_test {Q : ℕ} (d e : Option (ArithmeticSplitData Q)) + (x : (ZMod Q)ˣ) : + arithmeticPairSplitTest (pairArithmeticData d e) x ↔ + singleArithmeticSplitTest d x ∧ singleArithmeticSplitTest e x := by + cases d <;> cases e <;> simp [pairArithmeticData, arithmeticPairSplitTest, singleArithmeticSplitTest] + +theorem sequentialSupport_and {A : Type} (p q : List A → A → Prop) + (past : List A) (n : ℕ) (x : SplitSamples A n) : + sequentialSupport (fun past y => p past y ∧ q past y) past n x = + sequentialSupport p past n x * sequentialSupport q past n x := by + induction n generalizing past with + | zero => simp [sequentialSupport] + | succ n ih => + simp only [sequentialSupport] + by_cases hp : p past x.1 <;> by_cases hq : q past x.1 <;> + simp only [hp, hq, and_self, and_true, and_false, + ite_true, ite_false, zero_mul, mul_zero, ih] + +theorem arithmeticLeafSupport_pair {Q : ℕ} [NeZero Q] (n : ℕ) + (d e : (ZMod Q)ˣ → List (ZMod Q)ˣ → Option (ArithmeticSplitData Q)) + (x : TreeLeafTuple (ZMod Q)ˣ n) : + arithmeticLeafSupport n (fun total past => pairArithmeticData (d total past) (e total past)) x = + singleArithmeticLeafSupport n d x * singleArithmeticLeafSupport n e x := by + unfold arithmeticLeafSupport singleArithmeticLeafSupport + simp only [pairArithmeticData_test] + exact sequentialSupport_and _ _ _ _ _ + +noncomputable def compensatedPairData (n R k : ℕ) + (D E : PivotDependencyScheme (2 ^ n - 1)) (U V : Fin (2 ^ n - 1) → ℤ) + (hD : ∀ i, (D.frequencies i).root ≠ 0) (hE : ∀ i, (E.frequencies i).root ≠ 0) + (hDR : ∀ i, (D.frequencies i).root.natAbs ∣ R) + (hER : ∀ i, (E.frequencies i).root.natAbs ∣ R) + (total : (ZMod (R ^ (k + 2)))ˣ) (past : List (ZMod (R ^ (k + 2)))ˣ) : + Option (ArithmeticSplitData (R ^ (k + 2)) × ArithmeticSplitData (R ^ (k + 2))) := + pairArithmeticData (compensatedAdaptiveData n R k D U hD hDR total past) + (compensatedAdaptiveData n R k E V hE hER total past) + +theorem compensatedPairData_frequencies (n R k : ℕ) + (D E : PivotDependencyScheme (2 ^ n - 1)) (U V : Fin (2 ^ n - 1) → ℤ) + (hD : ∀ i, (D.frequencies i).root ≠ 0) (hE : ∀ i, (E.frequencies i).root ≠ 0) + (hDR : ∀ i, (D.frequencies i).root.natAbs ∣ R) + (hER : ∀ i, (E.frequencies i).root.natAbs ∣ R) + (total : (ZMod (R ^ (k + 2)))ˣ) (past : List (ZMod (R ^ (k + 2)))ˣ) + (hj : past.length < 2 ^ n - 1) (d e : ArithmeticSplitData (R ^ (k + 2))) + (hde : compensatedPairData n R k D E U V hD hE hDR hER total past = some (d, e)) : + d.hasFrequencies (D.frequencies ⟨past.length, hj⟩) ∧ + e.hasFrequencies (E.frequencies ⟨past.length, hj⟩) := by + cases hd : compensatedAdaptiveData n R k D U hD hDR total past with + | none => simp [compensatedPairData, pairArithmeticData, hd] at hde + | some d' => + cases he : compensatedAdaptiveData n R k E V hE hER total past with + | none => simp [compensatedPairData, pairArithmeticData, he] at hde + | some e' => + have h : d' = d ∧ e' = e := by + simpa only [compensatedPairData, pairArithmeticData, hd, he, + Option.some.injEq, Prod.mk.injEq] using hde + rcases h with ⟨rfl, rfl⟩ + exact ⟨compensatedAdaptiveData_frequencies n R k D U hD hDR total past hj d' hd, + compensatedAdaptiveData_frequencies n R k E V hE hER total past hj e' he⟩ + +/-- Both histories use one bulk residue tuple; no history validity is used +as a conditioning event. -/ +theorem compensatedPairData_actual_support (n R k : ℕ) [NeZero (R ^ (k + 2))] + (D E : PivotDependencyScheme (2 ^ n - 1)) (U V : Fin (2 ^ n - 1) → ℤ) + (hU : ∀ i, IsCoprime (U i) (R : ℤ)) (hV : ∀ i, IsCoprime (V i) (R : ℤ)) + (hdepthD : ∀ i, D.depth i ≤ k) (hdepthE : ∀ i, E.depth i ≤ k) + (hD : ∀ i, (D.frequencies i).root ≠ 0) (hE : ∀ i, (E.frequencies i).root ≠ 0) + (hDR : ∀ i, (D.frequencies i).root.natAbs ∣ R) + (hER : ∀ i, (E.frequencies i).root.natAbs ∣ R) + (a b : SampledPivotHistory n (R ^ (k + 2))) + (ha : a.compensatedValid D U) (hb : b.compensatedValid E V) (hab : a.residue = b.residue) : + arithmeticLeafSupport n (compensatedPairData n R k D E U V hD hE hDR hER) a.residue = 1 := by + change arithmeticLeafSupport n + (fun total past => pairArithmeticData + (compensatedAdaptiveData n R k D U hD hDR total past) + (compensatedAdaptiveData n R k E V hE hER total past)) a.residue = 1 + rw [arithmeticLeafSupport_pair, + compensatedAdaptiveData_actual_support n R k D U hU hdepthD hD hDR a ha, + hab, compensatedAdaptiveData_actual_support n R k E V hV hdepthE hE hER b hb, one_mul] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedPivotPrecision.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedPivotPrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3448e06932b5caeea9de92d1b1d33ad390a3893 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensatedPivotPrecision.lean @@ -0,0 +1,98 @@ +import OAI.NumberTheory.Ostmann.Construction.AncestorPivotPrecision + +namespace OAI + +/-! # Exposed-prefix precision for the actual compensation-divided pivots + +The new giant is N/(s U), where U is the product of the sampled +compensation primes. Its being a unit at the frequency modulus costs no +additional power of that modulus. +-/ + +namespace Ostmann +open scoped BigOperators + +/-- The equation of the moving construction, keeping its compensation +product instead of replacing the new giant by a composite pivot. -/ +def PivotDependencyScheme.compensatedEquations {N : ℕ} (D : PivotDependencyScheme N) + (U L R p : Fin N → ℤ) : Prop := + ∀ j, (D.frequencies j).left * D.leftCoefficient p j * R j - + (D.frequencies j).right * D.rightCoefficient p j * L j = + (D.frequencies j).root * U j * p j + +theorem PivotDependencyScheme.compensated_pivot_prefix_precision {N : ℕ} (D : PivotDependencyScheme N) + (R k J : ℕ) (U : Fin N → ℤ) (hU : ∀ j, IsCoprime (U j) (R : ℤ)) (hdepth : ∀ j, D.depth j ≤ k) + (hs : ∀ j, (D.frequencies j).root ≠ 0) + (hsR : ∀ j, (D.frequencies j).root.natAbs ∣ R) + (L₁ R₁ p₁ L₂ R₂ p₂ : Fin N → ℤ) + (heq₁ : D.compensatedEquations U L₁ R₁ p₁) (heq₂ : D.compensatedEquations U L₂ R₂ p₂) + (hL : ∀ j, j.val < J → L₁ j ≡ L₂ j [ZMOD (R : ℤ) ^ (k + 2)]) + (hR : ∀ j, j.val < J → R₁ j ≡ R₂ j [ZMOD (R : ℤ) ^ (k + 2)]) : + ∀ j, j.val < J → p₁ j ≡ p₂ j [ZMOD (R : ℤ) ^ (k + 1 - D.depth j)] := by + intro j hj + have hall : ∀ a : ℕ, ∀ j : Fin N, j.val = a → j.val < J → + p₁ j ≡ p₂ j [ZMOD (R : ℤ) ^ (k + 1 - D.depth j)] := by + intro a + induction a using Nat.strong_induction_on with + | h a ih => + intro j hja hj + have hcoeff (C : ℤ) (A : Finset (Fin N)) + (hA : ∀ i ∈ A, i.val < j.val ∧ D.depth i < D.depth j) : + ancestorCoefficient C A p₁ ≡ ancestorCoefficient C A p₂ + [ZMOD (R : ℤ) ^ (k + 2 - D.depth j)] := by + apply ancestorCoefficient_modEq + intro i hi + obtain ⟨hij, hdij⟩ := hA i hi + have hp := ih i.val (by omega) i rfl (by omega) + exact hp.of_dvd (pow_dvd_pow (R : ℤ) (by have := hdepth i; have := hdepth j; omega)) + have hcL := hcoeff (D.fixedLeft j) (D.ancestorsLeft j) (D.earlierLeft j) + have hcR := hcoeff (D.fixedRight j) (D.ancestorsRight j) (D.earlierRight j) + have hlj := (hL j hj).of_dvd (pow_dvd_pow (R : ℤ) (Nat.sub_le (k + 2) (D.depth j))) + have hrj := (hR j hj).of_dvd (pow_dvd_pow (R : ℤ) (Nat.sub_le (k + 2) (D.depth j))) + have hnum := ((hcL.mul_left (D.frequencies j).left).mul hrj).sub + ((hcR.mul_left (D.frequencies j).right).mul hlj) + have hroot : (D.frequencies j).root ∣ (R : ℤ) := + Int.natAbs_dvd.mp (Int.natCast_dvd_natCast.mpr (hsR j)) + have hx := reversal_residue_precision (R : ℤ) (D.frequencies j).root (U j) (U j) + ((D.frequencies j).left * D.leftCoefficient p₁ j * R₁ j - + (D.frequencies j).right * D.rightCoefficient p₁ j * L₁ j) + ((D.frequencies j).left * D.leftCoefficient p₂ j * R₂ j - + (D.frequencies j).right * D.rightCoefficient p₂ j * L₂ j) + (p₁ j) (p₂ j) (k + 1 - D.depth j) (hs j) hroot (hU j) (heq₁ j) (heq₂ j) + (by + have he : k + 1 - D.depth j + 1 = k + 2 - D.depth j := by have := hdepth j; omega + rw [he] + exact hnum) (.refl (U j)) + exact hx + exact hall j.val j rfl hj + +/-- Before the current split is exposed, both coefficients are already +known modulo its root frequency. This is the measurability step needed by +the sequential uniform-root count. -/ +theorem PivotDependencyScheme.compensated_coefficients_prefix_precision {N : ℕ} + (D : PivotDependencyScheme N) (R k : ℕ) (U : Fin N → ℤ) + (hU : ∀ i, IsCoprime (U i) (R : ℤ)) (j : Fin N) + (hdepth : ∀ i, D.depth i ≤ k) (hs : ∀ i, (D.frequencies i).root ≠ 0) + (hsR : ∀ i, (D.frequencies i).root.natAbs ∣ R) + (L₁ R₁ p₁ L₂ R₂ p₂ : Fin N → ℤ) + (heq₁ : D.compensatedEquations U L₁ R₁ p₁) (heq₂ : D.compensatedEquations U L₂ R₂ p₂) + (hL : ∀ i, i.val < j.val → L₁ i ≡ L₂ i [ZMOD (R : ℤ) ^ (k + 2)]) + (hR : ∀ i, i.val < j.val → R₁ i ≡ R₂ i [ZMOD (R : ℤ) ^ (k + 2)]) : + D.leftCoefficient p₁ j ≡ D.leftCoefficient p₂ j [ZMOD (D.frequencies j).root.natAbs] ∧ + D.rightCoefficient p₁ j ≡ D.rightCoefficient p₂ j [ZMOD (D.frequencies j).root.natAbs] := by + have hp := D.compensated_pivot_prefix_precision R k j.val U hU hdepth hs hsR L₁ R₁ p₁ L₂ R₂ p₂ heq₁ heq₂ hL hR + have hcoeff (C : ℤ) (A : Finset (Fin N)) + (hA : ∀ i ∈ A, i.val < j.val ∧ D.depth i < D.depth j) : + ancestorCoefficient C A p₁ ≡ ancestorCoefficient C A p₂ + [ZMOD (D.frequencies j).root.natAbs] := by + apply ancestorCoefficient_modEq + intro i hi + obtain ⟨hij, _⟩ := hA i hi + apply (hp i hij).of_dvd + exact (Int.natCast_dvd_natCast.mpr (hsR j)).trans + (dvd_pow_self (R : ℤ) (by have := hdepth i; omega)) + exact ⟨hcoeff _ _ (D.earlierLeft j), hcoeff _ _ (D.earlierRight j)⟩ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatterns.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatterns.lean new file mode 100644 index 0000000000000000000000000000000000000000..425d7456865ae926d06867e44f10c2620ff1dca2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatterns.lean @@ -0,0 +1,111 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompensationEqualityPatternsBasic + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.CompensationEqualityPatterns +open Construction +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] + +omit [Fintype ι] [DecidableEq ι] in +theorem value_eq_of_rel {τ : ι → ℕ} (p : Pattern τ) + (w : ι → κ) (hw : patternOf τ w = p) {i j : ι} (h : p.val.r i j) : w i = w j := by + cases hw + exact congrArg Prod.snd h + +def collapse {τ : ι → ℕ} (p : Pattern τ) + (w : {w : ι → κ // patternOf τ w = p}) : BlockDraw p κ := by + refine ⟨Quotient.lift w.val (fun _ _ h => value_eq_of_rel p w.val w.property h), ?_⟩ + intro q r + refine Quotient.inductionOn₂ q r ?_ + intro i j h + apply Quotient.sound + have hh : (patternOf τ w.val).val.r i j := h + exact (congrArg (fun r : Pattern τ => r.val.r i j) w.property).mp hh + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem collapse_label {τ : ι → ℕ} (p : Pattern τ) + (w : {w : ι → κ // patternOf τ w = p}) (i : ι) : + (collapse p w).val (label p i) = w.val i := rfl + +def fiberEquiv {τ : ι → ℕ} (p : Pattern τ) : + {w : ι → κ // patternOf τ w = p} ≃ BlockDraw p κ where + toFun := collapse p + invFun b := ⟨expand p b, patternOf_expand p b⟩ + left_inv w := by + apply Subtype.ext + funext i + rfl + right_inv b := by + apply Subtype.ext + funext q + induction q using Quotient.inductionOn with + | h i => rfl + +theorem sum_eq_patterns [Fintype κ] (τ : ι → ℕ) {A : Type*} [AddCommMonoid A] + (F : (ι → κ) → A) : + (∑ w : ι → κ, F w) = ∑ p : Pattern τ, ∑ b : BlockDraw p κ, F (expand p b) := by + classical + rw [← Fintype.sum_fiberwise (patternOf τ) F] + apply Finset.sum_congr rfl + intro p _ + exact ((fiberEquiv (κ := κ) p).symm.sum_comp (fun w => F w.val)).symm + +abbrev Fiber {τ : ι → ℕ} (p : Pattern τ) (q : Block p) := {i : ι // label p i = q} + +instance fiberFintype {τ : ι → ℕ} (p : Pattern τ) (q : Block p) : Fintype (Fiber p q) := + inferInstanceAs (Fintype {i : ι // label p i = q}) + +def multiplicity {τ : ι → ℕ} (p : Pattern τ) (q : Block p) : ℕ := Fintype.card (Fiber p q) + +omit [Fintype ι] [DecidableEq ι] in +theorem fiber_nonempty {τ : ι → ℕ} (p : Pattern τ) (q : Block p) : Nonempty (Fiber p q) := by + obtain ⟨i, hi⟩ := label_surjective p q + exact ⟨i, hi⟩ + +omit [DecidableEq ι] in +theorem multiplicity_pos {τ : ι → ℕ} (p : Pattern τ) (q : Block p) : 0 < multiplicity p q := by + let := fiber_nonempty p q + exact Fintype.card_pos + +def blockWeight {τ : ι → ℕ} (p : Pattern τ) (μ : ι → κ → ℝ) + (q : Block p) (v : κ) : ℝ := ∏ i : Fiber p q, μ i.val v + +omit [DecidableEq ι] in +theorem product_weights_by_blocks {τ : ι → ℕ} (p : Pattern τ) + (μ : ι → κ → ℝ) (b : BlockDraw p κ) : + (∏ i, μ i (expand p b i)) = ∏ q : Block p, blockWeight p μ q (b.val q) := by + rw [← Fintype.prod_fiberwise (label p) (fun i => μ i (expand p b i))] + apply Finset.prod_congr rfl + intro q _ + apply Finset.prod_congr rfl + intro i _ + simp only [expand, i.property] + +omit [DecidableEq ι] in +theorem product_by_multiplicity {τ : ι → ℕ} (p : Pattern τ) + (b : BlockDraw p κ) {A : Type*} [CommMonoid A] (f : κ → A) : + (∏ i, f (expand p b i)) = ∏ q : Block p, f (b.val q) ^ multiplicity p q := by + unfold expand + rw [← Fintype.prod_fiberwise' (label p) (fun q => f (b.val q))] + simp only [Finset.prod_const, Finset.card_univ, multiplicity] + +theorem product_weighted_sum_eq_patterns [Fintype κ] (τ : ι → ℕ) + (μ : ι → κ → ℝ) (F : (ι → κ) → ℂ) : + (∑ w : ι → κ, ((∏ i, μ i (w i)) : ℝ) • F w) = + ∑ p : Pattern τ, ∑ b : BlockDraw p κ, + (∏ q : Block p, blockWeight p μ q (b.val q)) • F (expand p b) := by + rw [sum_eq_patterns τ] + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + rw [product_weights_by_blocks] + +end Ostmann.Arithmetic.CompensationEqualityPatterns + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..7495201e5154be77a490101b23284f9f0d00d998 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsBasic.lean @@ -0,0 +1,97 @@ +import OAI.NumberTheory.Ostmann.Construction.PrimeSources + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.CompensationEqualityPatterns +open Construction +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] + +def Pattern (τ : ι → ℕ) := {r : Setoid ι // r ≤ Setoid.ker τ} + +def patternCode {τ : ι → ℕ} (p : Pattern τ) : ι → ι → Bool := + fun i j => decide (p.val.r i j) + +omit [Fintype ι] [DecidableEq ι] in +theorem patternCode_injective (τ : ι → ℕ) : Function.Injective (patternCode (τ := τ)) := by + intro p q h + apply Subtype.ext + apply Setoid.ext + intro i j + exact decide_eq_decide.mp (congrFun (congrFun h i) j) + +instance patternFintype (τ : ι → ℕ) : Fintype (Pattern τ) := + Fintype.ofInjective patternCode (patternCode_injective τ) + +instance patternDecidableEq (τ : ι → ℕ) : DecidableEq (Pattern τ) := Classical.decEq _ + +theorem card_pattern_le (τ : ι → ℕ) : + Fintype.card (Pattern τ) ≤ 2 ^ (Fintype.card ι * Fintype.card ι) := by + have h := Fintype.card_le_of_injective (patternCode (τ := τ)) (patternCode_injective τ) + simpa only [Fintype.card_fun, Fintype.card_bool, ← pow_mul] using h + +def patternOf (τ : ι → ℕ) (w : ι → κ) : Pattern τ := + ⟨Setoid.ker (fun i => (τ i, w i)), fun _ _ h => congrArg Prod.fst h⟩ + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem patternOf_rel (τ : ι → ℕ) (w : ι → κ) (i j : ι) : + (patternOf τ w).val.r i j ↔ τ i = τ j ∧ w i = w j := by + change (τ i, w i) = (τ j, w j) ↔ _ + simp only [Prod.mk.injEq] + +abbrev Block {τ : ι → ℕ} (p : Pattern τ) := Quotient p.val + +instance blockFintype {τ : ι → ℕ} (p : Pattern τ) : Fintype (Block p) := Fintype.ofFinite _ +instance blockDecidableEq {τ : ι → ℕ} (p : Pattern τ) : DecidableEq (Block p) := Classical.decEq _ + +def label {τ : ι → ℕ} (p : Pattern τ) (i : ι) : Block p := Quotient.mk p.val i + +omit [Fintype ι] [DecidableEq ι] in +theorem label_surjective {τ : ι → ℕ} (p : Pattern τ) : Function.Surjective (label p) := + Quotient.mk_surjective + +omit [DecidableEq ι] in +theorem card_block_le {τ : ι → ℕ} (p : Pattern τ) : + Fintype.card (Block p) ≤ Fintype.card ι := + Fintype.card_le_of_surjective (label p) (label_surjective p) + +def blockType {τ : ι → ℕ} (p : Pattern τ) : Block p → ℕ := + Quotient.lift τ (fun _ _ h => p.property h) + +omit [Fintype ι] [DecidableEq ι] in +@[simp] theorem blockType_label {τ : ι → ℕ} (p : Pattern τ) (i : ι) : + blockType p (label p i) = τ i := rfl + +def BlockDraw {τ : ι → ℕ} (p : Pattern τ) (κ : Type*) := + {b : Block p → κ // Function.Injective (fun q => (blockType p q, b q))} + +instance blockDrawFintype [Fintype κ] {τ : ι → ℕ} (p : Pattern τ) : + Fintype (BlockDraw p κ) := inferInstanceAs (Fintype {b : Block p → κ // + Function.Injective (fun q => (blockType p q, b q))}) + +def expand {τ : ι → ℕ} (p : Pattern τ) (b : BlockDraw p κ) : ι → κ := + fun i => b.val (label p i) + +omit [Fintype ι] [DecidableEq ι] in +theorem patternOf_expand {τ : ι → ℕ} (p : Pattern τ) (b : BlockDraw p κ) : + patternOf τ (expand p b) = p := by + apply Subtype.ext + apply Setoid.ext + intro i j + constructor + · intro h + apply Quotient.exact + apply b.property + exact h + · intro h + apply Prod.ext + · exact p.property h + · exact congrArg b.val (Quotient.sound h) + +end Ostmann.Arithmetic.CompensationEqualityPatterns + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsHistory.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsHistory.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f3dc184e086972a4022b199294dd042ece730ef --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsHistory.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompensationEqualityPatternsLaws +import OAI.NumberTheory.Ostmann.Arithmetic.CompensationEqualityPatternsTests +import OAI.NumberTheory.Ostmann.Construction.CanonicalHistoryProductChoicesPair + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.CompensationEqualityPatterns +open Construction Construction.CanonicalOccurrenceTransport +open scoped BigOperators +attribute [local instance] Classical.propDecidable + +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := + Classical.decEq _ + +def historyOrigin (seed : List SourceSlot) (l : ℕ) : Internal seed l → ℕ := + fun i => (internalSource seed i).origin + +def pairedHistoryType (seed : List SourceSlot) (l : ℕ) : + Internal seed l ⊕ Internal seed l → ℕ := + Sum.elim (internalLevel seed) (internalLevel seed) + +theorem sum_history_eq_patterns (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ → ℕ) (l : ℕ) (F : HistoryChoices sources seed V l → ℂ) : + (∑ c : HistoryChoices sources seed V l, + (choicesMass sources seed V l c : ℂ) * F c) = + ∑ f : FrequencyChoices V l, + ∑ p : Pattern (internalLevel seed : Internal seed l → ℕ), + ∑ b : BlockDraw p (CommonSample sources (historyOrigin seed l)), + (∏ q : Block p, + blockWeight p (sourceWeight sources (historyOrigin seed l)) q (b.val q)) • + extendSourceTest sources (historyOrigin seed l) + (fun x => F (assembleHistoryChoices sources seed V l f x)) (expand p b) := by + rw [sum_choicesMass_eq_source_prior] + apply Finset.sum_congr rfl + intro f _ + exact source_cmean_arbitrary_eq_patterns sources (historyOrigin seed l) + (internalLevel seed) (fun x => F (assembleHistoryChoices sources seed V l f x)) + +theorem sum_pair_history_eq_patterns (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ → ℕ) (l : ℕ) + (F : HistoryChoices sources seed V l → HistoryChoices sources seed V l → ℂ) : + (∑ c : HistoryChoices sources seed V l, ∑ d : HistoryChoices sources seed V l, + (choicesMass sources seed V l c : ℂ) * + (choicesMass sources seed V l d : ℂ) * F c d) = + ∑ f : FrequencyChoices V l, ∑ g : FrequencyChoices V l, + ∑ p : Pattern (pairedHistoryType seed l), + ∑ b : BlockDraw p (CommonSample sources (pairedInternalOrigin seed l)), + (∏ q : Block p, + blockWeight p (sourceWeight sources (pairedInternalOrigin seed l)) q (b.val q)) • + extendSourceTest sources (pairedInternalOrigin seed l) + (fun z => F + (assembleHistoryChoices sources seed V l f (fun i => z (.inl i))) + (assembleHistoryChoices sources seed V l g (fun i => z (.inr i)))) + (expand p b) := by + rw [sum_pair_choicesMass_eq_source_prior] + apply Finset.sum_congr rfl + intro f _ + apply Finset.sum_congr rfl + intro g _ + exact source_cmean_arbitrary_eq_patterns sources (pairedInternalOrigin seed l) + (pairedHistoryType seed l) (fun z => F + (assembleHistoryChoices sources seed V l f (fun i => z (.inl i))) + (assembleHistoryChoices sources seed V l g (fun i => z (.inr i)))) + +theorem card_pair_history_patterns_le (seed : List SourceSlot) (l : ℕ) : + Fintype.card (Pattern (pairedHistoryType seed l)) ≤ + 2 ^ ((2 * Fintype.card (Internal seed l)) * + (2 * Fintype.card (Internal seed l))) := by + simpa only [Fintype.card_sum, two_mul] using card_pattern_le (pairedHistoryType seed l) + +theorem pair_history_product_by_multiplicity (sources : SourceFamily) + (seed : List SourceSlot) (l : ℕ) (p : Pattern (pairedHistoryType seed l)) + (b : BlockDraw p (CommonSample sources (pairedInternalOrigin seed l))) : + (∏ i : Internal seed l ⊕ Internal seed l, ((expand p b i).val : ℝ)) = + ∏ q : Block p, ((b.val q).val : ℝ) ^ multiplicity p q := + source_product_by_multiplicity sources (pairedInternalOrigin seed l) + (pairedHistoryType seed l) p b + +end Ostmann.Arithmetic.CompensationEqualityPatterns + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsLaws.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a7e9ea37ca7ba49cd847887c6056bd2ebf33c14 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsLaws.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompensationEqualityPatternsSources + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.CompensationEqualityPatterns +open Construction +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +omit [DecidableEq ι] in +theorem source_block_mass_nonneg (sources : SourceFamily) (origin τ : ι → ℕ) + (p : Pattern τ) (b : BlockDraw p (CommonSample sources origin)) : + 0 ≤ ∏ q : Block p, blockWeight p (sourceWeight sources origin) q (b.val q) := by + apply Finset.prod_nonneg + intro q _ + apply Finset.prod_nonneg + intro i _ + exact sourceWeight_nonneg sources origin i.val (b.val q) + +theorem source_block_mass_total (sources : SourceFamily) (origin τ : ι → ℕ) : + (∑ p : Pattern τ, ∑ b : BlockDraw p (CommonSample sources origin), + ∏ q : Block p, blockWeight p (sourceWeight sources origin) q (b.val q)) = 1 := by + have h := source_cmean_eq_patterns sources origin τ (fun _ => (1 : ℂ)) + have hleft : (dependentProductPrior (fun i => (sources (origin i)).law)).cmean + (fun _ => (1 : ℂ)) = 1 := by + simp only [FinitePrior.cmean, mul_one, ← Complex.ofReal_sum, + FinitePrior.mass_total, Complex.ofReal_one] + rw [hleft] at h + simpa [← Complex.ofReal_prod] using congrArg Complex.re h.symm + +omit [DecidableEq ι] in +theorem source_supported_of_product_ne_zero (sources : SourceFamily) (origin : ι → ℕ) + (w : ι → CommonSample sources origin) + (hw : (∏ i, sourceWeight sources origin i (w i)) ≠ 0) : + ∀ i, (w i).val ∈ (sources (origin i)).candidates := by + intro i + by_contra hi + exact hw (Finset.prod_eq_zero (Finset.mem_univ i) (by simp [sourceWeight, hi])) + +omit [DecidableEq ι] in +theorem source_block_values_injective (sources : SourceFamily) (origin τ : ι → ℕ) + (hdisjoint : ∀ i j, τ i ≠ τ j → + Disjoint (sources (origin i)).candidates (sources (origin j)).candidates) + (p : Pattern τ) (b : BlockDraw p (CommonSample sources origin)) + (hb : (∏ q : Block p, blockWeight p (sourceWeight sources origin) q (b.val q)) ≠ 0) : + Function.Injective (fun q : Block p => (b.val q).val) := by + have he := product_weights_by_blocks p (sourceWeight sources origin) b + have hs := source_supported_of_product_ne_zero sources origin (expand p b) + (fun hz => hb (he.symm.trans hz)) + intro q r h + obtain ⟨i, rfl⟩ := label_surjective p q + obtain ⟨j, rfl⟩ := label_surjective p r + apply b.property + apply Prod.ext + · change τ i = τ j + by_contra ht + apply Finset.disjoint_left.mp (hdisjoint i j ht) (hs i) + change (b.val (label p i)).val ∈ (sources (origin j)).candidates + exact (congrArg (fun n : ℕ => n ∈ (sources (origin j)).candidates) h).mpr (hs j) + · exact Subtype.ext h + +end Ostmann.Arithmetic.CompensationEqualityPatterns + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsSources.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsSources.lean new file mode 100644 index 0000000000000000000000000000000000000000..1122f63301bb410ad07f21f098f031a1742b9357 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsSources.lean @@ -0,0 +1,112 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompensationEqualityPatterns + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.CompensationEqualityPatterns +open Construction +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def commonCandidates (sources : SourceFamily) (origin : ι → ℕ) : Finset ℕ := + Finset.univ.biUnion fun i => (sources (origin i)).candidates + +abbrev CommonSample (sources : SourceFamily) (origin : ι → ℕ) := + ↥(commonCandidates sources origin) + +abbrev IndependentSamples (sources : SourceFamily) (origin : ι → ℕ) := + ∀ i, (sources (origin i)).Sample + +def sourceEmbed (sources : SourceFamily) (origin : ι → ℕ) (i : ι) + (v : (sources (origin i)).Sample) : CommonSample sources origin := + ⟨v.val, Finset.mem_biUnion.mpr ⟨i, Finset.mem_univ i, v.property⟩⟩ + +def tupleEmbed (sources : SourceFamily) (origin : ι → ℕ) + (x : IndependentSamples sources origin) : ι → CommonSample sources origin := + fun i => sourceEmbed sources origin i (x i) + +omit [DecidableEq ι] in +theorem tupleEmbed_injective (sources : SourceFamily) (origin : ι → ℕ) : + Function.Injective (tupleEmbed sources origin) := by + intro x y h + funext i + apply Subtype.ext + exact congrArg (fun v : CommonSample sources origin => v.val) (congrFun h i) + +def sourceWeight (sources : SourceFamily) (origin : ι → ℕ) (i : ι) + (v : CommonSample sources origin) : ℝ := + if h : v.val ∈ (sources (origin i)).candidates then + (sources (origin i)).law.mass ⟨v.val, h⟩ else 0 + +omit [DecidableEq ι] in +@[simp] theorem sourceWeight_embed (sources : SourceFamily) (origin : ι → ℕ) (i : ι) + (v : (sources (origin i)).Sample) : + sourceWeight sources origin i (sourceEmbed sources origin i v) = + (sources (origin i)).law.mass v := by + simp [sourceWeight, sourceEmbed, v.property] + +omit [DecidableEq ι] in +theorem sourceWeight_nonneg (sources : SourceFamily) (origin : ι → ℕ) (i : ι) + (v : CommonSample sources origin) : 0 ≤ sourceWeight sources origin i v := by + unfold sourceWeight + split_ifs + · exact (sources (origin i)).law.mass_nonneg _ + · exact le_rfl + +theorem source_sum_eq_common (sources : SourceFamily) (origin : ι → ℕ) + (F : (ι → CommonSample sources origin) → ℂ) : + (∑ x : IndependentSamples sources origin, + (∏ i, (sources (origin i)).law.mass (x i)) • F (tupleEmbed sources origin x)) = + ∑ w : ι → CommonSample sources origin, + (∏ i, sourceWeight sources origin i (w i)) • F w := by + apply Fintype.sum_of_injective (tupleEmbed sources origin) (tupleEmbed_injective sources origin) + · intro w hw + have hn : ¬ ∀ i, (w i).val ∈ (sources (origin i)).candidates := by + intro hs + apply hw + refine ⟨fun i => ⟨(w i).val, hs i⟩, ?_⟩ + funext i + apply Subtype.ext + rfl + obtain ⟨i, hi⟩ := not_forall.mp hn + have hz : (∏ j, sourceWeight sources origin j (w j)) = 0 := + Finset.prod_eq_zero (Finset.mem_univ i) (by simp [sourceWeight, hi]) + simp only [hz, zero_smul] + · intro x + congr 1 + apply Finset.prod_congr rfl + intro i _ + exact (sourceWeight_embed sources origin i (x i)).symm + +theorem source_cmean_eq_patterns (sources : SourceFamily) (origin τ : ι → ℕ) + (F : (ι → CommonSample sources origin) → ℂ) : + (dependentProductPrior (fun i => (sources (origin i)).law)).cmean + (fun x => F (tupleEmbed sources origin x)) = + ∑ p : Pattern τ, ∑ b : BlockDraw p (CommonSample sources origin), + (∏ q : Block p, blockWeight p (sourceWeight sources origin) q (b.val q)) • + F (expand p b) := by + have h := source_sum_eq_common sources origin F + have h' := product_weighted_sum_eq_patterns τ (sourceWeight sources origin) F + apply Eq.trans _ (h.trans h') + unfold FinitePrior.cmean dependentProductPrior + rfl + +omit [DecidableEq ι] in +theorem commonSample_prime (sources : SourceFamily) (origin : ι → ℕ) + (v : CommonSample sources origin) : Nat.Prime v.val := by + obtain ⟨i, _, hi⟩ := Finset.mem_biUnion.mp v.property + exact (sources (origin i)).prime _ hi + +omit [DecidableEq ι] in +theorem source_product_by_multiplicity (sources : SourceFamily) (origin τ : ι → ℕ) + (p : Pattern τ) (b : BlockDraw p (CommonSample sources origin)) : + (∏ i, (((expand p b i).val : ℕ) : ℝ)) = + ∏ q : Block p, (((b.val q).val : ℕ) : ℝ) ^ multiplicity p q := + product_by_multiplicity p b (fun v => (v.val : ℝ)) + +end Ostmann.Arithmetic.CompensationEqualityPatterns + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsTests.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsTests.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b3b2910e89a3af15a61064c83fd8bd0d890f725 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompensationEqualityPatternsTests.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompensationEqualityPatternsSources + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.CompensationEqualityPatterns +open Construction +open scoped BigOperators +attribute [local instance] Classical.propDecidable +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def extendSourceTest (sources : SourceFamily) (origin : ι → ℕ) + (F : IndependentSamples sources origin → ℂ) (w : ι → CommonSample sources origin) : ℂ := + if h : ∀ i, (w i).val ∈ (sources (origin i)).candidates then + F (fun i => ⟨(w i).val, h i⟩) else 0 + +omit [DecidableEq ι] in +@[simp] theorem extendSourceTest_tupleEmbed [DecidableEq ι] + (sources : SourceFamily) (origin : ι → ℕ) + (F : IndependentSamples sources origin → ℂ) (x : IndependentSamples sources origin) : + extendSourceTest sources origin F (tupleEmbed sources origin x) = F x := by + have hs : ∀ i, (tupleEmbed sources origin x i).val ∈ (sources (origin i)).candidates := + fun i => (x i).property + rw [extendSourceTest, dite_eq_left hs] + congr 1 + +theorem source_cmean_arbitrary_eq_patterns (sources : SourceFamily) (origin τ : ι → ℕ) + (F : IndependentSamples sources origin → ℂ) : + (dependentProductPrior (fun i => (sources (origin i)).law)).cmean F = + ∑ p : Pattern τ, ∑ b : BlockDraw p (CommonSample sources origin), + (∏ q : Block p, blockWeight p (sourceWeight sources origin) q (b.val q)) • + extendSourceTest sources origin F (expand p b) := by + simpa only [extendSourceTest_tupleEmbed] using + source_cmean_eq_patterns sources origin τ (extendSourceTest sources origin F) + +end Ostmann.Arithmetic.CompensationEqualityPatterns + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRoots.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRoots.lean new file mode 100644 index 0000000000000000000000000000000000000000..371a2547244180d22a02b08fdcb17fe571396920 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRoots.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompositeSquareRootsGcd +import OAI.NumberTheory.Ostmann.Arithmetic.DivisorGrowth + +namespace OAI + +namespace Ostmann.Arithmetic + +def rootOneCode (n : ℕ) [NeZero n] (x : {x : ZMod n // x ^ 2 = 1}) : + {d : ℕ // d ∈ n.divisors} × Fin 2 := by + refine (⟨Int.gcd (n : ℤ) ((x.val.val : ℤ) - 1), ?_⟩, + ⟨2 * x.val.val / n, ?_⟩) + · apply Nat.mem_divisors.mpr + refine ⟨?_, NeZero.ne n⟩ + exact_mod_cast Int.gcd_dvd_left (n : ℤ) ((x.val.val : ℤ) - 1) + · apply (Nat.div_lt_iff_lt_mul (NeZero.pos n)).mpr + have h := x.val.val_lt + omega + +theorem square_one_int_factor_dvd (n : ℕ) [NeZero n] + (x : {x : ZMod n // x ^ 2 = 1}) : + (n : ℤ) ∣ ((x.val.val : ℤ) - 1) * ((x.val.val : ℤ) + 1) := by + apply (ZMod.intCast_zmod_eq_zero_iff_dvd _ n).mp + push_cast + rw [ZMod.natCast_zmod_val] + calc + (x.val - 1) * (x.val + 1) = x.val ^ 2 - 1 := by ring + _ = 0 := by rw [x.property]; ring + +theorem rootOneCode_injective (n : ℕ) [NeZero n] : + Function.Injective (rootOneCode n) := by + intro x y h + have hg := congrArg (fun z => z.1.val) h + have hq := congrArg (fun z => z.2.val) h + apply Subtype.ext + apply ZMod.val_injective n + apply nat_eq_of_two_sub_dvd_of_halfIndex_eq (NeZero.pos n) x.val.val_lt y.val.val_lt + · exact int_dvd_two_sub_of_square_gcd_eq n x.val.val y.val.val + (square_one_int_factor_dvd n x) (square_one_int_factor_dvd n y) hg + · exact hq + +theorem card_square_one_le_two_divisors (n : ℕ) [NeZero n] : + Nat.card {x : ZMod n // x ^ 2 = 1} ≤ 2 * n.divisors.card := by + have h := Nat.card_le_card_of_injective (rootOneCode n) (rootOneCode_injective n) + simpa only [Nat.card_prod, Nat.card_eq_fintype_card, Fintype.card_coe, Fintype.card_prod, + Fintype.card_fin, Nat.mul_comm] using h + +theorem card_square_fiber_le_one {G : Type*} [CommGroup G] [Finite G] (a : G) : + Nat.card {x : G // x ^ 2 = a} ≤ Nat.card {x : G // x ^ 2 = 1} := by + classical + by_cases h : ∃ x : G, x ^ 2 = a + · obtain ⟨r, hr⟩ := h + let f : {x : G // x ^ 2 = a} → {x : G // x ^ 2 = 1} := fun x => + ⟨x.val / r, by simp [div_pow, x.property, hr]⟩ + apply Nat.card_le_card_of_injective f + intro x y hxy + apply Subtype.ext + exact div_left_inj.mp (congrArg Subtype.val hxy) + · have hempty : IsEmpty {x : G // x ^ 2 = a} := ⟨fun x => h ⟨x.val, x.property⟩⟩ + simp + +theorem card_unit_square_fiber_le_two_divisors (n : ℕ) [NeZero n] + (a : (ZMod n)ˣ) : + Nat.card {x : (ZMod n)ˣ // x ^ 2 = a} ≤ 2 * n.divisors.card := by + apply (card_square_fiber_le_one a).trans + apply le_trans ?_ (card_square_one_le_two_divisors n) + let f : {x : (ZMod n)ˣ // x ^ 2 = 1} → {x : ZMod n // x ^ 2 = 1} := + fun x => ⟨x.val.val, by exact congrArg Units.val x.property⟩ + apply Nat.card_le_card_of_injective f + intro x y h + apply Subtype.ext + apply Units.ext + exact congrArg Subtype.val h + +theorem card_unit_square_fiber_le_rpow (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, ∀ [NeZero n], ∀ a : (ZMod n)ˣ, + (Nat.card {x : (ZMod n)ˣ // x ^ 2 = a} : ℝ) ≤ C * (n : ℝ) ^ ε := by + obtain ⟨C, hC, hbound⟩ := divisors_card_le_rpow ε hε + refine ⟨2 * C, by positivity, fun n _ a => ?_⟩ + have h : (Nat.card {x : (ZMod n)ˣ // x ^ 2 = a} : ℝ) ≤ 2 * n.divisors.card := by + exact_mod_cast card_unit_square_fiber_le_two_divisors n a + calc + _ ≤ 2 * (n.divisors.card : ℝ) := h + _ ≤ 2 * (C * (n : ℝ) ^ ε) := mul_le_mul_of_nonneg_left (hbound n (NeZero.pos n)) (by norm_num) + _ = (2 * C) * (n : ℝ) ^ ε := by ring + +end Ostmann.Arithmetic + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsDensity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad776b4272cf6baf336661129044dc7819d412fd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsDensity.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompositeSquareRootsLCM +import OAI.NumberTheory.Ostmann.Arithmetic.DivisorGrowthTotient + +namespace OAI + +namespace Ostmann.Arithmetic + +theorem density_le_two_divisors_sq (n k : ℕ) (hn : 0 < n) + (hk : k ≤ 2 * n.divisors.card) : + (k : ℝ) / n.totient ≤ 2 * (n.divisors.card : ℝ) ^ 2 / n := by + have ht : (0 : ℝ) < n.totient := by exact_mod_cast Nat.totient_pos.mpr hn + have hnR : (0 : ℝ) < n := by exact_mod_cast hn + have hkR : (k : ℝ) ≤ 2 * n.divisors.card := by exact_mod_cast hk + have hφ : (n : ℝ) ≤ n.totient * n.divisors.card := by + exact_mod_cast self_le_totient_mul_divisors n hn + apply (div_le_div_iff₀ ht hnR).mpr + calc + (k : ℝ) * n ≤ (2 * n.divisors.card) * n := + mul_le_mul_of_nonneg_right hkR hnR.le + _ ≤ (2 * n.divisors.card) * (n.totient * n.divisors.card) := + mul_le_mul_of_nonneg_left hφ (by positivity) + _ = (2 * (n.divisors.card : ℝ) ^ 2) * n.totient := by ring + +theorem density_le_rpow_of_le_two_divisors (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n k : ℕ, 0 < n → k ≤ 2 * n.divisors.card → + (k : ℝ) / n.totient ≤ C * (n : ℝ) ^ (ε - 1) := by + obtain ⟨C, hC, hbound⟩ := divisors_card_pow_le_rpow 2 ε hε + refine ⟨2 * C, by positivity, fun n k hn hk => ?_⟩ + have hnR : (0 : ℝ) < n := by exact_mod_cast hn + calc + (k : ℝ) / n.totient ≤ 2 * (n.divisors.card : ℝ) ^ 2 / n := + density_le_two_divisors_sq n k hn hk + _ ≤ 2 * (C * (n : ℝ) ^ ε) / n := + div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (hbound n hn) (by norm_num)) hnR.le + _ = (2 * C) * (n : ℝ) ^ (ε - 1) := by + rw [Real.rpow_sub hnR, Real.rpow_one] + ring + +theorem unit_square_fiber_density_le_rpow (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, ∀ [NeZero n], ∀ a : (ZMod n)ˣ, + (Nat.card {x : (ZMod n)ˣ // x ^ 2 = a} : ℝ) / Nat.card (ZMod n)ˣ ≤ + C * (n : ℝ) ^ (ε - 1) := by + classical + obtain ⟨C, hC, hbound⟩ := density_le_rpow_of_le_two_divisors ε hε + refine ⟨C, hC, fun n _ a => ?_⟩ + have hc : Nat.card (ZMod n)ˣ = n.totient := by + rw [Nat.card_eq_fintype_card, ZMod.card_units_eq_totient] + rw [hc] + exact hbound n _ (NeZero.pos n) (card_unit_square_fiber_le_two_divisors n a) + +theorem lcm_unit_square_fiber_density_le_rpow (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ m n : ℕ, ∀ [NeZero (m.lcm n)], + ∀ a : (ZMod m × ZMod n)ˣ, + (Nat.card {x : (ZMod (m.lcm n))ˣ // (lcmUnitsMap m n x) ^ 2 = a} : ℝ) / + Nat.card (ZMod (m.lcm n))ˣ ≤ C * (m.lcm n : ℝ) ^ (ε - 1) := by + classical + obtain ⟨C, hC, hbound⟩ := density_le_rpow_of_le_two_divisors ε hε + refine ⟨C, hC, fun m n _ a => ?_⟩ + have hc : Nat.card (ZMod (m.lcm n))ˣ = (m.lcm n).totient := by + rw [Nat.card_eq_fintype_card, ZMod.card_units_eq_totient] + rw [hc] + exact hbound (m.lcm n) _ (NeZero.pos _) (card_lcm_unit_square_fiber_le_two_divisors m n a) + +end Ostmann.Arithmetic + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsGcd.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsGcd.lean new file mode 100644 index 0000000000000000000000000000000000000000..414f5d8f14682111c9316abf98a45a006423835b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsGcd.lean @@ -0,0 +1,50 @@ +import Mathlib + +namespace OAI + +namespace Ostmann.Arithmetic + +theorem int_dvd_cross_of_square_gcd_eq (n a b : ℤ) + (hb : n ∣ (b - 1) * (b + 1)) + (hg : Int.gcd n (a - 1) = Int.gcd n (b - 1)) : + n ∣ (a - 1) * (b + 1) := by + have hd : n ∣ (Int.gcd n (b - 1) : ℤ) * (b + 1) := by + rw [Int.gcd_eq_gcd_ab] + convert dvd_add (dvd_mul_right n (Int.gcdA n (b - 1) * (b + 1))) + (dvd_mul_of_dvd_left hb (Int.gcdB n (b - 1))) using 1 + ring + rw [← hg] at hd + obtain ⟨k, hk⟩ := Int.gcd_dvd_right n (a - 1) + rw [hk] + convert dvd_mul_of_dvd_left hd k using 1 + ring + +theorem int_dvd_two_sub_of_square_gcd_eq (n a b : ℤ) + (ha : n ∣ (a - 1) * (a + 1)) (hb : n ∣ (b - 1) * (b + 1)) + (hg : Int.gcd n (a - 1) = Int.gcd n (b - 1)) : + n ∣ 2 * (a - b) := by + have hab := int_dvd_cross_of_square_gcd_eq n a b hb hg + have hba := int_dvd_cross_of_square_gcd_eq n b a ha hg.symm + convert dvd_sub hab hba using 1 + ring + +theorem nat_eq_of_two_sub_dvd_of_halfIndex_eq {n a b : ℕ} (_hn : 0 < n) + (_ha : a < n) (_hb : b < n) + (hd : (n : ℤ) ∣ 2 * ((a : ℤ) - b)) + (hq : 2 * a / n = 2 * b / n) : a = b := by + have hm : (2 * a : ℕ) % n = (2 * b : ℕ) % n := by + have hmod : (2 * (b : ℤ)) ≡ 2 * (a : ℤ) [ZMOD (n : ℤ)] := by + apply Int.modEq_iff_dvd.mpr + convert hd using 1 + ring + have hmod' : (2 * b : ℕ) ≡ (2 * a : ℕ) [MOD n] := by + exact_mod_cast hmod + exact hmod'.symm + have heq := Nat.mod_add_div (2 * a) n + have heq' := Nat.mod_add_div (2 * b) n + rw [hq, hm] at heq + omega + +end Ostmann.Arithmetic + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsLCM.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsLCM.lean new file mode 100644 index 0000000000000000000000000000000000000000..068ada203ea186c1ac8eab27ee322e76a4967892 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CompositeSquareRootsLCM.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CompositeSquareRoots + +namespace OAI + +namespace Ostmann.Arithmetic + +theorem card_square_map_fiber_le_one {G H : Type*} [CommGroup G] [CommGroup H] + [Finite G] (f : G →* H) (hf : Function.Injective f) (a : H) : + Nat.card {x : G // (f x) ^ 2 = a} ≤ Nat.card {x : G // x ^ 2 = 1} := by + classical + by_cases h : ∃ x : G, (f x) ^ 2 = a + · obtain ⟨r, hr⟩ := h + let g : {x : G // (f x) ^ 2 = a} → {x : G // x ^ 2 = 1} := fun x => + ⟨x.val / r, by + apply hf + rw [map_pow, map_div, map_one] + simp only [div_pow, x.property, hr, div_self']⟩ + apply Nat.card_le_card_of_injective g + intro x y hxy + apply Subtype.ext + exact div_left_inj.mp (congrArg Subtype.val hxy) + · have hempty : IsEmpty {x : G // (f x) ^ 2 = a} := ⟨fun x => h ⟨x.val, x.property⟩⟩ + simp + +def lcmUnitsMap (m n : ℕ) : + (ZMod (m.lcm n))ˣ →* (ZMod m × ZMod n)ˣ := + Units.map (ZMod.castHom dvd_rfl (ZMod m × ZMod n)).toMonoidHom + +theorem lcmUnitsMap_injective (m n : ℕ) : Function.Injective (lcmUnitsMap m n) := by + intro x y h + apply Units.ext + apply (ZMod.castHom_injective (R := ZMod m × ZMod n)) + exact congrArg Units.val h + +theorem card_lcm_unit_square_fiber_le_two_divisors (m n : ℕ) [NeZero (m.lcm n)] + (a : (ZMod m × ZMod n)ˣ) : + Nat.card {x : (ZMod (m.lcm n))ˣ // (lcmUnitsMap m n x) ^ 2 = a} ≤ + 2 * (m.lcm n).divisors.card := by + exact (card_square_map_fiber_le_one (lcmUnitsMap m n) (lcmUnitsMap_injective m n) a).trans + (card_unit_square_fiber_le_two_divisors (m.lcm n) 1) + +end Ostmann.Arithmetic + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousIntegerComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousIntegerComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..dd15e47cd0f342b4e8cc9362f4d987f67356d18c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousIntegerComparison.lean @@ -0,0 +1,133 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.IntegerIntervalVariation +import OAI.NumberTheory.Ostmann.Arithmetic.ContinuousIntervalMesh + +namespace OAI + +/-! # Continuous weights under the original external integer law -/ + +namespace Ostmann +open MeasureTheory +open scoped BigOperators + +theorem complex_integer_density_freeze (q : ℕ) (hq : 0 < q) (u v G : ℝ) (huv : u ≤ v) + (w : ℝ → ℂ) (hwc : ContinuousOn w (Set.Icc u v)) (c : ℂ) (η : ℝ) (hη : 0 ≤ η) + (hw : ∀ y ∈ Set.Ioc u v, ‖w y - c‖ ≤ η) : + ‖(∫ y in Set.Ioc u v, w y * (integerLogDensity q G y : ℂ)) - + c * (∫ y in Set.Ioc u v, integerLogDensity q G y : ℝ)‖ ≤ + η * Real.exp (v - G) * (v - u) := by + have hc := (continuous_integerLogDensity q G).continuousOn (s := Set.Icc u v) + have hiw : IntegrableOn (fun y => w y * (integerLogDensity q G y : ℂ)) (Set.Ioc u v) := + (hwc.mul (Complex.continuous_ofReal.comp_continuousOn hc)).integrableOn_Icc.mono_set + Set.Ioc_subset_Icc_self + have hic : IntegrableOn (fun y => c * (integerLogDensity q G y : ℂ)) (Set.Ioc u v) := + (continuousOn_const.mul (Complex.continuous_ofReal.comp_continuousOn hc)).integrableOn_Icc.mono_set + Set.Ioc_subset_Icc_self + have heq : (∫ y in Set.Ioc u v, w y * (integerLogDensity q G y : ℂ)) - + c * (∫ y in Set.Ioc u v, integerLogDensity q G y : ℝ) = + ∫ y in Set.Ioc u v, (w y - c) * (integerLogDensity q G y : ℂ) := by + rw [← integral_complex_ofReal, ← integral_const_mul, ← integral_sub hiw hic] + apply setIntegral_congr_fun measurableSet_Ioc + intro y _ + ring + rw [heq] + have hi := intervalIntegral.norm_integral_le_of_norm_le_const + (a := u) (b := v) (C := η * Real.exp (v - G)) + (f := fun y => (w y - c) * (integerLogDensity q G y : ℂ)) + (fun y hy => by + have hy' := (Set.uIoc_of_le huv) ▸ hy + rw [norm_mul, Complex.norm_real, Real.norm_eq_abs] + exact mul_le_mul (hw y hy') (integerLogDensity_abs_le q hq G hy'.2) (abs_nonneg _) hη) + rwa [intervalIntegral.integral_of_le huv, abs_of_nonneg (sub_nonneg.mpr huv)] at hi + +/-- A partition only incurs oscillation times total mass and interval length. +Its progression error is bounded by variation independently of the mesh. -/ +theorem integer_partition_variation (q a : ℕ) (hq : 0 < q) (G : ℝ) + (s : ℕ → ℝ) (hs : Monotone s) (N : ℕ) + (w : ℝ → ℂ) (hwc : ContinuousOn w (Set.Icc (s 0) (s N))) (η : ℝ) (hη : 0 ≤ η) + (hw : ∀ j < N, ∀ y ∈ Set.Ioc (s j) (s (j + 1)), ‖w y - w (s j)‖ ≤ η) : + ‖complexIntegerInterval q a (s 0) (s N) G w - + ∫ y in Set.Ioc (s 0) (s N), w y * (integerLogDensity q G y : ℂ)‖ ≤ + discreteVariation (fun j => w (s j)) N * (2 * Real.exp (-G)) + + η * (integerLogCellMass q a (s 0) (s N) G + Real.exp (s N - G) * (s N - s 0)) := by + let A (j : ℕ) := complexIntegerInterval q a (s j) (s (j + 1)) G w + let B (j : ℕ) := w (s j) * (integerLogCellMass q a (s j) (s (j + 1)) G : ℂ) + let C (j : ℕ) := w (s j) * (∫ y in Set.Ioc (s j) (s (j + 1)), integerLogDensity q G y : ℝ) + let D (j : ℕ) := ∫ y in Set.Ioc (s j) (s (j + 1)), w y * (integerLogDensity q G y : ℂ) + have hA : ‖∑ j ∈ Finset.range N, (A j - B j)‖ ≤ + η * integerLogCellMass q a (s 0) (s N) G := by + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ j ∈ Finset.range N, η * integerLogCellMass q a (s j) (s (j + 1)) G := by + apply Finset.sum_le_sum + intro j hj + exact complexIntegerInterval_freeze q a _ _ G w _ η (hw j (Finset.mem_range.mp hj)) + _ = _ := by rw [← Finset.mul_sum, integerLogCellMass_partition q a G s hs N] + have hD : ‖∑ j ∈ Finset.range N, (C j - D j)‖ ≤ + η * Real.exp (s N - G) * (s N - s 0) := by + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ j ∈ Finset.range N, η * Real.exp (s N - G) * (s (j + 1) - s j) := by + apply Finset.sum_le_sum + intro j hj + rw [norm_sub_rev] + apply (complex_integer_density_freeze q hq _ _ G (hs (Nat.le_succ _)) w + (hwc.mono (by + intro y hy + exact ⟨(hs (Nat.zero_le _)).trans hy.1, + hy.2.trans (hs (by have := Finset.mem_range.mp hj; omega))⟩)) + _ η hη (hw j (Finset.mem_range.mp hj))).trans + apply mul_le_mul_of_nonneg_right _ (sub_nonneg.mpr (hs (Nat.le_succ _))) + apply mul_le_mul_of_nonneg_left _ hη + apply Real.exp_le_exp.mpr + exact sub_le_sub_right (hs (by have := Finset.mem_range.mp hj; omega)) G + _ = _ := by rw [← Finset.mul_sum, Finset.sum_range_sub s] + have hBC : ‖∑ j ∈ Finset.range N, (B j - C j)‖ ≤ + discreteVariation (fun j => w (s j)) N * (2 * Real.exp (-G)) := by + simpa only [B, C, ← mul_sub, ← Complex.ofReal_sub] using + weighted_integer_interval_variation q a hq G s hs N (fun j => w (s j)) + have hid : complexIntegerInterval q a (s 0) (s N) G w - + (∫ y in Set.Ioc (s 0) (s N), w y * (integerLogDensity q G y : ℂ)) = + (∑ j ∈ Finset.range N, (A j - B j)) + + (∑ j ∈ Finset.range N, (B j - C j)) + (∑ j ∈ Finset.range N, (C j - D j)) := by + have hcont : ContinuousOn (fun y => w y * (integerLogDensity q G y : ℂ)) + (Set.Icc (s 0) (s N)) := + hwc.mul (Complex.continuous_ofReal.comp_continuousOn (continuous_integerLogDensity q G).continuousOn) + rw [← complexIntegerInterval_partition q a G s hs w N, + ← integral_Ioc_partition s hs N (fun y => w y * (integerLogDensity q G y : ℂ)) hcont] + simp only [Finset.sum_sub_distrib, A, D] + ring + rw [hid] + exact ((norm_add_le _ _).trans (add_le_add (norm_add_le _ _) le_rfl)).trans + (by linarith [add_le_add (add_le_add hA hBC) hD]) + +/-- The external integer comparison keeps the original normalization and +requires no fixed mesh or partition-count loss. -/ +theorem continuous_integer_comparison (q a : ℕ) (hq : 0 < q) (u v G : ℝ) (huv : u ≤ v) + (w : ℝ → ℂ) (hwc : ContinuousOn w (Set.Icc u v)) (V : ℝ) + (hV : ∀ (s : ℕ → ℝ), Monotone s → ∀ N, s 0 = u → s N = v → + discreteVariation (fun j => w (s j)) N ≤ V) : + ‖complexIntegerInterval q a u v G w - + ∫ y in Set.Ioc u v, w y * (integerLogDensity q G y : ℂ)‖ ≤ + V * (2 * Real.exp (-G)) := by + let M := integerLogCellMass q a u v G + Real.exp (v - G) * (v - u) + have hM : 0 ≤ M := add_nonneg (integerLogCellMass_nonneg q a u v G) + (mul_nonneg (Real.exp_pos _).le (sub_nonneg.mpr huv)) + have hM1 : 0 < M + 1 := by linarith + apply le_of_forall_pos_le_add + intro ε hε + let η := ε / (M + 1) + have hη : 0 < η := div_pos hε hM1 + obtain ⟨s, N, _hN, hs, hs0, hsN, hosc⟩ := continuous_interval_mesh u v huv w hwc η hη + have hc : ContinuousOn w (Set.Icc (s 0) (s N)) := by simpa only [hs0, hsN] using hwc + have hb := integer_partition_variation q a hq G s hs N w hc η hη.le hosc + rw [hs0, hsN] at hb + apply hb.trans + have hvar := mul_le_mul_of_nonneg_right (hV s hs N hs0 hsN) (by positivity : 0 ≤ 2 * Real.exp (-G)) + have hsmall : η * M ≤ ε := by + have hid : η * (M + 1) = ε := by dsimp [η]; field_simp + nlinarith + exact add_le_add hvar hsmall + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousIntervalMesh.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousIntervalMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..4acbfcbd11417feb9f43152425382ac3717a3442 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousIntervalMesh.lean @@ -0,0 +1,51 @@ +import Mathlib.Topology.UniformSpace.HeineCantor +import OAI.NumberTheory.Ostmann.Arithmetic.PrimePartitionVariation + +namespace OAI + +/-! # Finite meshes for the continuous factors in prime comparison -/ + +namespace Ostmann + +/-- Mesh fineness is arbitrary and has no arithmetic cost: the progression +comparison uses total variation instead of counting the subintervals. -/ +theorem continuous_interval_mesh (u v : ℝ) (huv : u ≤ v) (w : ℝ → ℂ) + (hw : ContinuousOn w (Set.Icc u v)) (η : ℝ) (hη : 0 < η) : + ∃ (s : ℕ → ℝ) (N : ℕ), 0 < N ∧ Monotone s ∧ s 0 = u ∧ s N = v ∧ + ∀ j < N, ∀ y ∈ Set.Ioc (s j) (s (j + 1)), ‖w y - w (s j)‖ ≤ η := by + obtain ⟨δ, hδ, hmod⟩ := Metric.uniformContinuousOn_iff.mp + (isCompact_Icc.uniformContinuousOn_of_continuous hw) η hη + obtain ⟨n, hn⟩ := exists_nat_gt ((v - u) / δ) + let N := n + 1 + have hN : (0 : ℝ) < N := by dsimp [N]; positivity + have hmesh : (v - u) / N < δ := by + apply (div_lt_iff₀ hN).mpr + have hh : (v - u) / δ < (N : ℝ) := hn.trans (by dsimp [N]; push_cast; linarith) + have := (div_lt_iff₀ hδ).mp hh + nlinarith + let s : ℕ → ℝ := fun j => u + (v - u) * j / N + have hs : Monotone s := by + intro i j hij + dsimp [s] + apply add_le_add le_rfl + exact div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left (by exact_mod_cast hij) + (sub_nonneg.mpr huv)) hN.le + have hs0 : s 0 = u := by simp [s] + have hsN : s N = v := by dsimp [s]; field_simp; ring + refine ⟨s, N, by dsimp [N]; omega, hs, hs0, hsN, ?_⟩ + intro j hj y hy + have hsju : u ≤ s j := by rw [← hs0]; exact hs (Nat.zero_le _) + have hsjv : s (j + 1) ≤ v := by rw [← hsN]; exact hs (by omega) + have hsj : s j ∈ Set.Icc u v := ⟨hsju, (hs (Nat.le_succ _)).trans hsjv⟩ + have hyuv : y ∈ Set.Icc u v := ⟨hsju.trans hy.1.le, hy.2.trans hsjv⟩ + have hwidth : s (j + 1) - s j = (v - u) / N := by dsimp [s]; push_cast; ring + have hdist : dist y (s j) < δ := by + rw [Real.dist_eq, abs_of_nonneg (sub_nonneg.mpr hy.1.le)] + calc + y - s j ≤ s (j + 1) - s j := sub_le_sub_right hy.2 _ + _ < δ := hwidth ▸ hmesh + simpa only [dist_eq_norm] using (hmod y hyuv (s j) hsj hdist).le + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousPrimeComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousPrimeComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..494bfc3b6bc901c274f59838491bd4a04b003df5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ContinuousPrimeComparison.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ContinuousIntervalMesh + +namespace OAI + +/-! # Comparing the full continuous weight with the retained Page measure -/ + +namespace Ostmann +open MeasureTheory + +/-- A continuous weight with a uniform variation budget can be used directly +in the published progression estimate. No mesh parameter survives. -/ +theorem PublishedProgressionInput.continuous_prime_comparison (P : PublishedProgressionInput) + {Q q a : ℕ} (hQ : 2 ≤ Q) (hq : 1 ≤ q) (hqQ : q ≤ Q) (ha : a.Coprime q) + (u v : ℝ) (hu : 1 ≤ u) (huv : u ≤ v) (hshort : v ≤ u + 1) + (w : ℝ → ℂ) (hwc : ContinuousOn w (Set.Icc u v)) (V : ℝ) + (hV : ∀ (s : ℕ → ℝ), Monotone s → ∀ N, s 0 = u → s N = v → + discreteVariation (fun j => w (s j)) N ≤ V) : + ‖complexPrimeInterval q a u v w - + ∫ y in Set.Ioc u v, w y * (selectedPrimeLogDensity P Q q a y : ℂ)‖ ≤ + V * (18 * P.errorConstant * Real.exp (-P.decay * Real.sqrt u) + + Real.exp (-P.kappa * u / Real.log (4 * (Q : ℝ)))) := by + let M := reciprocalPrimeInterval q a (Real.exp u) (Real.exp v) + 2 * (v - u) + have hM : 0 ≤ M := add_nonneg (reciprocalPrimeInterval_nonneg q a _ _) + (mul_nonneg (by norm_num) (sub_nonneg.mpr huv)) + have hM1 : 0 < M + 1 := by linarith + have hE : 0 ≤ 18 * P.errorConstant * Real.exp (-P.decay * Real.sqrt u) + + Real.exp (-P.kappa * u / Real.log (4 * (Q : ℝ))) := by + exact add_nonneg (mul_nonneg (mul_nonneg (by norm_num) P.errorConstant_nonneg) + (Real.exp_pos _).le) (Real.exp_pos _).le + apply le_of_forall_pos_le_add + intro ε hε + let η := ε / (M + 1) + have hη : 0 < η := div_pos hε hM1 + obtain ⟨s, N, _hN, hs, hs0, hsN, hosc⟩ := continuous_interval_mesh u v huv w hwc η hη + have hc : ContinuousOn w (Set.Icc (s 0) (s N)) := by simpa only [hs0, hsN] using hwc + have hb := P.prime_partition_variation hQ hq hqQ ha s hs + (by simpa only [hs0] using hu) N (by simpa only [hs0, hsN] using hshort) + w hc η hη.le hosc + rw [hs0, hsN] at hb + apply hb.trans + have hvar := mul_le_mul_of_nonneg_right (hV s hs N hs0 hsN) hE + have hsmall : η * M ≤ ε := by + have hid : η * (M + 1) = ε := by dsimp [η]; field_simp + nlinarith + exact add_le_add hvar hsmall + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedAggregate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedAggregate.lean new file mode 100644 index 0000000000000000000000000000000000000000..48f86967c821eff676aed84cc66a32a97ceb6d23 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedAggregate.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CorrectedAggregatePoint +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedAggregateAlgebra + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +section +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryRepresentativeSourceSeparation +open HistoryBulkIndependentFibreReference HistoryBulkUniversalPatternAggregation +open HistoryBulkActualPrincipalKernelStageCorrected +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (selectedBulkPrior C l).cmean (fun sample => + rootExpression (l:=l) C outside e he hp hAd hout hV bg sample true)) = + ∑ index : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ∑ pattern : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean (l:=l) C pattern outside e he hout hp hV + index.1 index.2.1 index.2.2 false := + (Eq.refl ((backgroundPrior C l).cmean (fun bg => + (selectedBulkPrior C l).cmean (fun u => + rootExpression (l:=l) C outside e he hp hAd hout hV bg u true)))).trans + ((cmean_cmean_sum (backgroundPrior C l) (selectedBulkPrior C l) + (fun bg u (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) => + expression (l:=l) C outside e he hp hAd hout hV bg u i true)).trans + (Finset.sum_congr rfl (fun i _ => + background_probability_expression_eq_kernel_mean + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hp hAd hout hV i))) + +public theorem background_probability_rootExpression_eq_kernel_sum : + (backgroundPrior C l).cmean (fun bg => + (selectedBulkPrior C l).cmean (fun sample => + rootExpression (l:=l) C outside e he hp hAd hout hV bg sample true)) = + ∑ index : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ∑ pattern : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean (l:=l) C pattern outside e he hout hp hV + index.1 index.2.1 index.2.2 false := + background_probability_rootExpression_eq_kernel_sum_core + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hp hAd hout hV + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedAggregatePoint.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedAggregatePoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a6400b45ad1573633c402ae2574dee8d8d0c57f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedAggregatePoint.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedPattern + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +section +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryRepresentativeSourceSeparation +open HistoryBulkIndependentFibreReference HistoryBulkUniversalPatternAggregation +open HistoryBulkActualPrincipalKernelStageCorrected +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (selectedBulkPrior C l).cmean (fun sample => + expression (l:=l) C outside e he hp hAd hout hV bg sample i true)) = + ∑ pattern : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean (l:=l) C pattern outside e he hout hp hV i.1 i.2.1 i.2.2 false := + (congrArg ((backgroundPrior C l).cmean) (funext fun bg => + mean_expression_probability_eq_kernel_pattern + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hp hAd hout hV bg i)).trans + (sum_selectedKernelMean_eq_background + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hout hp hV i.1 i.2.1 i.2.2 false).symm + +public theorem background_probability_expression_eq_kernel_mean : + (backgroundPrior C l).cmean (fun bg => + (selectedBulkPrior C l).cmean (fun sample => + expression (l:=l) C outside e he hp hAd hout hV bg sample i true)) = + ∑ pattern : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean (l:=l) C pattern outside e he hout hp hV i.1 i.2.1 i.2.2 false := + background_probability_expression_eq_kernel_mean_core + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hp hAd hout hV i + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedCollisionMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedCollisionMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..cdd6ba8f3f1a6b0f238c0f64bef7086781a53564 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedCollisionMean.lean @@ -0,0 +1,77 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanPattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCollision +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchange +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +section +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation +open HistoryBulkActualPrincipalCollisionCorrected +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedCollisionMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C outside e he hlen hprime hV bg true true true) := + (sum_selectedKernelMean_eq_backgroundIndex (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C outside e he hlen hprime hV).trans + (congrArg (backgroundPrior C l).cmean + (funext (fun bg=> + (congrArg (patternComplexSum (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (funext (fun p=>funext (fun b=> + sum_selectedKernelOptionValue_eq_collisionBlock (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hlen hprime hV bg b)))).trans + (selectedCollisionMean_eq_blockPattern + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hlen hprime hV bg true true true).symm))) + +private theorem selectedKernelCollisionMeanComplete : + (∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ∑p : Pattern (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C p outside e he hlen hprime hV + i.1 i.2.1 i.2.2 true) = + (backgroundPrior C l).cmean (fun bg=> + selectedCollisionMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C outside e he hlen hprime hV bg true true true) := + selectedKernelCollisionMeanProof (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C outside e he hlen hprime hV + +public theorem sum_selectedKernelMean_eq_collisionMean : + (∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ∑p : Pattern (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C p outside e he hlen hprime hV + i.1 i.2.1 i.2.2 true) = + (backgroundPrior C l).cmean (fun bg=> + selectedCollisionMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C outside e he hlen hprime hV bg true true true) := + selectedKernelCollisionMeanComplete (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C outside e he hlen hprime hV + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedKernelCollision.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedKernelCollision.lean new file mode 100644 index 0000000000000000000000000000000000000000..90268189005d43e8d845a0e9f67314dfbe0743f7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedKernelCollision.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CorrectedOptionScalar +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedCollisionSumProof + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkActualPrincipalCollision HistoryBulkActualPrincipalCollisionCorrected +open HistoryBulkPrincipalCollisionError +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern + (ι := Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C p outside e he hlen hprime hV + i.1 i.2.1 i.2.2 (restoreOuterBackground C l p bg b) true u)) = + HistoryBulkActualPrincipalCollisionCorrected.selectedCollisionBlockValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C outside e he hlen hprime hV bg true true true p b := + correctedKernelFrequencySumProof + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hlen hprime hV bg b + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedOptionScalar.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedOptionScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1861169f9340d5362aff1ba9fa4c34e424024ce --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/CorrectedOptionScalar.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedValue +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) : ℂ := + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).elim 0 + (fun R=>R.kernelTerm (l:=l) he hlen hprime hV symbolic u) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..cdb595cda6a11fc1bdde648d244c4b4bb714233e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNorm.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormActual + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open Construction +open scoped BigOperators + +theorem actual_small_average (d : Decomposition) (D P q : ℕ) + (outerU xs : List SmallSlot) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + [NeZero (∏ i, smallPrime xs outerU i)] + (h : SmallUnitData D P q outerU xs v) : + (∑ z : ZMod (∏ i, smallPrime xs outerU i) × (ZMod (∏ i, smallPrime xs outerU i))ˣ, + crtTest (smallPrime xs outerU) h.coprime (smallRetained xs outerU) + (fun i => residueTransform d (smallPrime xs outerU i)) + (smallCoefficients D outerU xs v h.frequency h.denominator) z) / + Fintype.card (ZMod (∏ i, smallPrime xs outerU i) × (ZMod (∏ i, smallPrime xs outerU i))ˣ) = + ∏ i : Fin outerU.length, (((outerU[i].value-1:ℕ):ℝ)/outerU[i].value) := by + rw [actual_crtTest_average,Fintype.prod_sum_type] + simp only [smallPrime,smallRetained,localDensity,Bool.false_eq_true,ite_false,ite_true, + Finset.prod_const_one,one_mul] + +theorem actual_small_average_le_one (d : Decomposition) (D P q : ℕ) + (outerU xs : List SmallSlot) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + [NeZero (∏ i, smallPrime xs outerU i)] + (h : SmallUnitData D P q outerU xs v) : + (∑ z : ZMod (∏ i, smallPrime xs outerU i) × (ZMod (∏ i, smallPrime xs outerU i))ˣ, + crtTest (smallPrime xs outerU) h.coprime (smallRetained xs outerU) + (fun i => residueTransform d (smallPrime xs outerU i)) + (smallCoefficients D outerU xs v h.frequency h.denominator) z) / + Fintype.card (ZMod (∏ i, smallPrime xs outerU i) × (ZMod (∏ i, smallPrime xs outerU i))ˣ) ≤ 1 := by + rw [actual_small_average d D P q outerU xs v h] + apply Finset.prod_le_one₀ + · intro i hi + positivity + · intro i hi + exact (localDensity_bounds _ + (Fact.out : (smallPrime xs outerU (.inr i)).Prime).pos false).2 + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8f842363b4bb74904a50558496f93a7361fd25e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActual.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormActualCRT +import OAI.NumberTheory.Ostmann.Construction.DiagonalCounterpartReindexSupport + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open Construction +open scoped BigOperators + +theorem assignedSmallPrimeFacts (sources : SourceFamily) (T U : List SourceSlot) + (x : SourceAssignment sources T) (u : SourceAssignment sources U) : + ∀ i, Fact (smallPrime (assignedSlots sources T x) (assignedSlots sources U u) i).Prime := by + intro i + constructor + cases i with + | inl i => exact assignedSlots_prime sources T x _ (List.getElem_mem i.isLt) + | inr i => exact assignedSlots_prime sources U u _ (List.getElem_mem i.isLt) + +section +variable (d : Decomposition) (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ → ℕ) (giant : PrimeSource) (X G : ℝ) (bins : List ℕ → State → ℝ) + (outside : List ℕ) (l P : ℕ) + (u : SourceAssignment sources (Template.extracted (l+1) (Template.current seed l))) + (z : RemainingTerm sources seed V giant l) + +theorem diagonalSmallTerm_unitData + (hs : ∀ i : Fin (Template.remainder (l+1) (Template.current seed l)).length, + (sources (Template.remainder (l+1) (Template.current seed l))[i].origin).AboveFrequency (V l)) + (hm : remainingTermMass sources seed V giant l z ≠ 0) + (hA : diagonalCoefficientTerm d sources seed V giant X G bins outside l P u z ≠ 0) : + SmallUnitData (outsideProduct outside) P z.1.1.val + (assignedSlots sources (Template.extracted (l+1) (Template.current seed l)) u) + (assignedSlots sources (Template.remainder (l+1) (Template.current seed l)) z.1.2) z.2.val := by + let T := Template.remainder (l+1) (Template.current seed l) + let U := Template.extracted (l+1) (Template.current seed l) + let xs := assignedSlots sources T z.1.2 + let us := assignedSlots sources U u + let := assignedSmallPrimeFacts sources T U z.1.2 u + have hroot := actualCoefficient_root_support sources seed V X G (residueTransform d) bins outside l + (remainingState sources (Template.current seed l) (l+1) giant P u z.1 z.2.val) hA + apply smallUnitData_of_state + (remainingState sources (Template.current seed l) (l+1) giant P u z.1 z.2.val) + us xs outside + (Template.reinsert_perm _ _ _ _ (assignedSlots_length _ _ _) (assignedSlots_length _ _ _)) + hroot.2.2.2.1 hroot.2.2.2.2.1 + intro i + have hx : (assignmentPrior sources T).mass z.1.2 ≠ 0 := + ((remainingPrior_mass_ne_zero_iff sources T giant z.1).mp hm).2 + have hi : xs[i] ∈ assignedSlots sources T z.1.2 := List.getElem_mem i.isLt + obtain ⟨j,hj⟩ := List.mem_ofFn.mp hi + have hlarge : V l < xs[i].value := by + rw [← hj] + exact hs j (z.1.2 j) (assignmentPrior_component_mass_ne_zero sources T z.1.2 hx j) + exact hroot.2.2.2.2.2.trans_lt hlarge + +theorem diagonalSmallTerm_eq_actual_crtTest + (hs : ∀ i : Fin (Template.remainder (l+1) (Template.current seed l)).length, + (sources (Template.remainder (l+1) (Template.current seed l))[i].origin).AboveFrequency (V l)) + (hm : remainingTermMass sources seed V giant l z ≠ 0) + (hA : diagonalCoefficientTerm d sources seed V giant X G bins outside l P u z ≠ 0) : + let T := Template.remainder (l+1) (Template.current seed l) + let U := Template.extracted (l+1) (Template.current seed l) + let xs := assignedSlots sources T z.1.2 + let us := assignedSlots sources U u + letI := assignedSmallPrimeFacts sources T U z.1.2 u + ∃ h : SmallUnitData (outsideProduct outside) P z.1.1.val us xs z.2.val, + diagonalSmallTerm d sources seed V giant outside l P u z = + crtTest (smallPrime xs us) h.coprime (smallRetained xs us) + (fun i => residueTransform d (smallPrime xs us i)) + (smallCoefficients (outsideProduct outside) us xs z.2.val h.frequency h.denominator) + ((P : ZMod (∏ i, smallPrime xs us i)), h.giantUnit) := by + dsimp only + let := assignedSmallPrimeFacts sources + (Template.remainder (l+1) (Template.current seed l)) + (Template.extracted (l+1) (Template.current seed l)) z.1.2 u + refine ⟨diagonalSmallTerm_unitData d sources seed V giant X G bins outside l P u z hs hm hA, ?_⟩ + exact diagonalSmallMultiplier_eq_crtTest d _ _ _ _ _ _ _ + +end +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..53b0d8cc75b42a801ac15cb1f6c7fffcdd591977 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualBasic.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormCRT +import OAI.NumberTheory.Ostmann.Construction.DiagonalTransform + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open Construction + +def smallProduct (xs : List SmallSlot) : ℕ := (xs.map SmallSlot.value).prod + +def coefficientDenominator (D : ℕ) (outerU xs : List SmallSlot) (p : ℕ) : ℕ := + D*smallProduct outerU*(smallProduct xs/p) + +theorem small_dvd_smallProduct {xs : List SmallSlot} {z : SmallSlot} (hz : z∈xs) : + z.value∣smallProduct xs := by + apply List.dvd_prod + exact List.mem_map.mpr ⟨z,hz,rfl⟩ + +theorem diagonal_denominator_split (D P q : ℕ) (outerU xs : List SmallSlot) + (z : SmallSlot) (hz : z∈xs) : + (D*halfProduct P outerU)*(halfProduct q xs/z.value)= + P*q*coefficientDenominator D outerU xs z.value := by + have hd := small_dvd_smallProduct hz + unfold smallProduct at hd + unfold halfProduct coefficientDenominator smallProduct + rw [Nat.mul_div_assoc q hd] + ring + +theorem diagonal_modFraction_split {p : ℕ} [Fact p.Prime] + (D P q : ℕ) (outerU xs : List SmallSlot) (v : ℤ) + (hp : p∣smallProduct xs) : + modFraction p v ((D*halfProduct P outerU)*(halfProduct q xs/p))= + ((v:ZMod p)/(coefficientDenominator D outerU xs p:ZMod p))/ + ((P:ZMod p)*(q:ZMod p)) := by + have he : (D*halfProduct P outerU)*(halfProduct q xs/p)= + P*q*coefficientDenominator D outerU xs p := by + unfold smallProduct at hp + unfold halfProduct coefficientDenominator smallProduct + rw [Nat.mul_div_assoc q hp] + ring + rw [he] + simp only [modFraction,Nat.cast_mul,div_eq_mul_inv,mul_inv_rev] + ring + +def coefficientUnit {p : ℕ} [Fact p.Prime] (v : ℤ) (A : ℕ) + (hv : IsUnit (v:ZMod p)) (hA : IsUnit (A:ZMod p)) : (ZMod p)ˣ := + Units.mk0 ((v:ZMod p)/(A:ZMod p)) (div_ne_zero hv.ne_zero hA.ne_zero) + +@[simp] theorem coefficientUnit_coe {p : ℕ} [Fact p.Prime] (v : ℤ) (A : ℕ) + (hv : IsUnit (v:ZMod p)) (hA : IsUnit (A:ZMod p)) : + (coefficientUnit v A hv hA : ZMod p)=(v:ZMod p)/(A:ZMod p) := rfl + +theorem diagonal_factor_eq_transformFactor {p : ℕ} [Fact p.Prime] + (d : Decomposition) (D P q : ℕ) (outerU xs : List SmallSlot) (v : ℤ) + (hp : p∣smallProduct xs) (hv : IsUnit (v:ZMod p)) + (hA : IsUnit (coefficientDenominator D outerU xs p:ZMod p)) + (hq : IsUnit (q:ZMod p)) : + ‖residueTransform d p + (modFraction p v ((D*halfProduct P outerU)*(halfProduct q xs/p)))‖^2= + transformFactor (residueTransform d p) + (coefficientUnit v (coefficientDenominator D outerU xs p) hv hA) + hq.unit (P:ZMod p) := by + rw [diagonal_modFraction_split D P q outerU xs v hp] + simp only [transformFactor,coefficientUnit_coe,IsUnit.unit_spec] + +theorem coprime_prod_div_of_pairwise {xs : List ℕ} (hxs : xs.Pairwise Nat.Coprime) + {p : ℕ} (hp : p∈xs) (hp0 : 0 simp at hp + | cons a xs ih => + obtain ⟨ha,hxs⟩ := List.pairwise_cons.mp hxs + rcases List.mem_cons.mp hp with hpa | hp + · subst a + rw [List.prod_cons,Nat.mul_div_cancel_left _ hp0] + exact Nat.coprime_list_prod_left_iff.mpr (fun n hn => (ha n hn).symm) + · rw [List.prod_cons,Nat.mul_div_assoc a (List.dvd_prod hp)] + exact (ha p hp).mul_left (ih hxs hp) + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualCRT.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualCRT.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bc5912c3c03b10a25db38cbe8012ede3bfca13a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualCRT.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormActualSupport + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open Construction +open scoped BigOperators + +def SmallUnitData.giantUnit {D P q : ℕ} {outerU xs : List SmallSlot} {v : ℤ} + (h : SmallUnitData D P q outerU xs v) : (ZMod (∏ i, smallPrime xs outerU i))ˣ := + ((ZMod.isUnit_iff_coprime _ _).mpr (Nat.Coprime.prod_right (fun i _ => + (ZMod.isUnit_iff_coprime _ _).mp (h.giant i)))).unit + +@[simp] theorem SmallUnitData.giantUnit_coe {D P q : ℕ} {outerU xs : List SmallSlot} {v : ℤ} + (h : SmallUnitData D P q outerU xs v) : + (h.giantUnit : ZMod (∏ i, smallPrime xs outerU i)) = q := IsUnit.unit_spec _ + +theorem actual_crtPairEquiv {D P q : ℕ} {outerU xs : List SmallSlot} {v : ℤ} + (h : SmallUnitData D P q outerU xs v) : + crtPairEquiv (smallPrime xs outerU) h.coprime ((P : ZMod (∏ i, smallPrime xs outerU i)), h.giantUnit) = + smallResidues P q xs outerU h.giant := by + funext i + apply Prod.ext + · simp only [crtPairEquiv_fst, map_natCast, smallResidues] + · apply Units.ext + simp only [crtPairEquiv_snd_coe, SmallUnitData.giantUnit_coe, + map_natCast, smallResidues, IsUnit.unit_spec] + +theorem diagonalSmallMultiplier_eq_crtTest (d : Decomposition) (D P q : ℕ) + (outerU xs : List SmallSlot) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + (h : SmallUnitData D P q outerU xs v) : + diagonalSmallMultiplier d (D*halfProduct P outerU) v q xs = + crtTest (smallPrime xs outerU) h.coprime (smallRetained xs outerU) + (fun i => residueTransform d (smallPrime xs outerU i)) + (smallCoefficients D outerU xs v h.frequency h.denominator) + ((P : ZMod (∏ i, smallPrime xs outerU i)), h.giantUnit) := by + rw [crtTest, actual_crtPairEquiv] + exact (actual_productTest_eq_of_outer_units d D P q outerU xs v + h.frequency h.denominator h.giant h.outer).symm + +theorem actual_small_modulus (a : State) (outerU xs : List SmallSlot) + (hslots : a.small.Perm (outerU ++ xs)) : + (∏ i, smallPrime xs outerU i) = (a.small.map SmallSlot.value).prod := by + rw [smallPrime_product] + have he := (hslots.map SmallSlot.value).prod_eq + simpa only [List.map_append, List.prod_append, smallProduct, mul_comm] using he.symm + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualProduct.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..7dabc41f7cb2bf71730338c7eb6769d6105a61a8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualProduct.lean @@ -0,0 +1,111 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormActualBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open Construction Classical +open scoped BigOperators + +abbrev SmallIndex (xs outerU : List SmallSlot) := Fin xs.length ⊕ Fin outerU.length + +def smallPrime (xs outerU : List SmallSlot) : SmallIndex xs outerU → ℕ + | .inl i => xs[i].value + | .inr i => outerU[i].value + +def smallRetained (xs outerU : List SmallSlot) : SmallIndex xs outerU → Bool + | .inl _ => true + | .inr _ => false + +def smallCoefficients (D : ℕ) (outerU xs : List SmallSlot) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + (hv : ∀ i : Fin xs.length, IsUnit (v : ZMod xs[i].value)) + (hA : ∀ i : Fin xs.length, + IsUnit (coefficientDenominator D outerU xs xs[i].value : ZMod xs[i].value)) : + ∀ i, (ZMod (smallPrime xs outerU i))ˣ + | .inl i => coefficientUnit v (coefficientDenominator D outerU xs xs[i].value) (hv i) (hA i) + | .inr _ => 1 + +def smallResidues (P q : ℕ) (xs outerU : List SmallSlot) + (hq : ∀ i, IsUnit (q : ZMod (smallPrime xs outerU i))) : LocalPair (smallPrime xs outerU) := + fun i => ((P : ZMod (smallPrime xs outerU i)), (hq i).unit) + +def outerUnitMask (P : ℕ) (outerU : List SmallSlot) : ℝ := + ∏ i : Fin outerU.length, if P.Coprime outerU[i].value then 1 else 0 + +theorem smallPrime_product (xs outerU : List SmallSlot) : + (∏ i, smallPrime xs outerU i) = smallProduct xs * smallProduct outerU := by + rw [Fintype.prod_sum_type] + exact congrArg₂ (· * ·) (Fin.prod_univ_fun_getElem xs SmallSlot.value) + (Fin.prod_univ_fun_getElem outerU SmallSlot.value) + +theorem unitFactor_natCast {p : ℕ} [Fact p.Prime] (P : ℕ) : + unitFactor (P : ZMod p) = if P.Coprime p then 1 else 0 := by + unfold unitFactor + by_cases hc : P.Coprime p + · have hu : IsUnit (P : ZMod p) := (ZMod.isUnit_iff_coprime P p).mpr hc + exact (ite_eq_left hu).trans (ite_eq_left hc).symm + · have hu : ¬IsUnit (P : ZMod p) := fun h => hc ((ZMod.isUnit_iff_coprime P p).mp h) + exact (ite_eq_right hu).trans (ite_eq_right hc).symm + +theorem actual_productTest_eq (d : Decomposition) (D P q : ℕ) + (outerU xs : List SmallSlot) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + (hv : ∀ i : Fin xs.length, IsUnit (v : ZMod xs[i].value)) + (hA : ∀ i : Fin xs.length, + IsUnit (coefficientDenominator D outerU xs xs[i].value : ZMod xs[i].value)) + (hq : ∀ i, IsUnit (q : ZMod (smallPrime xs outerU i))) : + productTest (smallPrime xs outerU) (smallRetained xs outerU) + (fun i => residueTransform d (smallPrime xs outerU i)) + (smallCoefficients D outerU xs v hv hA) (smallResidues P q xs outerU hq) = + diagonalSmallMultiplier d (D*halfProduct P outerU) v q xs * outerUnitMask P outerU := by + let (i : Fin xs.length) : Fact xs[i].value.Prime := + inferInstanceAs (Fact (smallPrime xs outerU (.inl i)).Prime) + unfold productTest + rw [Fintype.prod_sum_type] + apply congrArg₂ (· * ·) + · change (∏ i : Fin xs.length, + transformFactor (residueTransform d xs[i].value) + (coefficientUnit v (coefficientDenominator D outerU xs xs[i].value) (hv i) (hA i)) + (hq (.inl i)).unit (P : ZMod xs[i].value)) = _ + unfold diagonalSmallMultiplier + rw [← Fin.prod_univ_fun_getElem] + apply Finset.prod_congr rfl + intro i hi + exact (diagonal_factor_eq_transformFactor d D P q outerU xs v + (small_dvd_smallProduct (List.getElem_mem i.isLt)) (hv i) (hA i) (hq (.inl i))).symm + · unfold outerUnitMask + apply Finset.prod_congr rfl + intro i hi + exact unitFactor_natCast (p := smallPrime xs outerU (.inr i)) P + +theorem outerUnitMask_eq_one (P : ℕ) (outerU : List SmallSlot) + (hP : ∀ i : Fin outerU.length, IsUnit (P : ZMod outerU[i].value)) : + outerUnitMask P outerU = 1 := by + have hc (i : Fin outerU.length) := (ZMod.isUnit_iff_coprime _ _).mp (hP i) + unfold outerUnitMask + apply Finset.prod_eq_one + intro i hi + exact ite_eq_left (hc i) + +theorem actual_productTest_eq_of_outer_units (d : Decomposition) (D P q : ℕ) + (outerU xs : List SmallSlot) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + (hv : ∀ i : Fin xs.length, IsUnit (v : ZMod xs[i].value)) + (hA : ∀ i : Fin xs.length, + IsUnit (coefficientDenominator D outerU xs xs[i].value : ZMod xs[i].value)) + (hq : ∀ i, IsUnit (q : ZMod (smallPrime xs outerU i))) + (hP : ∀ i : Fin outerU.length, IsUnit (P : ZMod outerU[i].value)) : + productTest (smallPrime xs outerU) (smallRetained xs outerU) + (fun i => residueTransform d (smallPrime xs outerU i)) + (smallCoefficients D outerU xs v hv hA) (smallResidues P q xs outerU hq) = + diagonalSmallMultiplier d (D*halfProduct P outerU) v q xs := by + rw [actual_productTest_eq, outerUnitMask_eq_one P outerU hP, mul_one] + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9580c7716b4c7638e2b69a5c32c5840134f4c2b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormActualSupport.lean @@ -0,0 +1,105 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormActualProduct +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryResidueRegular + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open Construction +open scoped BigOperators + +structure SmallUnitData (D P q : ℕ) (outerU xs : List SmallSlot) (v : ℤ) : Prop where + frequency : ∀ i : Fin xs.length, IsUnit (v : ZMod xs[i].value) + denominator : ∀ i : Fin xs.length, + IsUnit (coefficientDenominator D outerU xs xs[i].value : ZMod xs[i].value) + giant : ∀ i, IsUnit (q : ZMod (smallPrime xs outerU i)) + outer : ∀ i : Fin outerU.length, IsUnit (P : ZMod outerU[i].value) + coprime : Pairwise (fun i j => (smallPrime xs outerU i).Coprime (smallPrime xs outerU j)) + +theorem pairwise_slot_values {xs : List SmallSlot} + (h : (xs.map SmallSlot.value).Pairwise Nat.Coprime) : + Pairwise (fun i j : Fin xs.length => xs[i].value.Coprime xs[j].value) := by + have hf : (List.ofFn (fun i : Fin xs.length => xs[i].value)).Pairwise Nat.Coprime := by + have he : List.ofFn (fun i : Fin xs.length => xs[i].value) = + xs.map SmallSlot.value := List.ofFn_getElem_eq_map xs SmallSlot.value + rw [he] + exact h + have hh := List.pairwise_ofFn.mp hf + intro i j hij + rcases lt_or_gt_of_ne hij with hij | hji + · exact hh hij + · exact (hh hji).symm + +theorem smallUnitData_of_pairwise (P q : ℕ) (outerU xs : List SmallSlot) + (outside : List ℕ) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + (hpair : (P :: q :: (outerU.map SmallSlot.value ++ xs.map SmallSlot.value ++ outside)).Pairwise Nat.Coprime) + (hv : v ≠ 0) (hlarge : ∀ i : Fin xs.length, v.natAbs < xs[i].value) : + SmallUnitData outside.prod P q outerU xs v := by + obtain ⟨hP, hrest⟩ := List.pairwise_cons.mp hpair + obtain ⟨hq, hall⟩ := List.pairwise_cons.mp hrest + obtain ⟨hsmall, houtside, hcross⟩ := List.pairwise_append.mp hall + obtain ⟨hU, hxs, hUx⟩ := List.pairwise_append.mp hsmall + have hmemx (i : Fin xs.length) : xs[i].value ∈ xs.map SmallSlot.value := + List.mem_map.mpr ⟨xs[i], List.getElem_mem i.isLt, rfl⟩ + have hmemU (i : Fin outerU.length) : outerU[i].value ∈ outerU.map SmallSlot.value := + List.mem_map.mpr ⟨outerU[i], List.getElem_mem i.isLt, rfl⟩ + constructor + · intro i + let : Fact xs[i].value.Prime := inferInstanceAs (Fact (smallPrime xs outerU (.inl i)).Prime) + exact isUnit_iff_ne_zero.mpr (HistoryResidueRegular.intCast_ne_zero_of_natAbs_lt hv (hlarge i)) + · intro i + have hD : outside.prod.Coprime xs[i].value := by + apply Nat.coprime_list_prod_left_iff.mpr + intro n hn + exact (hcross _ (List.mem_append_right _ (hmemx i)) n hn).symm + have hU' : (smallProduct outerU).Coprime xs[i].value := by + apply Nat.coprime_list_prod_left_iff.mpr + intro n hn + exact hUx n hn _ (hmemx i) + have hR : (smallProduct xs / xs[i].value).Coprime xs[i].value := + coprime_prod_div_of_pairwise hxs (hmemx i) + (show (smallPrime xs outerU (.inl i)).Prime from Fact.out).pos + exact (ZMod.isUnit_iff_coprime _ _).mpr ((hD.mul_left hU').mul_left hR) + · intro i + apply (ZMod.isUnit_iff_coprime _ _).mpr + cases i with + | inl i => exact hq _ (List.mem_append_left _ (List.mem_append_right _ (hmemx i))) + | inr i => exact hq _ (List.mem_append_left _ (List.mem_append_left _ (hmemU i))) + · intro i + apply (ZMod.isUnit_iff_coprime _ _).mpr + exact hP _ (List.mem_cons_of_mem _ + (List.mem_append_left _ (List.mem_append_left _ (hmemU i)))) + · intro i j hij + cases i with + | inl i => + cases j with + | inl j => exact pairwise_slot_values hxs (fun he => hij (congrArg Sum.inl he)) + | inr j => exact (hUx _ (hmemU j) _ (hmemx i)).symm + | inr i => + cases j with + | inl j => exact hUx _ (hmemU i) _ (hmemx j) + | inr j => exact pairwise_slot_values hU (fun he => hij (congrArg Sum.inr he)) + +theorem smallUnitData_of_state (a : State) (outerU xs : List SmallSlot) + (outside : List ℕ) [∀ i, Fact (smallPrime xs outerU i).Prime] + (hslots : a.small.Perm (outerU ++ xs)) (hcop : a.Coprime outside) + (hv : a.frequency ≠ 0) + (hlarge : ∀ i : Fin xs.length, a.frequency.natAbs < xs[i].value) : + SmallUnitData outside.prod a.giantPlus a.giantMinus outerU xs a.frequency := by + have he : a.values.Perm (a.giantPlus :: a.giantMinus :: + (outerU.map SmallSlot.value ++ xs.map SmallSlot.value)) := by + simpa only [State.values, List.map_append] using + List.Perm.cons a.giantPlus (List.Perm.cons a.giantMinus (hslots.map SmallSlot.value)) + apply smallUnitData_of_pairwise a.giantPlus a.giantMinus outerU xs outside a.frequency + _ hv hlarge + simpa only [List.cons_append] using + ((he.append_right outside).pairwise_iff Nat.Coprime.symm).mp hcop + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..72e94c32683c62fbb87ce42cb2e024402bed5a39 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormBasic.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Conclusion.RegularNorm +import OAI.NumberTheory.Ostmann.Construction.ActualRows + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open scoped BigOperators +open Conclusion Construction +variable {p : ℕ} [Fact p.Prime] + +def transformFactor (g : ZMod p→ℂ) (a y : (ZMod p)ˣ) (x : ZMod p) : ℝ := + ‖g ((a:ZMod p)/(x*(y:ZMod p)))‖^2 + +theorem transformFactor_sum (g : ZMod p→ℂ) (hg0 : g 0=0) + (hgnorm : ∑x:ZMod p,‖g x‖^2=(p:ℝ)) (a y : (ZMod p)ˣ) : + ∑x:ZMod p,transformFactor g a y x=(p:ℝ) := by + rw [←sum_units_eq_sum (transformFactor g a y) (by simp [transformFactor,hg0])] + have he (x : (ZMod p)ˣ) : transformFactor g a y x = + ‖g (((a*y⁻¹)*x⁻¹:(ZMod p)ˣ):ZMod p)‖^2 := by + simp only [transformFactor,div_eq_mul_inv,mul_inv_rev,Units.val_mul,Units.val_inv_eq_inv_val,mul_assoc] + simp_rw [he] + exact prime_unit_norm_sum g hg0 hgnorm (a*y⁻¹) + +def unitFactor (x : ZMod p) : ℝ := if IsUnit x then 1 else 0 + +theorem unitFactor_sum : ∑x:ZMod p,unitFactor x=(p-1:ℕ) := by + classical + rw [←sum_units_eq_sum unitFactor (by simp [unitFactor])] + simp only [unitFactor,Units.isUnit,ite_true,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] + rw [ZMod.card_units_eq_totient,Nat.totient_prime (Fact.out : p.Prime)] + +theorem transformFactor_average (g : ZMod p→ℂ) (hg0 : g 0=0) + (hgnorm : ∑x:ZMod p,‖g x‖^2=(p:ℝ)) (a : (ZMod p)ˣ) : + (∑z:ZMod p×(ZMod p)ˣ,transformFactor g a z.2 z.1)/ + Fintype.card (ZMod p×(ZMod p)ˣ)=1 := by + rw [Fintype.sum_prod_type,Finset.sum_comm] + simp_rw [transformFactor_sum g hg0 hgnorm] + rw [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Fintype.card_prod,ZMod.card,Nat.cast_mul] + have hp : (p:ℝ)≠0 := by exact_mod_cast (Fact.out : p.Prime).ne_zero + have hu : (Fintype.card (ZMod p)ˣ:ℝ)≠0 := by positivity + field_simp + +theorem unitFactor_average : + (∑z:ZMod p×(ZMod p)ˣ,unitFactor z.1)/Fintype.card (ZMod p×(ZMod p)ˣ)= + ((p-1:ℕ):ℝ)/p := by + rw [Fintype.sum_prod_type,Finset.sum_comm] + simp_rw [unitFactor_sum] + rw [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Fintype.card_prod,ZMod.card,Nat.cast_mul] + have hp : (p:ℝ)≠0 := by exact_mod_cast (Fact.out : p.Prime).ne_zero + have hu : (Fintype.card (ZMod p)ˣ:ℝ)≠0 := by positivity + field_simp + +theorem actual_transformFactor_average (d : Decomposition) (a : (ZMod p)ˣ) : + (∑z:ZMod p×(ZMod p)ˣ,transformFactor (residueTransform d p) a z.2 z.1)/ + Fintype.card (ZMod p×(ZMod p)ˣ)=1 := + transformFactor_average _ (by simp [residueTransform_eq,Supply.additiveTransform_zero]) + (residueTransform_sq_sum d p (Fact.out : p.Prime)) a + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0df10f090cd6a40ce16cdab5de28d65e2ee942e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormBound.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNorm + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open Construction +open scoped BigOperators +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem transformFactor_le {p : ℕ} [Fact p.Prime] (g : ZMod p → ℂ) + (hgnorm : ∑ x : ZMod p, ‖g x‖^2 = (p : ℝ)) + (a y : (ZMod p)ˣ) (x : ZMod p) : transformFactor g a y x ≤ p := by + rw [←hgnorm] + exact Finset.single_le_sum (f := fun x : ZMod p => ‖g x‖^2) + (fun _ _ => sq_nonneg _) (Finset.mem_univ _) + +theorem localFactor_le {p : ℕ} [Fact p.Prime] (retained : Bool) + (g : ZMod p → ℂ) (hgnorm : ∑ x : ZMod p, ‖g x‖^2 = (p : ℝ)) + (a : (ZMod p)ˣ) (z : ZMod p × (ZMod p)ˣ) : localFactor retained g a z ≤ p := by + cases retained + · have hp : (1 : ℝ) ≤ p := by exact_mod_cast (Fact.out : p.Prime).one_lt.le + change (if IsUnit z.1 then (1:ℝ) else 0) ≤ p + split_ifs + · exact hp + · positivity + · exact transformFactor_le g hgnorm a z.2 z.1 + +omit [DecidableEq ι] in +theorem productTest_le_modulus (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (retained : ι → Bool) (g : ∀ i, ZMod (p i) → ℂ) + (hgnorm : ∀ i, ∑ x : ZMod (p i), ‖g i x‖^2 = (p i : ℝ)) + (a : ∀ i, (ZMod (p i))ˣ) (z : LocalPair p) : + productTest p retained g a z ≤ (∏ i, p i : ℕ) := by + rw [Nat.cast_prod] + apply Finset.prod_le_prod₀ + · intro i _ + simp only [localFactor,transformFactor,unitFactor] + split_ifs <;> positivity + · intro i _ + exact localFactor_le (retained i) (g i) (hgnorm i) (a i) (z i) + +omit [DecidableEq ι] in +theorem actual_crtTest_bounds (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (d : Decomposition) (retained : ι → Bool) (a : ∀ i, (ZMod (p i))ˣ) + (z : ZMod (∏ i,p i) × (ZMod (∏ i,p i))ˣ) : + 0 ≤ crtTest p hc retained (fun i => residueTransform d (p i)) a z ∧ + crtTest p hc retained (fun i => residueTransform d (p i)) a z ≤ (∏ i,p i : ℕ) := + ⟨productTest_nonneg p retained _ a _, + productTest_le_modulus p retained _ + (fun i => residueTransform_sq_sum d (p i) (Fact.out : (p i).Prime)) a _⟩ + +theorem actual_small_pointwise_bounds (d : Decomposition) (D P q : ℕ) + (outerU xs : List SmallSlot) (v : ℤ) + [∀ i, Fact (smallPrime xs outerU i).Prime] + (h : SmallUnitData D P q outerU xs v) + (z : ZMod (∏ i,smallPrime xs outerU i) × (ZMod (∏ i,smallPrime xs outerU i))ˣ) : + 0 ≤ crtTest (smallPrime xs outerU) h.coprime (smallRetained xs outerU) + (fun i => residueTransform d (smallPrime xs outerU i)) + (smallCoefficients D outerU xs v h.frequency h.denominator) z ∧ + crtTest (smallPrime xs outerU) h.coprime (smallRetained xs outerU) + (fun i => residueTransform d (smallPrime xs outerU i)) + (smallCoefficients D outerU xs v h.frequency h.denominator) z ≤ + (smallProduct xs * smallProduct outerU : ℕ) := by + simpa only [smallPrime_product] using actual_crtTest_bounds (smallPrime xs outerU) + h.coprime d (smallRetained xs outerU) + (smallCoefficients D outerU xs v h.frequency h.denominator) z + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormCRT.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormCRT.lean new file mode 100644 index 0000000000000000000000000000000000000000..c51bffb8ceae72d3e5cc3ce5a74e75d822571f38 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormCRT.lean @@ -0,0 +1,93 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormProduct + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open scoped BigOperators +open Construction +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def pairPiEquiv (A B : ι → Type*) : + ((∀ i, A i) × (∀ i, B i)) ≃ (∀ i, A i × B i) where + toFun z i := (z.1 i, z.2 i) + invFun z := (fun i => (z i).1, fun i => (z i).2) + left_inv _ := rfl + right_inv _ := rfl + +def crtPairEquiv (p : ι → ℕ) + (hcop : Pairwise (fun i j => (p i).Coprime (p j))) : + (ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) ≃ LocalPair p := + ((ZMod.prodEquivPi p hcop).toEquiv.prodCongr + (Supply.crtUnitsEquiv p hcop).toEquiv).trans (pairPiEquiv _ _) + +omit [DecidableEq ι] in +@[simp] theorem crtPairEquiv_fst (p : ι → ℕ) + (hcop : Pairwise (fun i j => (p i).Coprime (p j))) + (z : ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) (i : ι) : + (crtPairEquiv p hcop z i).1 = + ZMod.castHom (Finset.dvd_prod_of_mem p (Finset.mem_univ i)) (ZMod (p i)) z.1 := + ZMod.prodEquivPi_apply p hcop z.1 i + +omit [DecidableEq ι] in +@[simp] theorem crtPairEquiv_snd_coe (p : ι → ℕ) + (hcop : Pairwise (fun i j => (p i).Coprime (p j))) + (z : ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) (i : ι) : + ((crtPairEquiv p hcop z i).2 : ZMod (p i)) = + ZMod.castHom (Finset.dvd_prod_of_mem p (Finset.mem_univ i)) (ZMod (p i)) + (z.2 : ZMod (∏ i, p i)) := + Supply.crtUnitsEquiv_apply p hcop z.2 i + +def crtTest (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (hcop : Pairwise (fun i j => (p i).Coprime (p j))) + (retained : ι → Bool) (g : ∀ i, ZMod (p i) → ℂ) + (a : ∀ i, (ZMod (p i))ˣ) + (z : ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) : ℝ := + productTest p retained g a (crtPairEquiv p hcop z) + +omit [DecidableEq ι] in +theorem crtTest_eq_casts (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (hcop : Pairwise (fun i j => (p i).Coprime (p j))) + (retained : ι → Bool) (g : ∀ i, ZMod (p i) → ℂ) + (a : ∀ i, (ZMod (p i))ˣ) + (z : ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) : + crtTest p hcop retained g a z = ∏ i, + let reduce := ZMod.castHom (Finset.dvd_prod_of_mem p (Finset.mem_univ i)) (ZMod (p i)) + if retained i then ‖g i ((a i : ZMod (p i)) / + (reduce z.1 * reduce (z.2 : ZMod (∏ i, p i))))‖^2 + else if IsUnit (reduce z.1) then 1 else 0 := by + simp only [crtTest, productTest, localFactor, transformFactor, unitFactor, + crtPairEquiv_fst, crtPairEquiv_snd_coe] + +theorem crtTest_average (p : ι → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, p i)] + (hcop : Pairwise (fun i j => (p i).Coprime (p j))) + (retained : ι → Bool) (g : ∀ i, ZMod (p i) → ℂ) + (hg0 : ∀ i, g i 0 = 0) + (hgnorm : ∀ i, ∑ x : ZMod (p i), ‖g i x‖^2 = (p i : ℝ)) + (a : ∀ i, (ZMod (p i))ˣ) : + (∑ z : ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ, crtTest p hcop retained g a z) / + Fintype.card (ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) = + ∏ i, localDensity (p i) (retained i) := by + change (∑ z, productTest p retained g a (crtPairEquiv p hcop z)) / _ = _ + rw [(crtPairEquiv p hcop).sum_comp (productTest p retained g a), + Fintype.card_congr (crtPairEquiv p hcop)] + exact productTest_average p retained g hg0 hgnorm a + +theorem actual_crtTest_average (p : ι → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, p i)] + (hcop : Pairwise (fun i j => (p i).Coprime (p j))) + (d : Decomposition) (retained : ι → Bool) (a : ∀ i, (ZMod (p i))ˣ) : + (∑ z : ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ, + crtTest p hcop retained (fun i => residueTransform d (p i)) a z) / + Fintype.card (ZMod (∏ i, p i) × (ZMod (∏ i, p i))ˣ) = + ∏ i, localDensity (p i) (retained i) := + crtTest_average p hcop retained _ + (fun _ => by simp [residueTransform_eq, Supply.additiveTransform_zero]) + (fun i => residueTransform_sq_sum d (p i) (Fact.out : (p i).Prime)) a + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormProduct.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ea7f163161d95b03a38a9f2f78e92306dc683f1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DiagonalSmallResidueNormProduct.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DiagonalSmallResidueNormBasic + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.DiagonalSmallResidueNorm +open scoped BigOperators +open Construction +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +abbrev LocalPair (p : ι → ℕ) := ∀ i, ZMod (p i) × (ZMod (p i))ˣ + +def localFactor {p : ℕ} [Fact p.Prime] (retained : Bool) + (g : ZMod p → ℂ) (a : (ZMod p)ˣ) (z : ZMod p × (ZMod p)ˣ) : ℝ := + if retained then transformFactor g a z.2 z.1 else unitFactor z.1 + +def localDensity (p : ℕ) (retained : Bool) : ℝ := + if retained then 1 else ((p-1 : ℕ) : ℝ)/p + +theorem localFactor_average {p : ℕ} [Fact p.Prime] (retained : Bool) + (g : ZMod p → ℂ) (hg0 : g 0 = 0) + (hgnorm : ∑ x : ZMod p, ‖g x‖^2 = (p : ℝ)) (a : (ZMod p)ˣ) : + (∑ z : ZMod p × (ZMod p)ˣ, localFactor retained g a z) / + Fintype.card (ZMod p × (ZMod p)ˣ) = localDensity p retained := by + cases retained + · exact unitFactor_average + · exact transformFactor_average g hg0 hgnorm a + +def productTest (p : ι → ℕ) [∀ i, Fact (p i).Prime] (retained : ι → Bool) + (g : ∀ i, ZMod (p i) → ℂ) (a : ∀ i, (ZMod (p i))ˣ) (z : LocalPair p) : ℝ := + ∏ i, localFactor (retained i) (g i) (a i) (z i) + +omit [DecidableEq ι] in +theorem productTest_nonneg (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (retained : ι → Bool) (g : ∀ i, ZMod (p i) → ℂ) + (a : ∀ i, (ZMod (p i))ˣ) (z : LocalPair p) : + 0 ≤ productTest p retained g a z := by + apply Finset.prod_nonneg + intro i hi + simp only [localFactor, transformFactor, unitFactor] + split_ifs <;> positivity + +theorem productTest_average (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (retained : ι → Bool) (g : ∀ i, ZMod (p i) → ℂ) + (hg0 : ∀ i, g i 0 = 0) + (hgnorm : ∀ i, ∑ x : ZMod (p i), ‖g i x‖^2 = (p i : ℝ)) + (a : ∀ i, (ZMod (p i))ˣ) : + (∑ z : LocalPair p, productTest p retained g a z) / Fintype.card (LocalPair p) = + ∏ i, localDensity (p i) (retained i) := by + unfold productTest + rw [← Fintype.prod_sum, Fintype.card_pi, Nat.cast_prod, ← Finset.prod_div_distrib] + exact Finset.prod_congr rfl (fun i _ => localFactor_average (retained i) (g i) + (hg0 i) (hgnorm i) (a i)) + +theorem localDensity_bounds (p : ℕ) (hp : 0 < p) (retained : Bool) : + 0 ≤ localDensity p retained ∧ localDensity p retained ≤ 1 := by + cases retained + · have hp' : (0 : ℝ) < p := by exact_mod_cast hp + refine ⟨by exact div_nonneg (Nat.cast_nonneg _) hp'.le, ?_⟩ + change ((p-1 : ℕ) : ℝ)/p ≤ 1 + apply (div_le_one hp').2 + exact_mod_cast Nat.sub_le p 1 + · simp [localDensity] + +theorem productTest_average_le_one (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (retained : ι → Bool) (g : ∀ i, ZMod (p i) → ℂ) + (hg0 : ∀ i, g i 0 = 0) + (hgnorm : ∀ i, ∑ x : ZMod (p i), ‖g i x‖^2 = (p i : ℝ)) + (a : ∀ i, (ZMod (p i))ˣ) : + (∑ z : LocalPair p, productTest p retained g a z) / Fintype.card (LocalPair p) ≤ 1 := by + rw [productTest_average p retained g hg0 hgnorm a] + apply Finset.prod_le_one₀ + · intro i hi + exact (localDensity_bounds (p i) (Fact.out : (p i).Prime).pos (retained i)).1 + · intro i hi + exact (localDensity_bounds (p i) (Fact.out : (p i).Prime).pos (retained i)).2 + +theorem actual_productTest_average (p : ι → ℕ) [∀ i, Fact (p i).Prime] + (d : Decomposition) (retained : ι → Bool) (a : ∀ i, (ZMod (p i))ˣ) : + (∑ z : LocalPair p, productTest p retained (fun i => residueTransform d (p i)) a z) / + Fintype.card (LocalPair p) = ∏ i, localDensity (p i) (retained i) := + productTest_average p retained _ + (fun _ => by simp [residueTransform_eq, Supply.additiveTransform_zero]) + (fun i => residueTransform_sq_sum d (p i) (Fact.out : (p i).Prime)) a + +end Ostmann.Arithmetic.DiagonalSmallResidueNorm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowth.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowth.lean new file mode 100644 index 0000000000000000000000000000000000000000..c52f1b62c1e91ff7ed6518435f9c63f2c31487fe --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowth.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DivisorGrowthLocal + +namespace OAI + +namespace Ostmann.Arithmetic +open scoped BigOperators + +theorem small_prime_cost_le (s : Finset ℕ) (P : ℕ) {C : ℝ} (hC : 1 ≤ C) : + (∏ p ∈ s, if p < P then C else 1) ≤ C ^ P := by + rw [← Finset.prod_filter] + simp only [Finset.prod_const] + apply pow_le_pow_right₀ hC + calc + (s.filter (fun p => p < P)).card ≤ (Finset.range P).card := + Finset.card_le_card (fun p hp => Finset.mem_range.mpr (Finset.mem_filter.mp hp).2) + _ = P := Finset.card_range P + +theorem prod_prime_factor_rpow (n : ℕ) (hn : n ≠ 0) (ε : ℝ) : + (∏ p ∈ n.primeFactors, ((p : ℝ) ^ ε) ^ n.factorization p) = (n : ℝ) ^ ε := by + calc + (∏ p ∈ n.primeFactors, ((p : ℝ) ^ ε) ^ n.factorization p) = + ∏ p ∈ n.primeFactors, ((p : ℝ) ^ n.factorization p) ^ ε := + Finset.prod_congr rfl (fun p _ => Real.rpow_pow_comm (Nat.cast_nonneg p) ε _) + _ = (∏ p ∈ n.primeFactors, (p : ℝ) ^ n.factorization p) ^ ε := + Real.finsetProd_rpow _ _ (fun _ _ => by positivity) ε + _ = (n : ℝ) ^ ε := by + congr 1 + exact_mod_cast (Nat.prod_primeFactors_pow_factorization hn).symm + +theorem divisors_card_le_rpow (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, 0 < n → + (n.divisors.card : ℝ) ≤ C * (n : ℝ) ^ ε := by + obtain ⟨P, C, hC, hlocal⟩ := prime_local_divisor_bounds ε hε + refine ⟨C ^ P, pow_pos (by linarith) P, fun n hn => ?_⟩ + have hn0 := Nat.ne_of_gt hn + have hprod : (∏ p ∈ n.primeFactors, ((n.factorization p : ℝ) + 1)) ≤ + ∏ p ∈ n.primeFactors, + (if p < P then C else 1) * ((p : ℝ) ^ ε) ^ n.factorization p := by + apply Finset.prod_le_prod₀ + · intro p hp + positivity + · intro p hp + exact hlocal p (Nat.prime_of_mem_primeFactors hp) _ + rw [Finset.prod_mul_distrib, prod_prime_factor_rpow n hn0 ε] at hprod + calc + (n.divisors.card : ℝ) = ∏ p ∈ n.primeFactors, ((n.factorization p : ℝ) + 1) := by + rw [Nat.card_divisors hn0] + push_cast + rfl + _ ≤ (∏ p ∈ n.primeFactors, if p < P then C else 1) * (n : ℝ) ^ ε := hprod + _ ≤ C ^ P * (n : ℝ) ^ ε := + mul_le_mul_of_nonneg_right (small_prime_cost_le _ P hC) (Real.rpow_nonneg (Nat.cast_nonneg n) _) + +theorem divisors_card_pow_le_rpow (k : ℕ) (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, 0 < n → + (n.divisors.card : ℝ) ^ k ≤ C * (n : ℝ) ^ ε := by + by_cases hk : k = 0 + · subst k + refine ⟨1, by norm_num, fun n hn => ?_⟩ + simp only [pow_zero, one_mul] + exact Real.one_le_rpow (by exact_mod_cast hn) hε.le + have hkpos : (0 : ℝ) < k := by exact_mod_cast Nat.pos_of_ne_zero hk + obtain ⟨C, hC, hbound⟩ := divisors_card_le_rpow (ε / k) (div_pos hε hkpos) + refine ⟨C ^ k, pow_pos hC k, fun n hn => ?_⟩ + have h := pow_le_pow_left₀ (Nat.cast_nonneg n.divisors.card) (hbound n hn) k + have hr : ((n : ℝ) ^ (ε / k)) ^ k = (n : ℝ) ^ ε := by + rw [← Real.rpow_natCast ((n : ℝ) ^ (ε / k)) k, + ← Real.rpow_mul (Nat.cast_nonneg n), div_mul_cancel₀ ε hkpos.ne'] + simpa only [mul_pow, hr] using h + +theorem two_pow_primeFactors_card_le_divisors_card (n : ℕ) (hn : 0 < n) : + 2 ^ n.primeFactors.card ≤ n.divisors.card := by + rw [Nat.card_divisors (Nat.ne_of_gt hn), ← Finset.prod_const] + apply Finset.prod_le_prod + intro p hp + have hmem := Nat.mem_primeFactors.mp hp + have h := hmem.1.factorization_pos_of_dvd hmem.2.2 hmem.2.1 + omega + +end Ostmann.Arithmetic + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowthLocal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowthLocal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f429da1662140d8511670b54e5b9821819279e26 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowthLocal.lean @@ -0,0 +1,54 @@ +import Mathlib + +namespace OAI + +namespace Ostmann.Arithmetic +open scoped BigOperators + +theorem exists_linear_le_geometric {b : ℝ} (hb : 1 < b) : + ∃ C : ℝ, 1 ≤ C ∧ ∀ e : ℕ, (e : ℝ) + 1 ≤ C * b ^ e := by + let C : ℝ := 1 + (b - 1)⁻¹ + have hb1 : 0 < b - 1 := by linarith + have hC : 1 ≤ C := by + dsimp [C] + have h := inv_nonneg.mpr hb1.le + linarith + have hCb : C * (b - 1) = b := by dsimp [C]; field_simp; ring + refine ⟨C, hC, fun e => ?_⟩ + have hbern := one_add_mul_sub_le_pow (show (-1 : ℝ) ≤ b by linarith) e + have hscale := mul_le_mul_of_nonneg_left hbern (by linarith : 0 ≤ C) + have he : (0 : ℝ) ≤ e := by positivity + have he' : (e : ℝ) ≤ e * b := by nlinarith + nlinarith [mul_assoc C (e : ℝ) (b - 1)] + +theorem exponent_succ_le_two_pow (e : ℕ) : (e : ℝ) + 1 ≤ (2 : ℝ) ^ e := by + induction e with + | zero => norm_num + | succ e ih => + rw [pow_succ] + push_cast + have : (0 : ℝ) ≤ e := by positivity + nlinarith + +theorem prime_local_divisor_bounds (ε : ℝ) (hε : 0 < ε) : + ∃ P : ℕ, ∃ C : ℝ, 1 ≤ C ∧ ∀ p : ℕ, Nat.Prime p → ∀ e : ℕ, + (e : ℝ) + 1 ≤ (if p < P then C else 1) * ((p : ℝ) ^ ε) ^ e := by + obtain ⟨C, hC, hCb⟩ := exists_linear_le_geometric + (Real.one_lt_rpow (by norm_num : (1 : ℝ) < 2) hε) + have ht : Filter.Tendsto (fun p : ℕ => (p : ℝ) ^ ε) Filter.atTop Filter.atTop := + (tendsto_rpow_atTop hε).comp tendsto_natCast_atTop_atTop + obtain ⟨P, hP⟩ := Filter.eventually_atTop.mp (ht.eventually_ge_atTop 2) + refine ⟨P, C, hC, fun p hp e => ?_⟩ + have hp2 : (2 : ℝ) ≤ p := by exact_mod_cast hp.two_le + by_cases hsmall : p < P + · simp only [hsmall, ite_true] + exact (hCb e).trans (mul_le_mul_of_nonneg_left + (pow_le_pow_left₀ (Real.rpow_nonneg (by norm_num) _) + (Real.rpow_le_rpow (by norm_num) hp2 hε.le) e) (by linarith)) + · simp only [hsmall, ite_false, one_mul] + exact (exponent_succ_le_two_pow e).trans + (pow_le_pow_left₀ (by norm_num) (hP p (by omega)) e) + +end Ostmann.Arithmetic + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowthTotient.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowthTotient.lean new file mode 100644 index 0000000000000000000000000000000000000000..d872a945cd68bbbaf67e95460c0bc08c591d2b4a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorGrowthTotient.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.DivisorGrowth + +namespace OAI + +namespace Ostmann.Arithmetic +open scoped BigOperators + +theorem self_le_totient_mul_two_pow (n : ℕ) : + n ≤ n.totient * 2 ^ n.primeFactors.card := by + have hpos : 0 < ∏ p ∈ n.primeFactors, (p - 1) := by + apply Finset.prod_pos + intro p hp + have h := (Nat.prime_of_mem_primeFactors hp).two_le + omega + have hprod : (∏ p ∈ n.primeFactors, p) ≤ + ∏ p ∈ n.primeFactors, 2 * (p - 1) := by + apply Finset.prod_le_prod + intro p hp + have h := (Nat.prime_of_mem_primeFactors hp).two_le + omega + rw [Finset.prod_mul_distrib, Finset.prod_const] at hprod + have h := Nat.mul_le_mul_left n.totient hprod + rw [Nat.totient_mul_prod_primeFactors, ← Nat.mul_assoc] at h + exact Nat.le_of_mul_le_mul_right h hpos + +theorem self_le_totient_mul_divisors (n : ℕ) (hn : 0 < n) : + n ≤ n.totient * n.divisors.card := + (self_le_totient_mul_two_pow n).trans + (Nat.mul_le_mul_left _ (two_pow_primeFactors_card_le_divisors_card n hn)) + +theorem div_totient_le_rpow (ε : ℝ) (hε : 0 < ε) : + ∃ C : ℝ, 0 < C ∧ ∀ n : ℕ, 0 < n → + (n : ℝ) / n.totient ≤ C * (n : ℝ) ^ ε := by + obtain ⟨C, hC, hbound⟩ := divisors_card_le_rpow ε hε + refine ⟨C, hC, fun n hn => ?_⟩ + have ht : (0 : ℝ) < n.totient := by exact_mod_cast Nat.totient_pos.mpr hn + calc + (n : ℝ) / n.totient ≤ n.divisors.card := by + apply (div_le_iff₀ ht).mpr + have h := self_le_totient_mul_divisors n hn + exact_mod_cast (by simpa [Nat.mul_comm] using h) + _ ≤ _ := hbound n hn + +theorem totient_ge_rpow (ε : ℝ) (hε : 0 < ε) : + ∃ c : ℝ, 0 < c ∧ ∀ n : ℕ, 0 < n → + c * (n : ℝ) ^ (1 - ε) ≤ n.totient := by + obtain ⟨C, hC, hbound⟩ := div_totient_le_rpow ε hε + refine ⟨C⁻¹, inv_pos.mpr hC, fun n hn => ?_⟩ + have hnR : (0 : ℝ) < n := by exact_mod_cast hn + have ht : (0 : ℝ) < n.totient := by exact_mod_cast Nat.totient_pos.mpr hn + have hr : 0 < (n : ℝ) ^ ε := Real.rpow_pos_of_pos hnR ε + have h := (div_le_iff₀ ht).mp (hbound n hn) + rw [Real.rpow_sub hnR, Real.rpow_one] + have heq : C⁻¹ * ((n : ℝ) / (n : ℝ) ^ ε) = (n : ℝ) / (C * (n : ℝ) ^ ε) := by + field_simp + rw [heq] + exact (div_le_iff₀ (mul_pos hC hr)).mpr (by simpa [mul_comm] using h) + +end Ostmann.Arithmetic + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorSquareMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorSquareMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..c31356d0133e1a306bf700227709b8f88022f432 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/DivisorSquareMean.lean @@ -0,0 +1,86 @@ +import Mathlib.Data.Nat.Factorization.Basic +import Mathlib.NumberTheory.Divisors +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyLCM + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.DivisorSquareMean +open scoped BigOperators + +lemma divisors_eq_bounded_filter {N n : ℕ} (hn : 0 < n) (hnN : n ≤ N) : + n.divisors = (Finset.Icc 1 N).filter (fun d => d ∣ n) := by + ext d + simp only [Nat.mem_divisors,Finset.mem_filter,Finset.mem_Icc] + constructor + · intro h + exact ⟨⟨Nat.pos_of_dvd_of_pos h.1 hn, (Nat.le_of_dvd hn h.1).trans hnN⟩,h.1⟩ + · intro h + exact ⟨h.2,hn.ne'⟩ + +lemma divisor_square_eq_double_sum {N n : ℕ} (hn : 0 < n) (hnN : n ≤ N) : + n.divisors.card^2 = ∑ d ∈ Finset.Icc 1 N, ∑ e ∈ Finset.Icc 1 N, + if d ∣ n ∧ e ∣ n then (1:ℕ) else 0 := by + have heq : n.divisors.card^2 = ∑ d ∈ n.divisors, ∑ e ∈ n.divisors, (1:ℕ) := by + simp [pow_two] + rw [heq,divisors_eq_bounded_filter hn hnN] + simp only [Finset.sum_filter] + apply Finset.sum_congr rfl + intro d hd + by_cases hd' : d ∣ n + · simp [hd'] + · simp [hd'] + +lemma sum_dvd_indicator (N k : ℕ) : + (∑ n ∈ Finset.Icc 1 N, if k ∣ n then (1:ℕ) else 0) = N/k := by + have hsets : (Finset.Icc 1 N).filter (fun n => k ∣ n) = + (Finset.range (N+1)).filter (fun n => n ≠ 0 ∧ k ∣ n) := by + ext n + simp only [Finset.mem_filter,Finset.mem_Icc,Finset.mem_range,Nat.lt_succ_iff] + omega + rw [← Finset.sum_filter] + simp only [Finset.sum_const, smul_eq_mul, mul_one] + rw [hsets] + exact Nat.card_multiples' N k + +theorem divisor_square_sum_eq (N : ℕ) : + (∑ n ∈ Finset.Icc 1 N, n.divisors.card^2) = + ∑ d ∈ Finset.Icc 1 N, ∑ e ∈ Finset.Icc 1 N, N/(d.lcm e) := by + calc + _ = ∑ n ∈ Finset.Icc 1 N, ∑ d ∈ Finset.Icc 1 N, ∑ e ∈ Finset.Icc 1 N, + if d ∣ n ∧ e ∣ n then (1:ℕ) else 0 := Finset.sum_congr rfl fun n hn => + divisor_square_eq_double_sum (Finset.mem_Icc.mp hn).1 (Finset.mem_Icc.mp hn).2 + _ = _ := by + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro d hd + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro e he + simp_rw [← Nat.lcm_dvd_iff] + exact sum_dvd_indicator N (d.lcm e) + +theorem divisor_square_mean (N : ℕ) : + (∑ n ∈ Finset.Icc 1 N, (n.divisors.card:ℝ)^2) ≤ + (N:ℝ)*(1+Real.log N)^3 := by + have heq : (∑ n ∈ Finset.Icc 1 N, (n.divisors.card:ℝ)^2) = + ∑ d ∈ Finset.Icc 1 N, ∑ e ∈ Finset.Icc 1 N, ((N/(d.lcm e):ℕ):ℝ) := by + exact_mod_cast divisor_square_sum_eq N + rw [heq] + calc + _ ≤ ∑ d ∈ Finset.Icc 1 N, ∑ e ∈ Finset.Icc 1 N, (N:ℝ)/(d.lcm e) := by + apply Finset.sum_le_sum + intro d hd + apply Finset.sum_le_sum + intro e he + exact Nat.cast_div_le + _ = (N:ℝ)*(∑ d ∈ Finset.Icc 1 N, ∑ e ∈ Finset.Icc 1 N, ((d.lcm e:ℕ):ℝ)⁻¹) := by + simp only [div_eq_mul_inv,Finset.mul_sum] + _ ≤ _ := mul_le_mul_of_nonneg_left (FrequencyLCM.reciprocal_lcm_sum_le_log N) + (Nat.cast_nonneg N) + +end Ostmann.Arithmetic.DivisorSquareMean + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteArithmeticIteration.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteArithmeticIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..886eb1e947026d3f8788a7ef1c348e0a7fa61af4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteArithmeticIteration.lean @@ -0,0 +1,105 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FiniteArithmeticStep + +namespace OAI + +/-! # Finite-depth iteration of the actual arithmetic amplitudes -/ +namespace Ostmann +open scoped BigOperators Classical + +theorem scheduled_constituent_interval_step_finite {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (size : I → ℕ) + (χ : (Σ i, Fin (size i)) → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : (Σ i, Fin (size i)) → ℕ → ℂ) (pivot : ℕ → (Σ i, Fin (size i))) + (j : ℕ) (hpivot : ∀ k ≤ j, role (pivot k).1 = .pivot k) (p : I) (hp : role p = .pivot j) (hu : ∀ i, role i = .pivot j → i = p) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (Q : (Σ i, Fin (size i)) → Finset ℕ) + (hκ : ∀ i q, q ∈ P → ‖κ i q‖ ≤ 1) + (hQP : ∀ i, Q i ⊆ P) (hQ : ∀ i, (∑ q ∈ Q i, (q : ℝ)⁻¹) ≠ 0) + (lo hi : I → ℕ) (cellLo cellHi : (Σ i, Fin (size i)) → ℕ) + (hcell : ∀ i q, q ∈ Q i → cellLo i ≤ q ∧ q ≤ cellHi i) + (V pivotBound : ℕ → ℕ) (hV : Monotone V) + (leaf : ScheduleAtomState role → ℤ → ℂ) (center : ∀ p : ℕ, ZMod p) + (hpLo : 0 < lo p) (hpHi : hi p ≤ pivotBound j) + (hcellLo : lo p ≤ ∏ t : Fin (size p), cellLo ⟨p, t⟩) + (hcellHi : (∏ t : Fin (size p), cellHi ⟨p, t⟩) ≤ hi p) + (hzero : ∀ x, fullAtomTransferWeight role V pivotBound + (atomIntervalRanges role lo hi) leaf 0 x (0 : ℤ) = 0) + (hgap : 2 * pivotBound j * V j < + ∏ h : CopyScheduleH (fun i : Σ a, Fin (size a) => role i.1) j, cellLo (copyScheduleOrigin j h.val)) + (hscale : 2 * V j * + (∏ h : CopyScheduleH (fun i : Σ a, Fin (size a) => role i.1) j, cellHi (copyScheduleOrigin j h.val)) + ≤ V (j + 1) * lo p) + (hlarge : ∀ q ∈ P, V (j + 1) < q) + (loss : ℝ) (hcost : (((size p).factorial : ℝ) * + ∏ i : Fin (size p), (∑ q ∈ Q ⟨p, i⟩, (q : ℝ)⁻¹)⁻¹) ≤ Real.exp loss) : + Real.exp (-loss) * ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi + V pivotBound leaf center j‖ ^ 2 ≤ + scheduledConstituentDiagonal role size χ κ pivot P hP Q lo hi V pivotBound leaf center p j + + ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center (j + 1)‖ := by + apply constituentPrimeGuardedAmplitude_interval_step_finite role size χ κ pivot j hpivot p hp hu P hP Q + hκ hQP hQ lo hi cellLo cellHi hcell V pivotBound leaf (scheduledFrequencyHistory V j) + center _ (V (j + 1)) hpLo hpHi hcellLo hcellHi + · exact scheduledFrequencyHistory_root_bound V j + · exact hzero + · intro d s hs q hq + exact (scheduledFrequencyHistory_all_bound V hV j d s hs).trans_lt + ((hV (Nat.le_succ j)).trans_lt (hlarge q hq)) + · exact le_rfl + · exact hgap + · exact hscale + · exact hlarge + · exact hcost + +/-- The initial reserve survives every actual arithmetic step once the +explicit diagonals and the sum of the actual losses have been bounded. -/ +theorem scheduled_constituent_iteration_finite {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (size : I → ℕ) + (χ : (Σ i, Fin (size i)) → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : (Σ i, Fin (size i)) → ℕ → ℂ) (pivot : ℕ → (Σ i, Fin (size i))) + (k : ℕ) (hpivot : ∀ j < k, role (pivot j).1 = .pivot j) (p : ℕ → I) + (hp : ∀ j < k, role (p j) = .pivot j) + (hu : ∀ j < k, ∀ i, role i = .pivot j → i = p j) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (Q : (Σ i, Fin (size i)) → Finset ℕ) + (hκ : ∀ i q, q ∈ P → ‖κ i q‖ ≤ 1) + (hQP : ∀ i, Q i ⊆ P) (hQ : ∀ i, (∑ q ∈ Q i, (q : ℝ)⁻¹) ≠ 0) + (lo hi : I → ℕ) (cellLo cellHi : (Σ i, Fin (size i)) → ℕ) + (hcell : ∀ i q, q ∈ Q i → cellLo i ≤ q ∧ q ≤ cellHi i) + (V pivotBound : ℕ → ℕ) (hV : Monotone V) + (leaf : ScheduleAtomState role → ℤ → ℂ) (center : ∀ p : ℕ, ZMod p) + (hpLo : ∀ j < k, 0 < lo (p j)) + (hpHi : ∀ j < k, hi (p j) ≤ pivotBound j) + (hcellLo : ∀ j < k, lo (p j) ≤ ∏ t : Fin (size (p j)), cellLo ⟨p j, t⟩) + (hcellHi : ∀ j < k, (∏ t : Fin (size (p j)), cellHi ⟨p j, t⟩) ≤ hi (p j)) + (hzero : ∀ x, fullAtomTransferWeight role V pivotBound + (atomIntervalRanges role lo hi) leaf 0 x (0 : ℤ) = 0) + (hgap : ∀ j < k, 2 * pivotBound j * V j < + ∏ h : CopyScheduleH (fun i : Σ a, Fin (size a) => role i.1) j, cellLo (copyScheduleOrigin j h.val)) + (hscale : ∀ j < k, 2 * V j * + (∏ h : CopyScheduleH (fun i : Σ a, Fin (size a) => role i.1) j, cellHi (copyScheduleOrigin j h.val)) + ≤ V (j + 1) * lo (p j)) + (hlarge : ∀ q ∈ P, V k < q) + (loss : ℕ → ℝ) (hloss : ∀ j < k, 0 ≤ loss j) + (hcost : ∀ j < k, (((size (p j)).factorial : ℝ) * + ∏ i : Fin (size (p j)), (∑ q ∈ Q ⟨p j, i⟩, (q : ℝ)⁻¹)⁻¹) ≤ Real.exp (loss j)) + (B₀ m : ℝ) (hm : 0 ≤ m) + (hbudget : ∑ j ∈ Finset.range k, (loss j + Real.log 2) ≤ m) + (hinit : Real.exp (-B₀ * m) ≤ + ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center 0‖) + (hdiag : ∀ j < k, scheduledConstituentDiagonal role size χ κ pivot P hP Q lo hi + V pivotBound leaf center (p j) j ≤ + Real.exp (-(2 * (B₀ + 1) + 3) * (2 : ℝ) ^ j * m)) : + Real.exp (-(B₀ + 1) * (2 : ℝ) ^ k * m) ≤ + ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center k‖ := by + apply variable_transfer_iteration k + (scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center) + (fun j => scheduledConstituentDiagonal role size χ κ pivot P hP Q lo hi + V pivotBound leaf center (p j) j) loss B₀ m hm hloss hbudget hinit hdiag + (fun j hj => ?_) k le_rfl + exact scheduled_constituent_interval_step_finite role size χ κ pivot j + (fun t ht => hpivot t (by omega)) (p j) (hp j hj) + (hu j hj) P hP Q hκ hQP hQ lo hi cellLo cellHi hcell V pivotBound hV leaf center + (hpLo j hj) (hpHi j hj) (hcellLo j hj) (hcellHi j hj) hzero (hgap j hj) (hscale j hj) + (fun q hq => (hV (by omega : j + 1 ≤ k)).trans_lt (hlarge q hq)) (loss j) (hcost j hj) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteArithmeticStep.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteArithmeticStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..82b1283341d1e96fafe54df9492c6590f36d763d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteArithmeticStep.lean @@ -0,0 +1,218 @@ +import OAI.NumberTheory.Ostmann.Construction.FiniteScheduledPhase + +namespace OAI + +/-! # The original-prior arithmetic transfer through a finite schedule -/ +namespace Ostmann +open scoped BigOperators Classical + +theorem scheduled_arithmetic_transfer_finite {I A Z : Type*} + [Fintype I] [Fintype A] [Fintype Z] + (role : I → CopyScheduleRole) (χ : I → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : I → ℕ → ℂ) (pivot : ℕ → I) (n r : ℕ) + (hpivot : ∀ k ≤ n, role (pivot k) = .pivot k) (e : Fin r ≃ CurrentPivotConstituent role n) (hist : A → FrequencyTree ℤ n) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) + (hκ : ∀ i p, p ∈ P → ‖κ i p‖ ≤ 1) + (Q : Fin r → Finset ℕ) (hQP : ∀ i, Q i ⊆ P) + (hQ : ∀ i, (∑ p ∈ Q i, (p : ℝ)⁻¹) ≠ 0) + (S : Finset (Fin r → P)) (hS : ∀ x ∈ S, Function.Injective x) + (T : Finset ℕ) (hT : ∀ M ∈ T, 0 < M) (hST : ∀ x ∈ S, (∏ i, (x i : ℕ)) ∈ T) + (L : A → CopyScheduleH role n → ℕ) (U : Z → CopyScheduleY role n → ℕ) + [∀ a h, Fact (L a h).Prime] [∀ z y, Fact (U z y).Prime] + (center : ∀ p : ℕ, ZMod p) (W : Z → ℕ → A → ℂ) (μ : Z → ℝ) + (hμ : ∀ z, 0 ≤ μ z) (hμsum : ∑ z, μ z ≤ 1) + (B K V : ℕ) + (hsupport : ∀ z M, M ∈ T → ∀ a, W z M a ≠ 0 → + Pairwise (fun i j => (Sum.elim (L a) (U z) i).Coprime (Sum.elim (L a) (U z) j)) ∧ + M.Coprime ((∏ h, L a h) * ∏ y, U z y) ∧ + (frequencyRoot n (hist a)).natAbs ≤ B ∧ (∏ h, L a h) ≤ K) + (hfreq : ∀ z x, x ∈ S → ∀ a, W z (∏ i, (x i : ℕ)) a ≠ 0 → + ∀ i, ∀ s ∈ allFrequencyList n (hist a), (s : ZMod (x i : ℕ)) ≠ 0) + (hscale : ∀ M ∈ T, 2 * B * K ≤ V * M) + (hlargeL : ∀ a h, V < L a h) (hlargeU : ∀ z y, V < U z y) + (d : ℝ) (hcost : ((r.factorial : ℝ) * ∏ i, (∑ p ∈ Q i, (p : ℝ)⁻¹)⁻¹) ≤ Real.exp d) : + Real.exp (-d) * + ‖scheduledCurrentAmplitude role χ κ pivot n r e hist P hP Q S L U center W μ‖ ^ 2 ≤ + (∑ z, μ z * ∑ M ∈ T, + (pivotDiagonal (fun a => ∏ h, L a h) (fun a => frequencyRoot n (hist a)) + (retainedWeightedCoefficient L (U z) center + (fun h => χ (copyScheduleOrigin n h.val)) (fun y => χ (copyScheduleOrigin n y.val)) + (scheduledRetainedGraph role initialCompleteGraph pivot n) + (fun a h => copyScheduleUnary χ initialCompleteGraph pivot (initialRegularUnary χ κ) + n (hist a) h.val (L a h)) + (fun a y => copyScheduleUnary χ initialCompleteGraph pivot (initialRegularUnary χ κ) + n (hist a) y.val (U z y)) + (fun a => frequencyRoot n (hist a)) (W z) M)).re) + + ‖∑ z, (μ z : ℂ) * scheduledNextAmplitude role χ initialCompleteGraph pivot + (initialRegularUnary χ κ) n hist L (U z) center (W z) T V‖ := by + have hcurrent := scheduledCurrentAmplitude_eq_grouped_finite role χ κ pivot n r hpivot e hist + P hP Q S hS L U center W μ (by + intro z x hx a ha + have hs := hsupport z _ (hST x hx) a ha + exact ⟨hs.1, hs.2.1, hfreq z x hx a ha⟩) + rw [hcurrent] + have ht := original_directed_transfer P hP Q hQP hQ S hS T hT hST + (fun i => χ (e i).val) (fun i p => κ (e i).val p) + (fun i p => hκ (e i).val p p.property) (fun _ => 1) L U center + (fun h => χ (copyScheduleOrigin n h.val)) (fun y => χ (copyScheduleOrigin n y.val)) + (scheduledRetainedGraph role initialCompleteGraph pivot n) + (fun z a h => copyScheduleUnary χ initialCompleteGraph pivot (initialRegularUnary χ κ) + n (hist a) h.val (L a h)) + (fun z a y => copyScheduleUnary χ initialCompleteGraph pivot (initialRegularUnary χ κ) + n (hist a) y.val (U z y)) (fun a => frequencyRoot n (hist a)) W μ hμ hμsum + B K V hsupport hscale hlargeL hlargeU + (fun y => scheduledRetainedGraph_diagonal role pivot n (some (.inr y))) d hcost + simpa only [copiedWeightedAmplitude_eq_scheduledNextAmplitude] using ht + +theorem constituentPrimeGuardedAmplitude_step_finite {I D : Type*} [Fintype I] [Fintype D] + (role : I → CopyScheduleRole) (size : I → ℕ) + (χ : (Σ i, Fin (size i)) → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : (Σ i, Fin (size i)) → ℕ → ℂ) (pivot : ℕ → (Σ i, Fin (size i))) + (n : ℕ) (hpivot : ∀ k ≤ n, role (pivot k).1 = .pivot k) (p : I) (hp : role p = .pivot n) (hu : ∀ i, role i = .pivot n → i = p) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (Q : (Σ i, Fin (size i)) → Finset ℕ) + (hκ : ∀ i q, q ∈ P → ‖κ i q‖ ≤ 1) + (hQP : ∀ i, Q i ⊆ P) (hQ : ∀ i, (∑ q ∈ Q i, (q : ℝ)⁻¹) ≠ 0) + (childBound pivotBound : ℕ → ℕ) (ranges : (j : ℕ) → List (ScheduleAtomRange role j)) + (leaf : ScheduleAtomState role → ℤ → ℂ) (hist : D → FrequencyTree ℤ n) + (center : ∀ p : ℕ, ZMod p) (K V : ℕ) (T : Finset ℕ) + (hST : ∀ x : Fin (size p) → P, Function.Injective x → (∀ i, (x i : ℕ) ∈ Q ⟨p, i⟩) → (∏ i, (x i : ℕ)) ∈ T) + (hzero : ∀ x, fullAtomTransferWeight role childBound pivotBound ranges leaf 0 x (0 : ℤ) = 0) + (hsmall : ∀ d s, s ∈ allFrequencyList n (hist d) → ∀ q ∈ P, s.natAbs < q) + (hTpos : ∀ M ∈ T, 0 < M) (hTbound : ∀ M ∈ T, M ≤ pivotBound n) + (hTfull : ∀ (u : CopyScheduleY (fun i : Σ a, Fin (size a) => role i.1) n → P) (l : CopyScheduleH (fun i : Σ a, Fin (size a) => role i.1) n → P) d M, 0 < M → M ≤ pivotBound n → + fullAtomTransferWeight role childBound pivotBound ranges leaf n + (scheduledInsertedAtoms role n M + (fun h => ∏ k, (l (constituentH role size n h k) : ℕ)) + (fun y => ∏ k, (u (constituentY role size n y k) : ℕ))) (hist d) ≠ 0 → M ∈ T) + (hcut : ∀ u, ∀ M ∈ T, ∀ a, + constituentTransferWeight role size n P Q childBound pivotBound ranges leaf hist u M a ≠ 0 → + (frequencyRoot n (hist a.2)).natAbs ≤ childBound n ∧ (∏ h, (a.1 h : ℕ)) ≤ K) + (hscale : ∀ M ∈ T, 2 * childBound n * K ≤ V * M) + (hlarge : ∀ q ∈ P, V < q) + (hgap : ∀ u, ∀ M ∈ T, ∀ a a', + constituentTransferWeight role size n P Q childBound pivotBound ranges leaf hist u M a ≠ 0 → + constituentTransferWeight role size n P Q childBound pivotBound ranges leaf hist u M a' ≠ 0 → + 2 * pivotBound n * childBound n < ∏ h, (a'.1 h : ℕ)) + (hrange : ∀ u, ∀ M ∈ T, ∀ a a', + constituentTransferWeight role size n P Q childBound pivotBound ranges leaf hist u M a ≠ 0 → + constituentTransferWeight role size n P Q childBound pivotBound ranges leaf hist u M a' ≠ 0 → + ∀ b ∈ ranges (n + 1), b.Holds (copiedConstituentAtomValues role size n P u a.1 a'.1)) + (loss : ℝ) (hcost : (((size p).factorial : ℝ) * + ∏ i : Fin (size p), (∑ q ∈ Q ⟨p, i⟩, (q : ℝ)⁻¹)⁻¹) ≤ Real.exp loss) : + Real.exp (-loss) * + ‖constituentPrimeGuardedAmplitude role size χ κ pivot n P hP Q + childBound pivotBound ranges leaf hist center‖ ^ 2 ≤ + (∑ u, (∏ y, primeSubsetPrior P (Q (copyScheduleOrigin n y.val)) (u y)) * + ∑ M ∈ T, (constituentPivotDiagonal role size χ κ pivot n P hP Q + childBound pivotBound ranges leaf hist center u M).re) + + ‖constituentPrimeGuardedAmplitude role size χ κ pivot (n + 1) P hP Q + childBound pivotBound ranges leaf (copiedConstituentHistory hist V) center‖ := by + let ρ := fun i : Σ a, Fin (size a) => role i.1 + let : ∀ (a : (CopyScheduleH ρ n → P) × D) h, Fact (a.1 h : ℕ).Prime := + fun a h => ⟨hP _ (a.1 h).property⟩ + let : ∀ (u : CopyScheduleY ρ n → P) y, Fact (u y : ℕ).Prime := + fun u y => ⟨hP _ (u y).property⟩ + let μ (u : CopyScheduleY ρ n → P) := + ∏ y, primeSubsetPrior P (Q (copyScheduleOrigin n y.val)) (u y) + have hμ (u) : 0 ≤ μ u := Finset.prod_nonneg (fun _ _ => primeSubsetPrior_nonneg _ _ _) + have hμsum : ∑ u, μ u = 1 := by + rw [← Fintype.prod_sum] + have hm (y : CopyScheduleY ρ n) : + (∑ q : P, primeSubsetPrior P (Q (copyScheduleOrigin n y.val)) q) = 1 := + primeSubsetPrior_mass P _ (hQP _) (hQ _) + simp only [hm, Finset.prod_const_one] + have ht := scheduled_arithmetic_transfer_finite ρ χ κ pivot n (size p) hpivot + (pivotConstituentEquiv role size n p hp hu) (fun a => hist a.2) P hP hκ + (fun k => Q ⟨p, k⟩) (fun k => hQP ⟨p, k⟩) (fun k => hQ ⟨p, k⟩) + (supportedPivotTuples P (fun k => Q ⟨p, k⟩)) + (fun x hx => ((mem_supportedPivotTuples _ _ _).mp hx).1) + T hTpos (fun x hx => hST x ((mem_supportedPivotTuples _ _ _).mp hx).1 + ((mem_supportedPivotTuples _ _ _).mp hx).2) + (fun a h => (a.1 h : ℕ)) (fun u y => (u y : ℕ)) center + (constituentTransferWeight role size n P Q childBound pivotBound ranges leaf hist) + μ hμ hμsum.le (childBound n) K V (by + intro u M hM a ha + have hs := constituentTransferWeight_support role size n p hp P Q childBound pivotBound ranges leaf hist u M a ha + exact ⟨hs.1, hs.2.1, (hcut u M hM a ha).1, (hcut u M hM a ha).2⟩) (by + intro u x _ a ha i s hs + let : Fact (x i : ℕ).Prime := ⟨hP _ (x i).property⟩ + exact constituentTransferWeight_frequency_unit role size n P Q childBound pivotBound ranges leaf hist + hzero u (∏ i, (x i : ℕ)) a ha (x i) s hs (hsmall a.2 s hs _ (x i).property)) + hscale (fun a h => hlarge _ (a.1 h).property) (fun u y => hlarge _ (u y).property) loss hcost + have hc := constituentPrimeGuardedAmplitude_eq_supported_transfer role size χ κ pivot n p hp hu + P hP Q childBound pivotBound ranges leaf hist center + have hn := constituentPrimeGuardedAmplitude_next role size χ κ pivot n p hp P hP Q + childBound pivotBound ranges leaf hist center K V T hTpos hTbound hTfull + hcut hscale hlarge hgap hrange + rw [← hc, ← hn] at ht + exact ht + +theorem constituentPrimeGuardedAmplitude_interval_step_finite {I D : Type*} [Fintype I] [Fintype D] + (role : I → CopyScheduleRole) (size : I → ℕ) + (χ : (Σ i, Fin (size i)) → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : (Σ i, Fin (size i)) → ℕ → ℂ) (pivot : ℕ → (Σ i, Fin (size i))) + (n : ℕ) (hpivot : ∀ k ≤ n, role (pivot k).1 = .pivot k) (p : I) (hp : role p = .pivot n) (hu : ∀ i, role i = .pivot n → i = p) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (Q : (Σ i, Fin (size i)) → Finset ℕ) + (hκ : ∀ i q, q ∈ P → ‖κ i q‖ ≤ 1) + (hQP : ∀ i, Q i ⊆ P) (hQ : ∀ i, (∑ q ∈ Q i, (q : ℝ)⁻¹) ≠ 0) + (lo hi : I → ℕ) (cellLo cellHi : (Σ i, Fin (size i)) → ℕ) + (hcell : ∀ i q, q ∈ Q i → cellLo i ≤ q ∧ q ≤ cellHi i) + (childBound pivotBound : ℕ → ℕ) (leaf : ScheduleAtomState role → ℤ → ℂ) + (hist : D → FrequencyTree ℤ n) (center : ∀ p : ℕ, ZMod p) (K V : ℕ) + (hpLo : 0 < lo p) (hpHi : hi p ≤ pivotBound n) + (hcellLo : lo p ≤ ∏ k : Fin (size p), cellLo ⟨p, k⟩) + (hcellHi : (∏ k : Fin (size p), cellHi ⟨p, k⟩) ≤ hi p) + (hroot : ∀ d, (frequencyRoot n (hist d)).natAbs ≤ childBound n) + (hzero : ∀ x, fullAtomTransferWeight role childBound pivotBound + (atomIntervalRanges role lo hi) leaf 0 x (0 : ℤ) = 0) + (hsmall : ∀ d s, s ∈ allFrequencyList n (hist d) → ∀ q ∈ P, s.natAbs < q) + (hK : (∏ h : CopyScheduleH (fun i : Σ a, Fin (size a) => role i.1) n, + cellHi (copyScheduleOrigin n h.val)) ≤ K) + (hgap : 2 * pivotBound n * childBound n < + ∏ h : CopyScheduleH (fun i : Σ a, Fin (size a) => role i.1) n, cellLo (copyScheduleOrigin n h.val)) + (hscale : 2 * childBound n * K ≤ V * lo p) (hlarge : ∀ q ∈ P, V < q) + (loss : ℝ) (hcost : (((size p).factorial : ℝ) * + ∏ i : Fin (size p), (∑ q ∈ Q ⟨p, i⟩, (q : ℝ)⁻¹)⁻¹) ≤ Real.exp loss) : + Real.exp (-loss) * + ‖constituentPrimeGuardedAmplitude role size χ κ pivot n P hP Q + childBound pivotBound (atomIntervalRanges role lo hi) leaf hist center‖ ^ 2 ≤ + (∑ u, (∏ y, primeSubsetPrior P (Q (copyScheduleOrigin n y.val)) (u y)) * + ∑ M ∈ Finset.Icc (lo p) (hi p), (constituentPivotDiagonal role size χ κ pivot n P hP Q + childBound pivotBound (atomIntervalRanges role lo hi) leaf hist center u M).re) + + ‖constituentPrimeGuardedAmplitude role size χ κ pivot (n + 1) P hP Q + childBound pivotBound (atomIntervalRanges role lo hi) leaf (copiedConstituentHistory hist V) center‖ := by + apply constituentPrimeGuardedAmplitude_step_finite role size χ κ pivot n hpivot p hp hu P hP Q + hκ hQP hQ childBound pivotBound (atomIntervalRanges role lo hi) leaf hist center K V + (Finset.Icc (lo p) (hi p)) + · intro x _ hx + apply Finset.mem_Icc.mpr + exact ⟨hcellLo.trans (Finset.prod_le_prod (fun i _ => (hcell _ _ (hx i)).1)), + (Finset.prod_le_prod (fun i _ => (hcell _ _ (hx i)).2)).trans hcellHi⟩ + · exact hzero + · exact hsmall + · intro M hM + exact hpLo.trans_le (Finset.mem_Icc.mp hM).1 + · intro M hM + exact (Finset.mem_Icc.mp hM).2.trans hpHi + · intro u l d M _ _ hw + exact Finset.mem_Icc.mpr (fullAtomTransferWeight_inserted_pivot_bounds role lo hi + childBound pivotBound leaf n p hp M _ _ (hist d) hw) + · intro u M _ a ha + have hh := constituentTransferWeight_product_bounds role size n P Q childBound pivotBound + (atomIntervalRanges role lo hi) leaf hist u M a ha cellLo cellHi hcell + exact ⟨hroot a.2, hh.2.trans hK⟩ + · intro M hM + exact hscale.trans (Nat.mul_le_mul_left V (Finset.mem_Icc.mp hM).1) + · exact hlarge + · intro u M _ a b _ hb + have hh := constituentTransferWeight_product_bounds role size n P Q childBound pivotBound + (atomIntervalRanges role lo hi) leaf hist u M b hb cellLo cellHi hcell + exact hgap.trans_le hh.1 + · intro u M _ a b ha hb + exact constituentTransferWeight_copied_intervals role size lo hi n P Q childBound pivotBound + leaf hist u M a b ha hb + · exact hcost + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteAtomIntervalIteration.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteAtomIntervalIteration.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4dd625d8b4d6830c53281a2caeb349e6a82ea35 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteAtomIntervalIteration.lean @@ -0,0 +1,106 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FiniteAtomIntervalStep +import OAI.NumberTheory.Ostmann.Arithmetic.FiniteArithmeticIteration + +namespace OAI + +/-! # Finite-depth iteration with whole-word interval support -/ +namespace Ostmann +open scoped BigOperators Classical + +theorem scheduled_constituent_atom_interval_step {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (size : I → ℕ) + (χ : (Σ i, Fin (size i)) → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : (Σ i, Fin (size i)) → ℕ → ℂ) (pivot : ℕ → (Σ i, Fin (size i))) + (j : ℕ) (hpivot : ∀ k ≤ j, role (pivot k).1 = .pivot k) (p : I) (hp : role p = .pivot j) (hu : ∀ i, role i = .pivot j → i = p) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (Q : (Σ i, Fin (size i)) → Finset ℕ) + (hκ : ∀ i q, q ∈ P → ‖κ i q‖ ≤ 1) + (hQP : ∀ i, Q i ⊆ P) (hQ : ∀ i, (∑ q ∈ Q i, (q : ℝ)⁻¹) ≠ 0) + (lo hi : I → ℕ) (cellLo cellHi : (Σ i, Fin (size i)) → ℕ) + (hcell : ∀ i q, q ∈ Q i → cellLo i ≤ q ∧ q ≤ cellHi i) + (V pivotBound : ℕ → ℕ) (hV : Monotone V) + (leaf : ScheduleAtomState role → ℤ → ℂ) (center : ∀ p : ℕ, ZMod p) + (hpLo : 0 < lo p) (hpHi : hi p ≤ pivotBound j) + (hcellLo : lo p ≤ ∏ t : Fin (size p), cellLo ⟨p, t⟩) + (hcellHi : (∏ t : Fin (size p), cellHi ⟨p, t⟩) ≤ hi p) + (hzero : ∀ x, fullAtomTransferWeight role V pivotBound + (atomIntervalRanges role lo hi) leaf 0 x (0 : ℤ) = 0) + (hgap : 2 * pivotBound j * V j < + ∏ h : CopyScheduleH role j, lo (copyScheduleOrigin j h.val)) + (hscale : 2 * V j * + (∏ h : CopyScheduleH role j, hi (copyScheduleOrigin j h.val)) + ≤ V (j + 1) * lo p) + (hlarge : ∀ q ∈ P, V (j + 1) < q) + (loss : ℝ) (hcost : (((size p).factorial : ℝ) * + ∏ i : Fin (size p), (∑ q ∈ Q ⟨p, i⟩, (q : ℝ)⁻¹)⁻¹) ≤ Real.exp loss) : + Real.exp (-loss) * ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi + V pivotBound leaf center j‖ ^ 2 ≤ + scheduledConstituentDiagonal role size χ κ pivot P hP Q lo hi V pivotBound leaf center p j + + ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center (j + 1)‖ := by + apply constituentPrimeGuardedAmplitude_atom_interval_step role size χ κ pivot j hpivot p hp hu P hP Q + hκ hQP hQ lo hi cellLo cellHi hcell V pivotBound leaf (scheduledFrequencyHistory V j) + center _ (V (j + 1)) hpLo hpHi hcellLo hcellHi + · exact scheduledFrequencyHistory_root_bound V j + · exact hzero + · intro d s hs q hq + exact (scheduledFrequencyHistory_all_bound V hV j d s hs).trans_lt + ((hV (Nat.le_succ j)).trans_lt (hlarge q hq)) + · exact le_rfl + · exact hgap + · exact hscale + · exact hlarge + · exact hcost + +/-- The initial reserve survives every actual arithmetic step once the +explicit diagonals and the sum of the actual losses have been bounded. -/ +theorem scheduled_constituent_atom_interval_iteration {I : Type*} [Fintype I] + (role : I → CopyScheduleRole) (size : I → ℕ) + (χ : (Σ i, Fin (size i)) → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : (Σ i, Fin (size i)) → ℕ → ℂ) (pivot : ℕ → (Σ i, Fin (size i))) + (k : ℕ) (hpivot : ∀ j < k, role (pivot j).1 = .pivot j) (p : ℕ → I) + (hp : ∀ j < k, role (p j) = .pivot j) + (hu : ∀ j < k, ∀ i, role i = .pivot j → i = p j) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (Q : (Σ i, Fin (size i)) → Finset ℕ) + (hκ : ∀ i q, q ∈ P → ‖κ i q‖ ≤ 1) + (hQP : ∀ i, Q i ⊆ P) (hQ : ∀ i, (∑ q ∈ Q i, (q : ℝ)⁻¹) ≠ 0) + (lo hi : I → ℕ) (cellLo cellHi : (Σ i, Fin (size i)) → ℕ) + (hcell : ∀ i q, q ∈ Q i → cellLo i ≤ q ∧ q ≤ cellHi i) + (V pivotBound : ℕ → ℕ) (hV : Monotone V) + (leaf : ScheduleAtomState role → ℤ → ℂ) (center : ∀ p : ℕ, ZMod p) + (hpLo : ∀ j < k, 0 < lo (p j)) + (hpHi : ∀ j < k, hi (p j) ≤ pivotBound j) + (hcellLo : ∀ j < k, lo (p j) ≤ ∏ t : Fin (size (p j)), cellLo ⟨p j, t⟩) + (hcellHi : ∀ j < k, (∏ t : Fin (size (p j)), cellHi ⟨p j, t⟩) ≤ hi (p j)) + (hzero : ∀ x, fullAtomTransferWeight role V pivotBound + (atomIntervalRanges role lo hi) leaf 0 x (0 : ℤ) = 0) + (hgap : ∀ j < k, 2 * pivotBound j * V j < + ∏ h : CopyScheduleH role j, lo (copyScheduleOrigin j h.val)) + (hscale : ∀ j < k, 2 * V j * + (∏ h : CopyScheduleH role j, hi (copyScheduleOrigin j h.val)) + ≤ V (j + 1) * lo (p j)) + (hlarge : ∀ q ∈ P, V k < q) + (loss : ℕ → ℝ) (hloss : ∀ j < k, 0 ≤ loss j) + (hcost : ∀ j < k, (((size (p j)).factorial : ℝ) * + ∏ i : Fin (size (p j)), (∑ q ∈ Q ⟨p j, i⟩, (q : ℝ)⁻¹)⁻¹) ≤ Real.exp (loss j)) + (B₀ m : ℝ) (hm : 0 ≤ m) + (hbudget : ∑ j ∈ Finset.range k, (loss j + Real.log 2) ≤ m) + (hinit : Real.exp (-B₀ * m) ≤ + ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center 0‖) + (hdiag : ∀ j < k, scheduledConstituentDiagonal role size χ κ pivot P hP Q lo hi + V pivotBound leaf center (p j) j ≤ + Real.exp (-(2 * (B₀ + 1) + 3) * (2 : ℝ) ^ j * m)) : + Real.exp (-(B₀ + 1) * (2 : ℝ) ^ k * m) ≤ + ‖scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center k‖ := by + apply variable_transfer_iteration k + (scheduledConstituentAmplitude role size χ κ pivot P hP Q lo hi V pivotBound leaf center) + (fun j => scheduledConstituentDiagonal role size χ κ pivot P hP Q lo hi + V pivotBound leaf center (p j) j) loss B₀ m hm hloss hbudget hinit hdiag + (fun j hj => ?_) k le_rfl + exact scheduled_constituent_atom_interval_step role size χ κ pivot j + (fun t ht => hpivot t (by omega)) (p j) (hp j hj) + (hu j hj) P hP Q hκ hQP hQ lo hi cellLo cellHi hcell V pivotBound hV leaf center + (hpLo j hj) (hpHi j hj) (hcellLo j hj) (hcellHi j hj) hzero (hgap j hj) (hscale j hj) + (fun q hq => (hV (by omega : j + 1 ≤ k)).trans_lt (hlarge q hq)) (loss j) (hcost j hj) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteAtomIntervalStep.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteAtomIntervalStep.lean new file mode 100644 index 0000000000000000000000000000000000000000..48dd5d854039e8808af0e8101ce32843334252bf --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteAtomIntervalStep.lean @@ -0,0 +1,77 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FiniteArithmeticStep +import OAI.NumberTheory.Ostmann.Construction.ConstituentAtomProductBounds + +namespace OAI + +/-! # Finite transfer using the selected whole-word intervals -/ +namespace Ostmann +open scoped Classical BigOperators + +theorem constituentPrimeGuardedAmplitude_atom_interval_step {I D : Type*} [Fintype I] [Fintype D] + (role : I → CopyScheduleRole) (size : I → ℕ) + (χ : (Σ i, Fin (size i)) → ∀ p : ℕ, DirichletCharacter ℂ p) + (κ : (Σ i, Fin (size i)) → ℕ → ℂ) (pivot : ℕ → (Σ i, Fin (size i))) + (n : ℕ) (hpivot : ∀ k ≤ n, role (pivot k).1 = .pivot k) (p : I) (hp : role p = .pivot n) (hu : ∀ i, role i = .pivot n → i = p) + (P : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (Q : (Σ i, Fin (size i)) → Finset ℕ) + (hκ : ∀ i q, q ∈ P → ‖κ i q‖ ≤ 1) + (hQP : ∀ i, Q i ⊆ P) (hQ : ∀ i, (∑ q ∈ Q i, (q : ℝ)⁻¹) ≠ 0) + (lo hi : I → ℕ) (cellLo cellHi : (Σ i, Fin (size i)) → ℕ) + (hcell : ∀ i q, q ∈ Q i → cellLo i ≤ q ∧ q ≤ cellHi i) + (childBound pivotBound : ℕ → ℕ) (leaf : ScheduleAtomState role → ℤ → ℂ) + (hist : D → FrequencyTree ℤ n) (center : ∀ p : ℕ, ZMod p) (K V : ℕ) + (hpLo : 0 < lo p) (hpHi : hi p ≤ pivotBound n) + (hcellLo : lo p ≤ ∏ k : Fin (size p), cellLo ⟨p, k⟩) + (hcellHi : (∏ k : Fin (size p), cellHi ⟨p, k⟩) ≤ hi p) + (hroot : ∀ d, (frequencyRoot n (hist d)).natAbs ≤ childBound n) + (hzero : ∀ x, fullAtomTransferWeight role childBound pivotBound + (atomIntervalRanges role lo hi) leaf 0 x (0 : ℤ) = 0) + (hsmall : ∀ d s, s ∈ allFrequencyList n (hist d) → ∀ q ∈ P, s.natAbs < q) + (hK : (∏ h : CopyScheduleH role n, hi (copyScheduleOrigin n h.val)) ≤ K) + (hgap : 2 * pivotBound n * childBound n < + ∏ h : CopyScheduleH role n, lo (copyScheduleOrigin n h.val)) + (hscale : 2 * childBound n * K ≤ V * lo p) (hlarge : ∀ q ∈ P, V < q) + (loss : ℝ) (hcost : (((size p).factorial : ℝ) * + ∏ i : Fin (size p), (∑ q ∈ Q ⟨p, i⟩, (q : ℝ)⁻¹)⁻¹) ≤ Real.exp loss) : + Real.exp (-loss) * + ‖constituentPrimeGuardedAmplitude role size χ κ pivot n P hP Q + childBound pivotBound (atomIntervalRanges role lo hi) leaf hist center‖ ^ 2 ≤ + (∑ u, (∏ y, primeSubsetPrior P (Q (copyScheduleOrigin n y.val)) (u y)) * + ∑ M ∈ Finset.Icc (lo p) (hi p), (constituentPivotDiagonal role size χ κ pivot n P hP Q + childBound pivotBound (atomIntervalRanges role lo hi) leaf hist center u M).re) + + ‖constituentPrimeGuardedAmplitude role size χ κ pivot (n + 1) P hP Q + childBound pivotBound (atomIntervalRanges role lo hi) leaf (copiedConstituentHistory hist V) center‖ := by + apply constituentPrimeGuardedAmplitude_step_finite role size χ κ pivot n hpivot p hp hu P hP Q + hκ hQP hQ childBound pivotBound (atomIntervalRanges role lo hi) leaf hist center K V + (Finset.Icc (lo p) (hi p)) + · intro x _ hx + apply Finset.mem_Icc.mpr + exact ⟨hcellLo.trans (Finset.prod_le_prod (fun i _ => (hcell _ _ (hx i)).1)), + (Finset.prod_le_prod (fun i _ => (hcell _ _ (hx i)).2)).trans hcellHi⟩ + · exact hzero + · exact hsmall + · intro M hM + exact hpLo.trans_le (Finset.mem_Icc.mp hM).1 + · intro M hM + exact (Finset.mem_Icc.mp hM).2.trans hpHi + · intro u l d M _ _ hw + exact Finset.mem_Icc.mpr (fullAtomTransferWeight_inserted_pivot_bounds role lo hi + childBound pivotBound leaf n p hp M _ _ (hist d) hw) + · intro u M _ a ha + have hh := constituentTransferWeight_atom_product_bounds role size n P Q childBound pivotBound + lo hi leaf hist u M a ha + exact ⟨hroot a.2, hh.2.trans hK⟩ + · intro M hM + exact hscale.trans (Nat.mul_le_mul_left V (Finset.mem_Icc.mp hM).1) + · exact hlarge + · intro u M _ a b _ hb + have hh := constituentTransferWeight_atom_product_bounds role size n P Q childBound pivotBound + lo hi leaf hist u M b hb + exact hgap.trans_le hh.1 + · intro u M _ a b ha hb + exact constituentTransferWeight_copied_intervals role size lo hi n P Q childBound pivotBound + leaf hist u M a b ha hb + · exact hcost + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteRootFibres.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteRootFibres.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9cf38577400861ada9b0637b6d2593911272ec3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteRootFibres.lean @@ -0,0 +1,116 @@ +import OAI.NumberTheory.Ostmann.Construction.ConstituentAmplitudeEnergy + +namespace OAI + +/-! # Keeping the root frequency in the final counting measure -/ + +namespace Ostmann +open scoped BigOperators Classical ComplexConjugate + +noncomputable def rootFibreSum {D R : Type*} [Fintype D] + (root : D → R) (s : R) (F : D → ℂ) : ℂ := + ∑ d, if root d = s then F d else 0 + +theorem sum_rootFibreSum {D R : Type*} [Fintype D] [Fintype R] + (root : D → R) (F : D → ℂ) : + (∑ s, rootFibreSum root s F) = ∑ d, F d := by + unfold rootFibreSum + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro d _ + simp + +/-- Disjoint root fibres retain the same crude finite-frequency energy cost. -/ +theorem rootFibreSum_energy {D R : Type*} [Fintype D] [Fintype R] + (root : D → R) (F : D → ℂ) (E : ℝ) (hE : 0 ≤ E) + (hF : ∀ d, ‖F d‖ ^ 2 ≤ E) : + (∑ s, ‖rootFibreSum root s F‖ ^ 2) ≤ (Fintype.card D : ℝ) ^ 2 * E := by + let c : R → ℝ := fun s => ((Finset.univ.filter fun d => root d = s).card : ℝ) + have hc (s : R) : 0 ≤ c s := Nat.cast_nonneg _ + have hnorm (s : R) : ‖rootFibreSum root s F‖ ≤ c s * Real.sqrt E := by + unfold rootFibreSum + rw [← Finset.sum_filter] + apply (norm_sum_le _ _).trans + calc + _ ≤ ∑ _d ∈ Finset.univ.filter (fun d => root d = s), Real.sqrt E := + Finset.sum_le_sum (fun d _ => Real.le_sqrt_of_sq_le (hF d)) + _ = _ := by simp [c] + have hcount : ∑ s, c s = (Fintype.card D : ℝ) := by + simp only [c, Finset.card_filter, Nat.cast_sum, Nat.cast_ite, Nat.cast_one, + Nat.cast_zero] + rw [Finset.sum_comm] + simp + calc + _ ≤ ∑ s, (c s * Real.sqrt E) ^ 2 := + Finset.sum_le_sum (fun s _ => pow_le_pow_left₀ (norm_nonneg _) (hnorm s) 2) + _ = (∑ s, c s ^ 2) * E := by + simp only [mul_pow, Real.sq_sqrt hE, Finset.sum_mul] + _ ≤ (∑ s, c s) ^ 2 * E := + mul_le_mul_of_nonneg_right (Finset.sum_sq_le_sq_sum_of_nonneg (fun s _ => hc s)) hE + _ = _ := by rw [hcount] + +/-- Expanding before taking norms leaves only equal-root pairs. -/ +theorem rootFibreSum_pair {D K R : Type*} [Fintype D] [Fintype K] [Fintype R] + (root : D → R) (root' : K → R) (F : D → ℂ) (G : K → ℂ) : + (∑ s, rootFibreSum root s F * conj (rootFibreSum root' s G)) = + ∑ d, ∑ k, if root d = root' k then F d * conj (G k) else 0 := by + unfold rootFibreSum + simp only [map_sum, Finset.sum_mul] + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro d _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + simp only [ite_mul, zero_mul] + simp only [Finset.sum_ite_eq, Finset.mem_univ, ite_true] + by_cases h : root d = root' k + · simp only [h, ite_true] + · simp only [h, Ne.symm h, ite_false, map_zero, mul_zero] + +theorem rootFibreSum_weighted_pair {D K R X : Type*} + [Fintype D] [Fintype K] [Fintype R] [Fintype X] + (root : D → R) (root' : K → R) (μ : X → ℝ) + (F : D → X → ℂ) (G : K → X → ℂ) : + (∑ s, ∑ x, (μ x : ℂ) * + (rootFibreSum root s (fun d => F d x) * conj (rootFibreSum root' s (fun k => G k x)))) = + ∑ d, ∑ k, if root d = root' k then ∑ x, (μ x : ℂ) * (F d x * conj (G k x)) else 0 := by + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum, rootFibreSum_pair, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro d _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro k _ + by_cases h : root d = root' k <;> simp only [h, ite_true, ite_false, mul_zero, + Finset.sum_const_zero] + +theorem rootFibreSum_pair_bound {D K R X : Type*} + [Fintype D] [Fintype K] [Fintype R] [Fintype X] + (root : D → R) (root' : K → R) (μ : X → ℝ) + (F : D → X → ℂ) (G : K → X → ℂ) (E : ℝ) (hE : 0 ≤ E) + (hpair : ∀ d k, root d = root' k → + ‖∑ x, (μ x : ℂ) * (F d x * conj (G k x))‖ ≤ E) : + ‖∑ s, ∑ x, (μ x : ℂ) * + (rootFibreSum root s (fun d => F d x) * conj (rootFibreSum root' s (fun k => G k x)))‖ ≤ + (Fintype.card D : ℝ) * Fintype.card K * E := by + rw [rootFibreSum_weighted_pair] + calc + _ ≤ ∑ d, ∑ k, ‖if root d = root' k then + ∑ x, (μ x : ℂ) * (F d x * conj (G k x)) else 0‖ := + (norm_sum_le _ _).trans (Finset.sum_le_sum fun d _ => norm_sum_le _ _) + _ ≤ ∑ _d : D, ∑ _k : K, E := by + apply Finset.sum_le_sum + intro d _ + apply Finset.sum_le_sum + intro k _ + by_cases h : root d = root' k + · simpa only [h, ite_true] using hpair d k h + · simpa only [h, ite_false, norm_zero] using hE + _ = _ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteRootMesh.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteRootMesh.lean new file mode 100644 index 0000000000000000000000000000000000000000..383c2006690ea0b59f569090d10b2fc1bb4acd05 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteRootMesh.lean @@ -0,0 +1,104 @@ +import OAI.NumberTheory.Ostmann.Characters.PolynomialRootCells + +namespace OAI + +/-! # A finite interval partition at every arithmetic root -/ + +namespace Ostmann +open scoped Classical + +/-- Partition a bounded interval at all roots in it, retaining the roots as +endpoints. The number of intervals is at most the number of cuts plus one. -/ +theorem finite_root_mesh (S : Finset ℝ) (u v : ℝ) (huv : u ≤ v) : + ∃ (s : ℕ → ℝ) (N : ℕ), Monotone s ∧ s 0 = u ∧ s N = v ∧ N ≤ S.card + 1 ∧ + ∀ j < N, ∀ r ∈ S, r ∉ Set.Ioo (s j) (s (j + 1)) := by + let R := insert u (insert v (S.filter (fun r => r ∈ Set.Icc u v))) + have hu : u ∈ R := by simp [R] + have hv : v ∈ R := by simp [R] + have hpos : 0 < R.card := Finset.card_pos.mpr ⟨u, hu⟩ + have hmem (r : ℝ) (hr : r ∈ R) : r ∈ Set.Icc u v := by + simp only [R, Finset.mem_insert, Finset.mem_filter] at hr + rcases hr with rfl | rfl | ⟨_, hr⟩ + · exact ⟨le_rfl, huv⟩ + · exact ⟨huv, le_rfl⟩ + · exact hr + let f := R.orderEmbOfFin rfl + have hf0 : f ⟨0, hpos⟩ = u := by + rw [Finset.orderEmbOfFin_zero rfl hpos] + exact le_antisymm (Finset.min'_le R u hu) + (hmem _ (Finset.min'_mem R _)).1 + have hflast : f ⟨R.card - 1, Nat.sub_lt hpos (by decide)⟩ = v := by + rw [Finset.orderEmbOfFin_last rfl hpos] + exact le_antisymm (hmem _ (Finset.max'_mem R _)).2 (Finset.le_max' R v hv) + let N := R.card - 1 + let s := fun j : ℕ => f ⟨min j N, lt_of_le_of_lt (min_le_right _ _) (by omega)⟩ + have hs : Monotone s := by + intro i j hij + exact f.monotone (show min i N ≤ min j N from min_le_min hij le_rfl) + have hs0 : s 0 = u := by simpa only [s, Nat.zero_min] using hf0 + have hsN : s N = v := by simpa only [s, min_self, N] using hflast + refine ⟨s, N, hs, hs0, hsN, ?_, ?_⟩ + · have hcard : R.card ≤ S.card + 2 := by + calc + R.card ≤ (insert v (S.filter (fun r => r ∈ Set.Icc u v))).card + 1 := Finset.card_insert_le _ _ + _ ≤ (S.filter (fun r => r ∈ Set.Icc u v)).card + 1 + 1 := by + gcongr + exact Finset.card_insert_le _ _ + _ ≤ S.card + 2 := by have := Finset.card_filter_le S (fun r => r ∈ Set.Icc u v); omega + omega + · intro j hj r hr hin + have hjc : j < R.card := by omega + have hj1c : j + 1 < R.card := by omega + have he0 : s j = f ⟨j, hjc⟩ := by simp only [s, min_eq_left (by omega : j ≤ N)] + have he1 : s (j + 1) = f ⟨j + 1, hj1c⟩ := by + simp only [s, min_eq_left (by omega : j + 1 ≤ N)] + have hrange : r ∈ Set.Icc u v := + ⟨(hs0 ▸ hs (Nat.zero_le j)).trans hin.1.le, + hin.2.le.trans (hsN ▸ hs (by omega : j + 1 ≤ N))⟩ + have hrR : r ∈ R := Finset.mem_insert_of_mem (Finset.mem_insert_of_mem + (Finset.mem_filter.mpr ⟨hr, hrange⟩)) + let k := (R.orderIsoOfFin rfl).symm ⟨r, hrR⟩ + have hk : f k = r := congrArg Subtype.val ((R.orderIsoOfFin rfl).apply_symm_apply ⟨r, hrR⟩) + have hleft : (⟨j, hjc⟩ : Fin R.card) < k := f.lt_iff_lt.mp (by rw [← he0, hk]; exact hin.1) + have hright : k < (⟨j + 1, hj1c⟩ : Fin R.card) := f.lt_iff_lt.mp (by rw [← he1, hk]; exact hin.2) + have hl : j < k.val := hleft + have hr' : k.val < j + 1 := hright + omega + +/-- The side of every root is constant in the open part of one partition cell. -/ +theorem rootCellCode_eq_of_root_free (S : Finset ℝ) (a b x y : ℝ) + (hfree : ∀ r ∈ S, r ∉ Set.Ioo a b) + (hx : x ∈ Set.Ioo a b) (hy : y ∈ Set.Ioo a b) : + rootCellCode S x = rootCellCode S y := by + funext r + change compare x r.val = compare y r.val + by_cases hr : r.val ≤ a + · rw [compare_gt_iff_gt.mpr (hr.trans_lt hx.1), compare_gt_iff_gt.mpr (hr.trans_lt hy.1)] + · have hb : b ≤ r.val := by + by_contra hb + exact hfree r.val r.property ⟨lt_of_not_ge hr, lt_of_not_ge hb⟩ + rw [compare_lt_iff_lt.mpr (hx.2.trans_le hb), compare_lt_iff_lt.mpr (hy.2.trans_le hb)] + +/-- A partition in logarithmic coordinates still includes every positive +root of the original giant-variable polynomials. -/ +theorem finite_log_root_mesh (S : Finset ℝ) (u v : ℝ) (huv : u ≤ v) : + ∃ (s : ℕ → ℝ) (N : ℕ), Monotone s ∧ s 0 = u ∧ s N = v ∧ N ≤ S.card + 1 ∧ + ∀ j < N, ∀ r ∈ S, r ∉ Set.Ioo (Real.exp (s j)) (Real.exp (s (j + 1))) := by + obtain ⟨x, N, hx, hx0, hxN, hN, hfree⟩ := + finite_root_mesh S (Real.exp u) (Real.exp v) (Real.exp_le_exp.mpr huv) + have hpos (j : ℕ) : 0 < x j := by + have hh := hx (Nat.zero_le j) + rw [hx0] at hh + exact (Real.exp_pos u).trans_le hh + let s := fun j => Real.log (x j) + refine ⟨s, N, ?_, ?_, ?_, hN, ?_⟩ + · intro i j hij + exact Real.log_le_log (hpos i) (hx hij) + · simp only [s, hx0, Real.log_exp] + · simp only [s, hxN, Real.log_exp] + · intro j hj r hr + simpa only [s, Real.exp_log (hpos _)] using hfree j hj r hr + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteSeparatedHeight.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteSeparatedHeight.lean new file mode 100644 index 0000000000000000000000000000000000000000..0b125c574107e411b0e80914cefc97c5df79f3f9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FiniteSeparatedHeight.lean @@ -0,0 +1,46 @@ +import Mathlib.MeasureTheory.Measure.Lebesgue.Basic + +namespace OAI + +/-! # A unit interval contains a quantitatively separated height -/ + +namespace Ostmann + +open Set MeasureTheory +open scoped BigOperators + +/-- Avoid a finite set of ordinates while retaining a definite distance. +The proof pays only for the total lengths of the forbidden intervals. -/ +theorem exists_height_separated (S : Finset ℝ) (T δ : ℝ) (_hδ : 0 < δ) + (hsize : 2 * δ * (S.card : ℝ) < 1) : + ∃ t ∈ Ioo T (T + 1), ∀ r ∈ S, δ ≤ |t - r| := by + classical + let U : Set ℝ := ⋃ r ∈ S, Ioo (r - δ) (r + δ) + have hvol : volume U ≤ ENNReal.ofReal (2 * δ * (S.card : ℝ)) := by + calc + _ ≤ ∑ r ∈ S, volume (Ioo (r - δ) (r + δ)) := measure_biUnion_finset_le _ _ + _ = ∑ _r ∈ S, ENNReal.ofReal (2 * δ) := by + apply Finset.sum_congr rfl + intro r _ + rw [Real.volume_Ioo] + congr 1 + ring + _ = ENNReal.ofReal (2 * δ * (S.card : ℝ)) := by + simp [Finset.sum_const, nsmul_eq_mul, ENNReal.ofReal_mul, mul_comm] + have hnot : ¬Ioo T (T + 1) ⊆ U := by + intro h + have hv := (measure_mono h).trans hvol + rw [Real.volume_Ioo, add_sub_cancel_left] at hv + norm_num at hv + exact (not_lt_of_ge hv) hsize + obtain ⟨t, ht, htu⟩ := Set.not_subset.mp hnot + refine ⟨t, ht, ?_⟩ + intro r hr + by_contra hd + have hd' := abs_lt.mp (lt_of_not_ge hd) + apply htu + exact mem_iUnion.mpr ⟨r, mem_iUnion.mpr ⟨hr, by constructor <;> linarith⟩⟩ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ForwardHistoryRate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ForwardHistoryRate.lean new file mode 100644 index 0000000000000000000000000000000000000000..7efab8126cdc60850fa5ed78c1c5974f347af341 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ForwardHistoryRate.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ForwardHistorySupport + +namespace OAI + +/-! # Squared forward-history weights under their original prime priors -/ + +namespace Ostmann + +open Filter +open scoped BigOperators Classical + +theorem forward_history_square_rate (n : ℕ) (K C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∀ N V : ℕ, ∀ Δ : ℝ, ∀ P : Finset ℕ, ∀ S : Finset ℤ, + (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + ∀ XL XR : ℤ, ∀ CL CR : List Bool → ℤ, + ∀ T : TreeLeafIndex n → Finset ℕ, ∀ h J : TreeLeafIndex n → ℕ, + ∀ hunit : ∀ t : FrequencyTree S n, ∀ p : P, + (p : ℕ).Coprime (historyFrequencyModulus S n n t), + (∀ t i, historyFrequencyModulus S n n t ≤ 2 ^ h i) → + (∀ i p, p ∈ T i → 2 ^ h i ≤ p ∧ p < 2 ^ (h i + J i)) → + ∀ a C₁ L : ℝ, 0 < a → 1 ≤ L → + (∀ i, a ≤ ∑ p ∈ T i, (p : ℝ)⁻¹) → + (∀ i, (J i : ℝ) ≤ Real.exp (C₁ * L)) → + ∀ pivots : FrequencyTree S n → (TreeLeafIndex n → P) → Fin (2 ^ n - 1) → ℤ, + ∀ W : FrequencyTree S n → (TreeLeafIndex n → P) → ℂ, + (∀ t x, ‖W t x‖ ^ 2 ≤ Real.exp (-(2 ^ n : ℕ) * Δ + K) * + frequencyLeafWeight (singleFrequencyLeaf S V) n t) → + (∀ t x, W t x ≠ 0 → forwardIntegerHistory S n (historyFrequencyModulus S n n t) + t XL XR CL CR + (sampledPrimeHistory P (historyFrequencyModulus S n n t) n (hunit t) x (pivots t x))) → + (∑ t, ∑ x, (∏ i, primeSubsetPrior P (T i) (x i)) * ‖W t x‖ ^ 2) ≤ + Real.exp ((C₁ + max (Real.log (3 / a)) 0) * (2 ^ n : ℕ) * L + ε * m) := by + filter_upwards [sampled_history_square_rate n n K C ε hC hε] with m hm + intro N V Δ P S hN hV hS XL XR CL CR T h J hunit hsmall hrange + a C₁ L ha hL hmass hJ pivots W hsize hnode + let R := historyFrequencyProduct S n + let D := fun t => forwardTreeAncestorScheme S n t XL XR CL CR + let : ∀ t, NeZero (R t ^ (n + 2)) := fun t => + ⟨Nat.ne_of_gt (historyFrequencyModulus_pos S (fun s hs => (hS s hs).1) n n t)⟩ + exact hm N V Δ P S hN hV hS R D + (fun t => forwardTreeAncestorScheme_depth S n t XL XR CL CR) + (fun t => forwardTreeAncestorScheme_root_ne_zero S n t XL XR CL CR (fun s hs => (hS s hs).1)) + (fun t => forwardTreeAncestorScheme_frequency_dvd S n t XL XR CL CR) + (fun _ _ => rfl) T h J hunit hsmall hrange a C₁ L ha hL hmass hJ pivots W hsize + (fun t x hx => forwardIntegerHistory_valid S n (R t ^ (n + 2)) t XL XR CL CR + (sampledPrimeHistory P _ n (hunit t) x (pivots t x)) (hnode t x hx)) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/ForwardHistorySupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ForwardHistorySupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..28f661ccb13e4bdedf77cdf1979409461cab4d85 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/ForwardHistorySupport.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Construction.HistoryGiantSources +import OAI.NumberTheory.Ostmann.Arithmetic.SampledHistoryRate +import OAI.NumberTheory.Ostmann.Arithmetic.SingleFrequencyModulus + +namespace OAI + +/-! # The constructed adaptive support for actual forward giant coefficients -/ + +namespace Ostmann + +open scoped Classical + +def forwardNodeGiants (n : ℕ) (XL XR : ℤ) (p : Fin (2 ^ n - 1) → ℤ) + (j : Fin (2 ^ n - 1)) : ℤ × ℤ := + ((historyGiantSources XL XR (preorderNodePath n j)).1.nodeValue n j p + (historyGiantSources_known XL XR _).1, + (historyGiantSources XL XR (preorderNodePath n j)).2.nodeValue n j p + (historyGiantSources_known XL XR _).2) + +/-- The actual node equations use the fixed nonbulk factor and the current +giant on each child. The support includes both coefficient unit conditions. -/ +def forwardIntegerHistory (S : Finset ℤ) (n Q : ℕ) (t : FrequencyTree S n) + (XL XR : ℤ) (CL CR : List Bool → ℤ) (a : SampledPivotHistory n Q) : Prop := + ∀ j : Fin (2 ^ n - 1), + let f := singleTreeNodeFrequencies S n t j.val + let path := preorderNodePath n j + let g := forwardNodeGiants n XL XR a.pivots j + f.left * (CR path * g.2) * a.rightProduct j - + f.right * (CL path * g.1) * a.leftProduct j = f.root * a.pivots j ∧ + IsCoprime (CR path * g.2) f.root ∧ IsCoprime (CL path * g.1) f.root + +theorem forwardIntegerHistory_valid (S : Finset ℤ) (n Q : ℕ) (t : FrequencyTree S n) + (XL XR : ℤ) (CL CR : List Bool → ℤ) (a : SampledPivotHistory n Q) + (ha : forwardIntegerHistory S n Q t XL XR CL CR a) : + a.valid (forwardTreeAncestorScheme S n t XL XR CL CR) := by + constructor + · intro j + rw [forwardTreeAncestorScheme_left, forwardTreeAncestorScheme_right] + exact (ha j).1 + · intro j + rw [forwardTreeAncestorScheme_left, forwardTreeAncestorScheme_right] + exact (ha j).2 + +theorem forwardTreeAncestorScheme_depth (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (XL XR : ℤ) (CL CR : List Bool → ℤ) (j : Fin (2 ^ n - 1)) : + (forwardTreeAncestorScheme S n t XL XR CL CR).depth j ≤ n := + (preorderNodePath_length n j).le + +theorem forwardTreeAncestorScheme_root_ne_zero (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (XL XR : ℤ) (CL CR : List Bool → ℤ) (hS : ∀ s ∈ S, s ≠ 0) + (j : Fin (2 ^ n - 1)) : + ((forwardTreeAncestorScheme S n t XL XR CL CR).frequencies j).root ≠ 0 := + hS _ (singleTreeNodeFrequencies_root_mem S n t j.val j.isLt) + +theorem forwardTreeAncestorScheme_frequency_dvd (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (XL XR : ℤ) (CL CR : List Bool → ℤ) (j : Fin (2 ^ n - 1)) : + ((forwardTreeAncestorScheme S n t XL XR CL CR).frequencies j).root.natAbs ∣ + historyFrequencyProduct S n t := by + apply history_node_dvd_frequencyProduct S n t + change singleTreeNodeFrequencies S n t j.val ∈ singleFrequencySplitList S n t + rw [singleTreeNodeFrequencies, List.getD_eq_getElem _ _ (by + simpa only [singleFrequencySplitList_length] using j.isLt)] + exact List.getElem_mem _ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBudgetRates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBudgetRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f324d99606d3c4fee3764052e574c11e2ba9f00 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBudgetRates.lean @@ -0,0 +1,61 @@ +import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticFrequencyTree +import OAI.NumberTheory.Ostmann.QuadraticCenter.UniformDivisorBound + +namespace OAI + +/-! # The frequency-tree cost is subexponential at fixed depth -/ + +namespace Ostmann + +open Filter + +theorem cubic_log_budget (C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∀ N : ℕ, (N : ℝ) ≤ Real.exp (C * m) → + 8 * (1 + Real.log N) ^ 3 ≤ Real.exp (ε * m) := by + have he := ((isLittleO_pow_exp_pos_mul_atTop 3 hε).const_mul_left + (8 * (1 + C) ^ 3)).bound (show (0 : ℝ) < 1 by norm_num) + filter_upwards [he, eventually_ge_atTop (1 : ℝ)] with m hm hm1 N hN + have hm0 : 0 ≤ m := by linarith + have hlog : Real.log N ≤ C * m := by + by_cases hn : N = 0 + · subst N + simpa using mul_nonneg hC hm0 + · exact (Real.log_le_iff_le_exp (by exact_mod_cast Nat.pos_of_ne_zero hn)).mpr hN + have hlog0 := Real.log_natCast_nonneg N + have hlin : 1 + Real.log N ≤ (1 + C) * m := by nlinarith + have hpoly : 8 * (1 + C) ^ 3 * m ^ 3 ≤ Real.exp (ε * m) := by + simpa only [Real.norm_eq_abs, abs_of_nonneg (by positivity : + 0 ≤ 8 * (1 + C) ^ 3 * m ^ 3), abs_of_pos (Real.exp_pos _), one_mul] using hm + calc + _ ≤ 8 * ((1 + C) * m) ^ 3 := by gcongr + _ = 8 * (1 + C) ^ 3 * m ^ 3 := by ring + _ ≤ _ := hpoly + +/-- One value of `D` controls every frequency divisor and every joint +square modulus up to `exp(2*C*m)`, with the total cost at most `exp(epsilon*m)`. -/ +theorem frequency_budget_subexponential (C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∃ D : ℝ, 0 ≤ D ∧ + (∀ n : ℕ, n ≠ 0 → (n : ℝ) ≤ Real.exp (2 * C * m) → + (n.divisors.card : ℝ) ≤ D) ∧ + (∀ N : ℕ, (N : ℝ) ≤ Real.exp (C * m) → + 8 * D ^ 4 * (1 + Real.log N) ^ 3 ≤ Real.exp (ε * m)) := by + obtain ⟨M, hM⟩ := divisors_subexponential_uniform (2 * C) (ε / 8) + (by positivity) (by positivity) + filter_upwards [eventually_ge_atTop M, cubic_log_budget C (ε / 2) hC (by positivity)] + with m hm hpoly + refine ⟨Real.exp ((ε / 8) * m), (Real.exp_pos _).le, hM m hm, fun N hN => ?_⟩ + have hexp : Real.exp ((ε / 8) * m) ^ 4 = Real.exp ((ε / 2) * m) := by + rw [← Real.exp_nat_mul] + congr 1 + ring + rw [hexp] + calc + _ = Real.exp ((ε / 2) * m) * (8 * (1 + Real.log N) ^ 3) := by ring + _ ≤ Real.exp ((ε / 2) * m) * Real.exp ((ε / 2) * m) := + mul_le_mul_of_nonneg_left (hpoly N hN) (Real.exp_pos _).le + _ = Real.exp (ε * m) := by rw [← Real.exp_add]; congr 1; ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBulkNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBulkNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a2d458f9a467f9165e4598f273dd25c6ed06ad2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBulkNorm.lean @@ -0,0 +1,160 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyBulkSupport +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenFrequencyAverage + +namespace OAI + +/-! # Sharp arithmetic probability retained in the bulk frequency norm -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem arithmeticLeafSupport_mean_le {Q : ℕ} [NeZero Q] + (S : Finset ℤ) (N n : ℕ) (D : ℝ) (hD : 0 ≤ D) + (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (t : FrequencyTree (S × S) n) + (data : (ZMod Q)ˣ → List (ZMod Q)ˣ → Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) + (hmatch : ∀ P past d e, data P past = some (d, e) → + d.hasFrequencies (treeNodeFrequencies S n t past.length).1 ∧ + e.hasFrequencies (treeNodeFrequencies S n t past.length).2) : + (Fintype.card (TreeLeafTuple (ZMod Q)ˣ n) : ℝ)⁻¹ * + (∑ z : TreeLeafTuple (ZMod Q)ˣ n, arithmeticLeafSupport n data z) ≤ + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + have he : (∏ j ∈ Finset.range (2 ^ n - 1), + pairFrequencySupportBound D (treeNodeFrequencies S n t j)) = + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + rw [← frequencySplitList_length S n t] + exact prod_range_list_getD _ _ _ + unfold arithmeticLeafSupport + apply treeLeaf_average_le (G := (ZMod Q)ˣ) n + (fun P x => sequentialSupport (fun past y => arithmeticPairSplitTest (data P past) y) + [] (2 ^ n - 1) (treeLeafSplitEquiv n P x)) _ + intro P + exact (arithmetic_leaf_support_fixed_frequencies (data P) (treeNodeFrequencies S n t) + D hD (hmatch P) (treeNodeFrequencies_divisor_bound S N D hD hS hdiv n t) n P).trans_eq he + +theorem uniform_average_norm_average_mul_le {A B : Type*} [Fintype A] [Fintype B] [Nonempty B] + (f : A → B → ℂ) (w : B → ℂ) (C K : ℝ) (hC : 0 ≤ C) + (hw : ∀ b, ‖w b‖ ≤ C) + (hf : ∀ b, (Fintype.card A : ℝ)⁻¹ * ∑ a, ‖f a b‖ ≤ K) : + (Fintype.card A : ℝ)⁻¹ * + (∑ a, ‖(Fintype.card B : ℂ)⁻¹ * ∑ b, f a b * w b‖) ≤ C * K := by + have hpoint (a : A) : ‖(Fintype.card B : ℂ)⁻¹ * ∑ b, f a b * w b‖ ≤ + (Fintype.card B : ℝ)⁻¹ * ∑ b, C * ‖f a b‖ := by + rw [norm_mul, norm_inv, Complex.norm_natCast] + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro b _ + rw [norm_mul] + exact (mul_le_mul_of_nonneg_left (hw b) (norm_nonneg _)).trans_eq (mul_comm _ _) + calc + _ ≤ (Fintype.card A : ℝ)⁻¹ * + ∑ a, (Fintype.card B : ℝ)⁻¹ * ∑ b, C * ‖f a b‖ := + mul_le_mul_of_nonneg_left (Finset.sum_le_sum fun a _ => hpoint a) + (inv_nonneg.mpr (Nat.cast_nonneg _)) + _ = (Fintype.card B : ℝ)⁻¹ * ∑ b, C * ((Fintype.card A : ℝ)⁻¹ * ∑ a, ‖f a b‖) := by + simp only [Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro b _ + apply Finset.sum_congr rfl + intro a _ + ring + _ ≤ (Fintype.card B : ℝ)⁻¹ * ∑ _b : B, C * K := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + exact Finset.sum_le_sum fun b _ => mul_le_mul_of_nonneg_left (hf b) hC + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + rw [← mul_assoc, inv_mul_cancel₀ (by exact_mod_cast Fintype.card_ne_zero), one_mul] + +section +variable {σ : Type*} (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (N : ℕ) (D : ℝ) (hD : 0 ≤ D) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (hm : 0 < m) + +include hslot hsmall ha hbase hS hR hD hN hdiv hm in +/-- The original bulk unit law gives the product of the simultaneous +quadratic-root bounds. The coefficient contains the literal data weights. -/ +theorem frequencyModelBulkCore_mean_le (x y : ℤ) : + let T := fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b) + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + (∑ z : TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ, + ‖movingFrequencyCore (Function.extend slot (fun j => (z j).val.val) base) F E T R x y‖) ≤ + (‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + intro T + let data := frequencyModelPairData base S n R t hS hR small a x y + let amp := ‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖ + have hs := arithmeticLeafSupport_mean_le S N n D hD (fun s hs => ⟨hS s hs, hN s hs⟩) + hdiv t data (frequencyModelPairData_frequencies base S n R t hS hR small a x y) + calc + _ ≤ (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + ∑ z : TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ, + amp * arithmeticLeafSupport n data + ((treeLeafTupleEquiv (ZMod (R ^ (n - 1 + 2)))ˣ n).symm (bulkBlockProduct z)) := by + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + exact Finset.sum_le_sum fun z _ => + frequencyModelBulkCore_norm_support base tier S n m R t hS hR slot small a hslot hsmall ha hbase F E x y z + _ = amp * ((Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + ∑ z : TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ, + arithmeticLeafSupport n data + ((treeLeafTupleEquiv (ZMod (R ^ (n - 1 + 2)))ˣ n).symm (bulkBlockProduct z))) := by + rw [← Finset.mul_sum] + ring + _ = amp * ((Fintype.card (TreeLeafTuple (ZMod (R ^ (n - 1 + 2)))ˣ n) : ℝ)⁻¹ * + ∑ z : TreeLeafTuple (ZMod (R ^ (n - 1 + 2)))ˣ n, arithmeticLeafSupport n data z) := by + rw [arithmeticLeafSupport_bulk_average n m hm data] + _ ≤ _ := mul_le_mul_of_nonneg_left hs (mul_nonneg (norm_nonneg _) (norm_nonneg _)) + +include hslot hsmall ha hbase hS hR hD hN hdiv hm in +/-- Discarding the Page multiplier costs only two and preserves every +frequency split saving under the original bulk law. -/ +theorem frequencyModelBulkPage_mean_le (input : PublishedProgressionInput) + (Q : ℕ) (Y : ℝ) (hY : 0 ≤ Y) : + let T := fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b) + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + (∑ z : TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ, + ‖movingFrequencyCorePageAverage (Function.extend slot (fun j => (z j).val.val) base) + F E T R (R ^ (n - 1 + 2)) input Q Y‖) ≤ + 2 * ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) := by + intro T + have h := uniform_average_norm_average_mul_le + (A := TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) + (B := ZMod (R ^ (n - 1 + 2)) × (ZMod (R ^ (n - 1 + 2)))ˣ) + (fun z (xy : ZMod (R ^ (n - 1 + 2)) × (ZMod (R ^ (n - 1 + 2)))ˣ) => + movingFrequencyCore (Function.extend slot (fun j => (z j).val.val) base) F E T R + xy.1.val xy.2.val.val) + (fun xy => pageGiantWeight input Q (R ^ (n - 1 + 2)) xy.2.val.val Y) + 2 ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) (by norm_num) + (fun xy => pageGiantWeight_norm_le_two input Q (R ^ (n - 1 + 2)) _ Y hY) + (fun xy => frequencyModelBulkCore_mean_le base tier S n m R t hS hR slot small a + hslot hsmall ha hbase F E N D hD hN hdiv hm xy.1.val xy.2.val.val) + simpa only [movingFrequencyCorePageAverage] using h + +end +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBulkSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBulkSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..0dfffb93e5e9f855e7c2066dc9f789d5fe9f0009 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyBulkSupport.lean @@ -0,0 +1,105 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelFrozen +import OAI.NumberTheory.Ostmann.Arithmetic.BulkFrequencyFactor +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSlotFieldBridge +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSpectatorNorm + +namespace OAI + +/-! # The frequency core under the original independent bulk-slot law -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem treeIntegerResidues_of_naturalLift {Q : ℕ} (n : ℕ) + (a : TreeLeafTuple ℕ n) (z : TreeLeafTuple (ZMod Q)ˣ n) + (h : TreeNaturalLift n a z) : + treeIntegerResidues Q n (treeLeafMap (fun q : ℕ => (q : ℤ)) n a) z := by + induction n with + | zero => simpa only [treeIntegerResidues, treeLeafMap, Int.cast_natCast] using h.symm + | succ n ih => exact ⟨ih a.1 z.1 h.1, ih a.2 z.2 h.2⟩ + +theorem bulkUnitRepresentative_coprime {σ J : Type*} (base : σ → ℕ) (slot : J ↪ σ) + (R Q : ℕ) [NeZero Q] (hRQ : R ∣ Q) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (z : J → (ZMod Q)ˣ) (i : σ) : + IsCoprime ((Function.extend slot (fun j => (z j).val.val) base i : ℕ) : ℤ) (R : ℤ) := by + by_cases hi : ∃ j, slot j = i + · obtain ⟨j, rfl⟩ := hi + rw [slot.injective.extend_apply] + have hc : IsCoprime ((z j).val.val : ℤ) (Q : ℤ) := by + apply IsCoprime.symm + apply (ZMod.coe_int_isUnit_iff_isCoprime _ Q).mp + simpa only [Int.cast_natCast, ZMod.natCast_zmod_val] using (z j).isUnit + exact hc.of_isCoprime_of_dvd_right (Int.natCast_dvd_natCast.mpr hRQ) + · rw [Function.extend_apply' _ base i hi] + exact hbase i hi + +/-- Keep the support indicator while taking the norm of the actual core. +The adaptive data uses the fixed nonbulk values; only the bulk law varies. -/ +theorem frequencyModelBulkCore_norm_support {σ : Type*} + (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (x y : ℤ) (z : TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : + let value := Function.extend slot (fun j => (z j).val.val) base + let T := fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b) + let Z := (treeLeafTupleEquiv (ZMod (R ^ (n - 1 + 2)))ˣ n).symm (bulkBlockProduct z) + ‖movingFrequencyCore value F E T R x y‖ ≤ + (‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + arithmeticLeafSupport n (frequencyModelPairData base S n R t hS hR small a x y) Z := by + intro value T Z + have hfixed (b : Bool) := frozenMoving_nonbulk_values tier base value slot n hslot + (fun i hi => Function.extend_apply' _ base i hi) (small b) (a b) (hsmall b) (ha b) + have hdata := frequencyModelPairData_congr value base S n R t hS hR small a x y + (fun b => (hfixed b).1) (fun b => (hfixed b).2) + have hunit := bulkUnitRepresentative_coprime base slot R (R ^ (n - 1 + 2)) + (dvd_pow_self R (by omega)) hbase z + have hz : treeIntegerResidues (R ^ (n - 1 + 2)) n + (treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n (bulkSlotLeaves n m slot))) Z := + treeIntegerResidues_of_naturalLift n _ _ (bulkSlotLeaves_naturalLift value n m slot z + (fun j => by + change ((Function.extend slot (fun j => (z j).val.val) base (slot j) : ℕ) : ZMod (R ^ (n - 1 + 2))) = _ + rw [slot.injective.extend_apply, ZMod.natCast_zmod_val])) + by_cases hg : ∀ b, movingFrequencyGate value R (T b) x y + · have hs := frequencyModelPairData_support value S n R t hS hR small + (bulkSlotLeaves n m slot) a x y hunit Z hz hg + rw [hdata] at hs + rw [hs, mul_one] + rw [movingFrequencyCore, ite_eq_left hg, norm_mul, Complex.norm_conj] + · rw [movingFrequencyCore, ite_eq_right hg, norm_zero] + exact mul_nonneg (mul_nonneg (norm_nonneg _) (norm_nonneg _)) + (arithmeticLeafSupport_nonneg n _ Z) + +/-- Passing from individual bulk slots to their leaf products is an exact +uniform averaging identity. -/ +theorem arithmeticLeafSupport_bulk_average {Q : ℕ} [NeZero Q] (n m : ℕ) (hm : 0 < m) + (data : (ZMod Q)ˣ → List (ZMod Q)ˣ → Option (ArithmeticSplitData Q × ArithmeticSplitData Q)) : + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod Q)ˣ) : ℝ)⁻¹ * + (∑ z : TreeLeafIndex n × Fin m → (ZMod Q)ˣ, arithmeticLeafSupport n data + ((treeLeafTupleEquiv (ZMod Q)ˣ n).symm (bulkBlockProduct z))) = + (Fintype.card (TreeLeafTuple (ZMod Q)ˣ n) : ℝ)⁻¹ * + ∑ z : TreeLeafTuple (ZMod Q)ˣ n, arithmeticLeafSupport n data z := by + have h := bulkBlockProduct_average (L := TreeLeafIndex n) (G := (ZMod Q)ˣ) (m := m) hm + (fun z => arithmeticLeafSupport n data ((treeLeafTupleEquiv (ZMod Q)ˣ n).symm z)) + let e := treeLeafTupleEquiv (ZMod Q)ˣ n + have he := e.symm.sum_comp (arithmeticLeafSupport n data) + have hc := Fintype.card_congr e + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at h he hc ⊢ + rw [← hc, he] at h + exact h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyLCM.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyLCM.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e54f4fff1c1e72bb33858ce62a991870443bdb2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyLCM.lean @@ -0,0 +1,89 @@ +import Mathlib.Data.Nat.GCD.Basic +import Mathlib.NumberTheory.Harmonic.Bounds +import Mathlib.Tactic.Linarith +import Mathlib.Tactic.Positivity +import Mathlib.Tactic.Ring + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.FrequencyLCM +open scoped BigOperators + +def gcdCoordinates (z : ℕ × ℕ) : ℕ × ℕ × ℕ := + (z.1.gcd z.2, z.1 / z.1.gcd z.2, z.2 / z.1.gcd z.2) + +theorem gcdCoordinates_injective : Function.Injective gcdCoordinates := by + intro x y h + have hd : x.1.gcd x.2 = y.1.gcd y.2 := congrArg Prod.fst h + have hu : x.1 / x.1.gcd x.2 = y.1 / y.1.gcd y.2 := congrArg (fun t => t.2.1) h + have hv : x.2 / x.1.gcd x.2 = y.2 / y.1.gcd y.2 := congrArg (fun t => t.2.2) h + apply Prod.ext + · calc + x.1 = x.1.gcd x.2 * (x.1 / x.1.gcd x.2) := (Nat.mul_div_cancel' (Nat.gcd_dvd_left _ _)).symm + _ = y.1.gcd y.2 * (y.1 / y.1.gcd y.2) := by rw [hu,hd] + _ = y.1 := Nat.mul_div_cancel' (Nat.gcd_dvd_left _ _) + · calc + x.2 = x.1.gcd x.2 * (x.2 / x.1.gcd x.2) := (Nat.mul_div_cancel' (Nat.gcd_dvd_right _ _)).symm + _ = y.1.gcd y.2 * (y.2 / y.1.gcd y.2) := by rw [hv,hd] + _ = y.2 := Nat.mul_div_cancel' (Nat.gcd_dvd_right _ _) + +theorem lcm_gcdCoordinates {a b : ℕ} (ha : 0 < a) : + a.lcm b = a.gcd b * (a/a.gcd b) * (b/a.gcd b) := by + have hg : 0 < a.gcd b := Nat.gcd_pos_of_pos_left b ha + apply Nat.eq_of_mul_eq_mul_left hg + have h₁ := Nat.mul_div_cancel' (Nat.gcd_dvd_left a b) + have h₂ := Nat.mul_div_cancel' (Nat.gcd_dvd_right a b) + have h₃ := Nat.gcd_mul_lcm a b + nlinarith + +theorem reciprocal_lcm_sum_le (V : ℕ) : + (∑ a ∈ Finset.Icc 1 V, ∑ b ∈ Finset.Icc 1 V, ((a.lcm b : ℕ):ℝ)⁻¹) ≤ + (∑ a ∈ Finset.Icc 1 V, (a:ℝ)⁻¹)^3 := by + let S := Finset.Icc 1 V + let T := S ×ˢ (S ×ˢ S) + let w : ℕ × ℕ × ℕ → ℝ := fun t => (t.1:ℝ)⁻¹*(t.2.1:ℝ)⁻¹*(t.2.2:ℝ)⁻¹ + have hsub : (S ×ˢ S).image gcdCoordinates ⊆ T := by + intro t ht + obtain ⟨⟨a,b⟩,hab,rfl⟩ := Finset.mem_image.mp ht + obtain ⟨ha,hb⟩ := Finset.mem_product.mp hab + obtain ⟨ha1,haV⟩ := Finset.mem_Icc.mp ha + obtain ⟨hb1,hbV⟩ := Finset.mem_Icc.mp hb + have hg : 0 < a.gcd b := Nat.gcd_pos_of_pos_left b ha1 + have hga : a.gcd b ≤ a := Nat.gcd_le_left b ha1 + have hgb : a.gcd b ≤ b := Nat.gcd_le_right a hb1 + have hua : 1 ≤ a / a.gcd b := Nat.one_le_div_iff hg |>.2 hga + have hub : 1 ≤ b / a.gcd b := Nat.one_le_div_iff hg |>.2 hgb + exact Finset.mem_product.mpr ⟨Finset.mem_Icc.mpr ⟨hg,hga.trans haV⟩, + Finset.mem_product.mpr ⟨Finset.mem_Icc.mpr ⟨hua,(Nat.div_le_self _ _).trans haV⟩, + Finset.mem_Icc.mpr ⟨hub,(Nat.div_le_self _ _).trans hbV⟩⟩⟩ + calc + _ = ∑ z ∈ S ×ˢ S, w (gcdCoordinates z) := by + rw [Finset.sum_product] + apply Finset.sum_congr rfl + intro a ha + apply Finset.sum_congr rfl + intro b hb + rw [lcm_gcdCoordinates (Finset.mem_Icc.mp ha).1] + simp [w,gcdCoordinates,mul_inv_rev, mul_comm, mul_left_comm, mul_assoc] + _ = ∑ t ∈ (S ×ˢ S).image gcdCoordinates, w t := + (Finset.sum_image (fun _ _ _ _ h => gcdCoordinates_injective h)).symm + _ ≤ ∑ t ∈ T, w t := Finset.sum_le_sum_of_subset_of_nonneg hsub (fun _ _ _ => by + dsimp [w]; positivity) + _ = _ := by + simp only [T,w,Finset.sum_product, ← Finset.mul_sum, ← Finset.sum_mul] + ring + +theorem reciprocal_lcm_sum_le_log (V : ℕ) : + (∑ a ∈ Finset.Icc 1 V, ∑ b ∈ Finset.Icc 1 V, ((a.lcm b : ℕ):ℝ)⁻¹) ≤ + (1+Real.log V)^3 := by + apply (reciprocal_lcm_sum_le V).trans + have h := harmonic_le_one_add_log V + simp only [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast] at h + exact pow_le_pow_left₀ (by positivity) h 3 + +end Ostmann.Arithmetic.FrequencyLCM + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelAdaptiveSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelAdaptiveSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..c98a67cb0e028b8efb28e55d0c714a8cfb129819 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelAdaptiveSupport.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelValidity +import OAI.NumberTheory.Ostmann.Arithmetic.MovingAdaptiveSupport + +namespace OAI + +/-! # Constructed split support for the arithmetic frequency gate -/ + +namespace Ostmann +open scoped Classical + +noncomputable def frequencyModelHistory {σ : Type*} (value : σ → ℕ) + (R : ℕ) (n : ℕ) (t : FrequencyTree ℤ n) + (small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (z : TreeLeafTuple (ZMod (R ^ (n - 1 + 2)))ˣ n) + (hz : treeIntegerResidues (R ^ (n - 1 + 2)) n + (treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)) z) : + SampledPivotHistory n (R ^ (n - 1 + 2)) where + bulk := treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk) + residue := z + pivots := frequencyModelPivots value R n (buildMovingSlotData n t small bulk a) x y + compatible := hz + +theorem frequencyModelHistory_valid {σ : Type*} (value : σ → ℕ) + (R : ℕ) (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (hsmall : ∀ i, IsCoprime (value i : ℤ) (R : ℤ)) (hR : ∀ j : Fin (2 ^ n - 1), (singleTreeNodeFrequencies S n t j.val).root.natAbs ∣ R) + (z : TreeLeafTuple (ZMod (R ^ (n - 1 + 2)))ˣ n) + (hz : treeIntegerResidues (R ^ (n - 1 + 2)) n + (treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)) z) + (hg : movingFrequencyGate value R + (buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a) x y) : + (frequencyModelHistory value R n (frequencyTreeMap Subtype.val n t) small bulk a x y z hz).modularValid + (frequencyModelAncestorScheme value S n t small a x y) R (n - 1) + (movingSampleCompensation value n small a) := by + constructor + · exact frequencyModel_modularEquations value R S n t small bulk a x y hsmall hg + · intro j + exact frequencyModel_coefficient_units value R S n t small bulk a x y hsmall hR hg j + +noncomputable def frequencyModelAdaptiveData {σ : Type*} (value : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) (t : FrequencyTree S n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ j : Fin (2 ^ n - 1), (singleTreeNodeFrequencies S n t j.val).root.natAbs ∣ R) + (small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) : + (ZMod (R ^ (n - 1 + 2)))ˣ → List (ZMod (R ^ (n - 1 + 2)))ˣ → + Option (ArithmeticSplitData (R ^ (n - 1 + 2))) := + modularAdaptiveData n R (n - 1) + (frequencyModelAncestorScheme value S n t small a x y) + (movingSampleCompensation value n small a) + (fun i => hS _ (singleTreeNodeFrequencies_root_mem S n t i.val i.isLt)) + hR + +theorem frequencyModelAdaptiveData_frequencies {σ : Type*} (value : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) (t : FrequencyTree S n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ j : Fin (2 ^ n - 1), (singleTreeNodeFrequencies S n t j.val).root.natAbs ∣ R) + (small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (total : (ZMod (R ^ (n - 1 + 2)))ˣ) (past : List (ZMod (R ^ (n - 1 + 2)))ˣ) + (d : ArithmeticSplitData (R ^ (n - 1 + 2))) + (hd : frequencyModelAdaptiveData value S n R t hS hR small a x y total past = some d) : + d.hasFrequencies (singleTreeNodeFrequencies S n t past.length) := by + by_cases hj : past.length < 2 ^ n - 1 + · exact modularAdaptiveData_frequencies n R (n - 1) + (frequencyModelAncestorScheme value S n t small a x y) + (movingSampleCompensation value n small a) _ _ total past hj d hd + · simp only [frequencyModelAdaptiveData, modularAdaptiveData, hj, dite_false] at hd + cases hd + +/-- Every residue tuple accepted by the existing frequency gate lies in the +constructed sequential support. No prime-line or integer-integrality test +has been reintroduced. -/ +theorem frequencyModelAdaptiveData_support {σ : Type*} (value : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree S n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ j : Fin (2 ^ n - 1), (singleTreeNodeFrequencies S n t j.val).root.natAbs ∣ R) + (small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (hsmall : ∀ i, IsCoprime (value i : ℤ) (R : ℤ)) + (z : TreeLeafTuple (ZMod (R ^ (n - 1 + 2)))ˣ n) + (hz : treeIntegerResidues (R ^ (n - 1 + 2)) n + (treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)) z) + (hg : movingFrequencyGate value R + (buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a) x y) : + singleArithmeticLeafSupport n + (frequencyModelAdaptiveData value S n R t hS hR small a x y) z = 1 := by + apply modularAdaptiveData_actual_support n R (n - 1) + (frequencyModelAncestorScheme value S n t small a x y) + (movingSampleCompensation value n small a) + (fun i => movingFrameConstants_compensation_coprime value R hsmall n small a + (preorderNodePath n i)) + (fun i => Nat.le_pred_of_lt (preorderNodePath_length n i)) + (fun i => hS _ (singleTreeNodeFrequencies_root_mem S n t i.val i.isLt)) + hR + (frequencyModelHistory value R n (frequencyTreeMap Subtype.val n t) small bulk a x y z hz) + exact frequencyModelHistory_valid value R S n t small bulk a x y hsmall hR z hz hg + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelCoefficients.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelCoefficients.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed05eabd0facff3b6760fe531201907f17fe4b1e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelCoefficients.lean @@ -0,0 +1,169 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelPaths + +namespace OAI + +/-! # Fixed factors and ancestor coefficients of the frequency model -/ + +namespace Ostmann +open scoped Classical + +def FrequencyModelState.leftProduct {σ : Type*} (value : σ → ℕ) : FrequencyModelState σ → ℤ + | ⟨0, _, _, _⟩ => 1 + | ⟨_ + 1, .node _ CL _ _ _ _, x, _⟩ => x * (MovingSlotReversal.naturalProduct value CL : ℤ) + +def FrequencyModelState.rightProduct {σ : Type*} (value : σ → ℕ) : FrequencyModelState σ → ℤ + | ⟨0, _, _, _⟩ => 1 + | ⟨_ + 1, .node _ _ CR _ _ _, _, y⟩ => y * (MovingSlotReversal.naturalProduct value CR : ℤ) + +def FrequencyModelState.compensation {σ : Type*} (value : σ → ℕ) : FrequencyModelState σ → ℤ + | ⟨0, _, _, _⟩ => 1 + | ⟨_ + 1, .node _ _ _ U _ _, _, _⟩ => MovingSlotReversal.naturalProduct value U + +def frequencyModelPivots {σ : Type*} (value : σ → ℕ) (R : ℤ) + (n : ℕ) (T : MovingSlotData σ n) (x y : ℤ) (j : Fin (2 ^ n - 1)) : ℤ := + (frequencyModelAtPath value R n T x y (preorderNodePath n j)).pivot value R + +theorem frequencyModelAtPath_giants {σ : Type*} (value : σ → ℕ) (R : ℤ) + (n : ℕ) (T : MovingSlotData σ n) (x y : ℤ) (path : List Bool) (hp : path.length < n) + (d : ℕ) (p : ℕ → ℤ) + (hanc : ∀ k < path.length, p (d + k) = + (frequencyModelAtPath value R n T x y (path.take k)).pivot value R) : + let z := frequencyModelAtPath value R n T x y path + (z.leftGiant, z.rightGiant) = evolveGiantValues p d (x, y) path := by + induction n generalizing x y path d with + | zero => simp at hp + | succ n ih => + cases T with + | node s CL CR U l r => + cases path with + | nil => rfl + | cons b path => + have hp' : path.length < n := by simpa using hp + let q := (MovingSlotData.step s CL CR U l r false).frequencyPivot value R (n + 1) x y + have hq : p d = q := by + simpa only [Nat.add_zero, List.take_zero, frequencyModelAtPath, + FrequencyModelState.pivot] using hanc 0 (by simp) + cases b <;> simp only [frequencyModelAtPath, Bool.false_eq_true, ite_false, ite_true] + · rw [evolveGiantValues, hq] + apply ih l q x path hp' (d + 1) + intro k hk + have h := hanc (k + 1) (by simpa using Nat.add_lt_add_right hk 1) + simpa only [Nat.add_assoc, Nat.add_comm 1 k, List.take_succ_cons, + frequencyModelAtPath, Bool.false_eq_true, ite_false] using h + · rw [evolveGiantValues, hq] + apply ih r q y path hp' (d + 1) + intro k hk + have h := hanc (k + 1) (by simpa using Nat.add_lt_add_right hk 1) + simpa only [Nat.add_assoc, Nat.add_comm 1 k, List.take_succ_cons, + frequencyModelAtPath, ite_true] using h + +theorem frequencyModelPivots_sources {σ : Type*} (value : σ → ℕ) (R : ℤ) + (n : ℕ) (T : MovingSlotData σ n) (x y : ℤ) (j : Fin (2 ^ n - 1)) : + let p := frequencyModelPivots value R n T x y + let z := frequencyModelAtPath value R n T x y (preorderNodePath n j) + (z.leftGiant, z.rightGiant) = + ((historyGiantSources x y (preorderNodePath n j)).1.nodeValue n j p + (historyGiantSources_known x y _).1, + (historyGiantSources x y (preorderNodePath n j)).2.nodeValue n j p + (historyGiantSources_known x y _).2) := by + dsimp only + let p := frequencyModelPivots value R n T x y + let q := fun k => if hk : k < (preorderNodePath n j).length then + p (ancestorNodeIndex n j ⟨k, hk⟩) else 0 + have h := frequencyModelAtPath_giants value R n T x y (preorderNodePath n j) + (preorderNodePath_length n j) 0 q (by + intro k hk + simp only [Nat.zero_add, q, dite_eq_left hk, p, frequencyModelPivots, ancestorNodeIndex_path]) + have heval := evolveGiantSources_eval q 0 (.fixed x, .fixed y) (preorderNodePath n j) + change _ = evolveGiantValues q 0 (x, y) (preorderNodePath n j) at heval + rw [← heval] at h + change _ = ((historyGiantSources x y (preorderNodePath n j)).1.eval q, + (historyGiantSources x y (preorderNodePath n j)).2.eval q) at h + rw [h] + have he (s : HistoryGiantSource) (hs : s.knownBefore (preorderNodePath n j).length) : + s.eval q = s.nodeValue n j p hs := by + cases s with + | fixed c => rfl + | ancestor i => + change (if hi : i < (preorderNodePath n j).length then + p (ancestorNodeIndex n j ⟨i, hi⟩) else 0) = _ + change i < (preorderNodePath n j).length at hs + rw [dite_eq_left hs] + rfl + exact Prod.ext (he _ (historyGiantSources_known x y _).1) + (he _ (historyGiantSources_known x y _).2) + +theorem frequencyModelAtPath_products {σ : Type*} (value : σ → ℕ) (R : ℤ) + (n : ℕ) (t : FrequencyTree ℤ n) (small bulk : TreeLeafTuple (List σ) n) + (a : MovingSampleSlots σ n) (x y : ℤ) (path : List Bool) (hp : path.length < n) : + let z := frequencyModelAtPath value R n (buildMovingSlotData n t small bulk a) x y path + let c := movingFrameConstants value n small a path + let b := movingBulkProducts value n bulk path + z.compensation value = c.compensation ∧ + z.leftProduct value = z.leftGiant * c.leftSmall * b.1 ∧ + z.rightProduct value = z.rightGiant * c.rightSmall * b.2 := by + induction n generalizing x y path with + | zero => simp at hp + | succ n ih => + cases a with + | node a l r => + cases path with + | nil => + simp only [frequencyModelAtPath, buildMovingSlotData, movingFrameConstants, + movingBulkProducts, FrequencyModelState.compensation, FrequencyModelState.leftProduct, + FrequencyModelState.rightProduct, movingNaturalProduct_append, Nat.cast_mul, + mul_assoc, and_self] + | cons b path => + have hp' : path.length < n := by simpa using hp + cases b + · exact ih t.2.1 (appendMovingSlotLeaves n (movingCompensationSlots n a) small.1) + bulk.1 l _ x path hp' + · exact ih t.2.2 (appendMovingSlotLeaves n (movingCompensationSlots n a) small.2) + bulk.2 r _ y path hp' + +noncomputable def frequencyModelAncestorScheme {σ : Type*} (value : σ → ℕ) + (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) : + PivotDependencyScheme (2 ^ n - 1) := + forwardTreeAncestorScheme S n t x y + (fun path => (movingFrameConstants value n small a path).leftSmall) + (fun path => (movingFrameConstants value n small a path).rightSmall) + +theorem frequencyModelNode_products {σ : Type*} (value : σ → ℕ) (R : ℤ) + (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) + (x y : ℤ) (j : Fin (2 ^ n - 1)) : + let tz := frequencyTreeMap Subtype.val n t + let T := buildMovingSlotData n tz small bulk a + let p := frequencyModelPivots value R n T x y + let D := frequencyModelAncestorScheme value S n t small a x y + let z := frequencyModelAtPath value R n T x y (preorderNodePath n j) + let b := (actualChildProducts n (treeLeafMap (fun q : ℕ => (q : ℤ)) n + (movingSlotValues value n bulk))).getD j.val (1, 1) + z.compensation value = movingSampleCompensation value n small a j ∧ + z.leftProduct value = D.rightCoefficient p j * b.1 ∧ + z.rightProduct value = D.leftCoefficient p j * b.2 := by + dsimp only + have hf := frequencyModelAtPath_products value R n (frequencyTreeMap Subtype.val n t) + small bulk a x y (preorderNodePath n j) (preorderNodePath_length n j) + have hg := frequencyModelPivots_sources value R n + (buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a) x y j + have hb := movingBulkProducts_preorder_intCast value n bulk j + have hl := congrArg Prod.fst hg + have hr := congrArg Prod.snd hg + have hbl := congrArg Prod.fst hb + have hbr := congrArg Prod.snd hb + dsimp only at hl hr hbl hbr + refine ⟨hf.1, ?_, ?_⟩ + · rw [hf.2.1] + change _ = (forwardTreeAncestorScheme S n t x y _ _).rightCoefficient _ j * _ + rw [forwardTreeAncestorScheme_right, ← hl, ← hbl] + ring + · rw [hf.2.2] + change _ = (forwardTreeAncestorScheme S n t x y _ _).leftCoefficient _ j * _ + rw [forwardTreeAncestorScheme_left, ← hr, ← hbr] + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelFrozen.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelFrozen.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f47b09bbcb35d6b5ddda282e82c4e51560df9eb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelFrozen.lean @@ -0,0 +1,106 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelPairSupport +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenMovingSamples + +namespace OAI + +/-! # Adaptive arithmetic data is fixed while the bulk residues vary -/ + +namespace Ostmann +open scoped Classical + +theorem movingFrameConstants_congr {σ : Type*} (v w : σ → ℕ) (n : ℕ) + (small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) + (hsmall : movingSlotValues v n small = movingSlotValues w n small) + (ha : a.values v = a.values w) (path : List Bool) : + movingFrameConstants v n small a path = movingFrameConstants w n small a path := by + induction a generalizing path with + | leaf => rfl + | @node n a l r ihL ihR => + have hsL := congrArg Prod.fst hsmall + have hsR := congrArg Prod.snd hsmall + dsimp only [movingSlotValues] at hsL hsR + have hc : movingCompensationValues v n a = movingCompensationValues w n a := by + injection ha + have hl : l.values v = l.values w := by injection ha + have hr : r.values v = r.values w := by injection ha + have hu : movingSlotValues v n (movingCompensationSlots n a) = + movingSlotValues w n (movingCompensationSlots n a) := by + rw [movingCompensationValues_product, movingCompensationValues_product, hc] + cases path with + | nil => + simp only [movingFrameConstants, movingSlotValues_flatten, hsL, hsR, hu] + | cons b path => + have hleft : movingSlotValues v n (appendMovingSlotLeaves n (movingCompensationSlots n a) small.1) = + movingSlotValues w n (appendMovingSlotLeaves n (movingCompensationSlots n a) small.1) := by + rw [movingSlotValues_append, movingSlotValues_append, hu, hsL] + have hright : movingSlotValues v n (appendMovingSlotLeaves n (movingCompensationSlots n a) small.2) = + movingSlotValues w n (appendMovingSlotLeaves n (movingCompensationSlots n a) small.2) := by + rw [movingSlotValues_append, movingSlotValues_append, hu, hsR] + cases b + · exact ihL _ hleft hl path + · exact ihR _ hright hr path + +theorem frequencyModelAncestorScheme_congr {σ : Type*} (v w : σ → ℕ) + (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (hsmall : movingSlotValues v n small = movingSlotValues w n small) + (ha : a.values v = a.values w) : + frequencyModelAncestorScheme v S n t small a x y = + frequencyModelAncestorScheme w S n t small a x y := by + unfold frequencyModelAncestorScheme + congr 1 + · funext path + rw [movingFrameConstants_congr v w n small a hsmall ha path] + · funext path + rw [movingFrameConstants_congr v w n small a hsmall ha path] + +theorem movingSampleCompensation_congr {σ : Type*} (v w : σ → ℕ) (n : ℕ) + (small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) + (hsmall : movingSlotValues v n small = movingSlotValues w n small) + (ha : a.values v = a.values w) : + movingSampleCompensation v n small a = movingSampleCompensation w n small a := by + funext j + unfold movingSampleCompensation + rw [movingFrameConstants_congr v w n small a hsmall ha] + +theorem frequencyModelAdaptiveData_congr {σ : Type*} (v w : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) (t : FrequencyTree S n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ j : Fin (2 ^ n - 1), (singleTreeNodeFrequencies S n t j.val).root.natAbs ∣ R) + (small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (hsmall : movingSlotValues v n small = movingSlotValues w n small) + (ha : a.values v = a.values w) : + frequencyModelAdaptiveData v S n R t hS hR small a x y = + frequencyModelAdaptiveData w S n R t hS hR small a x y := by + unfold frequencyModelAdaptiveData + have aux {D E : PivotDependencyScheme (2 ^ n - 1)} + {U V : Fin (2 ^ n - 1) → ℤ} (he : D = E) (hu : U = V) + (hsD : ∀ i, (D.frequencies i).root ≠ 0) (hsE : ∀ i, (E.frequencies i).root ≠ 0) + (hrD : ∀ i, (D.frequencies i).root.natAbs ∣ R) + (hrE : ∀ i, (E.frequencies i).root.natAbs ∣ R) : + modularAdaptiveData n R (n - 1) D U hsD hrD = + modularAdaptiveData n R (n - 1) E V hsE hrE := by + subst E + subst V + rfl + exact aux (frequencyModelAncestorScheme_congr v w S n t small a x y hsmall ha) + (movingSampleCompensation_congr v w n small a hsmall ha) _ _ _ _ + +theorem frequencyModelPairData_congr {σ : Type*} (v w : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) (x y : ℤ) + (hsmall : ∀ b, movingSlotValues v n (small b) = movingSlotValues w n (small b)) + (ha : ∀ b, (a b).values v = (a b).values w) : + frequencyModelPairData v S n R t hS hR small a x y = + frequencyModelPairData w S n R t hS hR small a x y := by + funext total past + unfold frequencyModelPairData + rw [frequencyModelAdaptiveData_congr v w S n R _ hS (hR false) (small false) (a false) x y + (hsmall false) (ha false), + frequencyModelAdaptiveData_congr v w S n R _ hS (hR true) (small true) (a true) x y + (hsmall true) (ha true)] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelModulus.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dde2ada8340e827b94a32ae9c5ec846cef3239d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelModulus.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelPairSupport +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFrequencyModulus + +namespace OAI + +/-! # A modulus using only the frequencies of the two fixed histories -/ + +namespace Ostmann +open scoped Classical + +def frequencyModelBase (S : Finset ℤ) (n : ℕ) (t : FrequencyTree (S × S) n) : ℕ := + historyFrequencyProduct S n (frequencyPairProjection S n false t) * + historyFrequencyProduct S n (frequencyPairProjection S n true t) + +theorem frequencyModelBase_pos (S : Finset ℤ) (n : ℕ) (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) : 0 < frequencyModelBase S n t := + Nat.mul_pos (historyFrequencyProduct_pos S hS n _) (historyFrequencyProduct_pos S hS n _) + +theorem frequencyModelBase_roots (S : Finset ℤ) (n : ℕ) (t : FrequencyTree (S × S) n) + (b : Bool) (j : Fin (2 ^ n - 1)) : + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ + frequencyModelBase S n t := by + have hj : j.val < (singleFrequencySplitList S n (frequencyPairProjection S n b t)).length := by + simpa only [singleFrequencySplitList_length] using j.isLt + have hmem : singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val ∈ + singleFrequencySplitList S n (frequencyPairProjection S n b t) := by + rw [singleTreeNodeFrequencies, List.getD_eq_getElem _ _ hj] + exact List.getElem_mem hj + have hd := history_node_dvd_frequencyProduct S n (frequencyPairProjection S n b t) _ hmem + cases b + · exact dvd_mul_of_dvd_left hd _ + · exact dvd_mul_of_dvd_right hd _ + +theorem frequencyModelBase_le (S : Finset ℤ) (n N : ℕ) (t : FrequencyTree (S × S) n) + (hN : ∀ s ∈ S, s.natAbs ≤ N) : + frequencyModelBase S n t ≤ N ^ (2 * (2 ^ (n + 1) - 1)) := by + calc + _ ≤ N ^ (2 ^ (n + 1) - 1) * N ^ (2 ^ (n + 1) - 1) := + Nat.mul_le_mul (historyFrequencyProduct_le S N hN n _) (historyFrequencyProduct_le S N hN n _) + _ = _ := by rw [← pow_add]; congr 1; omega + +theorem buildMovingSlotData_frequencyProduct_abs {σ : Type*} + (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) : + (buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a).frequencyProduct.natAbs = + historyFrequencyProduct S n t := by + induction a with + | leaf => rfl + | @node n u l r ihL ihR => + simp only [buildMovingSlotData, frequencyTreeMap, MovingSlotData.frequencyProduct, + Int.natAbs_mul, historyFrequencyProduct, ihL, ihR] + +theorem frequencyModelBase_actual {σ : Type*} + (S : Finset ℤ) (n m : ℕ) (t : FrequencyTree (S × S) n) + (small : Bool → TreeLeafTuple (List σ) n) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) (a : Bool → MovingSampleSlots σ n) : + (movingPairFrequencyBase (fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b))).natAbs = frequencyModelBase S n t := by + simp only [movingPairFrequencyBase, Int.natAbs_mul, buildMovingSlotData_frequencyProduct_abs, + frequencyModelBase] + +theorem frequencyModelBase_actual_dvd {σ : Type*} + (S : Finset ℤ) (n m : ℕ) (t : FrequencyTree (S × S) n) + (small : Bool → TreeLeafTuple (List σ) n) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) (a : Bool → MovingSampleSlots σ n) (b : Bool) : + (buildMovingSlotData n (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b)).frequencyProduct ∣ (frequencyModelBase S n t : ℤ) := by + let T := fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b) + have h := Int.natAbs_dvd_natAbs.mpr (movingPairFrequencyBase_dvd T b) + rw [frequencyModelBase_actual S n m t small slot a] at h + exact Int.natAbs_dvd.mp (Int.natCast_dvd_natCast.mpr h) + +theorem frequencyModelModulus_precision (R n : ℕ) : + (R : ℤ) ^ (n + 1) ∣ ((R ^ (n - 1 + 2) : ℕ) : ℤ) := by + rw [Nat.cast_pow] + exact pow_dvd_pow (R : ℤ) (by omega) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelPairSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelPairSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a97bac79e1217a3c43fe59b56a4ab6acd9d3792 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelPairSupport.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelAdaptiveSupport +import OAI.NumberTheory.Ostmann.Tree.PairedFrequencyProjection +import OAI.NumberTheory.Ostmann.Arithmetic.VariableModulusSupport + +namespace OAI + +/-! # Paired support for the two actual arithmetic frequency gates -/ + +namespace Ostmann +open scoped Classical + +noncomputable def frequencyModelPairData {σ : Type*} (value : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) (x y : ℤ) + (total : (ZMod (R ^ (n - 1 + 2)))ˣ) (past : List (ZMod (R ^ (n - 1 + 2)))ˣ) : + Option (ArithmeticSplitData (R ^ (n - 1 + 2)) × ArithmeticSplitData (R ^ (n - 1 + 2))) := + pairArithmeticData + (frequencyModelAdaptiveData value S n R (frequencyPairProjection S n false t) + hS (hR false) (small false) (a false) x y total past) + (frequencyModelAdaptiveData value S n R (frequencyPairProjection S n true t) + hS (hR true) (small true) (a true) x y total past) + +theorem frequencyModelPairData_frequencies {σ : Type*} (value : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) (x y : ℤ) + (total : (ZMod (R ^ (n - 1 + 2)))ˣ) (past : List (ZMod (R ^ (n - 1 + 2)))ˣ) + (d e : ArithmeticSplitData (R ^ (n - 1 + 2))) + (hde : frequencyModelPairData value S n R t hS hR small a x y total past = some (d, e)) : + d.hasFrequencies (treeNodeFrequencies S n t past.length).1 ∧ + e.hasFrequencies (treeNodeFrequencies S n t past.length).2 := by + let A := fun b => frequencyModelAdaptiveData value S n R (frequencyPairProjection S n b t) + hS (hR b) (small b) (a b) x y total past + change pairArithmeticData (A false) (A true) = some (d, e) at hde + cases hd : A false with + | none => simp [pairArithmeticData, hd] at hde + | some d' => + cases he : A true with + | none => simp [pairArithmeticData, he] at hde + | some e' => + have h : d' = d ∧ e' = e := by + simpa only [pairArithmeticData, hd, he, Option.some.injEq, Prod.mk.injEq] using hde + rcases h with ⟨rfl, rfl⟩ + have hL := frequencyModelAdaptiveData_frequencies value S n R + (frequencyPairProjection S n false t) hS (hR false) (small false) (a false) x y total past d' hd + have hR' := frequencyModelAdaptiveData_frequencies value S n R + (frequencyPairProjection S n true t) hS (hR true) (small true) (a true) x y total past e' he + simpa only [treeNodeFrequencies_projection, Bool.false_eq_true, ite_false, ite_true] + using And.intro hL hR' + +/-- The same tuple of bulk residues tests both histories, under the original +unit law. Only the two frequency gates are hypotheses. -/ +theorem frequencyModelPairData_support {σ : Type*} (value : σ → ℕ) + (S : Finset ℤ) (n R : ℕ) [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (small : Bool → TreeLeafTuple (List σ) n) (bulk : TreeLeafTuple (List σ) n) + (a : Bool → MovingSampleSlots σ n) (x y : ℤ) + (hsmall : ∀ i, IsCoprime (value i : ℤ) (R : ℤ)) + (z : TreeLeafTuple (ZMod (R ^ (n - 1 + 2)))ˣ n) + (hz : treeIntegerResidues (R ^ (n - 1 + 2)) n + (treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)) z) + (hg : ∀ b, movingFrequencyGate value R + (buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) bulk (a b)) x y) : + arithmeticLeafSupport n (frequencyModelPairData value S n R t hS hR small a x y) z = 1 := by + change arithmeticLeafSupport n (fun total past => pairArithmeticData + (frequencyModelAdaptiveData value S n R (frequencyPairProjection S n false t) + hS (hR false) (small false) (a false) x y total past) + (frequencyModelAdaptiveData value S n R (frequencyPairProjection S n true t) + hS (hR true) (small true) (a true) x y total past)) z = 1 + rw [arithmeticLeafSupport_pair, + frequencyModelAdaptiveData_support value S n R (frequencyPairProjection S n false t) + hS (hR false) (small false) bulk (a false) x y hsmall z hz (hg false), + frequencyModelAdaptiveData_support value S n R (frequencyPairProjection S n true t) + hS (hR true) (small true) bulk (a true) x y hsmall z hz (hg true), one_mul] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelPaths.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelPaths.lean new file mode 100644 index 0000000000000000000000000000000000000000..c762f5be8b61ea592c8845d20525e83347133bdd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelPaths.lean @@ -0,0 +1,115 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.MovingNodeUnits +import OAI.NumberTheory.Ostmann.Construction.ModularAdaptiveSupport + +namespace OAI + +/-! # Paths in the frequency-only arithmetic recursion + +These states follow `movingFrequencyGate`, whose pivots invert the fixed +compensation modulo a power of the frequency modulus. +-/ + +namespace Ostmann +open scoped Classical + +structure FrequencyModelState (σ : Type*) where + level : ℕ + data : MovingSlotData σ level + leftGiant : ℤ + rightGiant : ℤ + +def FrequencyModelState.pivot {σ : Type*} (value : σ → ℕ) (R : ℤ) : + FrequencyModelState σ → ℤ + | ⟨0, _, _, _⟩ => 0 + | ⟨n + 1, .node s CL CR U l r, x, y⟩ => + (MovingSlotData.step s CL CR U l r false).frequencyPivot value R (n + 1) x y + +def FrequencyModelState.frequencies {σ : Type*} : FrequencyModelState σ → NodeFrequencies + | ⟨0, .leaf s _, _, _⟩ => ⟨s, s, s⟩ + | ⟨_ + 1, .node s _ _ _ l r, _, _⟩ => ⟨s, l.frequency, r.frequency⟩ + +def frequencyModelAtPath {σ : Type*} (value : σ → ℕ) (R : ℤ) : + (n : ℕ) → MovingSlotData σ n → ℤ → ℤ → List Bool → FrequencyModelState σ + | 0, T, x, y, _ => ⟨0, T, x, y⟩ + | n + 1, T@(.node s CL CR U l r), x, y, path => + match path with + | [] => ⟨n + 1, T, x, y⟩ + | b :: path => + let p := (MovingSlotData.step s CL CR U l r false).frequencyPivot value R (n + 1) x y + if b then frequencyModelAtPath value R n r p y path + else frequencyModelAtPath value R n l p x path + +theorem frequencyModelAtPath_level {σ : Type*} (value : σ → ℕ) (R : ℤ) + (n : ℕ) (T : MovingSlotData σ n) (x y : ℤ) (path : List Bool) (hp : path.length < n) : + (frequencyModelAtPath value R n T x y path).level + path.length = n := by + induction n generalizing x y path with + | zero => simp at hp + | succ n ih => + cases T with + | node s CL CR U l r => + cases path with + | nil => rfl + | cons b path => + have hp' : path.length < n := by simpa using hp + cases b <;> simp only [frequencyModelAtPath, Bool.false_eq_true, ite_false, ite_true, + List.length_cons] + · have := ih l ((MovingSlotData.step s CL CR U l r false).frequencyPivot value R (n + 1) x y) x path hp'; omega + · have := ih r ((MovingSlotData.step s CL CR U l r false).frequencyPivot value R (n + 1) x y) y path hp'; omega + +theorem frequencyModelAtPath_gate {σ : Type*} (value : σ → ℕ) (R : ℤ) + (n : ℕ) (T : MovingSlotData σ n) (x y : ℤ) (path : List Bool) + (h : movingFrequencyGate value R T x y) : + let z := frequencyModelAtPath value R n T x y path + movingFrequencyGate value R z.data z.leftGiant z.rightGiant := by + induction n generalizing x y path with + | zero => cases T; exact h + | succ n ih => + cases T with + | node s CL CR U l r => + cases path with + | nil => exact h + | cons b path => + cases b + · exact ih l _ x path h.2.2.1 + · exact ih r _ y path h.2.2.2 + +theorem frequencyModelAtPath_frequencies {σ : Type*} (value : σ → ℕ) (R : ℤ) + (S : Finset ℤ) (n : ℕ) (T : MovingSlotData σ n) (t : FrequencyTree S n) + (hT : T.Follows (frequencyTreeMap Subtype.val n t)) + (x y : ℤ) (path : List Bool) (hp : path.length < n) : + (frequencyModelAtPath value R n T x y path).frequencies = + singleTreeNodeFrequencies S n t (nodePathIndex n path) := by + induction n generalizing x y path with + | zero => simp at hp + | succ n ih => + cases T with + | node s CL CR U l r => + cases path with + | nil => + change NodeFrequencies.mk s l.frequency r.frequency = _ + rw [hT.1, hT.2.1.root, hT.2.2.root] + simp only [frequencyTreeMap, frequencyRoot_map, nodePathIndex, + singleTreeNodeFrequencies, singleFrequencySplitList, List.getD_cons_zero] + | cons b path => + have hp' : path.length < n := by simpa using hp + have hidx := nodePathIndex_lt n path hp' + have hlen := singleFrequencySplitList_length S n t.2.1 + cases b + · change (frequencyModelAtPath value R n l _ x path).frequencies = _ + rw [ih l t.2.1 hT.2.1 _ x path hp'] + unfold singleTreeNodeFrequencies + simp only [nodePathIndex, Bool.false_eq_true, ite_false, singleFrequencySplitList] + rw [show 1 + nodePathIndex n path = nodePathIndex n path + 1 by omega, + List.getD_cons_succ, List.getD_append _ _ _ _ (by simpa only [hlen] using hidx)] + · change (frequencyModelAtPath value R n r _ y path).frequencies = _ + rw [ih r t.2.2 hT.2.2 _ y path hp'] + unfold singleTreeNodeFrequencies + simp only [nodePathIndex, ite_true, singleFrequencySplitList] + rw [show 2 ^ n + nodePathIndex n path = (2 ^ n - 1 + nodePathIndex n path) + 1 by + have := Nat.one_le_two_pow (n := n); omega, + List.getD_cons_succ, List.getD_append_right _ _ _ _ (by rw [hlen]; omega), hlen] + rw [show 2 ^ n - 1 + nodePathIndex n path - (2 ^ n - 1) = nodePathIndex n path by omega] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelValidity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelValidity.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b4146a89d1322b6727c3c0e6b1fe06c612177ac --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyModelValidity.lean @@ -0,0 +1,134 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelCoefficients + +namespace OAI + +/-! # The original frequency gate supplies modular adaptive validity -/ + +namespace Ostmann +open scoped Classical + +theorem FrequencyModelState.compensation_coprime {σ : Type*} (value : σ → ℕ) (R : ℤ) + (hsmall : ∀ i, IsCoprime (value i : ℤ) R) (z : FrequencyModelState σ) : + IsCoprime (z.compensation value) R := by + rcases z with ⟨n, T, x, y⟩ + cases T with + | leaf => exact isCoprime_one_left + | node s CL CR U l r => exact movingNaturalProduct_coprime value U R (fun i _ => hsmall i) + +theorem FrequencyModelState.relation {σ : Type*} (value : σ → ℕ) (R : ℤ) + (z : FrequencyModelState σ) + (hU : IsCoprime (z.compensation value) R) + (hg : movingFrequencyGate value R z.data z.leftGiant z.rightGiant) : + z.frequencies.left * z.rightProduct value - z.frequencies.right * z.leftProduct value ≡ + z.frequencies.root * z.compensation value * z.pivot value R [ZMOD R ^ z.level] := by + rcases z with ⟨n, T, x, y⟩ + cases T with + | leaf => simp [FrequencyModelState.frequencies, FrequencyModelState.leftProduct, + FrequencyModelState.rightProduct, FrequencyModelState.pivot] + | @node n s CL CR U l r => + let step := MovingSlotData.step s CL CR U l r false + let N := step.signedNumerator value x y + let u : ℤ := MovingSlotReversal.naturalProduct value U + have hd : s ∣ N := hg.2.1 + have hu : IsCoprime u R := hU + have hinv := coprime_bezout_inverse_modEq u R hu (n + 1) + change N ≡ s * u * ((N / s) * Int.gcdA u (R ^ (n + 1))) [ZMOD R ^ (n + 1)] + calc + N = s * (N / s) := (Int.mul_ediv_cancel' hd).symm + _ ≡ (s * (N / s)) * (u * Int.gcdA u (R ^ (n + 1))) [ZMOD R ^ (n + 1)] := by + simpa only [mul_one] using hinv.symm.mul_left (s * (N / s)) + _ = _ := by ring + +theorem FrequencyModelState.products_units {σ : Type*} (value : σ → ℕ) + (R : ℤ) (z : FrequencyModelState σ) + (hsmall : ∀ i, IsCoprime (value i : ℤ) z.frequencies.root) + (hg : movingFrequencyGate value R z.data z.leftGiant z.rightGiant) : + IsCoprime (z.leftProduct value) z.frequencies.root ∧ + IsCoprime (z.rightProduct value) z.frequencies.root := by + have hlocal : movingFrequencyLocalUnits z.data z.leftGiant z.rightGiant := by + rcases z with ⟨n, T, x, y⟩ + cases T + · exact hg + · exact hg.1 + rcases z with ⟨n, T, x, y⟩ + cases T with + | leaf => exact ⟨isCoprime_one_left, isCoprime_one_left⟩ + | node s CL CR U l r => + have hl := hlocal.1.of_isCoprime_of_dvd_right + (MovingSlotData.frequency_dvd_product (.node s CL CR U l r)) + have hr := hlocal.2.of_isCoprime_of_dvd_right + (MovingSlotData.frequency_dvd_product (.node s CL CR U l r)) + exact ⟨hl.mul_left (movingNaturalProduct_coprime value CL s (fun i _ => hsmall i)), + hr.mul_left (movingNaturalProduct_coprime value CR s (fun i _ => hsmall i))⟩ + +theorem frequencyModel_modularEquations {σ : Type*} (value : σ → ℕ) (R : ℕ) + (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (hsmall : ∀ i, IsCoprime (value i : ℤ) (R : ℤ)) + (hg : movingFrequencyGate value R + (buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a) x y) : + let T := buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a + let b := actualChildProducts n (treeLeafMap (fun q : ℕ => (q : ℤ)) n + (movingSlotValues value n bulk)) + (frequencyModelAncestorScheme value S n t small a x y).modularCompensatedEquations R (n - 1) + (movingSampleCompensation value n small a) + (fun j => (b.getD j.val (1, 1)).1) (fun j => (b.getD j.val (1, 1)).2) + (frequencyModelPivots value R n T x y) := by + dsimp only + intro j + let T := buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a + let z := frequencyModelAtPath value R n T x y (preorderNodePath n j) + have hgate := frequencyModelAtPath_gate value R n T x y (preorderNodePath n j) hg + have he := z.relation value R (z.compensation_coprime value R hsmall) hgate + have hp := frequencyModelNode_products value R S n t small bulk a x y j + have hf := frequencyModelAtPath_frequencies value R S n T t + (buildMovingSlotData_follows n _ small bulk a) x y (preorderNodePath n j) + (preorderNodePath_length n j) + have hl := frequencyModelAtPath_level value R n T x y (preorderNodePath n j) + (preorderNodePath_length n j) + rw [nodePathIndex_preorderNodePath] at hf + change z.level + (preorderNodePath n j).length = n at hl + have hn : 0 < n := lt_of_le_of_lt (Nat.zero_le _) (preorderNodePath_length n j) + have helevel : z.level = n - 1 + 1 - (preorderNodePath n j).length := by omega + change z.frequencies.left * z.rightProduct value - z.frequencies.right * z.leftProduct value ≡ + z.frequencies.root * z.compensation value * z.pivot value R [ZMOD (R : ℤ) ^ z.level] at he + rw [hp.1, hp.2.1, hp.2.2, hf, helevel] at he + simpa only [frequencyModelAncestorScheme, forwardTreeAncestorScheme, treeAncestorScheme, + frequencyModelPivots, mul_assoc] using he + +/-- Unit factors are retained from the exact local frequency gates. -/ +theorem frequencyModel_coefficient_units {σ : Type*} (value : σ → ℕ) (R : ℕ) + (S : Finset ℤ) (n : ℕ) (t : FrequencyTree S n) + (small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (x y : ℤ) + (hsmall : ∀ i, IsCoprime (value i : ℤ) (R : ℤ)) + (hR : ∀ j : Fin (2 ^ n - 1), (singleTreeNodeFrequencies S n t j.val).root.natAbs ∣ R) + (hg : movingFrequencyGate value R + (buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a) x y) + (j : Fin (2 ^ n - 1)) : + let T := buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a + let D := frequencyModelAncestorScheme value S n t small a x y + let p := frequencyModelPivots value R n T x y + IsCoprime (D.leftCoefficient p j) (D.frequencies j).root ∧ + IsCoprime (D.rightCoefficient p j) (D.frequencies j).root := by + dsimp only + let T := buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a + let z := frequencyModelAtPath value R n T x y (preorderNodePath n j) + have hf := frequencyModelAtPath_frequencies value R S n T t + (buildMovingSlotData_follows n _ small bulk a) x y (preorderNodePath n j) + (preorderNodePath_length n j) + rw [nodePathIndex_preorderNodePath] at hf + have hroot := congrArg NodeFrequencies.root hf + have hd : z.frequencies.root ∣ (R : ℤ) := by + rw [hroot] + exact Int.natAbs_dvd.mp (Int.natCast_dvd_natCast.mpr + (hR j)) + have hu := z.products_units value R + (fun i => (hsmall i).of_isCoprime_of_dvd_right hd) + (frequencyModelAtPath_gate value R n T x y (preorderNodePath n j) hg) + have hp := frequencyModelNode_products value R S n t small bulk a x y j + rw [hp.2.1, hp.2.2, hroot] at hu + exact ⟨hu.2.of_mul_left_left, hu.1.of_mul_left_left⟩ + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyMultiplicity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyMultiplicity.lean new file mode 100644 index 0000000000000000000000000000000000000000..357969ba6195ea88294003dbbf9aff783ae0323a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyMultiplicity.lean @@ -0,0 +1,51 @@ +import Mathlib + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.FrequencyMultiplicity +open scoped BigOperators + +def reducedModulus (v w s : ℤ) : ℕ := + s.natAbs / Nat.gcd (Nat.gcd v.natAbs w.natAbs) s.natAbs + +theorem frequency_eq_signed_divisor (v w s : ℤ) (hv : v ≠ 0) : + ∃ d ∈ (Nat.gcd v.natAbs w.natAbs).divisors, + s = ((reducedModulus v w s * d : ℕ):ℤ) ∨ + s = -((reducedModulus v w s * d : ℕ):ℤ) := by + let g := Nat.gcd v.natAbs w.natAbs + let d := g.gcd s.natAbs + have hg : g ≠ 0 := ne_of_gt (Nat.gcd_pos_of_pos_left _ (Int.natAbs_pos.mpr hv)) + refine ⟨d,Nat.mem_divisors.mpr ⟨Nat.gcd_dvd_left _ _,hg⟩,?_⟩ + have heq : reducedModulus v w s * d = s.natAbs := + Nat.div_mul_cancel (Nat.gcd_dvd_right _ _) + rw [heq] + exact Int.natAbs_eq s + +theorem reduced_fiber_card (v w : ℤ) (hv : v ≠ 0) (S : Finset ℤ) (a : ℕ) : + (S.filter fun s => reducedModulus v w s=a).card ≤ + 2 * (Nat.gcd v.natAbs w.natAbs).divisors.card := by + let D := (Nat.gcd v.natAbs w.natAbs).divisors + let f : Bool × ℕ → ℤ := fun z => if z.1 then ((a*z.2:ℕ):ℤ) else -((a*z.2:ℕ):ℤ) + have hsub : (S.filter fun s => reducedModulus v w s=a) ⊆ + (Finset.univ ×ˢ D).image f := by + intro s hs + obtain ⟨d,hd,hpos|hneg⟩ := frequency_eq_signed_divisor v w s hv + · refine Finset.mem_image.mpr ⟨(true,d),Finset.mem_product.mpr ⟨by simp,hd⟩,?_⟩ + simp only [f,ite_true] + rw [← (Finset.mem_filter.mp hs).2] + exact hpos.symm + · refine Finset.mem_image.mpr ⟨(false,d),Finset.mem_product.mpr ⟨by simp,hd⟩,?_⟩ + simp only [f,Bool.false_eq_true,ite_false] + rw [← (Finset.mem_filter.mp hs).2] + exact hneg.symm + calc + _ ≤ ((Finset.univ ×ˢ D).image f).card := Finset.card_le_card hsub + _ ≤ (Finset.univ ×ˢ D).card := Finset.card_image_le + _ = _ := by simp [D] + +end Ostmann.Arithmetic.FrequencyMultiplicity + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyPrecision.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyPrecision.lean new file mode 100644 index 0000000000000000000000000000000000000000..541977da9f84395278f4c4c6f249f51c173bd091 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyPrecision.lean @@ -0,0 +1,51 @@ +import Mathlib + +namespace OAI + +namespace Ostmann.Arithmetic.FrequencyPrecision + +def product (frequencies : List ℤ) : ℕ := (frequencies.map Int.natAbs).prod + +def modulus (frequencies : List ℤ) (depth : ℕ) : ℕ := + product frequencies ^ (depth+2) + +theorem frequency_dvd_product {frequencies : List ℤ} {s : ℤ} + (hs : s ∈ frequencies) : s.natAbs ∣ product frequencies := + List.dvd_prod (List.mem_map.mpr ⟨s,hs,rfl⟩) + +theorem prime_coprime_modulus {p : ℕ} (hp : p.Prime) (frequencies : List ℤ) + (hn : ∀ s ∈ frequencies, s ≠ 0) (hsize : ∀ s ∈ frequencies, s.natAbs < p) + (depth : ℕ) : p.Coprime (modulus frequencies depth) := by + apply Nat.Coprime.pow_right + apply Nat.coprime_list_prod_right_iff.mpr + intro n hmem + obtain ⟨s,hs,rfl⟩ := List.mem_map.mp hmem + apply hp.coprime_iff_not_dvd.mpr + intro hd + have := Nat.le_of_dvd (Int.natAbs_pos.mpr (hn s hs)) hd + exact (not_le.mpr (hsize s hs)) this + +theorem cancel_coprime {m u a b : ℤ} (hu : IsCoprime m u) + (h : u*a ≡ u*b [ZMOD m]) : a ≡ b [ZMOD m] := by + apply Int.modEq_iff_dvd.mpr + apply hu.dvd_of_dvd_mul_left + have hh := Int.modEq_iff_dvd.mp h + simpa only [mul_sub] using hh + +theorem reversal_precision_step {R s u p q : ℤ} (n : ℕ) + (hs : s ∣ R) (hs0 : s ≠ 0) (hu : IsCoprime u R) + (h : s*u*p ≡ s*u*q [ZMOD R^(n+1)]) : + p ≡ q [ZMOD R^n] := by + have hmod : s*R^n ∣ R^(n+1) := by + obtain ⟨t,ht⟩ := hs + refine ⟨t,?_⟩ + rw [pow_succ,ht] + ring + have h' : s*(u*p) ≡ s*(u*q) [ZMOD s*R^n] := by + simpa only [mul_assoc] using h.of_dvd hmod + have h'' := Int.ModEq.mul_left_cancel' hs0 h' + exact cancel_coprime hu.pow_right.symm h'' + +end Ostmann.Arithmetic.FrequencyPrecision + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyTreeNodes.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyTreeNodes.lean new file mode 100644 index 0000000000000000000000000000000000000000..b49ec1c9fe3229d23b0db4d08db452d027092051 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyTreeNodes.lean @@ -0,0 +1,126 @@ +import Mathlib.Data.List.GetD +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticFrequencyTree +import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSplitTreeSupport + +namespace OAI + +/-! # Preorder frequency data and its exact product of split costs -/ + +namespace Ostmann + +open scoped BigOperators Classical + +def pairedNodeFrequencies (S : Finset ℤ) (root left right : S × S) : + NodeFrequencies × NodeFrequencies := + (⟨root.1, left.1, right.1⟩, ⟨root.2, left.2, right.2⟩) + +theorem pairedNodeFrequencies_bound (S : Finset ℤ) (D : ℝ) (root left right : S × S) : + pairFrequencySupportBound D (pairedNodeFrequencies S root left right) = + pairedFrequencyKernel S D root left right := by + simp only [pairFrequencySupportBound, pairedNodeFrequencies, NodeFrequencies.reducedModulus, + pairedFrequencyKernel, div_eq_mul_inv] + +def frequencySplitList (S : Finset ℤ) : (n : ℕ) → + FrequencyTree (S × S) n → List (NodeFrequencies × NodeFrequencies) + | 0, _ => [] + | n + 1, x => pairedNodeFrequencies S x.1 (frequencyRoot n x.2.1) (frequencyRoot n x.2.2) :: + (frequencySplitList S n x.2.1 ++ frequencySplitList S n x.2.2) + +theorem frequencySplitList_length (S : Finset ℤ) (n : ℕ) (x : FrequencyTree (S × S) n) : + (frequencySplitList S n x).length = 2 ^ n - 1 := by + induction n with + | zero => rfl + | succ n ih => + simp only [frequencySplitList, List.length_cons, List.length_append, ih] + have hp : 1 ≤ 2 ^ n := Nat.one_le_two_pow + rw [pow_succ] + omega + +noncomputable def frequencyLeafWeight {A : Type} (W : A → ℝ) : + (n : ℕ) → FrequencyTree A n → ℝ + | 0, x => W x + | n + 1, x => frequencyLeafWeight W n x.2.1 * frequencyLeafWeight W n x.2.2 + +theorem frequencyLeafWeight_nonneg {A : Type} (W : A → ℝ) (hW : ∀ a, 0 ≤ W a) + (n : ℕ) (x : FrequencyTree A n) : 0 ≤ frequencyLeafWeight W n x := by + induction n with + | zero => exact hW x + | succ n ih => exact mul_nonneg (ih _) (ih _) + +theorem frequencyTreeWeight_eq_splitList (S : Finset ℤ) (D : ℝ) (W : S × S → ℝ) + (n : ℕ) (x : FrequencyTree (S × S) n) : + frequencyTreeWeight (pairedFrequencyKernel S D) W n x = + ((frequencySplitList S n x).map (pairFrequencySupportBound D)).prod * + frequencyLeafWeight W n x := by + induction n with + | zero => simp [frequencyTreeWeight, frequencySplitList, frequencyLeafWeight] + | succ n ih => + simp only [frequencyTreeWeight, frequencySplitList, frequencyLeafWeight, + List.map_cons, List.map_append, List.prod_cons, List.prod_append, + pairedNodeFrequencies_bound, ih] + ring + +theorem prod_range_list_getD {A : Type} (l : List A) (d : A) (f : A → ℝ) : + (∏ j ∈ Finset.range l.length, f (l.getD j d)) = (l.map f).prod := by + rw [← Fin.prod_univ_eq_prod_range] + calc + _ = ∏ i : Fin l.length, f l[i.val] := by + apply Finset.prod_congr rfl + intro i _ + rw [List.getD_eq_getElem l d i.isLt] + _ = _ := Fin.prod_univ_fun_getElem l f + +def emptyNodeFrequencies : NodeFrequencies := ⟨0, 0, 0⟩ + +def treeNodeFrequencies (S : Finset ℤ) (n : ℕ) (x : FrequencyTree (S × S) n) + (j : ℕ) : NodeFrequencies × NodeFrequencies := + (frequencySplitList S n x).getD j (emptyNodeFrequencies, emptyNodeFrequencies) + +theorem pairedNodeFrequencies_moduli_bounds (S : Finset ℤ) (N : ℕ) + (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) (root left right : S × S) : + (pairedNodeFrequencies S root left right).1.reducedModulus ∈ Finset.Icc 1 N ∧ + (pairedNodeFrequencies S root left right).2.reducedModulus ∈ Finset.Icc 1 N := by + constructor + · apply reducedFrequency_mem + exact Finset.mem_Icc.mpr ⟨Int.natAbs_pos.mpr (hS _ root.1.property).1, + (hS _ root.1.property).2⟩ + · apply reducedFrequency_mem + exact Finset.mem_Icc.mpr ⟨Int.natAbs_pos.mpr (hS _ root.2.property).1, + (hS _ root.2.property).2⟩ + +theorem frequencySplitList_moduli_bounds (S : Finset ℤ) (N : ℕ) + (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) (n : ℕ) (x : FrequencyTree (S × S) n) + (f : NodeFrequencies × NodeFrequencies) (hf : f ∈ frequencySplitList S n x) : + f.1.reducedModulus ∈ Finset.Icc 1 N ∧ f.2.reducedModulus ∈ Finset.Icc 1 N := by + induction n with + | zero => simp [frequencySplitList] at hf + | succ n ih => + simp only [frequencySplitList, List.mem_cons, List.mem_append] at hf + rcases hf with rfl | hf | hf + · exact pairedNodeFrequencies_moduli_bounds S N hS _ _ _ + · exact ih _ hf + · exact ih _ hf + +theorem treeNodeFrequencies_divisor_bound (S : Finset ℤ) (N : ℕ) (D : ℝ) (hD : 0 ≤ D) + (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (n : ℕ) (x : FrequencyTree (S × S) n) (j : ℕ) : + (((treeNodeFrequencies S n x j).1.reducedModulus.lcm + (treeNodeFrequencies S n x j).2.reducedModulus).divisors.card : ℝ) ≤ D := by + by_cases hj : j < (frequencySplitList S n x).length + · have hmem : treeNodeFrequencies S n x j ∈ frequencySplitList S n x := by + rw [treeNodeFrequencies, List.getD_eq_getElem _ _ hj] + exact List.getElem_mem hj + obtain ⟨ha, hb⟩ := frequencySplitList_moduli_bounds S N hS n x _ hmem + apply hdiv + · exact Nat.lcm_ne_zero (Nat.ne_of_gt (Finset.mem_Icc.mp ha).1) + (Nat.ne_of_gt (Finset.mem_Icc.mp hb).1) + · exact (Nat.lcm_le_mul (Finset.mem_Icc.mp ha).1 (Finset.mem_Icc.mp hb).1).trans (by + rw [pow_two] + exact Nat.mul_le_mul (Finset.mem_Icc.mp ha).2 (Finset.mem_Icc.mp hb).2) + · rw [treeNodeFrequencies, List.getD_eq_default _ _ (by omega)] + simpa [emptyNodeFrequencies, NodeFrequencies.reducedModulus, reducedFrequency] using hD + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyTreeSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyTreeSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..e2c81e44e541ee75be0b4bfb7b9f6fdcd4ec2435 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrequencyTreeSum.lean @@ -0,0 +1,94 @@ +import Mathlib.Algebra.Order.BigOperators.Ring.Finset +import Mathlib.Data.Fintype.Prod +import Mathlib.Algebra.BigOperators.Fin +import Mathlib.Basic.Real.Basic + +namespace OAI + +/-! # Summing internal frequencies from the root downwards -/ + +namespace Ostmann + +open scoped BigOperators + +@[implicit_reducible] def FrequencyTree (A : Type) : ℕ → Type + | 0 => A + | n + 1 => A × FrequencyTree A n × FrequencyTree A n + +instance frequencyTreeFintype (A : Type) [Fintype A] (n : ℕ) : + Fintype (FrequencyTree A n) := by + induction n with + | zero => exact inferInstanceAs (Fintype A) + | succ n ih => exact @instFintypeProd _ _ _ (@instFintypeProd _ _ ih ih) + +@[implicit_reducible] def frequencyRoot {A : Type} : (n : ℕ) → FrequencyTree A n → A + | 0, x => x + | _ + 1, x => x.1 + +noncomputable def frequencyTreeWeight {A : Type} (K : A → A → A → ℝ) (W : A → ℝ) : + (n : ℕ) → FrequencyTree A n → ℝ + | 0, x => W x + | n + 1, x => K x.1 (frequencyRoot n x.2.1) (frequencyRoot n x.2.2) * + frequencyTreeWeight K W n x.2.1 * frequencyTreeWeight K W n x.2.2 + +theorem frequencyTreeWeight_nonneg {A : Type} (K : A → A → A → ℝ) (W : A → ℝ) + (hK : ∀ a b c, 0 ≤ K a b c) (hW : ∀ a, 0 ≤ W a) + (n : ℕ) (x : FrequencyTree A n) : 0 ≤ frequencyTreeWeight K W n x := by + induction n with + | zero => exact hW x + | succ n ih => exact mul_nonneg (mul_nonneg (hK _ _ _) (ih x.2.1)) (ih x.2.2) + +/-- Each pair of parent frequencies is summed before either child pair. +Only the leaf mass remains after all internal frequencies are eliminated. -/ +theorem frequencyTree_sum_le {A : Type} [Fintype A] + (K : A → A → A → ℝ) (W : A → ℝ) (C : ℝ) + (hK : ∀ a b c, 0 ≤ K a b c) (hW : ∀ a, 0 ≤ W a) (hC : 0 ≤ C) + (hsum : ∀ b c, ∑ a : A, K a b c ≤ C) (n : ℕ) : + (∑ x : FrequencyTree A n, frequencyTreeWeight K W n x) ≤ + C ^ (2 ^ n - 1) * (∑ a : A, W a) ^ (2 ^ n) := by + induction n with + | zero => simp [FrequencyTree, frequencyTreeWeight] + | succ n ih => + have hweight := frequencyTreeWeight_nonneg K W hK hW n + have hsum0 : 0 ≤ ∑ x : FrequencyTree A n, frequencyTreeWeight K W n x := + Finset.sum_nonneg fun x _ => hweight x + have hbound0 : 0 ≤ C ^ (2 ^ n - 1) * (∑ a : A, W a) ^ (2 ^ n) := + mul_nonneg (pow_nonneg hC _) (pow_nonneg (Finset.sum_nonneg fun a _ => hW a) _) + change (∑ x : A × FrequencyTree A n × FrequencyTree A n, + K x.1 (frequencyRoot n x.2.1) (frequencyRoot n x.2.2) * + frequencyTreeWeight K W n x.2.1 * frequencyTreeWeight K W n x.2.2) ≤ _ + rw [Fintype.sum_prod_type] + simp_rw [Fintype.sum_prod_type] + rw [Finset.sum_comm] + calc + _ = ∑ x : FrequencyTree A n, ∑ y : FrequencyTree A n, + (∑ a : A, K a (frequencyRoot n x) (frequencyRoot n y)) * + frequencyTreeWeight K W n x * frequencyTreeWeight K W n y := by + apply Finset.sum_congr rfl + intro x _ + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro y _ + simp only [Finset.sum_mul] + _ ≤ ∑ x : FrequencyTree A n, ∑ y : FrequencyTree A n, + C * frequencyTreeWeight K W n x * frequencyTreeWeight K W n y := by + exact Finset.sum_le_sum fun x _ => Finset.sum_le_sum fun y _ => + mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_right (hsum _ _) (hweight x)) (hweight y) + _ = C * ((∑ x : FrequencyTree A n, frequencyTreeWeight K W n x) * + (∑ y : FrequencyTree A n, frequencyTreeWeight K W n y)) := by + simp only [← Finset.mul_sum, ← Finset.sum_mul] + ring + _ ≤ C * ((C ^ (2 ^ n - 1) * (∑ a : A, W a) ^ (2 ^ n)) * + (C ^ (2 ^ n - 1) * (∑ a : A, W a) ^ (2 ^ n))) := + mul_le_mul_of_nonneg_left (mul_le_mul ih ih hsum0 hbound0) hC + _ = _ := by + have hpow : 2 ^ (n + 1) = 2 ^ n + 2 ^ n := by omega + have hone : 1 ≤ 2 ^ n := Nat.one_le_two_pow + have hnodes : 2 ^ (n + 1) - 1 = (2 ^ n - 1) + (2 ^ n - 1) + 1 := by omega + rw [hnodes, hpow, pow_add, pow_add, pow_add, pow_one] + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenArithmeticFactors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenArithmeticFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..2bac58c6e557205fa7470b5de5dcc6c923252ddc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenArithmeticFactors.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenFrequencyAverage +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenSpectatorAverage +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenRegularSupport + +namespace OAI + +/-! # CRT identification of the actual bulk arithmetic factors -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem movingCoreSpectator_bulk_residues {σ I : Type*} [Fintype I] + (base value : σ → ℕ) (n m : ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (hv : ∀ i ∉ Set.range slot, value i = base i) + (t : Bool → FrequencyTree ℤ n) (small : Bool → TreeLeafTuple (List σ) n) + (samples : Bool → MovingSampleSlots σ n) + (hvsmall : ∀ b, movingSlotValues value n (small b) = movingSlotValues base n (small b)) + (hvsamples : ∀ b, (samples b).values value = (samples b).values base) + (e : Equiv.Perm (TreeLeafIndex n × Fin m)) + (T : Bool → MovingSlotData σ n) + (hT : ∀ b, T b = buildMovingSlotData n (t b) (small b) + (if b then bulkSlotLeaves n m (slot ∘ e.symm) else bulkSlotLeaves n m slot) (samples b)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (R : ℤ) (r : ℕ) [NeZero r] + (hf : ∀ b, (T b).Frequencies (· ≠ 0)) + (hcomp : ∀ b j, (T b).CompensationAbsent (slot j)) + (hR : ∀ b, (T b).frequencyProduct ∣ R) (hr : R ^ (n + 1) ∣ (r : ℤ)) + (p : I → ℕ) [∀ i, Fact (p i).Prime] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (D : ∀ i, Bool → (ZMod (p i))ˣ) + (z : TreeLeafIndex n × Fin m → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) + (hz : ∀ j, (value (slot j) : ZMod (∏ i, bulkResidueModuli r p i)) = (z j : ZMod _)) + (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : + movingFrequencyCorePageAverage value F E T R r input Q y * + ∏ i, movingSpectatorHaarAverage value (p i) (g i) (D i) T = + movingFrequencyCorePageAverage + (Function.extend slot (fun j => ((bulkResidueEquiv r p hc z).1 j).val.val) base) + F E T R r input Q y * + ∏ i, frozenBulkSpectatorHaar base n m t small samples (D i) e (g i) + ((bulkResidueEquiv r p hc z).2 i) := by + rw [movingFrequencyCorePageAverage_bulk_residues base value slot hv r + (bulkResidueEquiv r p hc z).1 + (bulkResidueEquiv_frequency_lift r p hc (value ∘ slot) z hz) + F E T R hf hcomp hR hr input Q y] + congr 1 + apply Finset.prod_congr rfl + intro i _ + have ht : T = fun b => buildMovingSlotData n (t b) (small b) + (if b then bulkSlotLeaves n m (slot ∘ e.symm) else bulkSlotLeaves n m slot) (samples b) := + funext hT + rw [ht] + exact frozenBulkSpectatorHaar_actual base n m t small samples (D i) e value + hvsmall hvsamples slot (g i) (hg i) ((bulkResidueEquiv r p hc z).2 i) + (bulkResidueEquiv_spectator_lift r p hc (value ∘ slot) z hz i) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenArithmeticNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenArithmeticNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..deef74adb48a8e601648f2f106f60e15e65ddb8d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenArithmeticNorm.lean @@ -0,0 +1,101 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenBulkFrequencyNorm +import OAI.NumberTheory.Ostmann.Arithmetic.BulkResidueAbsolute + +namespace OAI + +/-! # Full arithmetic norm for one common bulk assignment -/ + +namespace Ostmann +open scoped Classical BigOperators + +section +variable {σ I : Type*} [Fintype I] (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (N : ℕ) (D : ℝ) (hD : 0 ≤ D) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (hm : 0 < m) + +include hslot hsmall ha hbase hS hR hD hN hdiv hm in +/-- The nonnegative original arithmetic model retains the frequency saving, +the absolute spectator moments and the exact number of bulk Page factors. -/ +theorem frozenArithmetic_same_assignment_norm + (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) + (hp : ∀ i, 3 ≤ p i) + (hfreq : ∀ i b, movingGiantFrequencyUnits (p i) n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t))) + (hsmallp : ∀ i b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod (p i)) ≠ 0) + (hasamples : ∀ i b, ((a b).values base).UnitsAt (p i)) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, ∑ x : ZMod (p i), ‖g i x‖ ^ 2 ≤ (p i : ℝ)) + (twist : ∀ i, Bool → (ZMod (p i))ˣ) + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) (Q : ℕ) + (Y : ℝ) (hY : 0 ≤ Y) (Ybulk : TreeLeafIndex n × Fin m → ℝ) (hYbulk : ∀ j, 0 ≤ Ybulk j) : + let ts := fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t) + let T := fun b => buildMovingSlotData n (ts b) (small b) (bulkSlotLeaves n m slot) (a b) + let Freq := frozenBulkFrequencyFactor base slot outside F E T childBound R + (R ^ (n - 1 + 2)) input Q Y + let Spec := fun i => frozenBulkSpectatorHaar base n m ts small a (twist i) (Equiv.refl _) (g i) + (Fintype.card (TreeLeafIndex n × Fin m → + (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ) : ℝ)⁻¹ * + (∑ x : TreeLeafIndex n × Fin m → + (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ, + ‖(Freq (bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).1 * + ∏ j, pageGiantWeight input Q (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i) + (x j).val.val (Ybulk j)) * + ∏ i, Spec i ((bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).2 i)‖) ≤ + (2 : ℝ) ^ (2 ^ n * m) * + ((2 * ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod)) * + (3 : ℝ) ^ (2 ^ n * Fintype.card I)) := by + intro ts T Freq Spec + let B := 2 * ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) + have hprob : 0 ≤ ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + apply List.prod_nonneg + intro c hc + obtain ⟨f, _, rfl⟩ := List.mem_map.mp hc + exact pairFrequencySupportBound_nonneg D f + have hB : 0 ≤ B := by dsimp [B]; positivity + have hFreq : (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + ∑ z, ‖Freq z‖ ≤ B := + frozenBulkFrequencyFactor_mean_le base tier S n m R t hS hR slot small a hslot hsmall ha + hbase F E N D hD hN hdiv hm outside childBound input Q Y hY + have hSpec (i : I) : (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (p i))ˣ) : ℝ)⁻¹ * + ∑ z, ‖Spec i z‖ ≤ (3 : ℝ) ^ (2 ^ n) := + frozenBulkSpectatorHaar_absolute_mean_le (hp i) base n m hm ts small a + (hfreq i) (hsmallp i) (hasamples i) (twist i) (Equiv.refl _) (g i) (hg i) (henergy i) + have h := bulk_residue_absolute_mean_le (I := I) (J := TreeLeafIndex n × Fin m) + (R ^ (n - 1 + 2)) p hc input Q Ybulk hYbulk + Freq Spec B hB (fun _ => (3 : ℝ) ^ (2 ^ n)) + (by + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at hFreq ⊢ + exact hFreq) + (by + intro i + have hi := hSpec i + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at hi ⊢ + exact hi) + simp only [Fintype.card_prod, card_treeLeafIndex, Fintype.card_fin, Finset.prod_const, + Finset.card_univ, ← pow_mul, B] at h + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at h ⊢ + exact h + +end +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenBulkFrequencyNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenBulkFrequencyNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..031b636071c122c84e49c7cfdc3736259ce1b069 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenBulkFrequencyNorm.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyBulkNorm +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenSupportedArithmetic + +namespace OAI + +/-! # The frequency norm with the original fixed nonbulk masks -/ + +namespace Ostmann +open scoped Classical BigOperators + +section +variable {σ : Type*} (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (N : ℕ) (D : ℝ) (hD : 0 ≤ D) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (hm : 0 < m) + +include hslot hsmall ha hbase hS hR hD hN hdiv hm in +/-- The retained fixed support mask can only decrease the bulk norm. -/ +theorem frozenBulkFrequencyFactor_mean_le + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) + (Q : ℕ) (Y : ℝ) (hY : 0 ≤ Y) : + let T := fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b) + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + (∑ z : TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ, + ‖frozenBulkFrequencyFactor base slot outside F E T childBound R + (R ^ (n - 1 + 2)) input Q Y z‖) ≤ + 2 * ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) := by + intro T + apply le_trans _ (frequencyModelBulkPage_mean_le base tier S n m R t hS hR slot small a + hslot hsmall ha hbase F E N D hD hN hdiv hm input Q Y hY) + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + apply Finset.sum_le_sum + intro z _ + unfold frozenBulkFrequencyFactor + split_ifs + · rw [one_mul] + · simpa only [zero_mul, norm_zero] using norm_nonneg + (movingFrequencyCorePageAverage (Function.extend slot (fun j => (z j).val.val) base) + F E T R (R ^ (n - 1 + 2)) input Q Y) + +end +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenFrequencyAverage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenFrequencyAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..d717d9e07dfb6178f8d3e6bfc223f7b2d64d1019 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenFrequencyAverage.lean @@ -0,0 +1,101 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkFrequencyRepresentative +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSeparatedAverageNorm + +namespace OAI + +/-! # The frequency/Page average on the fixed bulk residue representative -/ + +namespace Ostmann +open scoped Classical BigOperators ComplexConjugate + +theorem extend_eq_of_eq_off_range {σ J A : Type*} (e : J ↪ σ) (f : J → A) + (v w : σ → A) (h : ∀ i ∉ Set.range e, v i = w i) : + Function.extend e f v = Function.extend e f w := by + funext i + by_cases hi : ∃ j, e j = i + · obtain ⟨j, rfl⟩ := hi + rw [e.injective.extend_apply, e.injective.extend_apply] + · rw [Function.extend_apply' _ v i hi, Function.extend_apply' _ w i hi, h i hi] + +noncomputable def movingFrequencyCorePageAverage {σ : Type*} (value : σ → ℕ) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (R : ℤ) + (r : ℕ) [NeZero r] (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : ℂ := + (Fintype.card (ZMod r × (ZMod r)ˣ) : ℂ)⁻¹ * + ∑ z : ZMod r × (ZMod r)ˣ, + movingFrequencyCore value F E T R z.1.val z.2.val.val * + pageGiantWeight input Q r z.2.val.val y + +theorem movingFrequencyPageAverage_core {σ : Type*} (value : σ → ℕ) + (outside : List ℕ) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (nodes : Bool → List MovingFormulaNode) + (R : ℤ) (r : ℕ) [NeZero r] (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : + movingFrequencyPageAverage value outside F E T nodes R r input Q y = + (if ∀ b, movingRegularOutsidePairwise value outside (T b) ∧ + (∀ f ∈ nodes b, f.guard.frequencyBounds) then (1 : ℂ) else 0) * + movingFrequencyCorePageAverage value F E T R r input Q y := by + simp only [movingFrequencyPageAverage, movingFrequencyPairFactor_core, + movingFrequencyCorePageAverage, Finset.mul_sum] + apply Finset.sum_congr rfl + intro z _ + ring + +theorem movingFrequencyCorePageAverage_bulk_residues {σ J : Type*} + (base value : σ → ℕ) (e : J ↪ σ) (hv : ∀ i ∉ Set.range e, value i = base i) + (r : ℕ) [NeZero r] (a : J → (ZMod r)ˣ) + (ha : ∀ j, (value (e j) : ZMod r) = (a j : ZMod r)) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (R : ℤ) + (hf : ∀ b, (T b).Frequencies (· ≠ 0)) + (hT : ∀ b j, (T b).CompensationAbsent (e j)) + (hR : ∀ b, (T b).frequencyProduct ∣ R) (hr : R ^ (n + 1) ∣ (r : ℤ)) + (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : + movingFrequencyCorePageAverage value F E T R r input Q y = + movingFrequencyCorePageAverage (Function.extend e (fun j => (a j).val.val) base) + F E T R r input Q y := by + unfold movingFrequencyCorePageAverage + apply congrArg ((Fintype.card (ZMod r × (ZMod r)ˣ) : ℂ)⁻¹ * ·) + apply Finset.sum_congr rfl + intro z _ + rw [movingFrequencyCore_bulk_residues value e r a ha F E T R hf hT hR hr, + extend_eq_of_eq_off_range e _ value base hv] + +theorem movingFrequencyCorePageAverage_norm_le {σ : Type*} (value : σ → ℕ) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (R : ℤ) + (r : ℕ) [NeZero r] (input : PublishedProgressionInput) (Q : ℕ) + (y : ℝ) (hy : 0 ≤ y) : + ‖movingFrequencyCorePageAverage value F E T R r input Q y‖ ≤ + 2 * (‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) := by + let B := 2 * (‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) + have hb (z : ZMod r × (ZMod r)ˣ) : + ‖movingFrequencyCore value F E T R z.1.val z.2.val.val * + pageGiantWeight input Q r z.2.val.val y‖ ≤ B := by + unfold movingFrequencyCore + split_ifs + · rw [norm_mul, norm_mul, Complex.norm_conj] + exact (mul_le_mul_of_nonneg_left (pageGiantWeight_norm_le_two input Q r _ y hy) + (mul_nonneg (norm_nonneg _) (norm_nonneg _))).trans_eq (mul_comm _ _) + · simpa only [zero_mul, norm_zero] using + mul_nonneg (by norm_num : (0 : ℝ) ≤ 2) (mul_nonneg (norm_nonneg _) (norm_nonneg _)) + have hc : (Fintype.card (ZMod r × (ZMod r)ˣ) : ℝ) ≠ 0 := by + exact_mod_cast (Fintype.card_ne_zero : Fintype.card (ZMod r × (ZMod r)ˣ) ≠ 0) + rw [movingFrequencyCorePageAverage, norm_mul, norm_inv, Complex.norm_natCast] + calc + _ ≤ (Fintype.card (ZMod r × (ZMod r)ˣ) : ℝ)⁻¹ * ∑ _z : ZMod r × (ZMod r)ˣ, B := + mul_le_mul_of_nonneg_left ((norm_sum_le _ _).trans (Finset.sum_le_sum fun z _ => hb z)) + (inv_nonneg.mpr (Nat.cast_nonneg _)) + _ = _ := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + rw [← mul_assoc, inv_mul_cancel₀ hc, one_mul] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenFrequencySupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenFrequencySupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..46a6289896c2663f62b83943733fac929b6a16f2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenFrequencySupport.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenFrequencyAverage +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenRegularSupport + +namespace OAI + +/-! # The full frequency factor retains precisely the fixed nonbulk support -/ + +namespace Ostmann +open scoped Classical + +theorem movingFrequencyPageAverage_nonbulk {σ : Type*} + (value base : σ → ℕ) (bulk : σ → Bool) (outside : List ℕ) + (hv : ∀ i, bulk i = false → value i = base i) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (nodes : Bool → List MovingFormulaNode) + (hprime : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, (value i).Prime) + (hnodup : ∀ b, ∀ L ∈ (T b).regularLists, (L.filter bulk).Nodup) + (hinj : ∀ i j, bulk i = true → bulk j = true → value i = value j → i = j) + (hcross : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, ∀ j ∈ L, + bulk i ≠ bulk j → value i ≠ value j) + (hout : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, bulk i = true → + ∀ p ∈ outside, (value i).Coprime p) + (R : ℤ) (r : ℕ) [NeZero r] (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : + movingFrequencyPageAverage value outside F E T nodes R r input Q y = + (if ∀ b, movingNonbulkOutsidePairwise base bulk outside (T b) ∧ + (∀ f ∈ nodes b, f.guard.frequencyBounds) then (1 : ℂ) else 0) * + movingFrequencyCorePageAverage value F E T R r input Q y := by + have hsupport : (∀ b, movingRegularOutsidePairwise value outside (T b) ∧ + (∀ f ∈ nodes b, f.guard.frequencyBounds)) ↔ + (∀ b, movingNonbulkOutsidePairwise base bulk outside (T b) ∧ + (∀ f ∈ nodes b, f.guard.frequencyBounds)) := by + apply forall_congr' + intro b + exact and_congr (movingRegularOutsidePairwise_frozen value base bulk outside (T b) + hv (hprime b) (hnodup b) hinj (hcross b) (hout b)) Iff.rfl + rw [movingFrequencyPageAverage_core] + simp only [hsupport] + +/-- For the literal formula-node list, the remaining frequency-size tests +depend on the frequency tree alone. -/ +theorem movingFrequencyPageAverage_actual_nonbulk {σ : Type*} + (value base : σ → ℕ) (bulk : σ → Bool) (outside : List ℕ) + (hv : ∀ i, bulk i = false → value i = base i) + (hvalue : ∀ i, value i ≠ 0) (childBound pivotBound : ℕ → ℕ) + (F : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℂ) + (E : Bool → {n : ℕ} → MovingSlotData σ n → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (hf : ∀ b, (T b).Frequencies (· ≠ 0)) + (hprime : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, (value i).Prime) + (hnodup : ∀ b, ∀ L ∈ (T b).regularLists, (L.filter bulk).Nodup) + (hinj : ∀ i j, bulk i = true → bulk j = true → value i = value j → i = j) + (hcross : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, ∀ j ∈ L, + bulk i ≠ bulk j → value i ≠ value j) + (hout : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, bulk i = true → + ∀ p ∈ outside, (value i).Coprime p) + (R : ℤ) (r : ℕ) [NeZero r] (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : + movingFrequencyPageAverage value outside F E T + (fun b => (T b).formulaNodes value hvalue childBound pivotBound (hf b) + (.prime false) (.prime true)) R r input Q y = + (if ∀ b, movingNonbulkOutsidePairwise base bulk outside (T b) ∧ + (T b).FrequencyBounds childBound then (1 : ℂ) else 0) * + movingFrequencyCorePageAverage value F E T R r input Q y := by + rw [movingFrequencyPageAverage_nonbulk value base bulk outside hv F E T _ + hprime hnodup hinj hcross hout] + have he : (∀ b, movingNonbulkOutsidePairwise base bulk outside (T b) ∧ + ∀ f ∈ (T b).formulaNodes value hvalue childBound pivotBound (hf b) + (.prime false) (.prime true), f.guard.frequencyBounds) ↔ + (∀ b, movingNonbulkOutsidePairwise base bulk outside (T b) ∧ + (T b).FrequencyBounds childBound) := by + apply forall_congr' + intro b + exact and_congr Iff.rfl ((T b).formulaNodes_frequencyBounds value hvalue childBound + pivotBound (hf b) (.prime false) (.prime true)) + simp only [he] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenMovingSamples.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenMovingSamples.lean new file mode 100644 index 0000000000000000000000000000000000000000..375c4e9f1c28202dab7c9a24aa5decca95749c02 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenMovingSamples.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.MovingSampleValues + +namespace OAI + +/-! # The actual low-tier samples stay fixed when bulk slots vary -/ + +namespace Ostmann +open scoped Classical + +theorem movingSlotValues_congr {σ : Type*} (v w : σ → ℕ) (n : ℕ) + (small : TreeLeafTuple (List σ) n) + (h : ∀ i ∈ flattenMovingSlots n small, v i = w i) : + movingSlotValues v n small = movingSlotValues w n small := by + induction n with + | zero => + unfold movingSlotValues MovingSlotReversal.naturalProduct + congr 1 + exact List.map_congr_left h + | succ n ih => + exact Prod.ext + (ih small.1 (fun i hi => h i (List.mem_append_left _ hi))) + (ih small.2 (fun i hi => h i (List.mem_append_right _ hi))) + +theorem movingCompensationValues_congr {σ : Type*} (v w : σ → ℕ) (n : ℕ) + (samples : TreeLeafTuple (Fin 4 → σ) n) + (h : ∀ i ∈ flattenMovingSlots n (movingCompensationSlots n samples), v i = w i) : + movingCompensationValues v n samples = movingCompensationValues w n samples := by + induction n with + | zero => + funext i + apply h + exact List.mem_ofFn.mpr ⟨i, rfl⟩ + | succ n ih => + exact Prod.ext + (ih samples.1 (fun i hi => h i (List.mem_append_left _ hi))) + (ih samples.2 (fun i hi => h i (List.mem_append_right _ hi))) + +/-- All internal samples have lower tier than the current bulk. This proves +equality of the complete sampled tree, including its shared child samples. -/ +theorem MovingSampleSlots.values_eq_of_levels {σ : Type*} (tier : σ → ℕ) + (v w : σ → ℕ) (k : ℕ) (heq : ∀ i, tier i < k → v i = w i) + {n : ℕ} (samples : MovingSampleSlots σ n) (hn : n ≤ k) + (hlevels : samples.Levels tier) : samples.values v = samples.values w := by + induction samples with + | leaf => rfl + | @node n s left right ihL ihR => + change MovingGiantSamples.node (movingCompensationValues v n s) (left.values v) (right.values v) = + MovingGiantSamples.node (movingCompensationValues w n s) (left.values w) (right.values w) + congr 1 + · apply movingCompensationValues_congr + intro i hi + apply heq + rw [hlevels.1 i hi] + omega + · exact ihL (by omega) hlevels.2.1 + · exact ihR (by omega) hlevels.2.2 + +/-- Replacing precisely the selected bulk coordinates preserves both sources +of nonbulk data used to construct the field diagram. -/ +theorem frozenMoving_nonbulk_values {σ J : Type*} (tier : σ → ℕ) + (base value : σ → ℕ) (e : J ↪ σ) (n : ℕ) + (he : ∀ j, n ≤ tier (e j)) + (hv : ∀ i ∉ Set.range e, value i = base i) + (small : TreeLeafTuple (List σ) n) (samples : MovingSampleSlots σ n) + (hsmall : ∀ i ∈ flattenMovingSlots n small, i ∉ Set.range e) + (hsamples : samples.Levels tier) : + movingSlotValues value n small = movingSlotValues base n small ∧ + samples.values value = samples.values base := by + refine ⟨movingSlotValues_congr value base n small (fun i hi => hv i (hsmall i hi)), ?_⟩ + apply samples.values_eq_of_levels tier value base n _ (le_refl _) hsamples + intro i hi + apply hv + rintro ⟨j, rfl⟩ + exact (not_lt_of_ge (he j)) hi + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenPrimeArithmeticNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenPrimeArithmeticNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..3de2d0aeaacbca7fdd40cf6f6229ea1353dd63f6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenPrimeArithmeticNorm.lean @@ -0,0 +1,160 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.MovingPrimeAverages +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenArithmeticNorm + +namespace OAI + +/-! # The same-assignment arithmetic norm under the two-prime giant law -/ + +namespace Ostmann +open scoped Classical BigOperators + +noncomputable def frozenBulkFrequencyPrime {σ J : Type*} + (base : σ → ℕ) (slot : J ↪ σ) (outside : List ℕ) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (childBound : ℕ → ℕ) + (R : ℤ) (r : ℕ) [NeZero r] (input : PublishedProgressionInput) + (Q : ℕ) (x y : ℝ) (a : J → (ZMod r)ˣ) : ℂ := + (if ∀ b, movingNonbulkOutsidePairwise base (bulkIndexPredicate slot) outside (T b) ∧ + (T b).FrequencyBounds childBound then (1 : ℂ) else 0) * + movingFrequencyCorePrimeAverage (Function.extend slot (fun j => (a j).val.val) base) + F E T R r input Q x y + +section +variable {σ : Type*} (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (N : ℕ) (D : ℝ) (hD : 0 ≤ D) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (hm : 0 < m) + +include hslot hsmall ha hbase hS hR hD hN hdiv hm in +/-- The retained fixed support mask can only decrease the bulk norm. -/ +theorem frozenBulkFrequencyPrime_mean_le + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) + (Q : ℕ) (X Y : ℝ) (hX : 0 ≤ X) (hY : 0 ≤ Y) : + let T := fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b) + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + (∑ z : TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ, + ‖frozenBulkFrequencyPrime base slot outside F E T childBound R + (R ^ (n - 1 + 2)) input Q X Y z‖) ≤ + 4 * ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) := by + intro T + apply le_trans _ (frequencyModelBulkPrime_mean_le base tier S n m R t hS hR slot small a + hslot hsmall ha hbase F E N D hD hN hdiv hm input Q X Y hX hY) + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + apply Finset.sum_le_sum + intro z _ + unfold frozenBulkFrequencyPrime + split_ifs + · rw [one_mul] + · simpa only [zero_mul, norm_zero] using norm_nonneg + (movingFrequencyCorePrimeAverage (Function.extend slot (fun j => (z j).val.val) base) + F E T R (R ^ (n - 1 + 2)) input Q X Y) + +end + +section +variable {σ I : Type*} [Fintype I] (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (N : ℕ) (D : ℝ) (hD : 0 ≤ D) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (hm : 0 < m) + +include hslot hsmall ha hbase hS hR hD hN hdiv hm in +/-- The nonnegative original arithmetic model retains the frequency saving, +the absolute spectator moments and the exact number of bulk Page factors. -/ +theorem frozenArithmetic_same_assignment_prime_norm + (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) + (hp : ∀ i, 3 ≤ p i) + (hfreq : ∀ i b, movingGiantFrequencyUnits (p i) n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t))) + (hsmallp : ∀ i b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod (p i)) ≠ 0) + (hasamples : ∀ i b, ((a b).values base).UnitsAt (p i)) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, ∑ x : ZMod (p i), ‖g i x‖ ^ 2 ≤ (p i : ℝ)) + (twist : ∀ i, Bool → (ZMod (p i))ˣ) + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) (Qfreq Qbulk : ℕ) + (X Y : ℝ) (hX : 0 ≤ X) (hY : 0 ≤ Y) (Ybulk : TreeLeafIndex n × Fin m → ℝ) (hYbulk : ∀ j, 0 ≤ Ybulk j) : + let ts := fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t) + let T := fun b => buildMovingSlotData n (ts b) (small b) (bulkSlotLeaves n m slot) (a b) + let Freq := frozenBulkFrequencyPrime base slot outside F E T childBound R + (R ^ (n - 1 + 2)) input Qfreq X Y + let Spec := fun i => frozenBulkSpectatorPrime base n m ts small a (twist i) (Equiv.refl _) (g i) + (Fintype.card (TreeLeafIndex n × Fin m → + (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ) : ℝ)⁻¹ * + (∑ x : TreeLeafIndex n × Fin m → + (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ, + ‖(Freq (bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).1 * + ∏ j, pageGiantWeight input Qbulk (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i) + (x j).val.val (Ybulk j)) * + ∏ i, Spec i ((bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).2 i)‖) ≤ + (2 : ℝ) ^ (2 ^ n * m) * + ((4 * ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod)) * + (3 : ℝ) ^ (2 ^ n * Fintype.card I)) := by + intro ts T Freq Spec + let B := 4 * ((‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) + have hprob : 0 ≤ ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + apply List.prod_nonneg + intro c hc + obtain ⟨f, _, rfl⟩ := List.mem_map.mp hc + exact pairFrequencySupportBound_nonneg D f + have hB : 0 ≤ B := by dsimp [B]; positivity + have hFreq : (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (R ^ (n - 1 + 2)))ˣ) : ℝ)⁻¹ * + ∑ z, ‖Freq z‖ ≤ B := + frozenBulkFrequencyPrime_mean_le base tier S n m R t hS hR slot small a hslot hsmall ha + hbase F E N D hD hN hdiv hm outside childBound input Qfreq X Y hX hY + have hSpec (i : I) : (Fintype.card (TreeLeafIndex n × Fin m → (ZMod (p i))ˣ) : ℝ)⁻¹ * + ∑ z, ‖Spec i z‖ ≤ (3 : ℝ) ^ (2 ^ n) := + frozenBulkSpectatorPrime_absolute_mean_le (hp i) base n m hm ts small a + (hfreq i) (hsmallp i) (hasamples i) (twist i) (Equiv.refl _) (g i) (hg i) (henergy i) + have h := bulk_residue_absolute_mean_le (I := I) (J := TreeLeafIndex n × Fin m) + (R ^ (n - 1 + 2)) p hc input Qbulk Ybulk hYbulk + Freq Spec B hB (fun _ => (3 : ℝ) ^ (2 ^ n)) + (by + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at hFreq ⊢ + exact hFreq) + (by + intro i + have hi := hSpec i + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at hi ⊢ + exact hi) + simp only [Fintype.card_prod, card_treeLeafIndex, Fintype.card_fin, Finset.prod_const, + Finset.card_univ, ← pow_mul, B] at h + simp only [finite_univ_canonical, Fintype.card_eq_nat_card] at h ⊢ + exact h + +end +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenPrimeUnitArithmetic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenPrimeUnitArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..31a5e7d7da66519a2fe5fa5a3424b840e95e95e2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenPrimeUnitArithmetic.lean @@ -0,0 +1,108 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenPrimeArithmeticNorm +import OAI.NumberTheory.Ostmann.Arithmetic.MovingLeafAmplitude +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelModulus +import OAI.NumberTheory.Ostmann.Characters.FourierWindowDecay + +namespace OAI + +/-! # The original two-prime arithmetic norm after removing compensation factors -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap + +noncomputable def frozenPrimeUnitArithmeticMean {σ I : Type*} [Fintype I] + (base : σ → ℕ) (n m R : ℕ) [NeZero (R ^ (n - 1 + 2))] + (ts : Bool → FrequencyTree ℤ n) (small : Bool → TreeLeafTuple (List σ) n) + (a : Bool → MovingSampleSlots σ n) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) (Qfreq Qbulk : ℕ) + (X Y : ℝ) (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) + (g : ∀ i, ZMod (p i) → ℂ) (twist : ∀ i, Bool → (ZMod (p i))ˣ) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) : ℝ := + let T := fun b => buildMovingSlotData n (ts b) (small b) (bulkSlotLeaves n m slot) (a b) + let Freq := frozenBulkFrequencyPrime base slot outside F (fun _ _ _ _ _ => 1) T childBound R + (R ^ (n - 1 + 2)) input Qfreq X Y + let Spec := fun i => frozenBulkSpectatorPrime base n m ts small a (twist i) (Equiv.refl _) (g i) + (Fintype.card (TreeLeafIndex n × Fin m → + (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ) : ℝ)⁻¹ * + ∑ x : TreeLeafIndex n × Fin m → (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ, + ‖(Freq (bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).1 * + ∏ j, pageGiantWeight input Qbulk (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i) + (x j).val.val (Ybulk j)) * + ∏ i, Spec i ((bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).2 i)‖ + +theorem frozenPrimeUnitArithmeticMean_nonneg {σ I : Type*} [Fintype I] + (base : σ → ℕ) (n m R : ℕ) [NeZero (R ^ (n - 1 + 2))] + (ts : Bool → FrequencyTree ℤ n) (small : Bool → TreeLeafTuple (List σ) n) + (a : Bool → MovingSampleSlots σ n) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) (Qfreq Qbulk : ℕ) + (X Y : ℝ) (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) + (g : ∀ i, ZMod (p i) → ℂ) (twist : ∀ i, Bool → (ZMod (p i))ˣ) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) : + 0 ≤ frozenPrimeUnitArithmeticMean base n m R ts small a slot F outside childBound input Qfreq Qbulk X Y + p hc g twist Ybulk := by unfold frozenPrimeUnitArithmeticMean; positivity + +theorem frozenPrimeUnitArithmeticMean_le {σ I : Type*} [Fintype I] + (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R N V : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (hF : ∀ b s regular, ‖F b (.leaf s regular) s‖ ≤ if s.natAbs ≤ V then 1 else 0) + (D : ℝ) (hD : 0 ≤ D) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) (hm : 0 < m) + (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) (hp : ∀ i, 3 ≤ p i) + (hfreq : ∀ i b, movingGiantFrequencyUnits (p i) n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t))) + (hsmallp : ∀ i b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod (p i)) ≠ 0) + (hasamples : ∀ i b, ((a b).values base).UnitsAt (p i)) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, ∑ x : ZMod (p i), ‖g i x‖ ^ 2 ≤ (p i : ℝ)) + (twist : ∀ i, Bool → (ZMod (p i))ˣ) (outside : List ℕ) (childBound : ℕ → ℕ) + (input : PublishedProgressionInput) (Qfreq Qbulk : ℕ) (X Y : ℝ) (hX : 0 ≤ X) (hY : 0 ≤ Y) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) (hYbulk : ∀ j, 0 ≤ Ybulk j) : + frozenPrimeUnitArithmeticMean base n m R + (fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + small a slot F outside childBound input Qfreq Qbulk X Y p hc g twist Ybulk ≤ + ((2 : ℝ) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * Fintype.card I)) * + (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) := by + have h := frozenArithmetic_same_assignment_prime_norm base tier S n m R t hS hR slot small a + hslot hsmall ha hbase F (fun _ _ _ _ _ => 1) N D hD hN hdiv hm p hc hp hfreq + hsmallp hasamples g hg henergy twist outside childBound input Qfreq Qbulk X Y hX hY Ybulk hYbulk + have hamp := movingDataWeight_pair_unit_leaf_bound F V hF S n t small (bulkSlotLeaves n m slot) a + have hprob : 0 ≤ ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + apply List.prod_nonneg + intro c hc + obtain ⟨f, _, rfl⟩ := List.mem_map.mp hc + exact pairFrequencySupportBound_nonneg D f + have hbound := mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hamp hprob) (by norm_num : (0 : ℝ) ≤ 4)) + (by positivity : (0 : ℝ) ≤ 3 ^ (2 ^ n * Fintype.card I))) + (by positivity : (0 : ℝ) ≤ 2 ^ (2 ^ n * m)) + have h' : frozenPrimeUnitArithmeticMean base n m R + (fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + small a slot F outside childBound input Qfreq Qbulk X Y p hc g twist Ybulk ≤ _ := h + exact h'.trans (hbound.trans_eq (by ring)) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenRegularSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenRegularSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..b29dfc9e30a401301534f75cb7f76af585e30190 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenRegularSupport.lean @@ -0,0 +1,98 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkRegularSupport +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFullSupport + +namespace OAI + +/-! # The retained nonbulk coprimality support for the complete sampled tree -/ + +namespace Ostmann +open scoped Classical + +theorem prime_list_outside_pairwise_iff_nonbulk {σ : Type*} (value : σ → ℕ) + (bulk : σ → Bool) (L : List σ) (outside : List ℕ) + (hprime : ∀ i ∈ L, (value i).Prime) (hnodup : (L.filter bulk).Nodup) + (hinj : ∀ i j, bulk i = true → bulk j = true → value i = value j → i = j) + (hcross : ∀ i ∈ L, ∀ j ∈ L, bulk i ≠ bulk j → value i ≠ value j) + (hout : ∀ i ∈ L, bulk i = true → ∀ p ∈ outside, (value i).Coprime p) : + (L.map value ++ outside).Pairwise Nat.Coprime ↔ + ((L.filter fun i => !(bulk i)).map value ++ outside).Pairwise Nat.Coprime := by + rw [List.pairwise_append, List.pairwise_append, + prime_list_pairwise_iff_nonbulk value bulk L hprime hnodup hinj hcross] + constructor + · rintro ⟨hl, ho, hc⟩ + refine ⟨hl, ho, ?_⟩ + intro v hv p hp + obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hv + exact hc _ (List.mem_map.mpr ⟨i, (List.mem_filter.mp hi).1, rfl⟩) p hp + · rintro ⟨hl, ho, hc⟩ + refine ⟨hl, ho, ?_⟩ + intro v hv p hp + obtain ⟨i, hi, rfl⟩ := List.mem_map.mp hv + cases hb : bulk i with + | true => exact hout i hi hb p hp + | false => exact hc _ (List.mem_map.mpr ⟨i, List.mem_filter.mpr ⟨hi, by simp [hb]⟩, rfl⟩) p hp + +def MovingSlotData.regularLists {σ : Type*} : {n : ℕ} → MovingSlotData σ n → List (List σ) + | _, .leaf _ regular => [regular] + | _, .node _ CL CR _ left right => (CL ++ CR) :: (left.regularLists ++ right.regularLists) + +theorem movingRegularOutsidePairwise_iff_lists {σ : Type*} (value : σ → ℕ) + (outside : List ℕ) {n : ℕ} (T : MovingSlotData σ n) : + movingRegularOutsidePairwise value outside T ↔ + ∀ L ∈ T.regularLists, (L.map value ++ outside).Pairwise Nat.Coprime := by + induction T with + | leaf => simp [movingRegularOutsidePairwise, MovingSlotData.regularLists, MovingSlotData.regularSlots] + | node s CL CR U left right ihL ihR => + simp only [movingRegularOutsidePairwise, MovingSlotData.regularSlots, + MovingSlotData.regularLists, List.mem_cons, List.mem_append, or_imp, forall_and, + forall_eq, ihL, ihR] + +def movingNonbulkOutsidePairwise {σ : Type*} (value : σ → ℕ) (bulk : σ → Bool) + (outside : List ℕ) {n : ℕ} (T : MovingSlotData σ n) : Prop := + ∀ L ∈ T.regularLists, ((L.filter fun i => !(bulk i)).map value ++ outside).Pairwise Nat.Coprime + +theorem movingRegularOutsidePairwise_iff_nonbulk {σ : Type*} (value : σ → ℕ) + (bulk : σ → Bool) (outside : List ℕ) {n : ℕ} (T : MovingSlotData σ n) + (hprime : ∀ L ∈ T.regularLists, ∀ i ∈ L, (value i).Prime) + (hnodup : ∀ L ∈ T.regularLists, (L.filter bulk).Nodup) + (hinj : ∀ i j, bulk i = true → bulk j = true → value i = value j → i = j) + (hcross : ∀ L ∈ T.regularLists, ∀ i ∈ L, ∀ j ∈ L, + bulk i ≠ bulk j → value i ≠ value j) + (hout : ∀ L ∈ T.regularLists, ∀ i ∈ L, bulk i = true → + ∀ p ∈ outside, (value i).Coprime p) : + movingRegularOutsidePairwise value outside T ↔ movingNonbulkOutsidePairwise value bulk outside T := by + rw [movingRegularOutsidePairwise_iff_lists] + exact forall_congr' fun L => forall_congr' fun hL => + prime_list_outside_pairwise_iff_nonbulk value bulk L outside (hprime L hL) + (hnodup L hL) hinj (hcross L hL) (hout L hL) + +theorem movingNonbulkOutsidePairwise_congr {σ : Type*} (v w : σ → ℕ) + (bulk : σ → Bool) (outside : List ℕ) {n : ℕ} (T : MovingSlotData σ n) + (hv : ∀ i, bulk i = false → v i = w i) : + movingNonbulkOutsidePairwise v bulk outside T ↔ movingNonbulkOutsidePairwise w bulk outside T := by + have he (L : List σ) : (L.filter fun i => !(bulk i)).map v = + (L.filter fun i => !(bulk i)).map w := by + apply List.map_congr_left + intro i hi + apply hv + simpa using (List.mem_filter.mp hi).2 + unfold movingNonbulkOutsidePairwise + simp_rw [he] + +theorem movingRegularOutsidePairwise_frozen {σ : Type*} (value base : σ → ℕ) + (bulk : σ → Bool) (outside : List ℕ) {n : ℕ} (T : MovingSlotData σ n) + (hv : ∀ i, bulk i = false → value i = base i) + (hprime : ∀ L ∈ T.regularLists, ∀ i ∈ L, (value i).Prime) + (hnodup : ∀ L ∈ T.regularLists, (L.filter bulk).Nodup) + (hinj : ∀ i j, bulk i = true → bulk j = true → value i = value j → i = j) + (hcross : ∀ L ∈ T.regularLists, ∀ i ∈ L, ∀ j ∈ L, + bulk i ≠ bulk j → value i ≠ value j) + (hout : ∀ L ∈ T.regularLists, ∀ i ∈ L, bulk i = true → + ∀ p ∈ outside, (value i).Coprime p) : + movingRegularOutsidePairwise value outside T ↔ movingNonbulkOutsidePairwise base bulk outside T := + (movingRegularOutsidePairwise_iff_nonbulk value bulk outside T hprime hnodup hinj hcross hout).trans + (movingNonbulkOutsidePairwise_congr value base bulk outside T hv) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorAbsolute.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorAbsolute.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee381b37bf66612d6fa8f7e718d54e20f98a4762 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorAbsolute.lean @@ -0,0 +1,81 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenSpectatorAverage +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyBulkNorm + +namespace OAI + +/-! # Absolute spectator moments under the unchanged bulk-unit law -/ + +namespace Ostmann +open scoped Classical BigOperators ComplexConjugate + +theorem frozenBulkSpectatorPair_absolute_mean_le {σ : Type*} {q : ℕ} [Fact q.Prime] + (hq : 3 ≤ q) (base : σ → ℕ) (n m : ℕ) (hm : 0 < m) + (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (hfreq : ∀ b, movingGiantFrequencyUnits q n (t b)) + (hsmall : ∀ b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod q) ≠ 0) + (hsamples : ∀ b, ((samples b).values base).UnitsAt q) + (D : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex n × Fin m)) + (g : ZMod q → ℂ) (hg : g 0 = 0) (henergy : ∑ x : ZMod q, ‖g x‖ ^ 2 ≤ (q : ℝ)) + (a : (ZMod q)ˣ × (ZMod q)ˣ) : + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod q)ˣ) : ℝ)⁻¹ * + (∑ z : TreeLeafIndex n × Fin m → (ZMod q)ˣ, + ‖frozenBulkSpectatorPair base n m t small samples D e g a z‖) ≤ (3 : ℝ) ^ (2 ^ n) := by + have hex (b : Bool) := (buildMovingGiantTree n (t b) + (movingSlotValues base n (small b)) ((samples b).values base)).exists_field_diagram + (buildMovingGiantTree_units (t b) _ _ (hfreq b) (hsmall b) (hsamples b)) + choose U R _ _ hR using hex + let d (b : Bool) : SpectatorDiagram q n := + ⟨D b, U b, R b, a.1, a.2, transferConjugations n false⟩ + have he (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) : + frozenBulkSpectatorPair base n m t small samples D e + g a z = + (d false).bulkValue g z * + conj ((d true).bulkValue g (z ∘ e.symm)) := by + unfold frozenBulkSpectatorPair + rw [show movingFieldGiantAmplitude g (D false) + (buildMovingGiantTree n (t false) (movingSlotValues base n (small false)) + ((samples false).values base)) a.1 a.2 _ = _ from + hR false g (D false) a.1 a.2 _ false, + show movingFieldGiantAmplitude g (D true) + (buildMovingGiantTree n (t true) (movingSlotValues base n (small true)) + ((samples true).values base)) a.1 a.2 _ = _ from + hR true g (D true) a.1 a.2 _ false] + rfl + simp_rw [he] + exact spectator_bulk_absolute_le hq hm g hg henergy (d false) (d true) e + +theorem frozenBulkSpectatorHaar_absolute_mean_le {σ : Type*} {q : ℕ} [Fact q.Prime] + (hq : 3 ≤ q) (base : σ → ℕ) (n m : ℕ) (hm : 0 < m) + (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (hfreq : ∀ b, movingGiantFrequencyUnits q n (t b)) + (hsmall : ∀ b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod q) ≠ 0) + (hsamples : ∀ b, ((samples b).values base).UnitsAt q) + (D : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex n × Fin m)) + (g : ZMod q → ℂ) (hg : g 0 = 0) (henergy : ∑ x : ZMod q, ‖g x‖ ^ 2 ≤ (q : ℝ)) : + (Fintype.card (TreeLeafIndex n × Fin m → (ZMod q)ˣ) : ℝ)⁻¹ * + (∑ z : TreeLeafIndex n × Fin m → (ZMod q)ˣ, + ‖frozenBulkSpectatorHaar base n m t small samples D e g z‖) ≤ (3 : ℝ) ^ (2 ^ n) := by + let F := frozenBulkSpectatorPair base n m t small samples D e g + have hmean := uniform_average_norm_average_mul_le + (A := TreeLeafIndex n × Fin m → (ZMod q)ˣ) + (B := (ZMod q)ˣ × (ZMod q)ˣ) (fun z a => F a z) (fun _ => 1) 1 ((3 : ℝ) ^ (2 ^ n)) + (by norm_num) (fun _ => by simp) + (fun a => frozenBulkSpectatorPair_absolute_mean_le hq base n m hm t small samples + hfreq hsmall hsamples D e g hg henergy a) + simp only [mul_one, one_mul] at hmean + have hratio : ‖(Fintype.card (ZMod q)ˣ : ℂ) / (q : ℂ)‖ ≤ 1 := by + rw [norm_div, Complex.norm_natCast, Complex.norm_natCast] + apply (div_le_one (by positivity : (0 : ℝ) < q)).mpr + exact_mod_cast (ZMod.card_units q ▸ Nat.sub_le q 1) + apply le_trans _ hmean + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + apply Finset.sum_le_sum + intro z _ + rw [frozenBulkSpectatorHaar, norm_mul] + exact (mul_le_mul_of_nonneg_right hratio (norm_nonneg _)).trans_eq (one_mul _) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorAverage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8319495c1023f8db923fdbff6d0cb5a8bac8089 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorAverage.lean @@ -0,0 +1,191 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenSpectatorDiagram +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenMovingSamples +import OAI.NumberTheory.Ostmann.Arithmetic.MovingFieldUnitAverage +import OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkPageBound + +namespace OAI + +/-! # The actual spectator Haar factor as a fixed function of the bulk residues -/ + +namespace Ostmann +open scoped Classical BigOperators ComplexConjugate + +section +variable {σ : Type*} {q : ℕ} [Fact q.Prime] + (base : σ → ℕ) (n m : ℕ) (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (D : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex n × Fin m)) + +noncomputable def frozenBulkSpectatorPair (g : ZMod q → ℂ) + (a : (ZMod q)ˣ × (ZMod q)ˣ) (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) : ℂ := + movingFieldGiantAmplitude g (D false) + (buildMovingGiantTree n (t false) (movingSlotValues base n (small false)) + ((samples false).values base)) a.1 a.2 + ((treeLeafTupleEquiv (ZMod q)ˣ n).symm (bulkBlockProduct z)) * + conj (movingFieldGiantAmplitude g (D true) + (buildMovingGiantTree n (t true) (movingSlotValues base n (small true)) + ((samples true).values base)) a.1 a.2 + ((treeLeafTupleEquiv (ZMod q)ˣ n).symm (bulkBlockProduct (z ∘ e.symm)))) + +noncomputable def frozenBulkSpectatorHaar (g : ZMod q → ℂ) + (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) : ℂ := + ((Fintype.card (ZMod q)ˣ : ℂ) / (q : ℂ)) * + ((Fintype.card ((ZMod q)ˣ × (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ a, frozenBulkSpectatorPair base n m t small samples D e g a z) + +theorem frozenBulkSpectatorPair_actual (value : σ → ℕ) + (hv : ∀ b, movingSlotValues value n (small b) = movingSlotValues base n (small b)) + (hs : ∀ b, (samples b).values value = (samples b).values base) + (slot : TreeLeafIndex n × Fin m → σ) (g : ZMod q → ℂ) + (a : (ZMod q)ˣ × (ZMod q)ˣ) (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) + (hz : ∀ j, (value (slot j) : ZMod q) = (z j : ZMod q)) : + movingSpectatorPairFactor value q g D + (fun b => buildMovingSlotData n (t b) (small b) + (if b then bulkSlotLeaves n m (slot ∘ e.symm) else bulkSlotLeaves n m slot) + (samples b)) a.1 a.2 = + frozenBulkSpectatorPair base n m t small samples D e g a z := by + unfold movingSpectatorPairFactor + simp only [Bool.false_eq_true, ↓reduceIte] + rw [buildMovingSlotData_modular_spectator value g (D false) n (t false) + (small false) _ (samples false) a.1 a.2 _ + (bulkSlotLeaves_naturalLift value n m slot z hz), + buildMovingSlotData_modular_spectator value g (D true) n (t true) + (small true) _ (samples true) a.1 a.2 _ + (bulkSlotLeaves_naturalLift value n m (slot ∘ e.symm) (z ∘ e.symm) + (fun j => hz (e.symm j))), hv, hv, hs, hs] + rfl + +theorem frozenBulkSpectatorHaar_actual (value : σ → ℕ) + (hv : ∀ b, movingSlotValues value n (small b) = movingSlotValues base n (small b)) + (hs : ∀ b, (samples b).values value = (samples b).values base) + (slot : TreeLeafIndex n × Fin m → σ) (g : ZMod q → ℂ) (hg : g 0 = 0) + (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) + (hz : ∀ j, (value (slot j) : ZMod q) = (z j : ZMod q)) : + movingSpectatorHaarAverage value q g D + (fun b => buildMovingSlotData n (t b) (small b) + (if b then bulkSlotLeaves n m (slot ∘ e.symm) else bulkSlotLeaves n m slot) + (samples b)) = frozenBulkSpectatorHaar base n m t small samples D e g z := by + rw [movingSpectatorHaarAverage_eq_units value g hg] + simp_rw [frozenBulkSpectatorPair_actual base n m t small samples D e value hv hs slot g _ z hz] + rfl + +end + +private theorem norm_finite_average_le {A : Type*} [Fintype A] [Nonempty A] + (f : A → ℂ) (δ : ℝ) (hf : ∀ a, ‖f a‖ ≤ δ) : + ‖(Fintype.card A : ℂ)⁻¹ * ∑ a, f a‖ ≤ δ := by + have hc : (Fintype.card A : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + rw [norm_mul, norm_inv, Complex.norm_natCast] + calc + _ ≤ (Fintype.card A : ℝ)⁻¹ * ∑ _a : A, δ := + mul_le_mul_of_nonneg_left ((norm_sum_le _ _).trans (Finset.sum_le_sum fun a _ => hf a)) + (inv_nonneg.mpr (Nat.cast_nonneg _)) + _ = δ := by simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul]; field_simp + +theorem frozenBulkSpectatorPair_mean_le {σ : Type*} {q : ℕ} [Fact q.Prime] + (hq : 3 ≤ q) (base : σ → ℕ) (n m : ℕ) (hm : 0 < m) + (t : Bool → FrequencyTree ℤ (n + 2)) + (small : Bool → TreeLeafTuple (List σ) (n + 2)) + (samples : Bool → MovingSampleSlots σ (n + 2)) + (hfreq : ∀ b, movingGiantFrequencyUnits q (n + 2) (t b)) + (hsmall : ∀ b, ((treeLeafProduct (n + 2) (movingSlotValues base (n + 2) (small b)) : ℕ) : + ZMod q) ≠ 0) + (hsamples : ∀ b, ((samples b).values base).UnitsAt q) + (D : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex (n + 2) × Fin m)) + (hgood : 4 * Fintype.card (arrangementGraph m e).ConnectedComponent ≤ + 3 * Fintype.card (TreeLeafIndex (n + 2))) + (S : Finset (ZMod q)) (hlo : (1 / 3 : ℝ) ≤ residueDensity S) + (hhi : residueDensity S ≤ 2 / 3) (hS : S.Nonempty) (hSq : S.card < q) + (β ε : ℝ) (hε : 0 ≤ ε) (hε1 : ε ≤ 1) + (hprincipal : 3 / Real.sqrt (q : ℝ) ≤ ε) (hβ : 2 * β ≤ ε) + (hbias : ∀ (χ : MulChar (ZMod q) ℂ), χ ≠ 1 → ∀ a : ZMod q, + ‖(S.card : ℂ)⁻¹ * ∑ x ∈ S, χ⁻¹ (-a - x)‖ ≤ β) + (δ : ℝ) (hδ : 0 ≤ δ) + (hnum : quartetTreeConstant n * (ε ^ 2 + Real.sqrt (3 / (q : ℝ))) ≤ δ ^ 2) + (a : (ZMod q)ˣ × (ZMod q)ˣ) : + ‖(Fintype.card (TreeLeafIndex (n + 2) × Fin m → (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ z, frozenBulkSpectatorPair base (n + 2) m t small samples D e + (normalizedResidueTransform S) a z‖ ≤ δ := by + have hex (b : Bool) := (buildMovingGiantTree (n + 2) (t b) + (movingSlotValues base (n + 2) (small b)) ((samples b).values base)).exists_field_diagram + (buildMovingGiantTree_units (t b) _ _ (hfreq b) (hsmall b) (hsamples b)) + choose U R _ _ hR using hex + let d (b : Bool) : SpectatorDiagram q (n + 2) := + ⟨D b, U b, R b, a.1, a.2, transferConjugations (n + 2) false⟩ + have he (z : TreeLeafIndex (n + 2) × Fin m → (ZMod q)ˣ) : + frozenBulkSpectatorPair base (n + 2) m t small samples D e + (normalizedResidueTransform S) a z = + (d false).bulkValue (normalizedResidueTransform S) z * + conj ((d true).bulkValue (normalizedResidueTransform S) (z ∘ e.symm)) := by + unfold frozenBulkSpectatorPair + rw [show movingFieldGiantAmplitude (normalizedResidueTransform S) (D false) + (buildMovingGiantTree (n + 2) (t false) (movingSlotValues base (n + 2) (small false)) + ((samples false).values base)) a.1 a.2 _ = _ from + hR false (normalizedResidueTransform S) (D false) a.1 a.2 _ false, + show movingFieldGiantAmplitude (normalizedResidueTransform S) (D true) + (buildMovingGiantTree (n + 2) (t true) (movingSlotValues base (n + 2) (small true)) + ((samples true).values base)) a.1 a.2 _ = _ from + hR true (normalizedResidueTransform S) (D true) a.1 a.2 _ false] + rfl + simp_rw [he] + exact normalized_transfer_bulk_mean hq n m hm e hgood S hlo hhi hS hSq + β ε hε hε1 hprincipal hβ hbias (d false) (d true) rfl δ hδ hnum + +theorem frozenBulkSpectatorHaar_mean_le {σ : Type*} {q : ℕ} [Fact q.Prime] + (hq : 3 ≤ q) (base : σ → ℕ) (n m : ℕ) (hm : 0 < m) + (t : Bool → FrequencyTree ℤ (n + 2)) + (small : Bool → TreeLeafTuple (List σ) (n + 2)) + (samples : Bool → MovingSampleSlots σ (n + 2)) + (hfreq : ∀ b, movingGiantFrequencyUnits q (n + 2) (t b)) + (hsmall : ∀ b, ((treeLeafProduct (n + 2) (movingSlotValues base (n + 2) (small b)) : ℕ) : + ZMod q) ≠ 0) + (hsamples : ∀ b, ((samples b).values base).UnitsAt q) + (D : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex (n + 2) × Fin m)) + (hgood : 4 * Fintype.card (arrangementGraph m e).ConnectedComponent ≤ + 3 * Fintype.card (TreeLeafIndex (n + 2))) + (S : Finset (ZMod q)) (hlo : (1 / 3 : ℝ) ≤ residueDensity S) + (hhi : residueDensity S ≤ 2 / 3) (hS : S.Nonempty) (hSq : S.card < q) + (β ε : ℝ) (hε : 0 ≤ ε) (hε1 : ε ≤ 1) + (hprincipal : 3 / Real.sqrt (q : ℝ) ≤ ε) (hβ : 2 * β ≤ ε) + (hbias : ∀ (χ : MulChar (ZMod q) ℂ), χ ≠ 1 → ∀ a : ZMod q, + ‖(S.card : ℂ)⁻¹ * ∑ x ∈ S, χ⁻¹ (-a - x)‖ ≤ β) + (δ : ℝ) (hδ : 0 ≤ δ) + (hnum : quartetTreeConstant n * (ε ^ 2 + Real.sqrt (3 / (q : ℝ))) ≤ δ ^ 2) + : ‖(Fintype.card (TreeLeafIndex (n + 2) × Fin m → (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ z, frozenBulkSpectatorHaar base (n + 2) m t small samples D e + (normalizedResidueTransform S) z‖ ≤ δ := by + let F := frozenBulkSpectatorPair base (n + 2) m t small samples D e + (normalizedResidueTransform S) + have hpair (a : (ZMod q)ˣ × (ZMod q)ˣ) : + ‖(Fintype.card (TreeLeafIndex (n + 2) × Fin m → (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ z, F a z‖ ≤ δ := + frozenBulkSpectatorPair_mean_le hq base n m hm t small samples hfreq hsmall + hsamples D e hgood S hlo hhi hS hSq β ε hε hε1 hprincipal hβ hbias δ hδ hnum a + have hmean := norm_finite_average_le _ δ hpair + have hswap : + (Fintype.card (TreeLeafIndex (n + 2) × Fin m → (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ z, frozenBulkSpectatorHaar base (n + 2) m t small samples D e + (normalizedResidueTransform S) z = + ((Fintype.card (ZMod q)ˣ : ℂ) / (q : ℂ)) * + ((Fintype.card ((ZMod q)ˣ × (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ a, (Fintype.card (TreeLeafIndex (n + 2) × Fin m → (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ z, F a z) := by + simp only [frozenBulkSpectatorHaar, Finset.mul_sum] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a _ + apply Finset.sum_congr rfl + intro z _ + dsimp only [F] + ring + have hratio : ‖(Fintype.card (ZMod q)ˣ : ℂ) / (q : ℂ)‖ ≤ 1 := by + rw [norm_div, Complex.norm_natCast, Complex.norm_natCast] + apply (div_le_one (by positivity : (0 : ℝ) < q)).mpr + exact_mod_cast (ZMod.card_units q ▸ Nat.sub_le q 1) + rw [hswap, norm_mul] + exact (mul_le_mul_of_nonneg_left hmean (norm_nonneg _)).trans + (by simpa using mul_le_mul_of_nonneg_right hratio hδ) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorDiagram.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorDiagram.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc5bf824fd157f3ce765ec527b0facd29703c16c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorDiagram.lean @@ -0,0 +1,104 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.BulkSlotFieldBridge + +namespace OAI + +/-! # One rational diagram for all bulk replacements of fixed nonbulk data -/ + +namespace Ostmann +open scoped Classical ComplexConjugate + +theorem buildMovingSlotData_frozen_field_diagram {σ : Type*} {q : ℕ} [Fact q.Prime] + (base : σ → ℕ) (n : ℕ) (t : FrequencyTree ℤ n) + (small : TreeLeafTuple (List σ) n) (samples : MovingSampleSlots σ n) + (hfreq : movingGiantFrequencyUnits q n t) + (hsmall : ((treeLeafProduct n (movingSlotValues base n small) : ℕ) : ZMod q) ≠ 0) + (hsamples : (samples.values base).UnitsAt q) : + ∃ (U : (ZMod q)ˣ) (R : RationalTreeData (ZMod q)ˣ n U), + ∀ (value : σ → ℕ), movingSlotValues value n small = movingSlotValues base n small → + samples.values value = samples.values base → + ∀ (g : ZMod q → ℂ) (D A B : (ZMod q)ˣ) + (bulk : TreeLeafTuple (List σ) n) (z : TreeLeafTuple (ZMod q)ˣ n), + TreeNaturalLift n (movingSlotValues value n bulk) z → + movingModularSpectator value q g D (buildMovingSlotData n t small bulk samples) A B = + rationalTreeAmplitude g D R A B (transferConjugations n false) z := by + let T := buildMovingGiantTree n t (movingSlotValues base n small) (samples.values base) + have hT : T.UnitsAt q := buildMovingGiantTree_units t _ _ hfreq hsmall hsamples + obtain ⟨U, R, _, _, hR⟩ := T.exists_field_diagram hT + refine ⟨U, R, ?_⟩ + intro value hv hs g D A B bulk z hz + rw [buildMovingSlotData_modular_spectator value g D n t small bulk samples A B z hz, + hv, hs] + exact hR g D A B z false + +/-- The same pair of diagrams works simultaneously for every actual bulk +tuple with the fixed small leaves and fixed internal samples. -/ +theorem moving_field_pair_frozen_diagrams {σ : Type*} {q : ℕ} [Fact q.Prime] + (base : σ → ℕ) (n : ℕ) (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (hfreq : ∀ b, movingGiantFrequencyUnits q n (t b)) + (hsmall : ∀ b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod q) ≠ 0) + (hsamples : ∀ b, ((samples b).values base).UnitsAt q) + (D A B : Bool → (ZMod q)ˣ) : + ∃ d : Bool → SpectatorDiagram q n, + (∀ b, (d b).conjugations = transferConjugations n false) ∧ + ∀ (value : σ → ℕ), + (∀ b, movingSlotValues value n (small b) = movingSlotValues base n (small b)) → + (∀ b, (samples b).values value = (samples b).values base) → + ∀ (g : ZMod q → ℂ) (bulk : Bool → TreeLeafTuple (List σ) n) + (z : Bool → TreeLeafTuple (ZMod q)ˣ n), + (∀ b, TreeNaturalLift n (movingSlotValues value n (bulk b)) (z b)) → + movingModularSpectator value q g (D false) + (buildMovingSlotData n (t false) (small false) (bulk false) (samples false)) (A false) (B false) * + conj (movingModularSpectator value q g (D true) + (buildMovingSlotData n (t true) (small true) (bulk true) (samples true)) (A true) (B true)) = + (d false).value g (z false) * conj ((d true).value g (z true)) := by + have h b := buildMovingSlotData_frozen_field_diagram base n (t b) (small b) (samples b) + (hfreq b) (hsmall b) (hsamples b) + choose U R hR using h + let d (b : Bool) : SpectatorDiagram q n := + ⟨D b, U b, R b, A b, B b, transferConjugations n false⟩ + refine ⟨d, fun _ => rfl, ?_⟩ + intro value hv hs g bulk z hz + rw [hR false value (hv false) (hs false) g (D false) (A false) (B false) (bulk false) (z false) (hz false), + hR true value (hv true) (hs true) g (D true) (A true) (B true) (bulk true) (z true) (hz true)] + rfl + +theorem moving_field_pair_frozen_bulk_slots {σ : Type*} {q : ℕ} [Fact q.Prime] + (base : σ → ℕ) (n m : ℕ) (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (hfreq : ∀ b, movingGiantFrequencyUnits q n (t b)) + (hsmall : ∀ b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod q) ≠ 0) + (hsamples : ∀ b, ((samples b).values base).UnitsAt q) + (D A B : Bool → (ZMod q)ˣ) : + ∃ d : Bool → SpectatorDiagram q n, + (∀ b, (d b).conjugations = transferConjugations n false) ∧ + ∀ (value : σ → ℕ), + (∀ b, movingSlotValues value n (small b) = movingSlotValues base n (small b)) → + (∀ b, (samples b).values value = (samples b).values base) → + ∀ (g : ZMod q → ℂ) (slot : TreeLeafIndex n × Fin m → σ) + (e : Equiv.Perm (TreeLeafIndex n × Fin m)) (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ), + (∀ j, (value (slot j) : ZMod q) = (z j : ZMod q)) → + movingModularSpectator value q g (D false) + (buildMovingSlotData n (t false) (small false) (bulkSlotLeaves n m slot) (samples false)) + (A false) (B false) * + conj (movingModularSpectator value q g (D true) + (buildMovingSlotData n (t true) (small true) + (bulkSlotLeaves n m (slot ∘ e.symm)) (samples true)) (A true) (B true)) = + (d false).bulkValue g z * conj ((d true).bulkValue g (z ∘ e.symm)) := by + obtain ⟨d, hd, he⟩ := moving_field_pair_frozen_diagrams base n t small samples + hfreq hsmall hsamples D A B + refine ⟨d, hd, ?_⟩ + intro value hv hs g slot e z hz + let bulk := fun b : Bool => if b then bulkSlotLeaves n m (slot ∘ e.symm) else bulkSlotLeaves n m slot + let Z := fun b : Bool => if b then + (treeLeafTupleEquiv (ZMod q)ˣ n).symm (bulkBlockProduct (z ∘ e.symm)) else + (treeLeafTupleEquiv (ZMod q)ˣ n).symm (bulkBlockProduct z) + have hlift (b : Bool) : TreeNaturalLift n (movingSlotValues value n (bulk b)) (Z b) := by + cases b + · exact bulkSlotLeaves_naturalLift value n m slot z hz + · exact bulkSlotLeaves_naturalLift value n m (slot ∘ e.symm) (z ∘ e.symm) (fun j => hz (e.symm j)) + exact he value hv hs g bulk Z hlift + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorGain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorGain.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff9e518f274185c72400d25d5cf1f2eff7e96700 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorGain.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenSpectatorAverage +import OAI.NumberTheory.Ostmann.Construction.SignedBulkGain + +namespace OAI + +namespace Ostmann +open scoped Classical BigOperators + +/-- The tolerance and threshold depend only on the fixed depth and the +requested exponential saving. All base values, sample trees, matchings and +bulk lengths remain variable. -/ +theorem exists_frozenSpectatorGain (n : ℕ) (C D : ℝ) : + ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1 ∧ ∃ N : ℕ, 3 ≤ N ∧ + ∀ (q : ℕ) [Fact q.Prime], N ≤ q → + ∀ (σ : Type*) (base : σ → ℕ) (m : ℕ), 0 < m → + ∀ (t : Bool → FrequencyTree ℤ (n + 2)) + (small : Bool → TreeLeafTuple (List σ) (n + 2)) + (samples : Bool → MovingSampleSlots σ (n + 2)), + (∀ b, movingGiantFrequencyUnits q (n + 2) (t b)) → + (∀ b, ((treeLeafProduct (n + 2) (movingSlotValues base (n + 2) (small b)) : ℕ) : + ZMod q) ≠ 0) → + (∀ b, ((samples b).values base).UnitsAt q) → + ∀ (twist : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex (n + 2) × Fin m)), + 4 * Fintype.card (arrangementGraph m e).ConnectedComponent ≤ + 3 * Fintype.card (TreeLeafIndex (n + 2)) → + ∀ (S : Finset (ZMod q)), (1 / 3 : ℝ) ≤ residueDensity S → + residueDensity S ≤ 2 / 3 → S.Nonempty → S.card < q → + ∀ β : ℝ, 2 * β ≤ ε → + (∀ (χ : MulChar (ZMod q) ℂ), χ ≠ 1 → ∀ a : ZMod q, + ‖(S.card : ℂ)⁻¹ * ∑ x ∈ S, χ⁻¹ (-a - x)‖ ≤ β) → + ‖(Fintype.card (TreeLeafIndex (n + 2) × Fin m → (ZMod q)ˣ) : ℂ)⁻¹ * + ∑ z, frozenBulkSpectatorHaar base (n + 2) m t small samples twist e + (normalizedResidueTransform S) z‖ ≤ signedBulkGainTarget (n + 2) C D := by + obtain ⟨ε, hε, hε1, N, hN, hnum⟩ := exists_signedBulkGain_parameters n C D + refine ⟨ε, hε, hε1, N, hN, ?_⟩ + intro q hq hqN σ base m hm t small samples hfreq hsmall hsamples twist e hgood S hlo hhi hS hSq β hβ hbias + exact frozenBulkSpectatorHaar_mean_le (hN.trans hqN) base n m hm t small samples + hfreq hsmall hsamples twist e hgood S hlo hhi hS hSq β ε hε.le hε1 + (hnum q hqN).1 hβ hbias (signedBulkGainTarget (n + 2) C D) + (signedBulkGainTarget_pos _ _ _).le (hnum q hqN).2 + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ee0b735e2d70bd4389ded682ff64aa04d16f7e9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSpectatorNorm.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenSpectatorAverage + +namespace OAI + +namespace Ostmann +open scoped Classical BigOperators + +theorem movingFieldGiantAmplitude_norm_le {q : ℕ} [Fact q.Prime] + (g : ZMod q → ℂ) (K : ℝ) (hK : 0 ≤ K) (hg : ∀ x, ‖g x‖ ≤ K) + (D : (ZMod q)ˣ) {n C : ℕ} (T : MovingGiantTree n C) + (x y : ZMod q) (z : TreeLeafTuple (ZMod q)ˣ n) : + ‖movingFieldGiantAmplitude g D T x y z‖ ≤ K ^ (2 ^ n) := by + induction T generalizing x y with + | leaf s C => + simpa only [movingFieldGiantAmplitude, pow_zero, pow_one] using hg _ + | @node n s CL CR u left right ihL ihR => + simp only [movingFieldGiantAmplitude] + split_ifs + · simpa only [norm_zero] using pow_nonneg hK (2 ^ (n + 1)) + · rw [norm_mul, Complex.norm_conj] + calc + _ ≤ K ^ (2 ^ n) * K ^ (2 ^ n) := + mul_le_mul (ihL _ _ _) (ihR _ _ _) (norm_nonneg _) (pow_nonneg hK _) + _ = K ^ (2 ^ (n + 1)) := by + rw [← pow_add, pow_succ] + congr 1 + omega + +theorem frozenBulkSpectatorPair_norm_le {σ : Type*} {q : ℕ} [Fact q.Prime] + (base : σ → ℕ) (n m : ℕ) (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (D : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex n × Fin m)) + (g : ZMod q → ℂ) (K : ℝ) (hK : 0 ≤ K) (hg : ∀ x, ‖g x‖ ≤ K) + (a : (ZMod q)ˣ × (ZMod q)ˣ) (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) : + ‖frozenBulkSpectatorPair base n m t small samples D e g a z‖ ≤ K ^ (2 ^ (n + 1)) := by + rw [frozenBulkSpectatorPair, norm_mul, Complex.norm_conj] + calc + _ ≤ K ^ (2 ^ n) * K ^ (2 ^ n) := + mul_le_mul (movingFieldGiantAmplitude_norm_le g K hK hg _ _ _ _ _) + (movingFieldGiantAmplitude_norm_le g K hK hg _ _ _ _ _) (norm_nonneg _) (pow_nonneg hK _) + _ = K ^ (2 ^ (n + 1)) := by rw [← pow_add, pow_succ]; congr 1; omega + +/-- The mixed Haar normalization has norm at most one, so the field bound +survives without a factor depending on the spectator prime. -/ +theorem frozenBulkSpectatorHaar_norm_le {σ : Type*} {q : ℕ} [Fact q.Prime] + (base : σ → ℕ) (n m : ℕ) (t : Bool → FrequencyTree ℤ n) + (small : Bool → TreeLeafTuple (List σ) n) (samples : Bool → MovingSampleSlots σ n) + (D : Bool → (ZMod q)ˣ) (e : Equiv.Perm (TreeLeafIndex n × Fin m)) + (g : ZMod q → ℂ) (K : ℝ) (hK : 0 ≤ K) (hg : ∀ x, ‖g x‖ ≤ K) + (z : TreeLeafIndex n × Fin m → (ZMod q)ˣ) : + ‖frozenBulkSpectatorHaar base n m t small samples D e g z‖ ≤ K ^ (2 ^ (n + 1)) := by + let A := (ZMod q)ˣ × (ZMod q)ˣ + have hc : (Fintype.card A : ℝ) ≠ 0 := by exact_mod_cast Fintype.card_ne_zero + have ha : ‖(Fintype.card A : ℂ)⁻¹ * ∑ a : A, + frozenBulkSpectatorPair base n m t small samples D e g a z‖ ≤ K ^ (2 ^ (n + 1)) := by + rw [norm_mul, norm_inv, Complex.norm_natCast] + calc + _ ≤ (Fintype.card A : ℝ)⁻¹ * ∑ _a : A, K ^ (2 ^ (n + 1)) := + mul_le_mul_of_nonneg_left ((norm_sum_le _ _).trans (Finset.sum_le_sum fun a _ => + frozenBulkSpectatorPair_norm_le base n m t small samples D e g K hK hg a z)) + (inv_nonneg.mpr (Nat.cast_nonneg _)) + _ = K ^ (2 ^ (n + 1)) := by + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + field_simp + have hr : ‖(Fintype.card (ZMod q)ˣ : ℂ) / (q : ℂ)‖ ≤ 1 := by + rw [norm_div, Complex.norm_natCast, Complex.norm_natCast] + apply (div_le_one (by exact_mod_cast (Fact.out : q.Prime).pos)).mpr + exact_mod_cast (ZMod.card_units q ▸ Nat.sub_le q 1) + rw [frozenBulkSpectatorHaar, norm_mul] + exact (mul_le_mul_of_nonneg_left ha (norm_nonneg _)).trans + (by simpa only [one_mul] using mul_le_mul_of_nonneg_right hr (pow_nonneg hK (2 ^ (n + 1)))) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSupportedArithmetic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSupportedArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..ffc750ad932ab5ed29f342a61c741c7a04165d2c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenSupportedArithmetic.lean @@ -0,0 +1,109 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenArithmeticFactors +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenFrequencySupport + +namespace OAI + +namespace Ostmann +open scoped Classical BigOperators + +noncomputable def bulkIndexPredicate {σ J : Type*} (slot : J ↪ σ) (i : σ) : Bool := + decide (i ∈ Set.range slot) + +@[simp] theorem bulkIndexPredicate_eq_true {σ J : Type*} (slot : J ↪ σ) (i : σ) : + bulkIndexPredicate slot i = true ↔ i ∈ Set.range slot := by + simp only [bulkIndexPredicate, decide_eq_true_eq] + +@[simp] theorem bulkIndexPredicate_eq_false {σ J : Type*} (slot : J ↪ σ) (i : σ) : + bulkIndexPredicate slot i = false ↔ i ∉ Set.range slot := by + simp only [bulkIndexPredicate, decide_eq_false_iff_not] + +noncomputable def frozenBulkFrequencyFactor {σ J : Type*} + (base : σ → ℕ) (slot : J ↪ σ) (outside : List ℕ) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (childBound : ℕ → ℕ) + (R : ℤ) (r : ℕ) [NeZero r] (input : PublishedProgressionInput) + (Q : ℕ) (y : ℝ) (a : J → (ZMod r)ˣ) : ℂ := + (if ∀ b, movingNonbulkOutsidePairwise base (bulkIndexPredicate slot) outside (T b) ∧ + (T b).FrequencyBounds childBound then (1 : ℂ) else 0) * + movingFrequencyCorePageAverage (Function.extend slot (fun j => (a j).val.val) base) + F E T R r input Q y + +theorem frozenBulkFrequencyFactor_norm_le {σ J : Type*} + (base : σ → ℕ) (slot : J ↪ σ) (outside : List ℕ) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + {n : ℕ} (T : Bool → MovingSlotData σ n) (childBound : ℕ → ℕ) + (R : ℤ) (r : ℕ) [NeZero r] (input : PublishedProgressionInput) + (Q : ℕ) (y : ℝ) (hy : 0 ≤ y) (a : J → (ZMod r)ˣ) : + ‖frozenBulkFrequencyFactor base slot outside F E T childBound R r input Q y a‖ ≤ + 2 * (‖movingDataWeight (F false) (E false) (T false)‖ * + ‖movingDataWeight (F true) (E true) (T true)‖) := by + unfold frozenBulkFrequencyFactor + split_ifs + · rw [one_mul] + exact movingFrequencyCorePageAverage_norm_le _ F E T R r input Q y hy + · rw [zero_mul, norm_zero] + positivity + +/-- The nonbulk coprimalities stay inside the fixed frequency factor. The +only injectivity used here is the actual distinct-bulk event, removed later +under its original product prior. -/ +theorem movingSupportedArithmetic_bulk_residues {σ I : Type*} [Fintype I] + (base value : σ → ℕ) (n m : ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (hv : ∀ i ∉ Set.range slot, value i = base i) + (t : Bool → FrequencyTree ℤ n) (small : Bool → TreeLeafTuple (List σ) n) + (samples : Bool → MovingSampleSlots σ n) + (hvsmall : ∀ b, movingSlotValues value n (small b) = movingSlotValues base n (small b)) + (hvsamples : ∀ b, (samples b).values value = (samples b).values base) + (e : Equiv.Perm (TreeLeafIndex n × Fin m)) + (T : Bool → MovingSlotData σ n) + (hT : ∀ b, T b = buildMovingSlotData n (t b) (small b) + (if b then bulkSlotLeaves n m (slot ∘ e.symm) else bulkSlotLeaves n m slot) (samples b)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (E : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℤ → ℤ → ℝ) + (outside : List ℕ) (childBound pivotBound : ℕ → ℕ) + (hvalue : ∀ i, value i ≠ 0) (hf : ∀ b, (T b).Frequencies (· ≠ 0)) + (hprime : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, (value i).Prime) + (hnodup : ∀ b, ∀ L ∈ (T b).regularLists, + (L.filter (bulkIndexPredicate slot)).Nodup) + (hinj : Function.Injective (value ∘ slot)) + (hcross : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, ∀ j ∈ L, + bulkIndexPredicate slot i ≠ bulkIndexPredicate slot j → value i ≠ value j) + (hout : ∀ b, ∀ L ∈ (T b).regularLists, ∀ i ∈ L, i ∈ Set.range slot → + ∀ p ∈ outside, (value i).Coprime p) + (R : ℤ) (r : ℕ) [NeZero r] + (hcomp : ∀ b j, (T b).CompensationAbsent (slot j)) + (hR : ∀ b, (T b).frequencyProduct ∣ R) (hr : R ^ (n + 1) ∣ (r : ℤ)) + (p : I → ℕ) [∀ i, Fact (p i).Prime] + (hc : Pairwise (fun i j => (bulkResidueModuli r p i).Coprime (bulkResidueModuli r p j))) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (D : ∀ i, Bool → (ZMod (p i))ˣ) + (z : TreeLeafIndex n × Fin m → (ZMod (∏ i, bulkResidueModuli r p i))ˣ) + (hz : ∀ j, (value (slot j) : ZMod (∏ i, bulkResidueModuli r p i)) = (z j : ZMod _)) + (input : PublishedProgressionInput) (Q : ℕ) (y : ℝ) : + movingFrequencyPageAverage value outside F E T + (fun b => (T b).formulaNodes value hvalue childBound pivotBound (hf b) + (.prime false) (.prime true)) R r input Q y * + ∏ i, movingSpectatorHaarAverage value (p i) (g i) (D i) T = + frozenBulkFrequencyFactor base slot outside F E T childBound R r input Q y + (bulkResidueEquiv r p hc z).1 * + ∏ i, frozenBulkSpectatorHaar base n m t small samples (D i) e (g i) + ((bulkResidueEquiv r p hc z).2 i) := by + have hinj' : ∀ i j, bulkIndexPredicate slot i = true → + bulkIndexPredicate slot j = true → value i = value j → i = j := by + intro i j hi hj hij + obtain ⟨a, rfl⟩ := (bulkIndexPredicate_eq_true slot i).mp hi + obtain ⟨b, rfl⟩ := (bulkIndexPredicate_eq_true slot j).mp hj + exact congrArg slot (hinj hij) + rw [movingFrequencyPageAverage_actual_nonbulk value base + (bulkIndexPredicate slot) outside + (fun i hi => hv i ((bulkIndexPredicate_eq_false slot i).mp hi)) hvalue childBound pivotBound F E T hf + hprime hnodup hinj' hcross (fun b L hL i hi hb => hout b L hL i hi ((bulkIndexPredicate_eq_true slot i).mp hb))] + rw [mul_assoc, movingCoreSpectator_bulk_residues base value n m slot hv t small samples + hvsmall hvsamples e T hT F E R r hf hcomp hR hr p hc g hg D z hz input Q y] + simp only [frozenBulkFrequencyFactor, mul_assoc, finite_univ_canonical] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenUnitArithmetic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenUnitArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..f930c7bb3818837cd9679f6c829266cc5baaba38 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/FrozenUnitArithmetic.lean @@ -0,0 +1,230 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.FrozenArithmeticNorm +import OAI.NumberTheory.Ostmann.Arithmetic.MovingLeafAmplitude +import OAI.NumberTheory.Ostmann.Arithmetic.FrequencyModelModulus +import OAI.NumberTheory.Ostmann.Characters.FourierWindowDecay + +namespace OAI + +/-! # The arithmetic norm after the explicit compensation factors are removed -/ + +namespace Ostmann +open scoped Classical BigOperators SchwartzMap + +noncomputable def frozenUnitArithmeticMean {σ I : Type*} [Fintype I] + (base : σ → ℕ) (n m R : ℕ) [NeZero (R ^ (n - 1 + 2))] + (ts : Bool → FrequencyTree ℤ n) (small : Bool → TreeLeafTuple (List σ) n) + (a : Bool → MovingSampleSlots σ n) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) (Q : ℕ) + (Y : ℝ) (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) + (g : ∀ i, ZMod (p i) → ℂ) (twist : ∀ i, Bool → (ZMod (p i))ˣ) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) : ℝ := + let T := fun b => buildMovingSlotData n (ts b) (small b) (bulkSlotLeaves n m slot) (a b) + let Freq := frozenBulkFrequencyFactor base slot outside F (fun _ _ _ _ _ => 1) T childBound R + (R ^ (n - 1 + 2)) input Q Y + let Spec := fun i => frozenBulkSpectatorHaar base n m ts small a (twist i) (Equiv.refl _) (g i) + (Fintype.card (TreeLeafIndex n × Fin m → + (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ) : ℝ)⁻¹ * + ∑ x : TreeLeafIndex n × Fin m → (ZMod (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i))ˣ, + ‖(Freq (bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).1 * + ∏ j, pageGiantWeight input Q (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i) + (x j).val.val (Ybulk j)) * + ∏ i, Spec i ((bulkResidueEquiv (R ^ (n - 1 + 2)) p hc x).2 i)‖ + +theorem frozenUnitArithmeticMean_nonneg {σ I : Type*} [Fintype I] + (base : σ → ℕ) (n m R : ℕ) [NeZero (R ^ (n - 1 + 2))] + (ts : Bool → FrequencyTree ℤ n) (small : Bool → TreeLeafTuple (List σ) n) + (a : Bool → MovingSampleSlots σ n) (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (outside : List ℕ) (childBound : ℕ → ℕ) (input : PublishedProgressionInput) (Q : ℕ) + (Y : ℝ) (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) + (g : ∀ i, ZMod (p i) → ℂ) (twist : ∀ i, Bool → (ZMod (p i))ˣ) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) : + 0 ≤ frozenUnitArithmeticMean base n m R ts small a slot F outside childBound input Q Y + p hc g twist Ybulk := by unfold frozenUnitArithmeticMean; positivity + +theorem frozenUnitArithmeticMean_le {σ I : Type*} [Fintype I] + (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m R N V : ℕ) + [NeZero (R ^ (n - 1 + 2))] (t : FrequencyTree (S × S) n) + (hS : ∀ s ∈ S, s ≠ 0) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hR : ∀ b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ i ∉ Set.range slot, IsCoprime (base i : ℤ) (R : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (hF : ∀ b s regular, ‖F b (.leaf s regular) s‖ ≤ if s.natAbs ≤ V then 1 else 0) + (D : ℝ) (hD : 0 ≤ D) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) (hm : 0 < m) + (p : I → ℕ) [∀ i, Fact (p i).Prime] + [NeZero (∏ i, bulkResidueModuli (R ^ (n - 1 + 2)) p i)] + (hc : Pairwise (fun i j => (bulkResidueModuli (R ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R ^ (n - 1 + 2)) p j))) (hp : ∀ i, 3 ≤ p i) + (hfreq : ∀ i b, movingGiantFrequencyUnits (p i) n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t))) + (hsmallp : ∀ i b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod (p i)) ≠ 0) + (hasamples : ∀ i b, ((a b).values base).UnitsAt (p i)) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, ∑ x : ZMod (p i), ‖g i x‖ ^ 2 ≤ (p i : ℝ)) + (twist : ∀ i, Bool → (ZMod (p i))ˣ) (outside : List ℕ) (childBound : ℕ → ℕ) + (input : PublishedProgressionInput) (Q : ℕ) (Y : ℝ) (hY : 0 ≤ Y) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) (hYbulk : ∀ j, 0 ≤ Ybulk j) : + frozenUnitArithmeticMean base n m R + (fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + small a slot F outside childBound input Q Y p hc g twist Ybulk ≤ + ((2 : ℝ) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * Fintype.card I)) * + (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) := by + have h := frozenArithmetic_same_assignment_norm base tier S n m R t hS hR slot small a + hslot hsmall ha hbase F (fun _ _ _ _ _ => 1) N D hD hN hdiv hm p hc hp hfreq + hsmallp hasamples g hg henergy twist outside childBound input Q Y hY Ybulk hYbulk + have hamp := movingDataWeight_pair_unit_leaf_bound F V hF S n t small (bulkSlotLeaves n m slot) a + have hprob : 0 ≤ ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod := by + apply List.prod_nonneg + intro c hc + obtain ⟨f, _, rfl⟩ := List.mem_map.mp hc + exact pairFrequencySupportBound_nonneg D f + have hbound := mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right + (mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right hamp hprob) (by norm_num : (0 : ℝ) ≤ 2)) + (by positivity : (0 : ℝ) ≤ 3 ^ (2 ^ n * Fintype.card I))) + (by positivity : (0 : ℝ) ≤ 2 ^ (2 ^ n * m)) + have h' : frozenUnitArithmeticMean base n m R + (fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + small a slot F outside childBound input Q Y p hc g twist Ybulk ≤ _ := h + exact h'.trans (hbound.trans_eq (by ring)) + +theorem frozenUnitArithmeticMean_sum_le {σ I : Type*} [Fintype I] + (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m N V : ℕ) + (R : FrequencyTree (S × S) n → ℕ) [∀ t, NeZero (R t ^ (n - 1 + 2))] + (hS : ∀ s ∈ S, s ≠ 0) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hR : ∀ t b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R t) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ t i, i ∉ Set.range slot → IsCoprime (base i : ℤ) (R t : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (hF : ∀ b s regular, ‖F b (.leaf s regular) s‖ ≤ if s.natAbs ≤ V then 1 else 0) + (D : ℝ) (hD : 0 ≤ D) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) (hm : 0 < m) + (p : I → ℕ) [∀ i, Fact (p i).Prime] + [∀ t, NeZero (∏ i, bulkResidueModuli (R t ^ (n - 1 + 2)) p i)] + (hc : ∀ t, Pairwise (fun i j => (bulkResidueModuli (R t ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R t ^ (n - 1 + 2)) p j))) (hp : ∀ i, 3 ≤ p i) + (hfreq : ∀ t i b, movingGiantFrequencyUnits (p i) n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t))) + (hsmallp : ∀ i b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod (p i)) ≠ 0) + (hasamples : ∀ i b, ((a b).values base).UnitsAt (p i)) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, ∑ x : ZMod (p i), ‖g i x‖ ^ 2 ≤ (p i : ℝ)) + (twist : ∀ i, Bool → (ZMod (p i))ˣ) (outside : List ℕ) (childBound : ℕ → ℕ) + (input : PublishedProgressionInput) (Q : ℕ) (Y : ℝ) (hY : 0 ≤ Y) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) (hYbulk : ∀ j, 0 ≤ Ybulk j) : + (∑ t : FrequencyTree (S × S) n, frozenUnitArithmeticMean base n m (R t) + (fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + small a slot F outside childBound input Q Y p (hc t) g twist Ybulk) ≤ + ((2 : ℝ) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * Fintype.card I)) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * (2 * (V : ℝ)) ^ (2 * 2 ^ n)) := by + let C : ℝ := (2 : ℝ) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * Fintype.card I) + have hC : 0 ≤ C := by dsimp [C]; positivity + calc + _ ≤ ∑ t : FrequencyTree (S × S) n, C * + (frequencyLeafWeight (pairedFrequencyLeaf S V) n t * + ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod) := by + apply Finset.sum_le_sum + intro t _ + exact frozenUnitArithmeticMean_le base tier S n m (R t) N V t hS hN (hR t) + slot small a hslot hsmall ha (hbase t) F hF D hD hdiv hm p (hc t) hp (hfreq t) + hsmallp hasamples g hg henergy twist outside childBound input Q Y hY Ybulk hYbulk + _ = C * ∑ t : FrequencyTree (S × S) n, + frequencyTreeWeight (pairedFrequencyKernel S D) (pairedFrequencyLeaf S V) n t := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + rw [frequencyTreeWeight_eq_splitList] + ring + _ ≤ _ := mul_le_mul_of_nonneg_left + (arithmetic_frequency_tree_sum_le S N V D hD (fun s hs => ⟨hS s hs, hN s hs⟩) + (gcd_frequency_divisor_bound S N D (fun s hs => ⟨hS s hs, hN s hs⟩) hdiv) n) hC + +theorem frozenUnitArithmetic_kernel_sum_le {σ I : Type*} [Fintype I] + (base : σ → ℕ) (tier : σ → ℕ) (S : Finset ℤ) (n m N V : ℕ) + (R : FrequencyTree (S × S) n → ℕ) [∀ t, NeZero (R t ^ (n - 1 + 2))] + (hS : ∀ s ∈ S, s ≠ 0) (hN : ∀ s ∈ S, s.natAbs ≤ N) + (hR : ∀ t b (j : Fin (2 ^ n - 1)), + (singleTreeNodeFrequencies S n (frequencyPairProjection S n b t) j.val).root.natAbs ∣ R t) + (slot : (TreeLeafIndex n × Fin m) ↪ σ) + (small : Bool → TreeLeafTuple (List σ) n) (a : Bool → MovingSampleSlots σ n) + (hslot : ∀ j, n ≤ tier (slot j)) + (hsmall : ∀ b i, i ∈ flattenMovingSlots n (small b) → i ∉ Set.range slot) + (ha : ∀ b, (a b).Levels tier) + (hbase : ∀ t i, i ∉ Set.range slot → IsCoprime (base i : ℤ) (R t : ℤ)) + (F : Bool → {k : ℕ} → MovingSlotData σ k → ℤ → ℂ) + (hF : ∀ b s regular, ‖F b (.leaf s regular) s‖ ≤ if s.natAbs ≤ V then 1 else 0) + (D : ℝ) (hD : 0 ≤ D) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) (hm : 0 < m) + (p : I → ℕ) [∀ i, Fact (p i).Prime] + [∀ t, NeZero (∏ i, bulkResidueModuli (R t ^ (n - 1 + 2)) p i)] + (hc : ∀ t, Pairwise (fun i j => (bulkResidueModuli (R t ^ (n - 1 + 2)) p i).Coprime + (bulkResidueModuli (R t ^ (n - 1 + 2)) p j))) (hp : ∀ i, 3 ≤ p i) + (hfreq : ∀ t i b, movingGiantFrequencyUnits (p i) n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t))) + (hsmallp : ∀ i b, ((treeLeafProduct n (movingSlotValues base n (small b)) : ℕ) : ZMod (p i)) ≠ 0) + (hasamples : ∀ i b, ((a b).values base).UnitsAt (p i)) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, ∑ x : ZMod (p i), ‖g i x‖ ^ 2 ≤ (p i : ℝ)) + (twist : ∀ i, Bool → (ZMod (p i))ˣ) (outside : List ℕ) (childBound : ℕ → ℕ) + (input : PublishedProgressionInput) (Q : ℕ) (Y : ℝ) (hY : 0 ≤ Y) + (Ybulk : TreeLeafIndex n × Fin m → ℝ) (hYbulk : ∀ j, 0 ≤ Ybulk j) + (value : σ → ℝ) (pivotBound : ℕ → ℕ) (ψ : 𝓢(ℝ, ℂ)) + (X Δ hi : ℝ) (hΔ : 0 ≤ Δ) (hhi : Real.exp Δ ≤ hi) + (φ : ℝ → ℝ) (G : ℕ → ℝ) (Bφ : ℝ) (hBφ : 0 ≤ Bφ) + (hφ : ∀ x, |φ x| ≤ Bφ) (L₀ R₀ : ℝ) : + (∑ t : FrequencyTree (S × S) n, + ‖realValueKernelPair value childBound pivotBound + (fun b => buildMovingSlotData n + (frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + (small b) (bulkSlotLeaves n m slot) (a b)) + ψ X (Real.exp Δ) hi (Real.one_le_exp hΔ) hhi φ G L₀ R₀‖ * + frozenUnitArithmeticMean base n m (R t) + (fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + small a slot F outside childBound input Q Y p (hc t) g twist Ybulk) ≤ + (((SchwartzMap.seminorm ℝ 0 0 ψ) ^ (2 ^ n) * Bφ ^ (2 ^ n - 1)) ^ 2 * + Real.exp (-(2 ^ n : ℕ) * Δ)) * + (((2 : ℝ) ^ (2 ^ n * m) * 2 * 3 ^ (2 ^ n * Fintype.card I)) * + ((8 * D ^ 4 * (1 + Real.log N) ^ 3) ^ (2 ^ n - 1) * (2 * (V : ℝ)) ^ (2 * 2 ^ n))) := by + let A := fun t : FrequencyTree (S × S) n => frozenUnitArithmeticMean base n m (R t) + (fun b => frequencyTreeMap Subtype.val n (frequencyPairProjection S n b t)) + small a slot F outside childBound input Q Y p (hc t) g twist Ybulk + let K := ((SchwartzMap.seminorm ℝ 0 0 ψ) ^ (2 ^ n) * Bφ ^ (2 ^ n - 1)) ^ 2 * + Real.exp (-(2 ^ n : ℕ) * Δ) + have hK : 0 ≤ K := by dsimp [K]; positivity + calc + _ ≤ ∑ t : FrequencyTree (S × S) n, K * A t := by + apply Finset.sum_le_sum + intro t _ + exact mul_le_mul_of_nonneg_right + (realValueKernelPair_norm_exp value childBound pivotBound _ ψ X Δ hi hΔ hhi φ G Bφ hBφ hφ L₀ R₀) + (frozenUnitArithmeticMean_nonneg base n m (R t) _ small a slot F outside childBound input Q Y + p (hc t) g twist Ybulk) + _ = K * ∑ t : FrequencyTree (S × S) n, A t := (Finset.mul_sum _ _ _).symm + _ ≤ _ := mul_le_mul_of_nonneg_left + (frozenUnitArithmeticMean_sum_le base tier S n m N V R hS hN hR slot small a hslot hsmall ha hbase + F hF D hD hdiv hm p hc hp hfreq hsmallp hasamples g hg henergy twist outside childBound input Q Y hY + Ybulk hYbulk) hK + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionError.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionError.lean new file mode 100644 index 0000000000000000000000000000000000000000..635fc278be915c111e859586b087f223d377120c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionError.lean @@ -0,0 +1,104 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GiantCollisionErrorInteger + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.GiantCollisionError +open Construction + +theorem cmean_sub_eq {α : Type*} [Fintype α] (μ : FinitePrior α) (f g : α → ℂ) : + μ.cmean f-μ.cmean g=μ.cmean (fun x => f x-g x) := by + simp only [FinitePrior.cmean,mul_sub,Finset.sum_sub_distrib] + +theorem norm_cmean_le_of_mass_ne_zero {α : Type*} [Fintype α] + (μ : FinitePrior α) (f : α → ℂ) (A : ℝ) + (hf : ∀ x, μ.mass x ≠ 0 → ‖f x‖ ≤ A) : ‖μ.cmean f‖ ≤ A := by + refine (μ.norm_cmean_le f).trans ?_ + calc + μ.mean (fun x => ‖f x‖) ≤ μ.mean (fun _ => A) := by + apply Finset.sum_le_sum + intro x _ + by_cases hx : μ.mass x=0 + · simp only [hx,zero_mul,le_refl] + · exact mul_le_mul_of_nonneg_left (hf x hx) (μ.mass_nonneg x) + _ = A := μ.mean_const A + +theorem pair_mean_fst {α β : Type*} [Fintype α] [Fintype β] + (μ : FinitePrior α) (ν : FinitePrior β) (h : α → ℝ) : + (μ.pair ν).mean (fun x => h x.1)=μ.mean h := by + simp only [FinitePrior.mean,FinitePrior.pair,Fintype.sum_prod_type] + simp_rw [show ∀ x y, μ.mass x*ν.mass y*h x=μ.mass x*h x*ν.mass y by intros; ring] + simp only [← Finset.mul_sum,ν.mass_total,mul_one] + +theorem logCell_guard_error_with_outer {α : Type*} [Fintype α] + (G : ℝ) (E : Finset ℕ) (hZ : 0 < logCellMass G E) (ν : FinitePrior α) + (f g : (LogCellSample G E × LogCellSample G E) × α → ℂ) {A : ℝ} (hA : 0 ≤ A) + (heq : ∀ x, Nat.Coprime x.1.1.val x.1.2.val → f x=g x) + (hbound : ∀ x, ¬ Nat.Coprime x.1.1.val x.1.2.val → ‖f x-g x‖ ≤ A) : + ‖(((logCellPrior G E hZ).pair (logCellPrior G E hZ)).pair ν).cmean f- + (((logCellPrior G E hZ).pair (logCellPrior G E hZ)).pair ν).cmean g‖ ≤ + A*(Real.exp (1-G)/logCellMass G E) := by + have h := cmean_error_of_agree_off + (((logCellPrior G E hZ).pair (logCellPrior G E hZ)).pair ν) + (fun x => ¬ Nat.Coprime x.1.1.val x.1.2.val) f g A + (fun x hx => heq x (not_not.mp hx)) hbound + have hprob := pair_mean_fst ((logCellPrior G E hZ).pair (logCellPrior G E hZ)) ν + (fun x => if ¬ Nat.Coprime x.1.val x.2.val then (1:ℝ) else 0) + rw [hprob] at h + exact h.trans (mul_le_mul_of_nonneg_left (logCell_collision_mass_le G E hZ) hA) + +theorem integer_guard_error_averaged {α : Type*} [Fintype α] (μ : FinitePrior α) + (q : α → ℕ) (G : ℝ) (hq : ∀ x, Nat.Prime (q x)) + (hlog : ∀ x, μ.mass x ≠ 0 → |Real.log (q x)-G| ≤ 1) + (f g : α → ℕ → ℂ) {A : ℝ} (hA : 0 ≤ A) + (heq : ∀ x, μ.mass x ≠ 0 → ∀ n ∈ integerPivotCell G, + Nat.Coprime n (q x) → f x n=g x n) + (hbound : ∀ x, μ.mass x ≠ 0 → ∀ n ∈ integerPivotCell G, + ¬ Nat.Coprime n (q x) → ‖f x n-g x n‖ ≤ A) : + ‖μ.cmean (fun x => ∑ n ∈ integerPivotCell G,(externalPivotWeight G n:ℂ)*f x n)- + μ.cmean (fun x => ∑ n ∈ integerPivotCell G,(externalPivotWeight G n:ℂ)*g x n)‖ ≤ + A*(8*Real.exp (-G)) := by + rw [cmean_sub_eq] + apply norm_cmean_le_of_mass_ne_zero + intro x hx + exact integerPivotCell_guard_error G (q x) (hq x) (hlog x hx) (f x) (g x) + hA (heq x hx) (hbound x hx) + +theorem logCell_integer_guard_error (G : ℝ) (E : Finset ℕ) (hZ : 0 < logCellMass G E) + (f g : LogCellSample G E → ℕ → ℂ) {A : ℝ} (hA : 0 ≤ A) + (heq : ∀ q, (logCellPrior G E hZ).mass q ≠ 0 → ∀ n ∈ integerPivotCell G, + Nat.Coprime n q.val → f q n=g q n) + (hbound : ∀ q, (logCellPrior G E hZ).mass q ≠ 0 → ∀ n ∈ integerPivotCell G, + ¬ Nat.Coprime n q.val → ‖f q n-g q n‖ ≤ A) : + ‖(logCellPrior G E hZ).cmean + (fun q => ∑ n ∈ integerPivotCell G,(externalPivotWeight G n:ℂ)*f q n)- + (logCellPrior G E hZ).cmean + (fun q => ∑ n ∈ integerPivotCell G,(externalPivotWeight G n:ℂ)*g q n)‖ ≤ + A*(8*Real.exp (-G)) := by + apply integer_guard_error_averaged (logCellPrior G E hZ) (fun q => q.val) G + (fun q => logCellSample_prime q) _ f g hA heq hbound + intro q hq + exact (logCellPrimeSource_log_support G E hZ q hq).le + +theorem cellSupport_guard_error (N : ℕ) (lo hi G : ℝ) (hhi : hi ≤ G+1) + (q : ℕ) (hq : Nat.Prime q) (hlog : |Real.log q-G| ≤ 1) + (f g : ℕ → ℂ) {A : ℝ} (hA : 0 ≤ A) + (heq : ∀ n ∈ IntegerCell.cellSupport N lo hi, Nat.Coprime n q → f n=g n) + (hbound : ∀ n ∈ IntegerCell.cellSupport N lo hi, + ¬ Nat.Coprime n q → ‖f n-g n‖ ≤ A) : + ‖(∑ n ∈ IntegerCell.cellSupport N lo hi,(externalPivotWeight G n:ℂ)*f n)- + ∑ n ∈ IntegerCell.cellSupport N lo hi,(externalPivotWeight G n:ℂ)*g n‖ ≤ + A*(8*Real.exp (-G)) := by + exact (weighted_error_of_agree_off (IntegerCell.cellSupport N lo hi) (externalPivotWeight G) + (fun n => ¬ Nat.Coprime n q) f g A (fun n _ => externalPivotWeight_nonneg G n) + (fun n hn hc => heq n hn (not_not.mp hc)) hbound).trans + (mul_le_mul_of_nonneg_left (cellSupport_collision_mass_le N lo hi G hhi q hq hlog) hA) + +end Ostmann.Arithmetic.GiantCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cd75be00a5e930d576efcc99421c575206d4ffe --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorBasic.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Construction.ActualAmplitude +import OAI.NumberTheory.Ostmann.Construction.SourcePriors + +namespace OAI + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.GiantCollisionError +open Construction + +theorem weighted_error_of_agree_off {α : Type*} (s : Finset α) + (w : α → ℝ) (Bad : α → Prop) [DecidablePred Bad] (f g : α → ℂ) (A : ℝ) + (hw : ∀ x ∈ s, 0 ≤ w x) + (heq : ∀ x ∈ s, ¬ Bad x → f x = g x) + (hbound : ∀ x ∈ s, Bad x → ‖f x-g x‖ ≤ A) : + ‖(∑ x ∈ s, (w x : ℂ)*f x) - ∑ x ∈ s, (w x : ℂ)*g x‖ ≤ + A * ∑ x ∈ s, if Bad x then w x else 0 := by + rw [← Finset.sum_sub_distrib] + calc + _ ≤ ∑ x ∈ s, ‖(w x : ℂ)*f x-(w x : ℂ)*g x‖ := norm_sum_le _ _ + _ ≤ ∑ x ∈ s, A*(if Bad x then w x else 0) := by + apply Finset.sum_le_sum + intro x hx + by_cases hb : Bad x + · rw [← mul_sub,norm_mul,Complex.norm_real,Real.norm_eq_abs, + abs_of_nonneg (hw x hx),ite_eq_left hb] + simpa only [mul_comm] using mul_le_mul_of_nonneg_left (hbound x hx hb) (hw x hx) + · simp only [heq x hx hb,sub_self,norm_zero,ite_eq_right hb,mul_zero,le_refl] + _ = _ := (Finset.mul_sum _ _ _).symm + +theorem cmean_error_of_agree_off {α : Type*} [Fintype α] (μ : FinitePrior α) + (Bad : α → Prop) [DecidablePred Bad] (f g : α → ℂ) (A : ℝ) + (heq : ∀ x, ¬ Bad x → f x = g x) + (hbound : ∀ x, Bad x → ‖f x-g x‖ ≤ A) : + ‖μ.cmean f-μ.cmean g‖ ≤ A*μ.mean (fun x => if Bad x then 1 else 0) := by + have h := weighted_error_of_agree_off Finset.univ μ.mass Bad f g A + (fun x _ => μ.mass_nonneg x) (fun x _ => heq x) (fun x _ => hbound x) + simpa only [FinitePrior.cmean,FinitePrior.mean,mul_ite,mul_one,mul_zero] using h + +theorem equality_mass_le {α : Type*} [Fintype α] [DecidableEq α] (μ ν : FinitePrior α) + (B : ℝ) (hB : ∀ x, ν.mass x ≤ B) : + (μ.pair ν).mean (fun x => if x.1=x.2 then 1 else 0) ≤ B := by + change (∑ x : α×α, μ.mass x.1*ν.mass x.2*(if x.1=x.2 then 1 else 0)) ≤ B + rw [Fintype.sum_prod_type] + simp only [mul_ite,mul_one,mul_zero,Finset.sum_ite_eq,Finset.mem_univ,ite_true] + calc + ∑ x, μ.mass x*ν.mass x ≤ ∑ x, μ.mass x*B := + Finset.sum_le_sum fun x _ => mul_le_mul_of_nonneg_left (hB x) (μ.mass_nonneg x) + _ = B := by rw [← Finset.sum_mul,μ.mass_total,one_mul] + +theorem primeSource_not_coprime_iff_eq (S : PrimeSource) (p q : S.Sample) : + ¬ Nat.Coprime p.val q.val ↔ p=q := by + rw [Nat.coprime_primes (S.prime p.val p.property) (S.prime q.val q.property)] + exact not_not.trans Subtype.ext_iff.symm + +theorem primeSource_collision_mass_le (S : PrimeSource) (B : ℝ) + (hB : ∀ p, S.law.mass p ≤ B) : + (S.law.pair S.law).mean (fun x => if ¬ Nat.Coprime x.1.val x.2.val then 1 else 0) ≤ B := by + simpa only [primeSource_not_coprime_iff_eq] using equality_mass_le S.law S.law B hB + +theorem logCellPrior_mass_le_exp (G : ℝ) (E : Finset ℕ) (hZ : 0 < logCellMass G E) + (p : LogCellSample G E) : + (logCellPrior G E hZ).mass p ≤ Real.exp (1-G)/logCellMass G E := by + change logCellWeight G p/(∑ q : LogCellSample G E,logCellWeight G q) ≤ _ + rw [logCell_sample_sum] + exact div_le_div_of_nonneg_right (logCellWeight_le_exp G p) hZ.le + +theorem logCell_collision_mass_le (G : ℝ) (E : Finset ℕ) (hZ : 0 < logCellMass G E) : + ((logCellPrior G E hZ).pair (logCellPrior G E hZ)).mean + (fun x => if ¬ Nat.Coprime x.1.val x.2.val then 1 else 0) ≤ + Real.exp (1-G)/logCellMass G E := + primeSource_collision_mass_le (logCellPrimeSource G E hZ) _ (logCellPrior_mass_le_exp G E hZ) + +theorem logCell_guard_error (G : ℝ) (E : Finset ℕ) (hZ : 0 < logCellMass G E) + (f g : LogCellSample G E × LogCellSample G E → ℂ) {A : ℝ} (hA : 0 ≤ A) + (heq : ∀ x, Nat.Coprime x.1.val x.2.val → f x=g x) + (hbound : ∀ x, ¬ Nat.Coprime x.1.val x.2.val → ‖f x-g x‖ ≤ A) : + ‖((logCellPrior G E hZ).pair (logCellPrior G E hZ)).cmean f - + ((logCellPrior G E hZ).pair (logCellPrior G E hZ)).cmean g‖ ≤ + A*(Real.exp (1-G)/logCellMass G E) := by + exact (cmean_error_of_agree_off _ (fun x => ¬ Nat.Coprime x.1.val x.2.val) f g A + (fun x hx => heq x (not_not.mp hx)) hbound).trans + (mul_le_mul_of_nonneg_left (logCell_collision_mass_le G E hZ) hA) + +end Ostmann.Arithmetic.GiantCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorInteger.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorInteger.lean new file mode 100644 index 0000000000000000000000000000000000000000..989520c609a502fda5b8615c53aac380ad3d944e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorInteger.lean @@ -0,0 +1,107 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GiantCollisionErrorBasic +import OAI.NumberTheory.Ostmann.Arithmetic.IntegerCellTests +import OAI.NumberTheory.Ostmann.Construction.DiagonalExternalMeasure + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.GiantCollisionError +open Construction + +lemma exp_two_lt_eight : Real.exp 2 < 8 := by + have h := Real.exp_one_lt_d9 + have hp := Real.exp_pos 1 + have he : Real.exp 2=Real.exp 1*Real.exp 1 := by + rw [← Real.exp_add] + norm_num + rw [he] + nlinarith + +theorem integerPivotCell_collision_card_le (G : ℝ) (q : ℕ) (hq : Nat.Prime q) + (hlog : |Real.log q-G| ≤ 1) : + ((integerPivotCell G).filter (fun n => ¬ Nat.Coprime n q)).card ≤ 8 := by + have hqR : (0:ℝ) ¬ Nat.Coprime n q), Real.exp (-G) := + Finset.sum_le_sum fun n _ => externalPivotWeight_le G n + _ = (((integerPivotCell G).filter (fun n => ¬ Nat.Coprime n q)).card : ℝ)* + Real.exp (-G) := by simp + _ ≤ _ := mul_le_mul_of_nonneg_right + (by exact_mod_cast integerPivotCell_collision_card_le G q hq hlog) (Real.exp_pos _).le + +theorem integerPivotCell_guard_error (G : ℝ) (q : ℕ) (hq : Nat.Prime q) + (hlog : |Real.log q-G| ≤ 1) (f g : ℕ → ℂ) {A : ℝ} (hA : 0 ≤ A) + (heq : ∀ n ∈ integerPivotCell G, Nat.Coprime n q → f n=g n) + (hbound : ∀ n ∈ integerPivotCell G, ¬ Nat.Coprime n q → ‖f n-g n‖ ≤ A) : + ‖(∑ n ∈ integerPivotCell G,(externalPivotWeight G n:ℂ)*f n)- + ∑ n ∈ integerPivotCell G,(externalPivotWeight G n:ℂ)*g n‖ ≤ + A*(8*Real.exp (-G)) := by + exact (weighted_error_of_agree_off (integerPivotCell G) (externalPivotWeight G) + (fun n => ¬ Nat.Coprime n q) f g A (fun n _ => externalPivotWeight_nonneg G n) + (fun n hn hc => heq n hn (not_not.mp hc)) hbound).trans + (mul_le_mul_of_nonneg_left (integerPivotCell_collision_mass_le G q hq hlog) hA) + +theorem cellSupport_subset_integerPivotCell (N : ℕ) (lo hi G : ℝ) (hhi : hi ≤ G+1) : + IntegerCell.cellSupport N lo hi ⊆ integerPivotCell G := by + intro n hn + have hh := (Finset.mem_filter.mp hn).2 + apply Finset.mem_Ioc.mpr + refine ⟨hh.1,?_⟩ + have hnR : (0:ℝ) ¬ Nat.Coprime n q)).card ≤ 8 := + (Finset.card_le_card (Finset.filter_subset_filter _ + (cellSupport_subset_integerPivotCell N lo hi G hhi))).trans + (integerPivotCell_collision_card_le G q hq hlog) + +theorem cellSupport_collision_mass_le (N : ℕ) (lo hi G : ℝ) (hhi : hi ≤ G+1) + (q : ℕ) (hq : Nat.Prime q) (hlog : |Real.log q-G| ≤ 1) : + (∑ n ∈ IntegerCell.cellSupport N lo hi, + if ¬ Nat.Coprime n q then externalPivotWeight G n else 0) ≤ 8*Real.exp (-G) := by + refine (Finset.sum_le_sum_of_subset_of_nonneg + (cellSupport_subset_integerPivotCell N lo hi G hhi) ?_).trans + (integerPivotCell_collision_mass_le G q hq hlog) + intro n _ _ + split_ifs <;> first | exact externalPivotWeight_nonneg G n | exact le_rfl + +end Ostmann.Arithmetic.GiantCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..786037393e620ac5e1ffb0f7731dff9c1e41cda4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GiantCollisionErrorSupport.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GiantCollisionError + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.GiantCollisionError +open Construction + +theorem weighted_guard_error_support {α : Type*} (s : Finset α) + (w : α→ℝ) (Good : α→Prop) [DecidablePred Good] (f : α→ℂ) + {A : ℝ} (hw : ∀x∈s,0≤w x) + (hf : ∀x∈s,w x≠0→¬Good x→‖f x‖≤A) : + ‖(∑x∈s,(w x:ℂ)*(if Good x then f x else 0))- + ∑x∈s,(w x:ℂ)*f x‖≤A*∑x∈s,if ¬Good x then w x else 0 := by + rw [←Finset.sum_sub_distrib] + calc + _ ≤ ∑x∈s,‖(w x:ℂ)*(if Good x then f x else 0)-(w x:ℂ)*f x‖ := norm_sum_le _ _ + _ ≤ ∑x∈s,A*(if ¬Good x then w x else 0) := by + apply Finset.sum_le_sum + intro x hx + by_cases hz : w x=0 + · simp only [hz,Complex.ofReal_zero,zero_mul,sub_self,norm_zero,ite_self,mul_zero,le_refl] + · by_cases hg : Good x + · simp [hg] + · simp only [ite_eq_right hg,ite_eq_left hg,mul_zero,zero_sub,norm_neg,norm_mul,Complex.norm_real, + Real.norm_eq_abs,abs_of_nonneg (hw x hx)] + exact (mul_le_mul_of_nonneg_left (hf x hx hz hg) (hw x hx)).trans_eq (mul_comm _ _) + _ = _ := (Finset.mul_sum _ _ _).symm + +theorem logCell_guard_support (G : ℝ) (E : Finset ℕ) (hZ : 0if Nat.Coprime x.1.val x.2.val then f x else 0)- + ((logCellPrior G E hZ).pair (logCellPrior G E hZ)).cmean f‖≤ + A*(Real.exp (1-G)/logCellMass G E) := by + let μ := (logCellPrior G E hZ).pair (logCellPrior G E hZ) + have hh := weighted_guard_error_support Finset.univ μ.mass + (fun x=>Nat.Coprime x.1.val x.2.val) f (fun x _=>μ.mass_nonneg x) (by + rintro ⟨p,q⟩ _ hz hb + exact hf p q (mul_ne_zero_iff.mp hz).1 (mul_ne_zero_iff.mp hz).2 hb) + have hmass := logCell_collision_mass_le G E hZ + have hh' : ‖μ.cmean (fun x=>if Nat.Coprime x.1.val x.2.val then f x else 0)-μ.cmean f‖≤ + A*μ.mean (fun x=>if ¬Nat.Coprime x.1.val x.2.val then 1 else 0) := by + simpa only [FinitePrior.cmean,FinitePrior.mean,mul_ite,mul_one,mul_zero] using hh + exact hh'.trans (mul_le_mul_of_nonneg_left hmass hA) + +theorem integer_guard_support (G : ℝ) (q : ℕ) (hq : q.Prime) + (hlog : |Real.log q-G|≤1) (f : ℕ→ℂ) {A : ℝ} (hA : 0≤A) + (hf : ∀n∈integerPivotCell G,externalPivotWeight G n≠0→¬Nat.Coprime n q→‖f n‖≤A) : + ‖(∑n∈integerPivotCell G,(externalPivotWeight G n:ℂ)*(if Nat.Coprime n q then f n else 0))- + ∑n∈integerPivotCell G,(externalPivotWeight G n:ℂ)*f n‖≤A*(8*Real.exp (-G)) := + (weighted_guard_error_support (integerPivotCell G) (externalPivotWeight G) + (fun n=>Nat.Coprime n q) f (fun n _=>externalPivotWeight_nonneg G n) hf).trans + (mul_le_mul_of_nonneg_left (integerPivotCell_collision_mass_le G q hq hlog) hA) + +theorem logCell_integer_guard_support (G : ℝ) (E : Finset ℕ) (hZ : 0∑n∈integerPivotCell G, + (externalPivotWeight G n:ℂ)*(if Nat.Coprime n q.val then f q n else 0))- + (logCellPrior G E hZ).cmean (fun q=>∑n∈integerPivotCell G, + (externalPivotWeight G n:ℂ)*f q n)‖≤A*(8*Real.exp (-G)) := by + rw [cmean_sub_eq] + apply norm_cmean_le_of_mass_ne_zero + intro q hq + exact integer_guard_support G q.val (logCellSample_prime q) + (logCellPrimeSource_log_support G E hZ q hq).le (f q) hA (hf q hq) + +end Ostmann.Arithmetic.GiantCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryCoefficient.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryCoefficient.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb0418453cf9161c089d87da015ae0571e56cd75 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryCoefficient.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Construction.HistoryFormulaFourier + +namespace OAI + +/-! # The global history coefficient and its exact one-variable polynomial form -/ + +namespace Ostmann + +open scoped BigOperators SchwartzMap Classical + +noncomputable def HistoryFormula.realValue {σ : Type*} (F : HistoryFormula σ) (x : σ → ℤ) : ℝ := + MvPolynomial.eval₂ (Int.castRingHom ℝ) (fun i => (x i : ℝ)) F.cleared.numerator / + F.cleared.denominator + +theorem formulaPolynomial_eval_update {σ : Type*} (F : HistoryFormula σ) + (a : σ → ℤ) (coord : σ) (z : ℤ) : + (formulaPolynomial F (fun j => (a j : ℝ)) coord).eval (z : ℝ) = + F.realValue (Function.update a coord z) := by + rw [formulaPolynomial, normalizedHistoryPolynomial_eval] + unfold HistoryFormula.realValue + congr 2 + funext j + by_cases hj : j = coord + · subst j; simp only [Function.update_self] + · simp only [Function.update_of_ne hj] + +theorem formulaFourier_polynomial_eval {σ : Type*} {n : ℕ} + (F : Fin n → HistoryFormula σ) (a : σ → ℤ) (coord : σ) + (X : Fin n → ℝ) (ψ : 𝓢(ℝ, ℂ)) (v lo hi : Fin n → ℝ) + (hlo : ∀ j, 1 ≤ lo j) (hhi : ∀ j, lo j ≤ hi j) (j : Fin n) (z : ℤ) : + ((formulaFourierFactors F (fun i => (a i : ℝ)) coord X ψ v lo hi hlo hhi) j).polynomial.eval (z : ℝ) = + (F j).realValue (Function.update a coord z) / X j := by + change (normalizedHistoryPolynomial _ _ _ ((F j).cleared.denominator * X j)).eval (z : ℝ) = _ + rw [normalizedHistoryPolynomial_eval, ← div_div] + have he := formulaPolynomial_eval_update (F j) a coord z + rw [formulaPolynomial, normalizedHistoryPolynomial_eval] at he + rw [he] + +noncomputable def globalHistoryArchCoefficient {σ : Type*} {n t : ℕ} + (F : Fin n → HistoryFormula σ) (G : Fin t → HistoryFormula σ) + (X : Fin n → ℝ) (ψ : 𝓢(ℝ, ℂ)) (v lo hi : Fin n → ℝ) + (glo ghi : Fin t → ℝ) (x : σ → ℤ) : ℂ := + (if (∀ j, (G j).realValue x ∈ Set.Icc (glo j) (ghi j)) ∧ + (∀ j, (F j).realValue x / X j ∈ Set.Icc (lo j) (hi j)) then 1 else 0) * + ∏ j, normalizedFourierProfile ψ (v j) ((F j).realValue x / X j) + +theorem globalHistoryArchCoefficient_local {σ : Type*} {n t : ℕ} + (F : Fin n → HistoryFormula σ) (G : Fin t → HistoryFormula σ) + (X : Fin n → ℝ) (ψ : 𝓢(ℝ, ℂ)) (v lo hi : Fin n → ℝ) + (hlo : ∀ j, 1 ≤ lo j) (hhi : ∀ j, lo j ≤ hi j) (glo ghi : Fin t → ℝ) + (a : σ → ℤ) (coord : σ) (z : ℤ) : + globalHistoryArchCoefficient F G X ψ v lo hi glo ghi (Function.update a coord z) = + polynomialAmplitude (formulaFourierFactors F (fun j => (a j : ℝ)) coord X ψ v lo hi hlo hhi) + (fullHistoryPolynomials (formulaFourierFactors F (fun j => (a j : ℝ)) coord X ψ v lo hi hlo hhi) + (formulaRangePolynomials G (fun j => (a j : ℝ)) coord glo ghi)) + (fullHistoryKeep (polynomialRangeKeep t)) z := by + rw [fullHistoryAmplitude_exact] + simp only [formulaRangePolynomials_iff, formulaPolynomial_eval_update, formulaFourier_polynomial_eval] + rfl + +noncomputable def globalHistoryCoefficient {σ : Type*} {n t : ℕ} + (steps : List (HistoryPivotStep σ)) (units : Fin steps.length → ℕ) + (F : Fin n → HistoryFormula σ) (G : Fin t → HistoryFormula σ) + (X : Fin n → ℝ) (ψ : 𝓢(ℝ, ℂ)) (v lo hi : Fin n → ℝ) + (glo ghi : Fin t → ℝ) (x : σ → ℤ) : ℂ := + (if ValidIntegerReconstruction steps x ∧ + ∀ i, IsUnit ((reconstructedPivotAt steps x i : ℤ) : ZMod (units i)) then 1 else 0) * + globalHistoryArchCoefficient F G X ψ v lo hi glo ghi x + +/-- No support representation is assumed here: the global coefficient is +identical to the polynomial coefficient used by the one-sided estimate. -/ +theorem globalHistoryCoefficient_local {σ : Type*} {n t : ℕ} + (steps : List (HistoryPivotStep σ)) (units : Fin steps.length → ℕ) + (F : Fin n → HistoryFormula σ) (G : Fin t → HistoryFormula σ) + (X : Fin n → ℝ) (ψ : 𝓢(ℝ, ℂ)) (v lo hi : Fin n → ℝ) + (hlo : ∀ j, 1 ≤ lo j) (hhi : ∀ j, lo j ≤ hi j) (glo ghi : Fin t → ℝ) + (a : σ → ℤ) (coord : σ) (z : ℤ) : + globalHistoryCoefficient steps units F G X ψ v lo hi glo ghi (Function.update a coord z) = + reconstructedHistoryAmplitude steps units a coord + (formulaFourierFactors F (fun j => (a j : ℝ)) coord X ψ v lo hi hlo hhi) + (fullHistoryPolynomials (formulaFourierFactors F (fun j => (a j : ℝ)) coord X ψ v lo hi hlo hhi) + (formulaRangePolynomials G (fun j => (a j : ℝ)) coord glo ghi)) + (fullHistoryKeep (polynomialRangeKeep t)) z := by + unfold globalHistoryCoefficient reconstructedHistoryAmplitude + rw [globalHistoryArchCoefficient_local F G X ψ v lo hi hlo hhi glo ghi a coord z] + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryPairBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryPairBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..b2481d54bf0fee74d67e2cc288c741504f5ab303 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryPairBound.lean @@ -0,0 +1,126 @@ +import OAI.NumberTheory.Ostmann.Construction.HistoryCoefficientData +import OAI.NumberTheory.Ostmann.Arithmetic.ReconstructedPairGraphBound +import OAI.NumberTheory.Ostmann.Construction.OriginalHarmonicPair + +namespace OAI + +/-! # The explicit pair bound for global history coefficients under original priors -/ + +namespace Ostmann + +open scoped BigOperators ComplexConjugate Classical + +noncomputable def historyPairBound {V : Type*} (D D' : HistoryCoefficientData V) + (frequencies : List ℤ) (C A E : ℕ) (P Q : Finset ℕ) (b : ℝ) (Bq : ℕ) : ℝ := + ((Nat.log 2 E + 1 : ℕ) : ℝ) * (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ * + (((∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * b⁻¹) * (2 * (D.budget * D'.budget) ^ 2) + + (historyFrequencyPeriod frequencies (C ^ (D.steps.length + D'.steps.length) + 1) : ℝ) * + ((3 ^ (2 * (D.complexity + D'.complexity)) : ℕ) * + (2 * (A : ℝ)⁻¹ * (D.budget * D'.budget) ^ 2)) * (Bq : ℝ) ^ 2) + +theorem selected_global_history_pair_bound {V : Type*} [Fintype V] + (a b : V) (hab : a ≠ b) (D D' : HistoryCoefficientData V) + (frequencies : List ℤ) (C : ℕ) (hC : 1 ≤ C) + (hfreq : ∀ s ∈ frequencies, s ≠ 0) + (hsteps : ∀ step ∈ D.steps, step.s ∈ frequencies) + (hsteps' : ∀ step ∈ D'.steps, step.s ∈ frequencies) + (hsize : ∀ step ∈ D.steps, step.left.length + step.right.length + 4 ≤ C) + (hsize' : ∀ step ∈ D'.steps, step.left.length + step.right.length + 4 ≤ C) + (hunits : ∀ i, (D.units i : ℤ) ∣ (historyFrequencyBase frequencies : ℤ)) + (hunits' : ∀ i, (D'.units i : ℤ) ∣ (historyFrequencyBase frequencies : ℤ)) + (χ : V → ∀ p : ℕ, DirichletCharacter ℂ p) (graph : V → V → ℤ) + (unary : V → ℕ → ℂ) (hunary : ∀ i x, ‖unary i x‖ ≤ 1) + (hself : graph a a = 0 ∧ graph b b = 0) (hreverse : graph b a = 0) + (P Q : Finset ℕ) (hprime : ∀ q ∈ Q, q.Prime) + (hnonprincipal : ∀ q ∈ Q, χ a q ^ graph a b ≠ 1) + (A E : ℕ) (hA : 0 < A) + (hMA : historyFrequencyPeriod frequencies (C ^ (D.steps.length + D'.steps.length) + 1) ≤ A) + (hsmall : ∀ q ∈ Q, ∀ s ∈ frequencies, s.natAbs < q) + (hlow : ∀ p ∈ P, 2 * A ≤ p) (hhigh : ∀ p ∈ P, p ≤ E) + (lower : ℝ) (hlower : 0 < lower) (hlowerQ : ∀ q ∈ Q, lower ≤ (q : ℝ)) + (hPmass : 0 < ∑ p ∈ P, (p : ℝ)⁻¹) (hQmass : 0 < ∑ q ∈ Q, (q : ℝ)⁻¹) + (Bq : ℕ) (hBq : ∀ q : Q, (q : ℕ) ≤ Bq) (outside : OtherVertices a b → ℕ) : + ‖∑ p : P, (primeSubsetPrior P P p : ℂ) * + ∑ q : Q, (primeSubsetPrior Q Q q : ℂ) * + (let x := twoCoordinateAssignment a b hab outside (q : ℕ) (p : ℕ) + finiteEdgeWeight (dirichletGraphEdge χ graph) unary x * + (D.value (fun i => (x i : ℤ)) * conj (D'.value (fun i => (x i : ℤ)))))‖ ^ 2 ≤ + historyPairBound D D' frequencies C A E P Q lower Bq := by + let e := twoVertexEquiv a b hab + let fixed (q : Q) : V → ℤ := twoCoordinateAssignment a b hab (fun i => (outside i : ℤ)) (q : ℕ) 0 + have hx (q : Q) (p : P) : + (fun i => ((twoCoordinateAssignment a b hab outside (q : ℕ) (p : ℕ) i : ℕ) : ℤ)) = + Function.update (fixed q) b (p : ℕ) := by + rw [twoCoordinateAssignment_map] + exact (twoCoordinateAssignment_update_long a b hab + (fun i => (outside i : ℤ)) (q : ℕ) 0 (p : ℕ)).symm + have hgraph (q : Q) (p : P) : + finiteEdgeWeight (dirichletGraphEdge χ graph) unary + (twoCoordinateAssignment a b hab outside (q : ℕ) (p : ℕ)) = + finiteEdgeWeight (dirichletGraphEdge (fun i => χ (e i)) (fun i j => graph (e i) (e j))) + (fun i => unary (e i)) (twoVertexLabels outside q p) := by + rw [finiteEdgeWeight_two_vertices] + congr 1 + funext i + unfold twoCoordinateAssignment + cases (twoVertexEquiv a b hab).symm i with + | inl t => cases t <;> rfl + | inr v => rfl + have hh := reconstructed_pair_dyadic_graph_bound D.steps D'.steps frequencies C hC hfreq + hsteps hsteps' hsize hsize' D.units D'.units hunits hunits' + (fun i => χ (e i)) (fun i j => graph (e i) (e j)) (fun i => unary (e i)) outside + (fun i x => hunary (e i) x) hself hreverse P Q hprime hnonprincipal A E hA hMA hsmall + hlow hhigh lower hlower hlowerQ hPmass hQmass fixed b + (fun q => D.factors (fixed q) b) (fun q => D'.factors (fixed q) b) + (fun q => D.polynomials (fixed q) b) (fun q => D'.polynomials (fixed q) b) + (fun _ => D.keep) (fun _ => D'.keep) D.budget D'.budget D.complexity D'.complexity Bq + D.budget_nonneg D'.budget_nonneg + (fun q => (D.factors_budget (fixed q) b).le) (fun q => (D'.factors_budget (fixed q) b).le) + (fun q => D.polynomials_complexity (fixed q) b) (fun q => D'.polynomials_complexity (fixed q) b) hBq + simp_rw [hgraph, hx, D.value_local, D'.value_local] + exact hh + +/-- This is the full original-prior correlation estimate for the two +constructed coefficients. Its only remaining loss is the displayed numerical +bound, which is independent of the other sampled labels. -/ +theorem global_history_pair_original_bound {V : Type*} [Fintype V] + (a b : V) (hab : a ≠ b) (D D' : HistoryCoefficientData V) + (frequencies : List ℤ) (C : ℕ) (hC : 1 ≤ C) + (hfreq : ∀ s ∈ frequencies, s ≠ 0) + (hsteps : ∀ step ∈ D.steps, step.s ∈ frequencies) + (hsteps' : ∀ step ∈ D'.steps, step.s ∈ frequencies) + (hsize : ∀ step ∈ D.steps, step.left.length + step.right.length + 4 ≤ C) + (hsize' : ∀ step ∈ D'.steps, step.left.length + step.right.length + 4 ≤ C) + (hunits : ∀ i, (D.units i : ℤ) ∣ (historyFrequencyBase frequencies : ℤ)) + (hunits' : ∀ i, (D'.units i : ℤ) ∣ (historyFrequencyBase frequencies : ℤ)) + (χ : V → ∀ p : ℕ, DirichletCharacter ℂ p) (graph : V → V → ℤ) + (unary : V → ℕ → ℂ) (hunary : ∀ i x, ‖unary i x‖ ≤ 1) + (hself : graph a a = 0 ∧ graph b b = 0) (hreverse : graph b a = 0) + (P : Finset ℕ) (Q : V → Finset ℕ) (hQP : ∀ i, Q i ⊆ P) + (hQmass : ∀ i, 0 < ∑ q ∈ Q i, (q : ℝ)⁻¹) + (hprime : ∀ q ∈ Q a, q.Prime) + (hnonprincipal : ∀ q ∈ Q a, χ a q ^ graph a b ≠ 1) + (A E : ℕ) (hA : 0 < A) + (hMA : historyFrequencyPeriod frequencies (C ^ (D.steps.length + D'.steps.length) + 1) ≤ A) + (hsmall : ∀ q ∈ Q a, ∀ s ∈ frequencies, s.natAbs < q) + (hlow : ∀ p ∈ Q b, 2 * A ≤ p) (hhigh : ∀ p ∈ Q b, p ≤ E) + (lower : ℝ) (hlower : 0 < lower) (hlowerQ : ∀ q ∈ Q a, lower ≤ (q : ℝ)) + (Bq : ℕ) (hBq : ∀ q : Q a, (q : ℕ) ≤ Bq) + (δ : ℝ) (hδ : 0 ≤ δ) + (hnum : historyPairBound D D' frequencies C A E (Q b) (Q a) lower Bq ≤ δ ^ 2) : + ‖∑ x : V → P, ((∏ i, primeSubsetPrior P (Q i) (x i) : ℝ) : ℂ) * + (finiteEdgeWeight (dirichletGraphEdge χ graph) unary (fun i => (x i : ℕ)) * + (D.value (fun i => (x i : ℤ)) * conj (D'.value (fun i => (x i : ℤ)))))‖ ≤ δ := by + apply original_harmonic_pair_bound a b hab P Q hQP (fun i => (hQmass i).ne') + (fun x => finiteEdgeWeight (dirichletGraphEdge χ graph) unary x * + (D.value (fun i => (x i : ℤ)) * conj (D'.value (fun i => (x i : ℤ))))) δ hδ + intro outside + have hs := selected_global_history_pair_bound a b hab D D' frequencies C hC hfreq + hsteps hsteps' hsize hsize' hunits hunits' χ graph unary hunary hself hreverse + (Q b) (Q a) hprime hnonprincipal A E hA hMA hsmall hlow hhigh lower hlower hlowerQ + (hQmass b) (hQmass a) Bq hBq (fun i => (outside i : ℕ)) + exact (sq_le_sq₀ (norm_nonneg _) hδ).mp (hs.trans hnum) + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryPairDecay.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryPairDecay.lean new file mode 100644 index 0000000000000000000000000000000000000000..c7e50321a8d5a6a6f87a413fa47e6214f9f2292c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GlobalHistoryPairDecay.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GlobalHistoryPairBound +import OAI.NumberTheory.Ostmann.Characters.DyadicCharacterBudget + +namespace OAI + +/-! # Double-exponential decay of the constructed history-pair bound -/ + +namespace Ostmann + +open scoped BigOperators +open Filter + +theorem eventual_history_pair_numeric_bound (K z α β γ c : ℝ) (d : ℕ) + (hK : 0 ≤ K) (hz : 0 ≤ z) (hα : 0 < α) (hαβ : α < β) + (hγβ : γ < β) (hc : 0 < c) : + ∀ᶠ L : ℝ in atTop, ∀ {V : Type} (D D' : HistoryCoefficientData V) + (frequencies : List ℤ) (C A E : ℕ) (P Q : Finset ℕ) (lower : ℝ) (Bq : ℕ) (m : ℝ), + 0 ≤ m → m ≤ z * L → + Real.exp (c * Real.exp (α * L)) ≤ lower → + Real.exp (Real.exp (β * L)) ≤ (A : ℝ) → + (Bq : ℝ) ≤ Real.exp (Real.exp (γ * L)) → + 2 * ((Nat.log 2 E + 1 : ℕ) : ℝ) * (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ * + (∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * (D.budget * D'.budget) ^ 2 ≤ Real.exp (K * (1 + m) ^ d) → + 2 * ((Nat.log 2 E + 1 : ℕ) : ℝ) * (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ * + (historyFrequencyPeriod frequencies (C ^ (D.steps.length + D'.steps.length) + 1) : ℝ) * + (3 ^ (2 * (D.complexity + D'.complexity)) : ℕ) * (D.budget * D'.budget) ^ 2 ≤ + Real.exp (K * (1 + m) ^ d) → + historyPairBound D D' frequencies C A E P Q lower Bq ≤ + (Real.exp (-(c / 4) * Real.exp (α * L))) ^ 2 := by + filter_upwards [eventual_one_sided_squared_budget K z α β γ c d hK hz hα hαβ hγβ hc] + with L hL V D D' frequencies C A E P Q lower Bq m hm hmL hlower hA hBq hcost₁ hcost₂ + apply le_trans (dyadic_character_numeric_bound + ((Nat.log 2 E + 1 : ℕ) : ℝ) (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ (∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ + (historyFrequencyPeriod frequencies (C ^ (D.steps.length + D'.steps.length) + 1)) + (3 ^ (2 * (D.complexity + D'.complexity)) : ℕ) (D.budget * D'.budget) + A lower Bq (Real.exp (K * (1 + m) ^ d)) α β γ c L + (by positivity) (by positivity) (by positivity) (by positivity) (by positivity) + hlower hA (Nat.cast_nonneg Bq) hBq hcost₁ hcost₂) + apply (hL m hm hmL).trans_eq + rw [← Real.exp_nat_mul] + congr 1 + ring + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GroupHaarImage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GroupHaarImage.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ee59ea5ddc01e9e26ed440350292659acee9900 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GroupHaarImage.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.ResidueHaar + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.GroupHaarImage +open scoped BigOperators +open ResidueHaar + +local instance subgroupFintype {H : Type*} [Group H] [Fintype H] + (S : Subgroup H) : Fintype S := Fintype.ofFinite S + +def homProductEquiv {G H : Type*} [Group G] [Group H] + (f : G →* H) (hf : Function.Surjective f) : G ≃ H × f.ker where + toFun x := (f x,⟨(Classical.choose (hf (f x)))⁻¹*x, by + simp [MonoidHom.mem_ker,Classical.choose_spec (hf (f x))]⟩) + invFun z := Classical.choose (hf z.1) * z.2.val + left_inv x := by simp + right_inv z := by + have hk : f z.2.val = 1 := z.2.property + have hr : f (Classical.choose (hf z.1)) = z.1 := Classical.choose_spec (hf z.1) + apply Prod.ext + · simp [map_mul,hr,hk] + · apply Subtype.ext + simp [map_mul,hr,hk] + +theorem average_surjective {G H : Type*} [Group G] [Group H] + [Fintype G] [Fintype H] (f : G →* H) (hf : Function.Surjective f) + (F : H → ℂ) : average (fun x => F (f x)) = average F := by + classical + let e := homProductEquiv f hf + have h := average_equiv e (fun z : H × f.ker => F z.1) + change average (fun x => F (f x)) = average (fun z : H × f.ker => F z.1) at h + have hk : average (fun _ : f.ker => (1:ℂ)) = 1 := by + have hc : (Fintype.card f.ker : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr Fintype.card_ne_zero + simp only [average,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_one] + exact inv_mul_cancel₀ hc + calc + _ = average (fun z : H × f.ker => F z.1 * 1) := by + simpa only [mul_one] using h + _ = average F * average (fun _ : f.ker => (1:ℂ)) := average_product F (fun _ : f.ker => (1:ℂ)) + _ = _ := by rw [hk,mul_one] + +theorem average_range {G H : Type*} [Group G] [Group H] + [Fintype G] [Fintype H] (f : G →* H) (F : f.range → ℂ) : + average (fun x => F (f.rangeRestrict x)) = average F := by + classical + exact @average_surjective G f.range _ _ _ (subgroupFintype f.range) + f.rangeRestrict f.rangeRestrict_surjective F + +end Ostmann.Arithmetic.GroupHaarImage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GroupedBulkSymmetrization.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GroupedBulkSymmetrization.lean new file mode 100644 index 0000000000000000000000000000000000000000..d6a6697898c7a81e99088e3d66d894f466fad272 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GroupedBulkSymmetrization.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Characters.MixedBulkSymmetrization +import OAI.NumberTheory.Ostmann.Arithmetic.MovingDiagonalEnergy + +namespace OAI + +/-! # Bulk averaging inside the original product and frequency fibres -/ + +namespace Ostmann +open scoped Classical BigOperators + +theorem selectedBulkAverage_statistic {B A : Type*} [Fintype B] [Fintype A] + (n m : ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ B) + (ν : B → A → ℝ) (hν : ∀ j k, ν (slot j) = ν (slot k)) + (G W : (B → A) → ℂ) + (hG : ∀ e y, G (selectedBulkSample slot e y) = G y) : + (∑ y, ((∏ i, ν i (y i) : ℝ) : ℂ) * G y * + mixedBulkSymmetrize n m slot (fun _ y _ _ => W y) 0 y 0 0) = + ∑ y, ((∏ i, ν i (y i) : ℝ) : ℂ) * G y * W y := by + have hc : (Fintype.card (Equiv.Perm (TreeLeafIndex n × Fin m)) : ℂ) ≠ 0 := by + exact_mod_cast Fintype.card_ne_zero + have hs (e : Equiv.Perm (TreeLeafIndex n × Fin m)) : + (∑ y, ((∏ i, ν i (y i) : ℝ) : ℂ) * G y * W (selectedBulkSample slot e y)) = + ∑ y, ((∏ i, ν i (y i) : ℝ) : ℂ) * G y * W y := by + have h := selectedBulkSample_sum slot e ν hν (fun y => G y * W y) + simpa only [hG, mul_assoc] using h + unfold mixedBulkSymmetrize finiteFamilyAverage + simp only [Finset.mul_sum] + simp_rw [show ∀ (y : B → A) (e : Equiv.Perm (TreeLeafIndex n × Fin m)), + ((∏ i, ν i (y i) : ℝ) : ℂ) * G y * + ((Fintype.card (Equiv.Perm (TreeLeafIndex n × Fin m)) : ℂ)⁻¹ * + W (selectedBulkSample slot e⁻¹ y)) = + (Fintype.card (Equiv.Perm (TreeLeafIndex n × Fin m)) : ℂ)⁻¹ * + (((∏ i, ν i (y i) : ℝ) : ℂ) * G y * W (selectedBulkSample slot e⁻¹ y)) by intros; ring] + rw [Finset.sum_comm] + simp_rw [← Finset.mul_sum, hs] + simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] + field_simp + +/-- All pointwise cutoffs may remain inside the coefficient. Only the key +and the original independent bulk law are invariant under reassignment. -/ +theorem groupedCoefficient_bulk_average {B A K : Type*} [Fintype B] [Fintype A] + (n m : ℕ) (slot : (TreeLeafIndex n × Fin m) ↪ B) + (ν : B → A → ℝ) (hν : ∀ j k, ν (slot j) = ν (slot k)) + (key : (B → A) → K) (hkey : ∀ e y, key (selectedBulkSample slot e y) = key y) + (W : (B → A) → ℂ) (k : K) : + groupedCoefficient key (fun y => ((∏ i, ν i (y i) : ℝ) : ℂ) * + mixedBulkSymmetrize n m slot (fun _ y _ _ => W y) 0 y 0 0) k = + groupedCoefficient key (fun y => ((∏ i, ν i (y i) : ℝ) : ℂ) * W y) k := by + have h := selectedBulkAverage_statistic n m slot ν hν + (fun y => if key y = k then 1 else 0) W (fun e y => by rw [hkey e y]) + simpa only [groupedCoefficient, mul_ite, mul_one, mul_zero, ite_mul, zero_mul] using h + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedHistoryCancellation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedHistoryCancellation.lean new file mode 100644 index 0000000000000000000000000000000000000000..48bb24976e48bdfea146d669f600fcdfdc7ac0ca --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedHistoryCancellation.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.SupportedHistoryCancellation + +namespace OAI + +/-! # One-sided cancellation retaining all polynomial history tests -/ + +namespace Ostmann + +open scoped BigOperators Classical + +noncomputable def guardedHistoryAmplitude {σ I : Type*} [Fintype I] {n t : ℕ} + (N : I → MvPolynomial σ ℤ) (d : I → ℤ) (s : I → ℕ) (a : σ → ℤ) (i : σ) + (F : Fin n → ClippedPolynomialFactor) (H : Fin t → Polynomial ℝ) + (keep : (Fin t → Bool) → Bool) (x : ℤ) : ℂ := + (if ∀ j, smallDivisionTest + (MvPolynomial.eval₂ (RingHom.id ℤ) (Function.update a i x) (N j)) (d j) (s j) then 1 else 0) * + polynomialAmplitude F H keep (x : ℝ) + +theorem guardedHistoryAmplitude_residue {σ I : Type*} [Fintype I] {n t : ℕ} + (N : I → MvPolynomial σ ℤ) (d : I → ℤ) (s : I → ℕ) (a : σ → ℤ) (i : σ) + (F : Fin n → ClippedPolynomialFactor) (H : Fin t → Polynomial ℝ) + (keep : (Fin t → Bool) → Bool) (M : ℕ) [NeZero M] + (hd : ∀ j, d j ≠ 0) (hdiv : ∀ j, d j * s j ∣ (M : ℤ)) (x : ℤ) : + guardedHistoryAmplitude N d s a i F H keep x = + clearedHistoryResidueGate N d s a i M (x : ZMod M) * polynomialAmplitude F H keep (x : ℝ) := by + rw [clearedHistoryResidueGate_exact N d s a i M hd hdiv x] + rfl + +theorem harmonic_guarded_history_bound {σ I : Type*} [Fintype I] {n t : ℕ} + (P Q : Finset ℕ) (hprime : ∀ q ∈ Q, q.Prime) + (χ : ∀ q : Q, DirichletCharacter ℂ (q : ℕ)) (hnonprincipal : ∀ q, χ q ≠ 1) + (a M K : ℕ) [NeZero M] (ha : 0 < a) (hM : ∀ q : Q, M.Coprime (q : ℕ)) + (hlow : ∀ p ∈ P, a ≤ p) (hhigh : ∀ p ∈ P, p < a + K * M) + (b : ℝ) (hb : 0 < b) (hbQ : ∀ q ∈ Q, b ≤ (q : ℝ)) + (hPmass : 0 < ∑ p ∈ P, (p : ℝ)⁻¹) (hQmass : 0 < ∑ q ∈ Q, (q : ℝ)⁻¹) + (N : Q → I → MvPolynomial σ ℤ) (d : Q → I → ℤ) (s : Q → I → ℕ) + (fixed : Q → σ → ℤ) (coord : σ) + (hd : ∀ q j, d q j ≠ 0) (hdiv : ∀ q j, d q j * s q j ∣ (M : ℤ)) + (F : Q → Fin n → ClippedPolynomialFactor) (H : Q → Fin t → Polynomial ℝ) + (keep : Q → (Fin t → Bool) → Bool) (B : ℝ) (R Bq : ℕ) + (hB : 0 ≤ B) (hbudget : ∀ q, smoothPolynomialBudget (F q) ≤ B) + (hcomplexity : ∀ q, polynomialWeightComplexity (F q) (H q) ≤ R) + (hBq : ∀ q : Q, (q : ℕ) ≤ Bq) + (U : P → ℂ) (V : Q → ℂ) (hU : ∀ p, ‖U p‖ ≤ 1) (hV : ∀ q, ‖V q‖ ≤ 1) : + ‖∑ p : P, (primeSubsetPrior P P p : ℂ) * + (U p * ∑ q : Q, (primeSubsetPrior Q Q q : ℂ) * V q * + (χ q ((p : ℕ) : ZMod (q : ℕ)) * + guardedHistoryAmplitude (N q) (d q) (s q) (fixed q) coord (F q) (H q) (keep q) (p : ℕ)))‖ ^ 2 ≤ + (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ * + (((∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * b⁻¹) * (((K * M : ℕ) : ℝ) / a * B ^ 2) + + (M : ℝ) * ((3 ^ (2 * R) : ℕ) * (2 * (a : ℝ)⁻¹ * B ^ 2)) * (Bq : ℝ) ^ 2) := by + have he (q : Q) (p : P) : guardedHistoryAmplitude (N q) (d q) (s q) (fixed q) coord + (F q) (H q) (keep q) (p : ℕ) = + clearedHistoryResidueGate (N q) (d q) (s q) (fixed q) coord M ((p : ℕ) : ZMod M) * + polynomialAmplitude (F q) (H q) (keep q) (p : ℝ) := by + simpa only [Int.cast_natCast] using guardedHistoryAmplitude_residue + (N q) (d q) (s q) (fixed q) coord (F q) (H q) (keep q) M (hd q) (hdiv q) (p : ℕ) + simp_rw [he] + exact harmonic_periodic_polynomial_one_sided_bound P Q hprime χ hnonprincipal a M K ha hM + (fun q => clearedHistoryResidueGate (N q) (d q) (s q) (fixed q) coord M) + (fun q => clearedHistoryResidueGate_norm (N q) (d q) (s q) (fixed q) coord M) + hlow hhigh b hb hbQ hPmass hQmass F H keep B R Bq hB hbudget hcomplexity hBq U V hU hV + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedHistoryPair.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedHistoryPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ad28629ed89af4d69dfc80db198ddfcb1bbcc08 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedHistoryPair.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GuardedHistoryCancellation +import OAI.NumberTheory.Ostmann.Construction.ConstructedHistoryGuards + +namespace OAI + +/-! # The literal product of both reconstructed history supports -/ + +namespace Ostmann + +open scoped BigOperators ComplexConjugate Classical + +theorem guardedHistoryAmplitude_pair {σ : Type*} {r s n m t u : ℕ} + (N : Fin r → MvPolynomial σ ℤ) (d : Fin r → ℤ) (v : Fin r → ℕ) + (N' : Fin s → MvPolynomial σ ℤ) (d' : Fin s → ℤ) (v' : Fin s → ℕ) + (a : σ → ℤ) (coord : σ) + (F : Fin n → ClippedPolynomialFactor) (G : Fin m → ClippedPolynomialFactor) + (H : Fin t → Polynomial ℝ) (J : Fin u → Polynomial ℝ) + (keep : (Fin t → Bool) → Bool) (keep' : (Fin u → Bool) → Bool) (x : ℤ) : + guardedHistoryAmplitude (Fin.append N N') (Fin.append d d') (Fin.append v v') + a coord (pairedPolynomialFactors F G) (Fin.append H J) (pairedPolynomialKeep keep keep') x = + guardedHistoryAmplitude N d v a coord F H keep x * + conj (guardedHistoryAmplitude N' d' v' a coord G J keep' x) := by + unfold guardedHistoryAmplitude + rw [pairedPolynomialAmplitude] + simp only [Fin.forall_fin_add, Fin.append_left, Fin.append_right, map_mul] + split_ifs <;> simp_all + +theorem reconstructedHistoryAmplitude_pair {σ : Type*} {n m t u : ℕ} + (steps steps' : List (HistoryPivotStep σ)) + (v : Fin steps.length → ℕ) (v' : Fin steps'.length → ℕ) + (a : σ → ℤ) (coord : σ) + (F : Fin n → ClippedPolynomialFactor) (G : Fin m → ClippedPolynomialFactor) + (H : Fin t → Polynomial ℝ) (J : Fin u → Polynomial ℝ) + (keep : (Fin t → Bool) → Bool) (keep' : (Fin u → Bool) → Bool) (x : ℤ) : + reconstructedHistoryAmplitude steps v a coord F H keep x * + conj (reconstructedHistoryAmplitude steps' v' a coord G J keep' x) = + guardedHistoryAmplitude + (Fin.append (fun i => (reconstructionFormulaAt steps .prime i).cleared.numerator) + (fun i => (reconstructionFormulaAt steps' .prime i).cleared.numerator)) + (Fin.append (fun i => (reconstructionFormulaAt steps .prime i).cleared.denominator) + (fun i => (reconstructionFormulaAt steps' .prime i).cleared.denominator)) + (Fin.append v v') a coord (pairedPolynomialFactors F G) (Fin.append H J) + (pairedPolynomialKeep keep keep') x := by + rw [reconstructedHistoryAmplitude_exact, reconstructedHistoryAmplitude_exact] + exact (guardedHistoryAmplitude_pair _ _ _ _ _ _ a coord F G H J keep keep' x).symm + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedRegularCRT.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedRegularCRT.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce23c4fe3df300391d3d7aaffdc0989b8e4f9cf3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/GuardedRegularCRT.lean @@ -0,0 +1,92 @@ +import OAI.NumberTheory.Ostmann.Construction.RegularGiantMultiplier + +namespace OAI + +/-! # The displayed natural-giant regular multiplier in the CRT average -/ + +namespace Ostmann +open scoped BigOperators Classical + +theorem regular_unit_tests_iff {I : Type*} [Fintype I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] (XL XR : ℕ) : + (∀ i, (XL : ZMod (p i)) ≠ 0 ∧ (XR : ZMod (p i)) ≠ 0) ↔ + XL.Coprime (∏ i, p i) ∧ XR.Coprime (∏ i, p i) := by + simp only [← isUnit_iff_ne_zero, ZMod.isUnit_iff_coprime, + Nat.coprime_prod_right_iff, Finset.mem_univ, forall_true_left, forall_and] + +theorem guardedRegularMultiplier_eq_coprime {I : Type*} [Fintype I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] (active : I → Bool) (s : ℤ) + (other : ∀ i, ZMod (p i)) (g : ∀ i, ZMod (p i) → ℂ) (XL XR : ℕ) : + guardedRegularMultiplier p active s other g XL XR = + if XL.Coprime (∏ i, p i) ∧ XR.Coprime (∏ i, p i) then + naturalRegularMultiplier p active s other g XL XR else 0 := by + simp only [guardedRegularMultiplier, regular_unit_tests_iff] + +theorem multiply_regular_after_support {I : Type*} [Fintype I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] (active : I → Bool) (s : ℤ) + (other : ∀ i, ZMod (p i)) (g : ∀ i, ZMod (p i) → ℂ) (XL XR : ℕ) + (w c k : ℂ) + (hw : w = if XL.Coprime XR ∧ XL.Coprime (∏ i, p i) ∧ XR.Coprime (∏ i, p i) + then c * k else 0) : + w * (naturalRegularMultiplier p active s other g XL XR : ℂ) = + if XL.Coprime XR then (c * (guardedRegularMultiplier p active s other g XL XR : ℂ)) * k else 0 := by + rw [hw, guardedRegularMultiplier_eq_coprime] + by_cases hpair : XL.Coprime XR <;> + by_cases hreg : XL.Coprime (∏ i, p i) ∧ XR.Coprime (∏ i, p i) + · rw [ite_eq_left ⟨hpair, hreg⟩, ite_eq_left hreg, ite_eq_left hpair] + ring + · rw [ite_eq_right (fun h => hreg h.2), ite_eq_right hreg, ite_eq_left hpair] + simp + · rw [ite_eq_right (fun h => hpair h.1), ite_eq_right hpair] + simp + · rw [ite_eq_right (fun h => hpair h.1), ite_eq_right hpair] + simp + +theorem guardedRegularMultiplier_crt {I : Type*} [Fintype I] [DecidableEq I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] [∀ i, NeZero (p i)] [NeZero (∏ i, p i)] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (r : ℕ) [NeZero r] [NeZero ((∏ i, p i) * r)] (hcop : (∏ i, p i).Coprime r) + (active : I → Bool) (s : ℤ) (other : ∀ i, ZMod (p i)) (g : ∀ i, ZMod (p i) → ℂ) + (z : ZMod ((∏ i, p i) * r) × (ZMod ((∏ i, p i) * r))ˣ) : + guardedRegularMultiplier p active s other g z.1.val (z.2 : ZMod ((∏ i, p i) * r)).val = + diagonalRegularMultiplier p active s other g + (crtExternalPairEquiv p hc (crtSplitExternalEquiv (∏ i, p i) r hcop z).1) := by + apply guardedRegularMultiplier_eq_diagonal + · intro i + change (z.1.val : ZMod (p i)) = + ZMod.prodEquivPi p hc ((ZMod.chineseRemainder hcop) z.1).1 i + have h := congrArg (fun x : ZMod ((∏ i, p i) * r) => + ZMod.prodEquivPi p hc ((ZMod.chineseRemainder hcop) x).1 i) + (ZMod.natCast_zmod_val z.1) + simpa only [map_natCast, Prod.fst_natCast, Pi.natCast_apply] using h + · intro i + change ((z.2 : ZMod ((∏ i, p i) * r)).val : ZMod (p i)) = + ZMod.prodEquivPi p hc ((ZMod.chineseRemainder hcop) (z.2 : ZMod ((∏ i, p i) * r))).1 i + have h := congrArg (fun x : ZMod ((∏ i, p i) * r) => + ZMod.prodEquivPi p hc ((ZMod.chineseRemainder hcop) x).1 i) + (ZMod.natCast_zmod_val (z.2 : ZMod ((∏ i, p i) * r))) + simpa only [map_natCast, Prod.fst_natCast, Pi.natCast_apply] using h + +/-- This is the actual natural-coordinate multiplier, not an auxiliary copy +of its transform. The remainder stays complex and may contain the Page factor. -/ +theorem guardedRegularMultiplier_average {I : Type*} [Fintype I] [DecidableEq I] + (p : I → ℕ) [∀ i, Fact (p i).Prime] [∀ i, NeZero (p i)] [NeZero (∏ i, p i)] + (hc : Pairwise (fun i j => (p i).Coprime (p j))) + (r : ℕ) [NeZero r] [NeZero ((∏ i, p i) * r)] (hcop : (∏ i, p i).Coprime r) + (active : I → Bool) (s : ℤ) (other : ∀ i, ZMod (p i)) + (hs : ∀ i, (s : ZMod (p i)) ≠ 0) (ho : ∀ i, other i ≠ 0) + (g : ∀ i, ZMod (p i) → ℂ) (hg : ∀ i, g i 0 = 0) + (henergy : ∀ i, (∑ x : ZMod (p i), ‖g i x‖ ^ 2) = p i) + (F : ZMod r × (ZMod r)ˣ → ℂ) : + (Fintype.card (ZMod ((∏ i, p i) * r) × (ZMod ((∏ i, p i) * r))ˣ) : ℂ)⁻¹ * + (∑ z, (guardedRegularMultiplier p active s other g z.1.val + (z.2 : ZMod ((∏ i, p i) * r)).val : ℂ) * + F (crtSplitExternalEquiv (∏ i, p i) r hcop z).2) = + ((∏ i, if active i then (1 : ℝ) else 1 - (p i : ℝ)⁻¹ : ℝ) : ℂ) * + ((Fintype.card (ZMod r × (ZMod r)ˣ) : ℂ)⁻¹ * ∑ z, F z) := by + simp_rw [guardedRegularMultiplier_crt p hc r hcop active s other g] + exact diagonalRegularMultiplier_crt p hc r hcop active s other hs ho g hg henergy F + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicGraphCancellation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicGraphCancellation.lean new file mode 100644 index 0000000000000000000000000000000000000000..db889711e686f6ae6bb33fd424b1fdcece125cb7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicGraphCancellation.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.ZeroDensity.DirichletGraphFactor +import OAI.NumberTheory.Ostmann.Arithmetic.HarmonicOneSidedBound + +namespace OAI + +/-! # Applying the one-sided estimate to the actual graph quotient -/ + +namespace Ostmann + +open scoped BigOperators Classical + +theorem harmonic_one_sided_graph_bound {J : Type*} [Fintype J] + (χ : (Bool ⊕ J) → ∀ p : ℕ, DirichletCharacter ℂ p) + (b : (Bool ⊕ J) → (Bool ⊕ J) → ℤ) + (unary : (Bool ⊕ J) → ℕ → ℂ) (fixed : J → ℕ) + (hunary : ∀ i x, ‖unary i x‖ ≤ 1) + (hself : b (.inl true) (.inl true) = 0 ∧ b (.inl false) (.inl false) = 0) + (hreverse : b (.inl false) (.inl true) = 0) + (P Q : Finset ℕ) (hprime : ∀ q ∈ Q, q.Prime) + (hnonprincipal : ∀ q ∈ Q, χ (.inl true) q ^ b (.inl true) (.inl false) ≠ 1) + (a M K : ℕ) (ha : 0 < a) (hM : ∀ q : Q, M.Coprime (q : ℕ)) + (hlow : ∀ p ∈ P, a ≤ p) (hhigh : ∀ p ∈ P, p < a + K * M) + (b₀ : ℝ) (hb₀ : 0 < b₀) (hbQ : ∀ q ∈ Q, b₀ ≤ (q : ℝ)) + (hPmass : 0 < ∑ p ∈ P, (p : ℝ)⁻¹) (hQmass : 0 < ∑ q ∈ Q, (q : ℝ)⁻¹) + {n t : ℕ} (F : Q → Fin n → ClippedPolynomialFactor) + (H : Q → Fin t → Polynomial ℝ) (keep : Q → (Fin t → Bool) → Bool) + (B : ℝ) (R Bq : ℕ) (hB : 0 ≤ B) + (hbudget : ∀ q, smoothPolynomialBudget (F q) ≤ B) + (hcomplexity : ∀ q, polynomialWeightComplexity (F q) (H q) ≤ R) + (hBq : ∀ q : Q, (q : ℕ) ≤ Bq) : + ‖∑ p : P, (primeSubsetPrior P P p : ℂ) * + ∑ q : Q, (primeSubsetPrior Q Q q : ℂ) * + (finiteEdgeWeight (dirichletGraphEdge χ b) unary + (twoVertexLabels fixed (q : ℕ) (p : ℕ)) * + polynomialAmplitude (F q) (H q) (keep q) (p : ℝ))‖ ^ 2 ≤ + (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ * + (((∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * b₀⁻¹) * (((K * M : ℕ) : ℝ) / a * B ^ 2) + + (M : ℝ) * ((3 ^ (2 * R) : ℕ) * (2 * (a : ℝ)⁻¹ * B ^ 2)) * (Bq : ℝ) ^ 2) := by + have hQne : Q.Nonempty := by + by_contra h + have he : Q = ∅ := Finset.not_nonempty_iff_eq_empty.mp h + simp only [he, Finset.sum_empty] at hQmass + exact (lt_irrefl (0 : ℝ)) hQmass + obtain ⟨q₀, hq₀⟩ := hQne + have hforward : b (.inl true) (.inl false) ≠ 0 := by + intro h + have hh := hnonprincipal q₀ hq₀ + simp only [h, zpow_zero, ne_eq, not_true_eq_false] at hh + obtain ⟨U, V, hU, hV, hfactor⟩ := dirichlet_one_sided_graph_factorization + χ b unary fixed hunary hself hreverse hforward + have hb := harmonic_polynomial_one_sided_bound P Q hprime + (fun q => χ (.inl true) q ^ b (.inl true) (.inl false)) + (fun q => hnonprincipal q q.property) a M K ha hM hlow hhigh b₀ hb₀ hbQ hPmass hQmass + F H keep B R Bq hB hbudget hcomplexity hBq + (fun p => U p) (fun q => V q) (fun p => hU p) (fun q => hV q) + have he : (∑ p : P, (primeSubsetPrior P P p : ℂ) * + ∑ q : Q, (primeSubsetPrior Q Q q : ℂ) * + (finiteEdgeWeight (dirichletGraphEdge χ b) unary + (twoVertexLabels fixed (q : ℕ) (p : ℕ)) * + polynomialAmplitude (F q) (H q) (keep q) (p : ℝ))) = + ∑ p : P, (primeSubsetPrior P P p : ℂ) * + (U p * ∑ q : Q, (primeSubsetPrior Q Q q : ℂ) * V q * + ((χ (.inl true) q ^ b (.inl true) (.inl false)) ((p : ℕ) : ZMod (q : ℕ)) * + polynomialAmplitude (F q) (H q) (keep q) (p : ℝ))) := by + apply Finset.sum_congr rfl + intro p _ + congr 1 + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro q _ + rw [hfactor] + ring + rw [he] + exact hb + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicHistoryRates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicHistoryRates.lean new file mode 100644 index 0000000000000000000000000000000000000000..81bf721e536588f849c4de312f20ee1d52a74116 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicHistoryRates.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.SingleHistoryRates +import OAI.NumberTheory.Ostmann.Construction.HarmonicPriorCost + +namespace OAI + +/-! # The single-history arithmetic rate under the actual prime priors -/ + +namespace Ostmann + +open Filter +open scoped BigOperators Classical + +/-- All growth and normalization hypotheses refer to the original prime +sets. The only arithmetic input is the proved bound for divisors. -/ +theorem harmonic_history_support_rate (n : ℕ) (K C ε : ℝ) (hC : 0 ≤ C) (hε : 0 < ε) : + ∀ᶠ m : ℝ in atTop, ∀ N V : ℕ, ∀ Δ : ℝ, ∀ P : Finset ℕ, ∀ S : Finset ℤ, + (N : ℝ) ≤ Real.exp (C * m) → + (V : ℝ) ≤ Real.exp (Δ + Real.sqrt m) → + (∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) → + ∀ Q : FrequencyTree S n → ℕ, ∀ [_hQ : ∀ t, NeZero (Q t)], + ∀ T : TreeLeafIndex n → Finset ℕ, ∀ h J : TreeLeafIndex n → ℕ, + ∀ hunit : ∀ t, ∀ p : P, (p : ℕ).Coprime (Q t), + (∀ t i, Q t ≤ 2 ^ h i) → + (∀ i p, p ∈ T i → 2 ^ h i ≤ p ∧ p < 2 ^ (h i + J i)) → + ∀ a C₁ L : ℝ, 0 < a → 1 ≤ L → + (∀ i, a ≤ ∑ p ∈ T i, (p : ℝ)⁻¹) → + (∀ i, (J i : ℝ) ≤ Real.exp (C₁ * L)) → + ∀ data : (t : FrequencyTree S n) → (ZMod (Q t))ˣ → + List (ZMod (Q t))ˣ → Option (ArithmeticSplitData (Q t)), + (∀ t R past d, data t R past = some d → + d.hasFrequencies (singleTreeNodeFrequencies S n t past.length)) → + Real.exp (-(2 ^ n : ℕ) * Δ + K) * harmonicHistorySupportSum P S V n Q T hunit data ≤ + Real.exp ((C₁ + max (Real.log (3 / a)) 0) * (2 ^ n : ℕ) * L + ε * m) := by + filter_upwards [single_history_budget_parameters n K C ε hC hε] with m hm + obtain ⟨D, hD, hdiv, hbudget⟩ := hm + intro N V Δ P S hN hV hS Q _hQ T h J hunit hsmall hrange a C₁ L ha hL hmass hJ data hmatch + have hdivN (q : ℕ) (hq : q ≠ 0) (hqN : q ≤ N ^ 2) : (q.divisors.card : ℝ) ≤ D := by + apply hdiv q hq + calc + (q : ℝ) ≤ (N : ℝ) ^ 2 := by exact_mod_cast hqN + _ ≤ Real.exp (C * m) ^ 2 := pow_le_pow_left₀ (Nat.cast_nonneg _) hN 2 + _ = Real.exp (2 * C * m) := by rw [← Real.exp_nat_mul]; congr 1; ring + have hs := harmonic_history_support_le P S N V n D hD hS hdivN Q T h J hunit hsmall hrange data hmatch + have hc := harmonic_prior_product_cost_linear n T J a C₁ L ha hL hmass hJ + have hb := hbudget N V Δ hN hV + unfold harmonicHistorySupportSum + calc + _ ≤ Real.exp (-(2 ^ n : ℕ) * Δ + K) * + ((∏ i, (∑ p ∈ T i, (p : ℝ)⁻¹)⁻¹ * (3 * J i)) * + ((4 * D ^ 3 * (1 + Real.log N)) ^ (2 ^ n - 1) * (2 * (V : ℝ)) ^ (2 ^ n))) := + mul_le_mul_of_nonneg_left hs (Real.exp_pos _).le + _ = (∏ i, (∑ p ∈ T i, (p : ℝ)⁻¹)⁻¹ * (3 * J i)) * + (Real.exp (-(2 ^ n : ℕ) * Δ + K) * + ((4 * D ^ 3 * (1 + Real.log N)) ^ (2 ^ n - 1) * (2 * (V : ℝ)) ^ (2 ^ n))) := by ring + _ ≤ Real.exp ((C₁ + max (Real.log (3 / a)) 0) * (2 ^ n : ℕ) * L) * Real.exp (ε * m) := + mul_le_mul hc hb (by + have := Real.log_natCast_nonneg N + positivity) (Real.exp_pos _).le + _ = _ := (Real.exp_add _ _).symm + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicHistorySupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicHistorySupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d05a35e4b64ae904256d0ed74dd71a2d0be835a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicHistorySupport.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Construction.HarmonicProductDomination +import OAI.NumberTheory.Ostmann.Arithmetic.SingleHistorySupport + +namespace OAI + +/-! # The arithmetic support bound under the original prime priors + +The residue modulus is allowed to depend on the entire fixed frequency +history. Only the prime samples are averaged, with their original priors. +-/ + +namespace Ostmann + +open scoped BigOperators Classical + +noncomputable def harmonicHistorySupportSum (P : Finset ℕ) (S : Finset ℤ) (V n : ℕ) + (Q : FrequencyTree S n → ℕ) [∀ t, NeZero (Q t)] + (T : TreeLeafIndex n → Finset ℕ) + (hunit : ∀ t, ∀ p : P, (p : ℕ).Coprime (Q t)) + (data : (t : FrequencyTree S n) → (ZMod (Q t))ˣ → + List (ZMod (Q t))ˣ → Option (ArithmeticSplitData (Q t))) : ℝ := + ∑ t : FrequencyTree S n, frequencyLeafWeight (singleFrequencyLeaf S V) n t * + (∑ x : TreeLeafIndex n → P, (∏ i, primeSubsetPrior P (T i) (x i)) * + singleArithmeticLeafSupport n (data t) + ((treeLeafTupleEquiv (ZMod (Q t))ˣ n).symm + (fun i => ZMod.unitOfCoprime (x i : ℕ) (hunit t (x i))))) + +theorem harmonic_history_support_le (P : Finset ℕ) (S : Finset ℤ) (N V n : ℕ) + (D : ℝ) (hD : 0 ≤ D) (hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ≤ N) + (hdiv : ∀ q : ℕ, q ≠ 0 → q ≤ N ^ 2 → (q.divisors.card : ℝ) ≤ D) + (Q : FrequencyTree S n → ℕ) [∀ t, NeZero (Q t)] + (T : TreeLeafIndex n → Finset ℕ) (h J : TreeLeafIndex n → ℕ) + (hunit : ∀ t, ∀ p : P, (p : ℕ).Coprime (Q t)) + (hsmall : ∀ t i, Q t ≤ 2 ^ h i) + (hrange : ∀ i p, p ∈ T i → 2 ^ h i ≤ p ∧ p < 2 ^ (h i + J i)) + (data : (t : FrequencyTree S n) → (ZMod (Q t))ˣ → + List (ZMod (Q t))ˣ → Option (ArithmeticSplitData (Q t))) + (hmatch : ∀ t R past d, data t R past = some d → + d.hasFrequencies (singleTreeNodeFrequencies S n t past.length)) : + (∑ t : FrequencyTree S n, frequencyLeafWeight (singleFrequencyLeaf S V) n t * + (∑ x : TreeLeafIndex n → P, (∏ i, primeSubsetPrior P (T i) (x i)) * + singleArithmeticLeafSupport n (data t) + ((treeLeafTupleEquiv (ZMod (Q t))ˣ n).symm + (fun i => ZMod.unitOfCoprime (x i : ℕ) (hunit t (x i)))))) ≤ + (∏ i, (∑ p ∈ T i, (p : ℝ)⁻¹)⁻¹ * (3 * J i)) * + ((4 * D ^ 3 * (1 + Real.log N)) ^ (2 ^ n - 1) * + (2 * (V : ℝ)) ^ (2 ^ n)) := by + let C := ∏ i, (∑ p ∈ T i, (p : ℝ)⁻¹)⁻¹ * (3 * J i) + have hC : 0 ≤ C := Finset.prod_nonneg fun i _ => by positivity + have hlocal (t : FrequencyTree S n) := harmonic_leaf_residue_domination P (Q t) n T h J + (hunit t) (hsmall t) hrange (singleArithmeticLeafSupport n (data t)) + (singleArithmeticLeafSupport_nonneg n (data t)) + calc + _ ≤ ∑ t : FrequencyTree S n, frequencyLeafWeight (singleFrequencyLeaf S V) n t * + (C * ((singleFrequencySplitList S n t).map (singleFrequencySupportBound D)).prod) := by + apply Finset.sum_le_sum + intro t _ + apply mul_le_mul_of_nonneg_left _ (frequencyLeafWeight_nonneg _ + (fun _ => by unfold singleFrequencyLeaf; split_ifs <;> norm_num) n t) + exact (hlocal t).trans (mul_le_mul_of_nonneg_left + (single_arithmetic_leaf_average_le S N n D hD hS hdiv t (data t) (hmatch t)) hC) + _ = C * ∑ t : FrequencyTree S n, + frequencyTreeWeight (singleFrequencyKernel S D) (singleFrequencyLeaf S V) n t := by + rw [Finset.mul_sum] + apply Finset.sum_congr rfl + intro t _ + rw [singleFrequencyTreeWeight_eq] + ring + _ ≤ _ := mul_le_mul_of_nonneg_left (single_frequency_tree_sum_le S N V n D hD hS + (gcd_frequency_divisor_bound S N D hS hdiv)) hC + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicOneSidedBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicOneSidedBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..bcc1cf071331b4d1ac50eea4d6bb4536c100e504 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicOneSidedBound.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Construction.OriginalPriorOneSidedBound +import OAI.NumberTheory.Ostmann.Construction.HarmonicWordPriors + +namespace OAI + +/-! # The one-sided estimate for the original harmonic prime priors -/ + +namespace Ostmann + +open scoped BigOperators Classical + +theorem harmonic_polynomial_one_sided_bound (P Q : Finset ℕ) + (hprime : ∀ q ∈ Q, q.Prime) + (χ : ∀ q : Q, DirichletCharacter ℂ (q : ℕ)) (hnonprincipal : ∀ q, χ q ≠ 1) + (a M K : ℕ) (ha : 0 < a) (hM : ∀ q : Q, M.Coprime (q : ℕ)) + (hlow : ∀ p ∈ P, a ≤ p) (hhigh : ∀ p ∈ P, p < a + K * M) + (b : ℝ) (hb : 0 < b) (hbQ : ∀ q ∈ Q, b ≤ (q : ℝ)) + (hPmass : 0 < ∑ p ∈ P, (p : ℝ)⁻¹) (hQmass : 0 < ∑ q ∈ Q, (q : ℝ)⁻¹) + {n t : ℕ} (F : Q → Fin n → ClippedPolynomialFactor) + (H : Q → Fin t → Polynomial ℝ) (keep : Q → (Fin t → Bool) → Bool) + (B : ℝ) (R Bq : ℕ) (hB : 0 ≤ B) + (hbudget : ∀ q, smoothPolynomialBudget (F q) ≤ B) + (hcomplexity : ∀ q, polynomialWeightComplexity (F q) (H q) ≤ R) + (hBq : ∀ q : Q, (q : ℕ) ≤ Bq) + (U : P → ℂ) (V : Q → ℂ) (hU : ∀ p, ‖U p‖ ≤ 1) (hV : ∀ q, ‖V q‖ ≤ 1) : + ‖∑ p : P, (primeSubsetPrior P P p : ℂ) * + (U p * ∑ q : Q, (primeSubsetPrior Q Q q : ℂ) * V q * + (χ q ((p : ℕ) : ZMod (q : ℕ)) * + polynomialAmplitude (F q) (H q) (keep q) (p : ℝ)))‖ ^ 2 ≤ + (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ * + (((∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * b⁻¹) * (((K * M : ℕ) : ℝ) / a * B ^ 2) + + (M : ℝ) * ((3 ^ (2 * R) : ℕ) * (2 * (a : ℝ)⁻¹ * B ^ 2)) * (Bq : ℝ) ^ 2) := by + apply original_prior_polynomial_one_sided_bound (fun p : P => (p : ℕ)) Subtype.val_injective + Q hprime χ hnonprincipal a M K ha hM + (fun p => hlow p p.property) (fun p => hhigh p p.property) F H keep B R Bq hB + hbudget hcomplexity hBq (primeSubsetPrior P P) (primeSubsetPrior Q Q) U V + ((∑ p ∈ P, (p : ℝ)⁻¹)⁻¹) ((∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * b⁻¹) + (by positivity) (by positivity) (primeSubsetPrior_nonneg P P) + · exact (primeSubsetPrior_mass P P (Finset.Subset.refl _) hPmass.ne').le + · exact primeSubsetPrior_atom P P + · exact primeSubsetPrior_nonneg Q Q + · exact (primeSubsetPrior_mass Q Q (Finset.Subset.refl _) hQmass.ne').le + · intro q + apply (primeSubsetPrior_atom Q Q q).trans + exact mul_le_mul_of_nonneg_left (inv_anti₀ hb (hbQ q q.property)) (by positivity) + · exact hU + · exact hV + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicPairIntegral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicPairIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..14509b299900555b42bb9a56ab02f9689d94b669 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicPairIntegral.lean @@ -0,0 +1,108 @@ +import OAI.NumberTheory.Ostmann.ZeroDensity.GiantDensitySum + +namespace OAI + +namespace Ostmann +open MeasureTheory +open scoped Classical BigOperators + +theorem norm_harmonic_pair_integral_le (u v r s C : ℝ) (hu : 1 ≤ u) (hr : 1 ≤ r) + (huv : u ≤ v) (hrs : r ≤ s) (hv : v ≤ u + 1) (hs : s ≤ r + 1) + (hC : 0 ≤ C) (F : ℝ → ℝ → ℂ) + (hF : ∀ x ∈ Set.Ioc u v, ∀ y ∈ Set.Ioc r s, ‖F x y‖ ≤ C) : + ‖∫ x in Set.Ioc u v, ∫ y in Set.Ioc r s, + F x y / ((x : ℂ) * (y : ℂ))‖ ≤ C / (u * r) := by + have hu0 : 0 < u := lt_of_lt_of_le zero_lt_one hu + have hr0 : 0 < r := lt_of_lt_of_le zero_lt_one hr + have hpoint (x : ℝ) (hx : x ∈ Set.Ioc u v) (y : ℝ) (hy : y ∈ Set.Ioc r s) : + ‖F x y / ((x : ℂ) * (y : ℂ))‖ ≤ C / (u * r) := by + have hx0 := hu0.trans hx.1 + have hy0 := hr0.trans hy.1 + simp only [norm_div, norm_mul, Complex.norm_real, Real.norm_eq_abs, + abs_of_pos hx0, abs_of_pos hy0] + exact (div_le_div_of_nonneg_right (hF x hx y hy) (mul_nonneg hx0.le hy0.le)).trans + (div_le_div_of_nonneg_left hC (mul_pos hu0 hr0) + (mul_le_mul hx.1.le hy.1.le hr0.le hx0.le)) + have hin (x : ℝ) (hx : x ∈ Set.Ioc u v) := + norm_setIntegral_le_of_norm_le_const (μ := volume) measure_Ioc_lt_top (hpoint x hx) + simp only [Real.volume_real_Ioc_of_le hrs] at hin + have hout := norm_setIntegral_le_of_norm_le_const (μ := volume) measure_Ioc_lt_top hin + rw [Real.volume_real_Ioc_of_le huv] at hout + calc + _ ≤ (C / (u * r) * (s - r)) * (v - u) := hout + _ ≤ C / (u * r) * 1 * 1 := by gcongr <;> linarith + _ = _ := by ring + +/-- A finite signed average is integrated before its norm is bounded. This +retains cancellation in the arithmetic coefficient on each giant cell. -/ +theorem finite_harmonic_pair_sum_norm {A : Type*} [Fintype A] + (u v r s C : ℝ) (hu : 1 ≤ u) (hr : 1 ≤ r) + (huv : u ≤ v) (hrs : r ≤ s) (hv : v ≤ u + 1) (hs : s ≤ r + 1) + (hC : 0 ≤ C) (w : A → ℂ) (F : A → ℝ → ℝ → ℂ) + (hmeas : ∀ a, Measurable (Function.uncurry (F a))) + (K : A → ℝ) (hK : ∀ a, 0 ≤ K a) + (hbound : ∀ a x, x ∈ Set.Ioc u v → ∀ y, y ∈ Set.Ioc r s → ‖F a x y‖ ≤ K a) + (hmean : ∀ x ∈ Set.Ioc u v, ∀ y ∈ Set.Ioc r s, ‖∑ a, w a * F a x y‖ ≤ C) : + ‖∑ a, w a * ∫ x in Set.Ioc u v, ∫ y in Set.Ioc r s, + F a x y / ((x : ℂ) * (y : ℂ))‖ ≤ C / (u * r) := by + let box := Set.Ioc u v ×ˢ Set.Ioc r s + let H := fun a (z : ℝ × ℝ) => box.indicator + (fun z => w a * F a z.1 z.2 / ((z.1 : ℂ) * (z.2 : ℂ))) z + have hH (a : A) : Measurable (H a) := by + apply Measurable.indicator _ (measurableSet_Ioc.prod measurableSet_Ioc) + exact (measurable_const.mul (hmeas a)).div + ((Complex.continuous_ofReal.measurable.comp measurable_fst).mul + (Complex.continuous_ofReal.measurable.comp measurable_snd)) + have hnorm (a : A) (z : ℝ × ℝ) : ‖H a z‖ ≤ ‖w a‖ * K a / (u * r) := by + by_cases hz : z ∈ box + · obtain ⟨hx, hy⟩ := hz + have hx0 : 0 < z.1 := (lt_of_lt_of_le zero_lt_one hu).trans hx.1 + have hy0 : 0 < z.2 := (lt_of_lt_of_le zero_lt_one hr).trans hy.1 + simp only [H, Set.indicator_of_mem (show z ∈ box from ⟨hx, hy⟩), norm_div, + norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_pos hx0, abs_of_pos hy0] + exact (div_le_div_of_nonneg_right + (mul_le_mul_of_nonneg_left (hbound a z.1 hx z.2 hy) (norm_nonneg _)) + (mul_nonneg hx0.le hy0.le)).trans + (div_le_div_of_nonneg_left (mul_nonneg (norm_nonneg _) (hK a)) (by positivity) + (mul_le_mul hx.1.le hy.1.le (by linarith) hx0.le)) + · rw [show H a z = 0 from Set.indicator_of_notMem hz _] + simp only [norm_zero] + exact div_nonneg (mul_nonneg (norm_nonneg _) (hK a)) (by linarith [mul_pos (lt_of_lt_of_le zero_lt_one hu) (lt_of_lt_of_le zero_lt_one hr)]) + let μ := volume.restrict (Set.Ioc u v) + let ν := volume.restrict (Set.Ioc r s) + have hp (a : A) : Integrable (H a) (μ.prod ν) := + ⟨(hH a).aestronglyMeasurable, + HasFiniteIntegral.of_bounded (Filter.Eventually.of_forall (hnorm a))⟩ + have hi (a : A) (x : ℝ) : Integrable (fun y => H a (x, y)) ν := + ⟨((hH a).comp (measurable_const.prodMk measurable_id)).aestronglyMeasurable, + HasFiniteIntegral.of_bounded (Filter.Eventually.of_forall (fun y => hnorm a (x, y)))⟩ + have hswap := double_integral_finset_sum (Finset.univ : Finset A) μ ν + (fun a x y => H a (x, y)) (fun a _ => hi a) (fun a _ => (hp a).integral_prod_left) + have heq (a : A) : (∫ x, ∫ y, H a (x, y) ∂ν ∂μ) = + w a * ∫ x in Set.Ioc u v, ∫ y in Set.Ioc r s, + F a x y / ((x : ℂ) * (y : ℂ)) := by + rw [← integral_const_mul] + apply setIntegral_congr_fun measurableSet_Ioc + intro x hx + dsimp only + rw [← integral_const_mul] + apply setIntegral_congr_fun measurableSet_Ioc + intro y hy + simp only [H, box, Set.indicator_of_mem (show (x, y) ∈ box from ⟨hx, hy⟩)] + ring + have hinside : (∫ x, ∫ y, ∑ a, H a (x, y) ∂ν ∂μ) = + ∫ x in Set.Ioc u v, ∫ y in Set.Ioc r s, + (∑ a, w a * F a x y) / ((x : ℂ) * (y : ℂ)) := by + apply setIntegral_congr_fun measurableSet_Ioc + intro x hx + apply setIntegral_congr_fun measurableSet_Ioc + intro y hy + simp only [H, box, Set.indicator_of_mem (show (x, y) ∈ box from ⟨hx, hy⟩), + Finset.sum_div] + simp only [heq] at hswap + rw [← hswap, hinside] + exact norm_harmonic_pair_integral_le u v r s C hu hr huv hrs hv hs hC _ hmean + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicPeriodicBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicPeriodicBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ccb40bcbe5184ae263bd24c2e76d6eaa29764ed --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HarmonicPeriodicBound.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Construction.OriginalPriorPeriodicBound +import OAI.NumberTheory.Ostmann.Construction.HarmonicWordPriors + +namespace OAI + +/-! # Original harmonic prime priors with all frequency residue tests -/ + +namespace Ostmann + +open scoped BigOperators Classical + +theorem harmonic_periodic_polynomial_one_sided_bound (P Q : Finset ℕ) + (hprime : ∀ q ∈ Q, q.Prime) + (χ : ∀ q : Q, DirichletCharacter ℂ (q : ℕ)) (hnonprincipal : ∀ q, χ q ≠ 1) + (a M K : ℕ) (ha : 0 < a) (hM : ∀ q : Q, M.Coprime (q : ℕ)) + (gate : Q → ZMod M → ℂ) (hgate : ∀ q z, ‖gate q z‖ ≤ 1) + (hlow : ∀ p ∈ P, a ≤ p) (hhigh : ∀ p ∈ P, p < a + K * M) + (b : ℝ) (hb : 0 < b) (hbQ : ∀ q ∈ Q, b ≤ (q : ℝ)) + (hPmass : 0 < ∑ p ∈ P, (p : ℝ)⁻¹) (hQmass : 0 < ∑ q ∈ Q, (q : ℝ)⁻¹) + {n t : ℕ} (F : Q → Fin n → ClippedPolynomialFactor) + (H : Q → Fin t → Polynomial ℝ) (keep : Q → (Fin t → Bool) → Bool) + (B : ℝ) (R Bq : ℕ) (hB : 0 ≤ B) + (hbudget : ∀ q, smoothPolynomialBudget (F q) ≤ B) + (hcomplexity : ∀ q, polynomialWeightComplexity (F q) (H q) ≤ R) + (hBq : ∀ q : Q, (q : ℕ) ≤ Bq) + (U : P → ℂ) (V : Q → ℂ) (hU : ∀ p, ‖U p‖ ≤ 1) (hV : ∀ q, ‖V q‖ ≤ 1) : + ‖∑ p : P, (primeSubsetPrior P P p : ℂ) * + (U p * ∑ q : Q, (primeSubsetPrior Q Q q : ℂ) * V q * + (χ q ((p : ℕ) : ZMod (q : ℕ)) * + (gate q ((p : ℕ) : ZMod M) * polynomialAmplitude (F q) (H q) (keep q) (p : ℝ))))‖ ^ 2 ≤ + (∑ p ∈ P, (p : ℝ)⁻¹)⁻¹ * + (((∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * b⁻¹) * (((K * M : ℕ) : ℝ) / a * B ^ 2) + + (M : ℝ) * ((3 ^ (2 * R) : ℕ) * (2 * (a : ℝ)⁻¹ * B ^ 2)) * (Bq : ℝ) ^ 2) := by + apply original_prior_periodic_polynomial_one_sided_bound (fun p : P => (p : ℕ)) Subtype.val_injective + Q hprime χ hnonprincipal a M K ha hM gate hgate + (fun p => hlow p p.property) (fun p => hhigh p p.property) F H keep B R Bq hB + hbudget hcomplexity hBq (primeSubsetPrior P P) (primeSubsetPrior Q Q) U V + ((∑ p ∈ P, (p : ℝ)⁻¹)⁻¹) ((∑ q ∈ Q, (q : ℝ)⁻¹)⁻¹ * b⁻¹) + (by positivity) (by positivity) (primeSubsetPrior_nonneg P P) + · exact (primeSubsetPrior_mass P P (Finset.Subset.refl _) hPmass.ne').le + · exact primeSubsetPrior_atom P P + · exact primeSubsetPrior_nonneg Q Q + · exact (primeSubsetPrior_mass Q Q (Finset.Subset.refl _) hQmass.ne').le + · intro q + apply (primeSubsetPrior_atom Q Q q).trans + exact mul_le_mul_of_nonneg_left (inv_anti₀ hb (hbQ q q.property)) (by positivity) + · exact hU + · exact hV + +end Ostmann + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActiveCoordinates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActiveCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8a0564a3d48e9f07b4692c2bc7562cdb9779c10 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActiveCoordinates.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryRepeatedSmoothPullback + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryActiveCoordinates +open Characters.RationalHistory +open scoped ContDiff +variable {κ : Type*} [Fintype κ] [DecidableEq κ] + +def insert (I : Finset κ) (background : κ → ℝ) (x : I → ℝ) : κ → ℝ := + fun i => if hi : i∈I then x ⟨i,hi⟩ else background i + +omit [Fintype κ] in +theorem insert_positive (I : Finset κ) (background : κ → ℝ) (x : I → ℝ) + (hbackground : ∀ i, 0 < background i) (hx : ∀ i, 0 < x i) : + ∀ i, 0 < insert I background x i := by + intro i + unfold insert + split_ifs with hi + · exact hx ⟨i,hi⟩ + · exact hbackground i + +omit [Fintype κ] in +theorem insert_restriction (I : Finset κ) (background : κ → ℝ) : + insert I background (fun i => background i.val) = background := by + funext i + simp [insert] + +omit [Fintype κ] in +theorem insert_logCurve (I : Finset κ) (background : κ → ℝ) (x : I → ℝ) + (i : I) (t : ℝ) : + insert I background (Expr.logCurve x i t) = Expr.logCurve (insert I background x) i.val t := by + funext j + by_cases hj : j∈I + · have hiff : (⟨j,hj⟩:I)=i ↔ j=i.val := Subtype.ext_iff + simp only [insert,dite_eq_left hj,Expr.logCurve] + by_cases he : j=i.val + · simp only [he,ite_true] + · simp only [he,ite_false] + rw [ite_eq_right (hiff.not.mpr he)] + · have hne : j≠i.val := by intro he; exact hj (he ▸ i.property) + simp only [insert,dite_eq_right hj,Expr.logCurve,hne,ite_false,Real.exp_zero,mul_one] + +def logInsert (I : Finset κ) (background : κ → ℝ) (y : I → ℝ) : κ → ℝ := + fun i => if hi : i∈I then y ⟨i,hi⟩ else Real.log (background i) + +omit [Fintype κ] in +theorem insert_exp (I : Finset κ) (background : κ → ℝ) (y : I → ℝ) + (hbackground : ∀ i, 0 < background i) : + insert I background (fun i => Real.exp (y i)) = fun i => Real.exp (logInsert I background y i) := by + funext i + unfold insert logInsert + split_ifs with hi + · rfl + · exact (Real.exp_log (hbackground i)).symm + +theorem logInsert_contDiff (I : Finset κ) (background : κ → ℝ) : + ContDiff ℝ ∞ (logInsert I background) := by + apply contDiff_pi.mpr + intro i + unfold logInsert + split_ifs <;> fun_prop + +theorem log_contDiff_insert (f : (κ → ℝ) → ℂ) (I : Finset κ) (background : κ → ℝ) + (hbackground : ∀ i, 0 < background i) + (hf : ContDiff ℝ ∞ (fun y : κ → ℝ => f (fun i => Real.exp (y i)))) : + ContDiff ℝ ∞ (fun y : I → ℝ => f (insert I background (fun i => Real.exp (y i)))) := by + simpa only [Function.comp_def,← insert_exp I background _ hbackground] using + hf.comp (logInsert_contDiff I background) + +end Ostmann.Arithmetic.HistoryActiveCoordinates + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActiveSourceDomain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActiveSourceDomain.lean new file mode 100644 index 0000000000000000000000000000000000000000..6644adc41b45e851c30b7d08f6df192d8ce1b121 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActiveSourceDomain.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryActiveCoordinates +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySmoothWeightSourceXi + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryActiveCoordinates +open Construction HistoryOccurrenceVariables HistorySymbolicEncoding PrimeCellFreezing +variable {κ : Type*} [Fintype κ] [DecidableEq κ] + +omit [Fintype κ] in +theorem sourceDomain_insert_exp (b k : ℕ) (G : ℝ) (center : ℕ → ℝ) + {l : ℕ} (h : History l) (m : Key h → κ) (I : Finset κ) + (background : κ → ℝ) (lo hi : I → ℝ) + (hbackground : SourceDomain b k G center h (fun i => background (m i))) + (hsource : ∀ i q, independentSlot h i=some q → q.role≠.bulk → ∀ hm : m i∈I, + center q.origin-1 ≤ lo ⟨m i,hm⟩ ∧ hi ⟨m i,hm⟩ ≤ center q.origin+1) + (hgiant : ∀ a : Bool, ∀ hm : m (Sum.inl a)∈I, + G-1 ≤ lo ⟨m (Sum.inl a),hm⟩ ∧ hi ⟨m (Sum.inl a),hm⟩ ≤ G+1) + (z : I → ℝ) (hz : z∈logRectangle lo hi) : + SourceDomain b k G center h (fun i => insert I background (fun j => Real.exp (z j)) (m i)) := by + constructor + · intro i + unfold insert + split_ifs with hm + · exact Real.exp_pos _ + · exact hbackground.positive i + · intro i q hiq hq + by_cases hm : m i∈I + · have hs := hsource i q hiq hq hm + have hzi := hz ⟨m i,hm⟩ (Set.mem_univ _) + simp only [insert,dite_eq_left hm,Real.log_exp] + exact abs_le.mpr ⟨by linarith [hs.1,hzi.1],by linarith [hs.2,hzi.2]⟩ + · simpa only [insert,dite_eq_right hm] using hbackground.source i q hiq hq + · intro a + by_cases hm : m (Sum.inl a)∈I + · have hs := hgiant a hm + have hzi := hz ⟨m (Sum.inl a),hm⟩ (Set.mem_univ _) + simp only [insert,dite_eq_left hm,Real.log_exp] + exact abs_le.mpr ⟨by linarith [hs.1,hzi.1],by linarith [hs.2,hzi.2]⟩ + · simpa only [insert,dite_eq_right hm] using hbackground.giant a + · exact hbackground.leaves + +structure SourceBounds (b k : ℕ) (G : ℝ) (center : ℕ → ℝ) + {l : ℕ} (h : History l) (m : Key h → κ) (I : Finset κ) + (background : κ → ℝ) (lo hi : I → ℝ) : Prop where + background_source : SourceDomain b k G center h (fun i => background (m i)) + source : ∀ i q, independentSlot h i=some q → q.role≠.bulk → ∀ hm : m i∈I, + center q.origin-1 ≤ lo ⟨m i,hm⟩ ∧ hi ⟨m i,hm⟩ ≤ center q.origin+1 + giant : ∀ a : Bool, ∀ hm : m (Sum.inl a)∈I, + G-1 ≤ lo ⟨m (Sum.inl a),hm⟩ ∧ hi ⟨m (Sum.inl a),hm⟩ ≤ G+1 + +omit [Fintype κ] in +theorem SourceBounds.sourceDomain {b k : ℕ} {G : ℝ} {center : ℕ → ℝ} + {l : ℕ} {h : History l} {m : Key h → κ} {I : Finset κ} + {background : κ → ℝ} {lo hi : I → ℝ} + (hh : SourceBounds b k G center h m I background lo hi) + (z : I → ℝ) (hz : z∈logRectangle lo hi) : + SourceDomain b k G center h (fun i => insert I background (fun j => Real.exp (z j)) (m i)) := + sourceDomain_insert_exp b k G center h m I background lo hi hh.background_source hh.source hh.giant z hz + +end Ostmann.Arithmetic.HistoryActiveCoordinates + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualComparisonDecayArithmetic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualComparisonDecayArithmetic.lean new file mode 100644 index 0000000000000000000000000000000000000000..2aaa20128d4eb7a839758c3e398b7a9ff64eb744 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualComparisonDecayArithmetic.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedComparisonAbsorptionBasic + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryActualComparisonDecayArithmetic +open HistorySelectedComparisonAbsorption + +theorem nat_mul_exp_reserve_le (n : ℕ) (x m : ℝ) (hm : 1 ≤ m) : + (n:ℝ)*Real.exp (x-(n:ℝ)*m) ≤ Real.exp x := by + simpa only [Finset.sum_const, Finset.card_univ, Fintype.card_fin, nsmul_eq_mul] + using finite_sum_exp_reserve_le + (fun _ : Fin n => Real.exp (x-(n:ℝ)*m)) x m hm (fun _ => by simp only [Fintype.card_fin]; exact le_rfl) + +theorem five_stage_exp_le {F H m : ℝ} (hm : 1 ≤ m) + (z₀ z₁ z₂ z₃ z₄ z₅ : ℂ) + (h₀₁ : ‖z₀-z₁‖ ≤ Real.exp (-F-(H+5)*m)) + (h₁₂ : ‖z₁-z₂‖ ≤ Real.exp (-F-(H+5)*m)) + (h₂₃ : ‖z₂-z₃‖ ≤ Real.exp (-F-(H+5)*m)) + (h₃₄ : ‖z₃-z₄‖ ≤ Real.exp (-F-(H+5)*m)) + (h₄₅ : ‖z₄-z₅‖ ≤ Real.exp (-F-(H+5)*m)) : + ‖z₀-z₅‖ ≤ Real.exp (-F-H*m) := by + have htri : ‖z₀-z₅‖ ≤ 5*Real.exp (-F-(H+5)*m) := by + have h₀ := dist_triangle z₀ z₁ z₅ + have h₁ := dist_triangle z₁ z₂ z₅ + have h₂ := dist_triangle z₂ z₃ z₅ + have h₃ := dist_triangle z₃ z₄ z₅ + simp only [dist_eq_norm] at h₀ h₁ h₂ h₃ + linarith + have hcap := nat_mul_exp_reserve_le 5 (-F-H*m) m hm + have heq : -F-H*m-(5:ℝ)*m = -F-(H+5)*m := by ring + rw [Nat.cast_ofNat, heq] at hcap + exact htri.trans hcap + +theorem five_stage_bulk_exp_le {H m : ℝ} (hm : 1 ≤ m) + (z₀ z₁ z₂ z₃ z₄ z₅ : ℂ) + (h₀₁ : ‖z₀-z₁‖ ≤ Real.exp (-(H+5)*m)) + (h₁₂ : ‖z₁-z₂‖ ≤ Real.exp (-(H+5)*m)) + (h₂₃ : ‖z₂-z₃‖ ≤ Real.exp (-(H+5)*m)) + (h₃₄ : ‖z₃-z₄‖ ≤ Real.exp (-(H+5)*m)) + (h₄₅ : ‖z₄-z₅‖ ≤ Real.exp (-(H+5)*m)) : + ‖z₀-z₅‖ ≤ Real.exp (-H*m) := by + simpa only [neg_zero,zero_sub,neg_mul] using + five_stage_exp_le (F:=0) hm z₀ z₁ z₂ z₃ z₄ z₅ + (by simpa only [neg_zero,zero_sub,neg_mul] using h₀₁) + (by simpa only [neg_zero,zero_sub,neg_mul] using h₁₂) + (by simpa only [neg_zero,zero_sub,neg_mul] using h₂₃) + (by simpa only [neg_zero,zero_sub,neg_mul] using h₃₄) + (by simpa only [neg_zero,zero_sub,neg_mul] using h₄₅) + +theorem five_stage_exp_le_of_steps {F H m : ℝ} (hm : 1 ≤ m) (z : Fin 6→ℂ) + (hz : ∀i : Fin 5,‖z i.castSucc-z i.succ‖ ≤ Real.exp (-F-(H+5)*m)) : + ‖z 0-z 5‖ ≤ Real.exp (-F-H*m) := + five_stage_exp_le hm (z 0) (z 1) (z 2) (z 3) (z 4) (z 5) + (hz 0) (hz 1) (hz 2) (hz 3) (hz 4) + +theorem two_terms_exp_67_65_le (k : ℕ) {F m a b : ℝ} (hm : 1 ≤ m) + (ha : a ≤ Real.exp (-(F+67*(2:ℝ)^k*m))) + (hb : b ≤ Real.exp (-(F+67*(2:ℝ)^k*m))) : + a+b ≤ Real.exp (-(F+65*(2:ℝ)^k*m)) := by + have hr : 1 ≤ (2:ℝ)^k := one_le_pow₀ (by norm_num) + have hs : 1 ≤ (2:ℝ)^k*m := by nlinarith + have hcap := nat_mul_exp_reserve_le 2 (-(F+65*(2:ℝ)^k*m)) ((2:ℝ)^k*m) hs + have heq : -(F+65*(2:ℝ)^k*m)-(2:ℝ)*((2:ℝ)^k*m) = + -(F+67*(2:ℝ)^k*m) := by ring + rw [Nat.cast_ofNat,heq] at hcap + exact (show a+b ≤ 2*Real.exp (-(F+67*(2:ℝ)^k*m)) by linarith).trans hcap + +theorem two_norms_exp_67_65_le (k : ℕ) {F m : ℝ} (hm : 1 ≤ m) (z w : ℂ) + (hz : ‖z‖ ≤ Real.exp (-(F+67*(2:ℝ)^k*m))) + (hw : ‖w‖ ≤ Real.exp (-(F+67*(2:ℝ)^k*m))) : + ‖z‖+‖w‖ ≤ Real.exp (-(F+65*(2:ℝ)^k*m)) := + two_terms_exp_67_65_le k hm hz hw + +theorem norm_add_exp_67_65_le (k : ℕ) {F m : ℝ} (hm : 1 ≤ m) (z w : ℂ) + (hz : ‖z‖ ≤ Real.exp (-(F+67*(2:ℝ)^k*m))) + (hw : ‖w‖ ≤ Real.exp (-(F+67*(2:ℝ)^k*m))) : + ‖z+w‖ ≤ Real.exp (-(F+65*(2:ℝ)^k*m)) := + (norm_add_le z w).trans (two_norms_exp_67_65_le k hm z w hz hw) + +end Ostmann.Arithmetic.HistoryActualComparisonDecayArithmetic + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualComparisonDecayArithmeticSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualComparisonDecayArithmeticSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..90379347eb1163c348675681794a54e521391267 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualComparisonDecayArithmeticSelected.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryActualComparisonDecayArithmetic +import OAI.NumberTheory.Ostmann.Conclusion.Scales + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryActualComparisonDecayArithmetic +open Conclusion Filter + +theorem eventually_five_stage_exp_le {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ F H : ℝ, ∀ z : Fin 6 → ℂ, + (∀ i : Fin 5, ‖z i.castSucc-z i.succ‖ ≤ + Real.exp (-F-(H+5)*(bulkSize k L:ℝ))) → + ‖z 0-z 5‖ ≤ Real.exp (-F-H*(bulkSize k L:ℝ)) := by + filter_upwards [(bulkSize_tendsto_atTop hk).eventually_ge_atTop 1] with L hm + intro F H z hz + exact five_stage_exp_le_of_steps hm z hz + +theorem eventually_five_stage_bulk_exp_le {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ H : ℝ, ∀ z : Fin 6 → ℂ, + (∀ i : Fin 5, ‖z i.castSucc-z i.succ‖ ≤ + Real.exp (-(H+5)*(bulkSize k L:ℝ))) → + ‖z 0-z 5‖ ≤ Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [eventually_five_stage_exp_le hk] with L h + intro H z hz + simpa only [neg_zero,zero_sub,neg_mul] using + h 0 H z (fun i => by simpa only [neg_zero,zero_sub,neg_mul] using hz i) + +theorem eventually_two_terms_exp_67_65_le {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ F a b : ℝ, + a ≤ Real.exp (-(F+67*(2:ℝ)^k*(bulkSize k L:ℝ))) → + b ≤ Real.exp (-(F+67*(2:ℝ)^k*(bulkSize k L:ℝ))) → + a+b ≤ Real.exp (-(F+65*(2:ℝ)^k*(bulkSize k L:ℝ))) := by + filter_upwards [(bulkSize_tendsto_atTop hk).eventually_ge_atTop 1] with L hm + intro F a b ha hb + exact two_terms_exp_67_65_le k hm ha hb + +theorem eventually_norm_add_exp_67_65_le {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ F : ℝ, ∀ z w : ℂ, + ‖z‖ ≤ Real.exp (-(F+67*(2:ℝ)^k*(bulkSize k L:ℝ))) → + ‖w‖ ≤ Real.exp (-(F+67*(2:ℝ)^k*(bulkSize k L:ℝ))) → + ‖z+w‖ ≤ Real.exp (-(F+65*(2:ℝ)^k*(bulkSize k L:ℝ))) := by + filter_upwards [(bulkSize_tendsto_atTop hk).eventually_ge_atTop 1] with L hm + intro F z w hz hw + exact norm_add_exp_67_65_le k hm z w hz hw + +end Ostmann.Arithmetic.HistoryActualComparisonDecayArithmetic + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualNumerators.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualNumerators.lean new file mode 100644 index 0000000000000000000000000000000000000000..eeffd0c7d11326cadaf5f4c899181c8631e5ee38 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryActualNumerators.lean @@ -0,0 +1,140 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryIntegerFieldBridge +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPatternRows + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryActualNumerators +open Construction Characters.RationalHistory HistoryOccurrenceVariables +open HistorySymbolicState HistorySymbolicEncoding HistorySymbolicLinearity HistoryNumeratorForms +open HistoryOccurrenceRows HistoryPatternRows HistoryRepeatedRenaming ClearedCoefficientFlags +open MvPolynomial + +def actual : {l : ℕ} → (h : History l) → InternalKey h → ℤ + | _, .leaf _ => fun i => nomatch i + | _, .node a _ _ hp hm left right => + Sum.elim (fun _ => reversalNumerator left.root.frequency right.root.frequency + ((a.giantPlus*(hp.map SmallSlot.value).prod:ℕ):ℤ) + ((a.giantMinus*(hm.map SmallSlot.value).prod:ℕ):ℤ)) + (Sum.elim (actual left) (actual right)) + +theorem actual_divisible {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + (h : History l) (hs : h.Supported V outside) (i : InternalKey h) : + ((internalSlot h i).value:ℤ) ∣ actual h i := by + induction h with + | leaf a => exact isEmptyElim i + | @node l a p u hp hm left right ihl ihr => + rcases i with i | i + · have hd : (u.get i).value ∣ (u.map SmallSlot.value).prod := + List.dvd_prod (List.mem_map.mpr ⟨u.get i,List.get_mem _ _,rfl⟩) + have hd' : ((u.get i).value:ℤ) ∣ ((u.map SmallSlot.value).prod:ℤ) := by + exact_mod_cast hd + change ((u.get i).value:ℤ) ∣ reversalNumerator _ _ _ _ + rw [History.supported_reversal hs] + exact dvd_mul_of_dvd_left (dvd_mul_of_dvd_right hd' _) _ + · rcases i with i | i + · exact ihl (History.supported_left hs) i + · exact ihr (History.supported_right hs) i + +variable {ι : Type*} + +theorem rows_actual_eval {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + (h : History l) (hs : h.Supported V outside) (e : TreeExpr ι h) (x : ι → ℚ) + (he : TreeCorrect x h e) (i : InternalKey h) : + (rows V outside h hs e e i).1.rationalEval x = (actual h i:ℚ) := by + induction h with + | leaf a => exact isEmptyElim i + | @node l a p u hp hm left right ihl ihr => + rcases i with i | i + · simpa only [rows,actual,Sum.elim_inl,reversalNumerator,Int.cast_sub,Int.cast_mul] + using nodeNumerator_eval hs e.1 x he.1 + · rcases i with i | i + · exact ihl (History.supported_left hs) e.2.1 he.2.1 i + · exact ihr (History.supported_right hs) e.2.2 he.2.2 i + +theorem rows_linear {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + (h : History l) (hs : h.Supported V outside) (e c d : TreeExpr ι h) (x : ι → ℚ) + (X Y : ℚ) (he : TreeLinear x X Y h e c d) (i : InternalKey h) : + (rows V outside h hs e e i).1.rationalEval x = + (rows V outside h hs c d i).1.rationalEval x*X+ + (rows V outside h hs c d i).2.rationalEval x*Y := by + induction h with + | leaf a => exact isEmptyElim i + | @node l a p u hp hm left right ihl ihr => + rcases i with i | i + · exact nodeNumerator_linear hs e.1 c.1 d.1 x X Y he.1 + · rcases i with i | i + · exact ihl (History.supported_left hs) e.2.1 c.2.1 d.2.1 he.2.1 i + · exact ihr (History.supported_right hs) e.2.2 c.2.2 d.2.2 he.2.2 i + +theorem actual_linear {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + (h : History l) (hs : h.Supported V outside) (i : InternalKey h) : + (actual h i:ℚ) = + (canonical h hs i).1.rationalEval (rationalSample h)*(h.root.giantPlus:ℚ)+ + (canonical h hs i).2.rationalEval (rationalSample h)*(h.root.giantMinus:ℚ) := by + have he := rows_linear h hs _ _ _ (rationalSample h) _ _ + (symbolicHistory_linear h hs (rationalSample h)) i + rw [rows_actual_eval h hs _ _ (symbolicHistory_correct h hs) i] at he + exact he + +theorem actual_pattern_linear {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + (h : History l) (hs : h.Supported V outside) (i : InternalKey h) : + (actual h i:ℚ) = + (row h hs i).1.rationalEval (sample h)*(h.root.giantPlus:ℚ)+ + (row h hs i).2.rationalEval (sample h)*(h.root.giantMinus:ℚ) := by + simpa only [row,Expr.rationalEval_rename,sample_comp] using actual_linear h hs i + +theorem integer_linear_cleared {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + (h : History l) (hs : h.Supported V outside) (i : InternalKey h) : + eval (fun j => patternSample h j.val) (commonDenominator (row h hs i).1 (row h hs i).2)* + actual h i = + eval (fun j => patternSample h j.val) (leftFlag h hs i)*(h.root.giantPlus:ℤ)+ + eval (fun j => patternSample h j.val) (rightFlag h hs i)*(h.root.giantMinus:ℤ) := by + obtain ⟨ha,hb,_⟩ := row_regular_nonzero h hs i + have hca := coefficients_cleared (row h hs i).1 (row h hs i).2 (sample h) + ((Expr.fieldRegularAt_rat _ _).mpr ha) ((Expr.fieldRegularAt_rat _ _).mpr hb) + simp only [Expr.fieldEval_rat] at hca + have hQ : eval₂ (Int.castRingHom ℚ) (sample h) + (commonDenominator (row h hs i).1 (row h hs i).2)*(actual h i:ℚ) = + eval₂ (Int.castRingHom ℚ) (sample h) (leftFlag h hs i)*(h.root.giantPlus:ℚ)+ + eval₂ (Int.castRingHom ℚ) (sample h) (rightFlag h hs i)*(h.root.giantMinus:ℚ) := by + rw [actual_pattern_linear h hs i] + change _ = eval₂ _ _ (leftCoefficient _ _)*_+eval₂ _ _ (rightCoefficient _ _)*_ + rw [hca.2.1,hca.2.2] + ring + have hD : eval₂ (Int.castRingHom ℚ) (sample h) + (commonDenominator (row h hs i).1 (row h hs i).2) = + (eval (fun j : PatternKey h => patternSample h j.val) + (commonDenominator (row h hs i).1 (row h hs i).2):ℚ) := + Expr.eval₂_cast_int _ (fun j : PatternKey h => patternSample h j.val) + have hA : eval₂ (Int.castRingHom ℚ) (sample h) (leftFlag h hs i) = + (eval (fun j : PatternKey h => patternSample h j.val) (leftFlag h hs i):ℚ) := + Expr.eval₂_cast_int _ (fun j : PatternKey h => patternSample h j.val) + have hB : eval₂ (Int.castRingHom ℚ) (sample h) (rightFlag h hs i) = + (eval (fun j : PatternKey h => patternSample h j.val) (rightFlag h hs i):ℚ) := + Expr.eval₂_cast_int _ (fun j : PatternKey h => patternSample h j.val) + rw [hD,hA,hB] at hQ + apply Int.cast_injective (α := ℚ) + simpa only [Int.cast_mul,Int.cast_add,Int.cast_natCast] using hQ + +theorem actual_line_zero {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + (h : History l) (hs : h.Supported V outside) (i : InternalKey h) : + let p := (internalSlot h i).value + eval₂ (Int.castRingHom (ZMod p)) (fun j => (patternSample h j.val:ZMod p)) + (leftFlag h hs i)*(h.root.giantPlus:ZMod p)+ + eval₂ (Int.castRingHom (ZMod p)) (fun j => (patternSample h j.val:ZMod p)) + (rightFlag h hs i)*(h.root.giantMinus:ZMod p) = 0 := by + dsimp only + rw [Expr.eval₂_cast_int,Expr.eval₂_cast_int] + have he := congrArg (fun z : ℤ => (z:ZMod (internalSlot h i).value)) + (integer_linear_cleared h hs i) + have hzero : (actual h i:ZMod (internalSlot h i).value) = 0 := + (ZMod.intCast_zmod_eq_zero_iff_dvd _ _).mpr (actual_divisible h hs i) + simp only [Int.cast_mul,Int.cast_add,Int.cast_natCast,hzero,mul_zero] at he + exact he.symm + +end Ostmann.Arithmetic.HistoryActualNumerators + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..0454bd10e15008c7b67bdc1430baa9a37c6f1a1d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementBasic.lean @@ -0,0 +1,81 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +local instance actualBSquareBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

(selectedBulkPrior C l).cmean (fun u => + rootExpression C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV + bg u probability corrected mixed)) + +def frequencyError (corrected mixed : Bool) : ℝ := + ∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + ∑f : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ∑g : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ‖(FinitePrior.pair (backgroundPrior C l) (selectedBulkPrior C l)).cmean + (fun a => expression C outside σ (J a.1) w P Q hactual hl houtside hw hpos hcell hp + hAd hout hV a.1 a.2 (v,(f,g)) false corrected mixed) - + (FinitePrior.pair (backgroundPrior C l) (selectedBulkPrior C l)).cmean + (fun a => expression C outside σ (J a.1) w P Q hactual hl houtside hw hpos hcell hp + hAd hout hV a.1 a.2 (v,(f,g)) true corrected mixed)‖ + +theorem norm_sourceMean_sub_le_frequencyError (corrected mixed : Bool) : + ‖sourceMean C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV + false corrected mixed - + sourceMean C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV + true corrected mixed‖ ≤ + frequencyError C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV + corrected mixed := by + unfold sourceMean rootExpression + simp_rw [FinitePrior.cmean_sum] + rw [←Finset.sum_sub_distrib] + calc + _ ≤ ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ‖(backgroundPrior C l).cmean (fun bg => (selectedBulkPrior C l).cmean (fun u => + expression C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV + bg u i false corrected mixed)) - + (backgroundPrior C l).cmean (fun bg => (selectedBulkPrior C l).cmean (fun u => + expression C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV + bg u i true corrected mixed))‖ := norm_sum_le _ _ + _ = _ := by + simp only [frequencyError, Index, RootFrequencyIndex, Fintype.sum_prod_type, + FinitePrior.pair_cmean] + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementBoundInterface.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementBoundInterface.lean new file mode 100644 index 0000000000000000000000000000000000000000..61a9bb0c2832c7640c2d5dccfa40133fbdc4c962 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementBoundInterface.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensityBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensityRoot + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns Filter +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum HistoryBulkPrincipalBSquareReplacement +attribute [local instance] Classical.propDecidable +local instance actualSquareBoundInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_root_density_B_replacement_interface (d : Decomposition) + (Bs BD Bz D H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop, ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then ldensityBExpressionSum (R v f g a) (X v f g a) false corrected mixed (mask v f g a))- + μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) true corrected mixed (mask v f g a))‖) ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,‖μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) false corrected mixed (mask v f g a))- + μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) true corrected mixed (mask v f g a))‖) ≤ Real.exp (-H*(bulkSize k L:ℝ)) := + selected_root_density_B_replacement_eventually d Bs BD Bz D H hBs hH hk + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementCorrectedBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementCorrectedBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..42037f09a96fafeb2d385a5f02fb0044e8f765da --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementCorrectedBasic.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +local instance actualBSquareCorrectedBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j (selectedBulkPrior C l).cmean (fun u => + rootExpression C outside e he hp hAd hout hV + bg u probability)) + +def correctedFrequencyError : ℝ := + ∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + ∑f : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ∑g : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ‖(FinitePrior.pair (backgroundPrior C l) (selectedBulkPrior C l)).cmean + (fun a => expression C outside e he hp hAd hout hV a.1 a.2 (v,(f,g)) false) - + (FinitePrior.pair (backgroundPrior C l) (selectedBulkPrior C l)).cmean + (fun a => expression C outside e he hp hAd hout hV a.1 a.2 (v,(f,g)) true)‖ + +theorem norm_correctedSourceMean_sub_le_correctedFrequencyError : + ‖correctedSourceMean C outside e he hp hAd hout hV + false - + correctedSourceMean C outside e he hp hAd hout hV + true‖ ≤ + correctedFrequencyError C outside e he hp hAd hout hV + := + norm_nested_root_sum_sub_le (backgroundPrior C l) (selectedBulkPrior C l) + (fun bg u i => expression C outside e he hp hAd hout hV bg u i false) + (fun bg u i => expression C outside e he hp hAd hout hV bg u i true) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementCorrectedSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementCorrectedSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3c736cc27229b85ba595c587a71bf3fef624582 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementCorrectedSelected.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementBoundInterface +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementCorrectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementGeometryInterface +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementZeroCost + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkActualPrincipalBlockFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkActualPrincipalSourceReindexFamilyCorrected HistoryBulkIndependentFibreReference Filter +attribute [local instance] Classical.propDecidable +local instance actualBSquareCorrectedSelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_corrected_errors_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) + let hp : ∀q∈outside,q.Prime := fun q hq => + Exists.elim (houtside q hq) (fun r hr => hr ▸ spectator.prime r.val r.property) + let hmem : ∀q∈outside,q∈spectator.candidates := fun q hq => + Exists.elim (houtside q hq) (fun r hr => hr ▸ r.property) + let hg := h.1 E C hG hcl hcu hb hd spectator hspec outside hmem l hl.le + let hV := hg.1 + let hAd := hg.2 + let hsize : outside.length≤bulkSize k L := hout.symm ▸ Nat.mul_div_le (bulkSize k L) 2 + let hlog : ∀q∈outside,Real.log (q:ℝ)≤Real.exp ((1/1000:ℝ)*L) := fun q hq => + Exists.elim (houtside q hq) (fun r hr => hr ▸ (hspec r).2) + ⟨hp,hAd,hV,fun e he => + let hbnd := h.2 E C hG hGu hcl hcu hb hd spectator hspec l true true hl + outside (fun q hq => (hp q hq).pos) hsize hlog + (Background C l × SelectedBulkSample C l) + (FinitePrior.pair (backgroundPrior C l) (selectedBulkPrior C l)) + (fun v f g a => referenceFamily C outside e he hp hAd hout hV a.1 a.2 (v,(f,g))) + (fun v f g a => densitySources C outside e he hp a.1 a.2 (v,(f,g))) + (fun v f g a => staticMask C outside e he hp a.1 a.2 (v,(f,g))) + let hfreq := zero_cost_bounds L (correctedFrequencyError C outside e he hp hAd hout hV) + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) hbnd + let hn := norm_correctedSourceMean_sub_le_correctedFrequencyError C outside e he hp hAd hout hV + ⟨hfreq,hn.trans hfreq.1,hn.trans hfreq.2⟩⟩) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..5776541ae0471ccc9a9c76feacd1022846cae6ff --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementFinite.lean @@ -0,0 +1,31 @@ +import OAI.NumberTheory.Ostmann.Construction.ActualAmplitude +import OAI.NumberTheory.Ostmann.Construction.OffDiagonalExpectations + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction + +theorem norm_nested_root_sum_sub_le {α β ι κ τ : Type*} + [Fintype α] [Fintype β] [Fintype ι] [Fintype κ] [Fintype τ] + (μ : FinitePrior α) (ν : FinitePrior β) (F G : α → β → ι×(κ×τ) → ℂ) : + ‖μ.cmean (fun a => ν.cmean (fun b => ∑i,F a b i))- + μ.cmean (fun a => ν.cmean (fun b => ∑i,G a b i))‖ ≤ + ∑i,∑j,∑k,‖(μ.pair ν).cmean (fun a => F a.1 a.2 (i,(j,k)))- + (μ.pair ν).cmean (fun a => G a.1 a.2 (i,(j,k)))‖ := by + simp_rw [FinitePrior.cmean_sum] + rw [←Finset.sum_sub_distrib] + calc + _ ≤ ∑i,‖μ.cmean (fun a=>ν.cmean (fun b=>F a b i))- + μ.cmean (fun a=>ν.cmean (fun b=>G a b i))‖ := norm_sum_le _ _ + _ = _ := by simp only [Fintype.sum_prod_type,FinitePrior.pair_cmean] + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementGeometryInterface.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementGeometryInterface.lean new file mode 100644 index 0000000000000000000000000000000000000000..8353b3b49cda6b42e609e6caa002e6bc8257e77d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementGeometryInterface.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion Filter HistoryBulkFibreGiantApproximation +open HistoryBulkSupportConverse HistoryBulkPrincipalBSquareReference +open HistoryRepresentativeSourceSeparation + +theorem selected_square_inputs_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k : ℕ} (hk : 0 (hframe E C hG hcl hcu hb hd spectator hspec outside hmem l hl r).1⟩ + intro q hq j hj + exact hsf ⟨q,hmem q hq⟩ j (hj.trans hl) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementLaws.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a20997ef016006943cc232954de911857f2d9cc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementLaws.lean @@ -0,0 +1,108 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalSmallOriginalMeanDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + +def primeLawMultiplier : Background C l → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ := fun _ _ _ _ _ => 1 + +def plainMixedLawMultiplier : Background C l → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ := + fun bg i u P Q => + (HistoryDiagonalSmallOriginalMean.smallMultiplier C outside + (HistoryBulkFibreOriginalReference.fibreAssignment C bg.2 u) i.1.val P Q : ℂ) + +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + hp hAd hout hV probability false false + +def plainMixedSourceMean (probability : Bool) : ℂ := + sourceMean C outside σ (plainMixedLawMultiplier C outside) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) hactual hl houtside + (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + hp hAd hout hV probability false true + +def primeFrequencyError : ℝ := + frequencyError C outside σ (primeLawMultiplier C) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl houtside (primeWeight_nonneg C.giant) + (fun r _ => primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + hp hAd hout hV false false + +def plainMixedFrequencyError : ℝ := + frequencyError C outside σ (plainMixedLawMultiplier C outside) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) hactual hl houtside + (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + hp hAd hout hV false true + +theorem norm_primeSourceMean_sub_le : + ‖primeSourceMean C outside σ hactual hl houtside hp hAd hout hV false - + primeSourceMean C outside σ hactual hl houtside hp hAd hout hV true‖ ≤ + primeFrequencyError C outside σ hactual hl houtside hp hAd hout hV := + norm_sourceMean_sub_le_frequencyError C outside σ (primeLawMultiplier C) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl houtside (primeWeight_nonneg C.giant) + (fun r _ => primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + hp hAd hout hV false false + +theorem norm_plainMixedSourceMean_sub_le : + ‖plainMixedSourceMean C outside σ hactual hl houtside hp hAd hout hV false - + plainMixedSourceMean C outside σ hactual hl houtside hp hAd hout hV true‖ ≤ + plainMixedFrequencyError C outside σ hactual hl houtside hp hAd hout hV := + norm_sourceMean_sub_le_frequencyError C outside σ (plainMixedLawMultiplier C outside) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) hactual hl houtside + (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + hp hAd hout hV false true + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementLawsSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementLawsSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..880ab27d9514e3f117a5dbc13cb212b239aeacae --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementLawsSelected.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean HistoryRepresentativeSourceSeparation Filter +attribute [local instance] Classical.propDecidable + +theorem selected_law_errors_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) false false hl + have hmixed := h σ (plainMixedLawMultiplier C outside) (MixedDraw C.giantCenter C.giant) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) false true hl + have hpmean := norm_primeSourceMean_sub_le C outside σ hactual hl houtside hp hAd hout hV + have hmmean := norm_plainMixedSourceMean_sub_le C outside σ hactual hl houtside hp hAd hout hV + exact ⟨hprime,hmixed,⟨hpmean.trans hprime.1,hpmean.trans hprime.2⟩, + ⟨hmmean.trans hmixed.1,hmmean.trans hmixed.2⟩⟩ + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce89919fb582e842d04cd4eb59dd6a9339392952 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementSelected.lean @@ -0,0 +1,97 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementBoundInterface +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementGeometryInterface +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkActualPrincipalBlockFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkActualPrincipalSourceReindexFamily Filter +attribute [local instance] Classical.propDecidable +local instance actualBSquareSelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_frequency_error_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) (hp q hq).pos) hsize hlog + (Background C l × SelectedBulkSample C l) + (FinitePrior.pair (backgroundPrior C l) (selectedBulkPrior C l)) + (fun v f g a => referenceFamily C outside σ (J a.1) w P Q hactual hl houtside hw hpos hcell + hp hAd hout hV a.1 a.2 (v,(f,g))) + (fun v f g a => densitySources C outside σ (J a.1) w P Q hactual hl houtside hw hpos hcell + hp a.1 a.2 (v,(f,g))) + (fun v f g a => staticMask C outside σ (J a.1) w P Q hactual hl houtside hw hpos hcell + hp a.1 a.2 (v,(f,g))) + simpa only [frequencyError,expression,zero_mul,Real.exp_zero,one_mul] using hbnd + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementZeroCost.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementZeroCost.lean new file mode 100644 index 0000000000000000000000000000000000000000..ae022a0126dbec16a8708f72a057485fa3e0423a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualBSquareReplacementZeroCost.lean @@ -0,0 +1,14 @@ +import OAI.NumberTheory.Ostmann.Conclusion.Scales + +namespace OAI + +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +theorem zero_cost_bounds (L x a b : ℝ) + (h : Real.exp (0*(L+1)^2)*x≤a ∧ Real.exp (0*(L+1)^2)*x≤b) : + x≤a ∧ x≤b := by + simpa only [zero_mul,Real.exp_zero,one_mul] using h + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyData.lean new file mode 100644 index 0000000000000000000000000000000000000000..60072e5f1b939a8fefd63559caa2e45daeedf3c6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyData.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamilyMatchedMetadata +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedReferenceFrame + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +attribute [local instance] Classical.propDecidable +local instance actualCorrectedPrincipalDataInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i)(he : PreservesRemainingBands _ e) + +theorem reference_giants : RootGiantsAgree (R.blockReference he).left.history + (R.blockReference he).right.history := + HistoryBulkActualCorrectedReferenceFamily.matchedWitnessBlockReference_giants C p + R.data.blockDraw R.data.valid outside (outerNonbulk C l p o) e + i.1.val i.1.val i.2.1 i.2.2 R.witness he + +theorem reference_rootAligned + (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + coordinateSample _ (R.blockReference he).right.history (R.blockReference he).right.labels (.inr (.inl j))= + coordinateSample _ (R.blockReference he).left.history (R.blockReference he).left.labels + (.inr (.inl (fullPermutation (l+1) _ e he j))) := + HistoryBulkActualCorrectedReferenceFamily.matchedWitnessBlockReference_rootAligned C p + R.data.blockDraw R.data.valid outside (outerNonbulk C l p o) e + i.1.val i.1.val i.2.1 i.2.2 R.witness he j + +def principalData (n : ℕ)(hlen : outside.length=2*n)(hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(((selectCorrectedOuterReference C p o outside e (v,f,g)).get ho).frame he hprime).leftSource + +def correctedDensityKernelError + (mask : (v : AllowedFrequency (frequencyBound Bs BD Bz k L) l) → + (f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l) → + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) → + OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → Prop) : ℝ := + ∑v,∑f,∑g,∑p,‖densityPrincipalDifferenceMean + (correctedPrincipalFamily (l:=l) C p outside e he n hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he n hlen hprime hV p v f g) + true true (mask v f g p)‖ + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..c1ec4c352bde7819794b14de2847e8a4674f945d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityBound.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensityExpression + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance actualCorrectedPrincipalDensityBoundInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E)(outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l))(he : PreservesRemainingBands _ e) + (n : ℕ)(hlen : outside.length=2*n)(hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → Prop), + a*(∑v,∑f,∑g,∑p,‖densityPrincipalDifferenceMean (F v f g p) (X v f g p) true true (mask v f g p)‖)≤r₁ ∧ + a*(∑v,∑f,∑g,∑p,‖densityPrincipalDifferenceMean (F v f g p) (X v f g p) true true (mask v f g p)‖)≤r₂) + (mask : AllowedFrequency (frequencyBound Bs BD Bz k L) l → + FrequencyChoices (frequencyBound Bs BD Bz k L) l → + FrequencyChoices (frequencyBound Bs BD Bz k L) l → + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) → + OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → Prop) : + a*correctedDensityKernelError (l:=l) C outside e he n hlen hprime hV mask≤r₁ ∧ + a*correctedDensityKernelError (l:=l) C outside e he n hlen hprime hV mask≤r₂ := by + rw [correctedDensityKernelError_eq] + exact h + (fun v f g p=>correctedPrincipalFamily (l:=l) C p outside e he n hlen hprime hV v f g) + (fun v f g p o ho=>correctedPrincipalFamily_reference_giants (l:=l) C p outside e he n hlen hprime hV v f g o ho) + (fun v f g p=>correctedDensitySources (l:=l) C outside e he n hlen hprime hV p v f g) mask + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityExpression.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityExpression.lean new file mode 100644 index 0000000000000000000000000000000000000000..abdc32e5c73e8849fbf3ee83351fb687ce073056 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityExpression.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensity + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance actualCorrectedPrincipalDensityExpressionInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E)(outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l))(he : PreservesRemainingBands _ e) + (n : ℕ)(hlen : outside.length=2*n)(hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → Prop) : + correctedDensityKernelError (l:=l) C outside e he n hlen hprime hV mask = + ∑v,∑f,∑g,∑p,‖densityPrincipalDifferenceMean + (correctedPrincipalFamily (l:=l) C p outside e he n hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he n hlen hprime hV p v f g) + true true (mask v f g p)‖ + := rfl + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensitySelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensitySelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..7d7c2ac7250cbcd5b2217a3ce02295c270e31a56 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensitySelected.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensityBound +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensityStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilySelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedDensityRoot + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkPrincipalKernelReplacementMatched Filter +attribute [local instance] Classical.propDecidable + +theorem selected_corrected_principal_factory_density_kernel_error_eventually + (d : Decomposition) (Bs BD Bz D H : ℝ) {k : ℕ} + (hBs : 0≤Bs)(hH : 0≤H)(hk : 0 + (h.1 E C hG hGu hcl hcu hb hd spectator hspec outside houtside n hlen hsize l hl e he).elim + (fun hprime hex => hex.elim (fun hV _ => + ⟨hprime,hV,fun mask => + @correctedDensityKernelError_bound d Bs BD Bz L k l E C outside e he n hlen hprime hV + (Real.exp (D*(L+1)^2)) + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (h.2 E C hG hGu hcl hcu hb hd spectator hspec l true true hl + outside (fun q hq=>(hprime q hq).pos) hsize + (fun q hq=>(houtside q hq).elim (fun r hr=>hr ▸ (hspec r).2))) mask⟩))) + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..47c7f36a90625092052abab81a46e57de2a120b1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyDensityStatement.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensity + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkPrincipalKernelReplacementMatched Filter +attribute [local instance] Classical.propDecidable +local instance actualCorrectedPrincipalDensityStatementInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +def SelectedCorrectedDensityKernelEstimate + (d : Decomposition) (Bs BD Bz D H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ)C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → Prop, + Real.exp (D*(L+1)^2)*@correctedDensityKernelError d Bs BD Bz L k l E C outside e he n hlen hprime hV mask≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + Real.exp (D*(L+1)^2)*@correctedDensityKernelError d Bs BD Bz L k l E C outside e he n hlen hprime hV mask≤ + Real.exp (-H*(bulkSize k L:ℝ)) + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyError.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyError.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc3fc46d7d9216a69dafdd7469213e496fc04033 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyError.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyFactory +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedRoot + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance actualCorrectedPrincipalErrorInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E)(outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l))(he : PreservesRemainingBands _ e) + (n : ℕ)(hlen : outside.length=2*n)(hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → Prop) : ℝ := + ∑v,∑f,∑g,∑p,‖principalDifferenceMean + (correctedPrincipalFamily C p outside e he n hlen hprime hV v f g) true true (mask v f g p)‖ + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyFactory.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyFactory.lean new file mode 100644 index 0000000000000000000000000000000000000000..122117eaf1bb7292cdf9e655042c7daf52fde6e2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilyFactory.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyMatchedMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagPrincipalMatchedFamily + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +attribute [local instance] Classical.propDecidable +local instance actualCorrectedPrincipalFactoryInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ)(e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (n : ℕ)(hlen : outside.length=2*n)(hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jrfl + rightRootFrequency_eq := fun _ _=>rfl + leftFrequency_eq := fun _ _=>rfl + rightFrequency_eq := fun _ _=>rfl + permutation := fullPermutation (l+1) _ e he + rootAligned o ho j := reference_rootAligned + ((selectCorrectedOuterReference C p o outside e (v,f,g)).get ho) he j + principal o ho := principalData ((selectCorrectedOuterReference C p o outside e (v,f,g)).get ho) + he n hlen hprime hV + +theorem correctedPrincipalFamily_reference_giants + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (ho : (correctedPrincipalFamily C p outside e he n hlen hprime hV v f g).active o) : + RootGiantsAgree + ((correctedPrincipalFamily C p outside e he n hlen hprime hV v f g).reference o ho).left.history + ((correctedPrincipalFamily C p outside e he n hlen hprime hV v f g).reference o ho).right.history := + reference_giants ((selectCorrectedOuterReference C p o outside e (v,f,g)).get ho) he + +theorem correctedPrincipalFamily_mean_eq : + (correctedPrincipalFamily C p outside e he n hlen hprime hV v f g).mean true true= + matchedOuterPrincipalFlagMean + (correctedPrincipalFamily C p outside e he n hlen hprime hV v f g) true true := + matched_mean_eq_outerPrincipalFlagMean _ true true + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilySelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilySelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9dcaed5dac65a82eaeb0faa9a3baf56fb65d0d3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedPrincipalBlockFamilySelected.lean @@ -0,0 +1,77 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyError + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkPrincipalKernelReplacementMatched Filter +attribute [local instance] Classical.propDecidable +local instance actualCorrectedPrincipalSelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_corrected_principal_factory_kernel_error_eventually + (d : Decomposition) (Bs BD Bz D H : ℝ) {k : ℕ} + (hBs : 0≤Bs)(hH : 0≤H)(hk : 0C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → Prop, + Real.exp (D*(L+1)^2)*correctedKernelError (l:=l) C outside e he n hlen hprime hV mask≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + Real.exp (D*(L+1)^2)*correctedKernelError (l:=l) C outside e he n hlen hprime hV mask≤ + Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [HistoryBulkSupportConverse.selected_source_inputs_eventually d Bs BD Bz hk, + selected_root_principal_kernel_error_eventually d Bs BD Bz D H hBs hH hk] with L hsource herror + intro E C hG hGu hcl hcu hb hd spectator hspec outside houtside n hlen hsize l hl e he + have hsf := (hsource E C hG hcl hcu hb hd spectator hspec).2.2 + have hprime : ∀q∈outside,q.Prime := by + intro q hq + obtain ⟨r,rfl⟩ := houtside q hq + exact spectator.prime r.val r.property + have hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(hprime q hq).pos) hsize hlog + (fun v f g p=>correctedPrincipalFamily (l:=l) C p outside e he n hlen hprime hV v f g) + (fun v f g p o ho=>correctedPrincipalFamily_reference_giants (l:=l) C p outside e he n hlen hprime hV + v f g o ho) mask + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamily.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..27444e34c4a7470c35df8269028647d4de74cfdb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamily.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamilyBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreGiantApproximation +open HistoryGiantOriginalMeanFactorization (Choices) + +theorem selected_witness_equality_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k : ℕ} (hk : 0term_eq_fixedReferenceTerm C outside a e he s t c₁ c₂ + hactual k hl hl ha hc₁ hc₂ houtside r u hu P Q hP hQ, + mixedFibreMean_eq_referenceMean C outside a e he s t c₁ c₂ + hactual k hl hl ha hc₁ hc₂ houtside r⟩ + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..80bb505dc01c143674de8b90e2959f75b6c5aaee --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyBasic.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceFrameCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreGiantApproximation +open HistoryGiantOriginalMeanFactorization (Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (a : SelectedNonbulkSample C l) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) +variable (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) + +abbrev Witness := Reference C outside a e s t c₁ c₂ + +def selectWitness (ha : 0<(selectedNonbulkPrior C l).mass a) : + Option (Witness C outside a e s t c₁ c₂) := by + classical + exact if hz : mixedFibreMean C outside a e s t c₁ c₂=0 then none else + some (Classical.choice ((mixedFibreMean_eq_zero_or_reference C outside a e s t c₁ c₂ ha).resolve_left hz)) + +theorem selectWitness_none_iff (ha : 0<(selectedNonbulkPrior C l).mass a) : + selectWitness C outside a e s t c₁ c₂ ha=none ↔ + mixedFibreMean C outside a e s t c₁ c₂=0 := by + classical + unfold selectWitness + split_ifs <;> simp_all + +theorem selectWitness_isSome_iff (ha : 0<(selectedNonbulkPrior C l).mass a) : + (selectWitness C outside a e s t c₁ c₂ ha).isSome ↔ + mixedFibreMean C outside a e s t c₁ c₂≠0 := by + classical + unfold selectWitness + split_ifs <;> simp_all + +def witnessFrame (he : PreservesRemainingBands _ e) + (ha : 0<(selectedNonbulkPrior C l).mass a) + (hc₁ : choicesMass C.sources _ _ l c₁≠0) + (hc₂ : choicesMass C.sources _ _ l c₂≠0) + (hp : ∀q∈outside,q.Prime) (r : Witness C outside a e s t c₁ c₂) : Frame (l:=l) C outside := + correctedFrame C outside a e s t c₁ c₂ r ha he hc₁ hc₂ hp + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyMatchedMetadata.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyMatchedMetadata.lean new file mode 100644 index 0000000000000000000000000000000000000000..afbcc197d50454782ad487a47b082bb0befea915 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyMatchedMetadata.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamilyMatchedReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBoundsBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryCompensationRepresentativePatterns +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkIndependentFibreReference HistoryGiantOriginalMeanFactorization HistorySignedXiTransport +open HistoryPairPattern HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +open HistoryPairBulkTransport HistoryGiantReferenceSourceBounds +open HistoryDiagonalRemainingRootMatching HistoryBulkIndependentReferenceFrequency +attribute [local instance] Classical.propDecidable +local instance correctedMatchedMetadataInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀ i, (expand p b i).val ∈ (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates) + (outside : List ℕ) (a : SelectedNonbulkSample C l) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) (s t : ℤ) + (f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l) + (r : Witness C outside a e s t + (blockLeftChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l p b hb f) + (blockRightChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l p b hb g)) + +theorem matchedWitnessBlockReference_rootAligned (he : PreservesRemainingBands _ e) + (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + coordinateSample _ (matchedWitnessBlockReference C p b hb outside a e s t f g r he).right.history + (matchedWitnessBlockReference C p b hb outside a e s t f g r he).right.labels (.inr (.inl j)) = + coordinateSample _ (matchedWitnessBlockReference C p b hb outside a e s t f g r he).left.history + (matchedWitnessBlockReference C p b hb outside a e s t f g r he).left.labels + (.inr (.inl (fullPermutation (l+1) _ e he j))) := by + have hleft := coordinateSample_root_assigned C.sources _ (frequencyBound Bs BD Bz k L) l + (matchedWitnessLeftRoot C p b hb outside a e s t f g r) + (blockLeftChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb f) + (fibreAssignment C a r.bulk) rfl (Template.assignedSlots_matches _ _ _) + (fullPermutation (l+1) _ e he j) + have hright := coordinateSample_root_assigned C.sources _ (frequencyBound Bs BD Bz k L) l + (matchedWitnessRightRoot C p b hb outside a e s t f g r) + (blockRightChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb g) + (rightAssignment C a e r.bulk r.compatible) rfl (Template.assignedSlots_matches _ _ _) j + have hvalues := counterpartCurrentAssignment_value C (fibreAssignment C a r.bulk) e he r.compatible j + exact hright.trans ((congrArg (fun v : ℕ => (v : ℤ)) hvalues).trans hleft.symm) + +def matchedWitnessPrincipalData (he : PreservesRemainingBands _ e) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (blockLeftChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb f) ≠ 0) + (hechoices : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (blockRightChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb g) ≠ 0) + (n : ℕ) (hlen : outside.length = 2*n) (hprime : ∀q ∈ outside, q.Prime) + (hV : ∀q ∈ outside, ∀j ≤ l, frequencyBound Bs BD Bz k L j < q) + (independent : Bool) : MatchedPrincipalReferenceData C + (matchedWitnessBlockReference C p b hb outside a e s t f g r he) := by + have href := corrected_reference_data C outside a e s t + (blockLeftChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb f) + (blockRightChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb g) r ha + have hs := selected_reference_sourceBounds C (frequencyBound Bs BD Bz k L) l + (fibreAssignment C a r.bulk) (rightAssignment C a e r.bulk r.compatible) s t + (blockLeftChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb f) + (blockRightChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb g) + (mixedP C.giantCenter C.giant r.draw) (mixedQ C.giantCenter C.giant r.draw) + href.left_mass href.right_mass hc hechoices href.plus_pos href.minus_pos href.plus_cell href.minus_cell + exact { + leftSource := hs.1 + rightSource := hs.2 + s := n + outsideLength := hlen + outsidePrime := hprime + outsideFrequency := hV + permutation := inducedBulkPermutation (2*(bulkSize k L/2)) k l + (fullPermutation (l+1) _ e he) (fullPermutation_bulk (l+1) _ e he) + K := k + independent := independent } + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyMatchedReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyMatchedReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..cae546c9c30dfa1c692902462b7845b64e244a68 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualCorrectedReferenceFamilyMatchedReference.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamilyBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagPrincipalMatchedData + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryCompensationRepresentativePatterns +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkIndependentFibreReference HistoryGiantOriginalMeanFactorization HistorySignedXiTransport +open HistoryPairPattern HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +attribute [local instance] Classical.propDecidable +local instance correctedMatchedReferenceInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀ i, (expand p b i).val ∈ (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates) + (outside : List ℕ) (a : SelectedNonbulkSample C l) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) (s t : ℤ) + (f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l) + (r : Witness C outside a e s t + (blockLeftChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l p b hb f) + (blockRightChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l p b hb g)) + +def matchedWitnessLeftRoot : State := + giantState (sourceState C.sources _ (fibreAssignment C a r.bulk) s) + (mixedP C.giantCenter C.giant r.draw) (mixedQ C.giantCenter C.giant r.draw) + +def matchedWitnessRightRoot : State := + giantState (sourceState C.sources _ (rightAssignment C a e r.bulk r.compatible) t) + (mixedP C.giantCenter C.giant r.draw) (mixedQ C.giantCenter C.giant r.draw) + +def matchedWitnessBlockReference (he : PreservesRemainingBands _ e) : + MatchedBlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p where + blockDraw := b + valid := hb + leftRoot := matchedWitnessLeftRoot C p b hb outside a e s t f g r + rightRoot := matchedWitnessRightRoot C p b hb outside a e s t f g r + leftFrequency := f + rightFrequency := g + leftMatch := Template.assignedSlots_matches C.sources _ (fibreAssignment C a r.bulk) + rightMatch := Template.assignedSlots_matches C.sources _ (rightAssignment C a e r.bulk r.compatible) + leftSupported := r.supported.1 + rightSupported := r.supported.2 + rootMatching := corrected_reference_draw_matching C outside a e s t _ _ r he + +@[simp] theorem matchedWitnessBlockReference_left_frequency (he : PreservesRemainingBands _ e) : + (matchedWitnessBlockReference C p b hb outside a e s t f g r he).leftRoot.frequency = s := rfl + +@[simp] theorem matchedWitnessBlockReference_right_frequency (he : PreservesRemainingBands _ e) : + (matchedWitnessBlockReference C p b hb outside a e s t f g r he).rightRoot.frequency = t := rfl + +theorem matchedWitnessBlockReference_giants (he : PreservesRemainingBands _ e) : + RootGiantsAgree (matchedWitnessBlockReference C p b hb outside a e s t f g r he).left.history + (matchedWitnessBlockReference C p b hb outside a e s t f g r he).right.history := by + constructor <;> simp only [MatchedBlockReference.left_root,MatchedBlockReference.right_root] <;> rfl + +end Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..d01fc9668695a4b165a7e001fc0f66a5e2b1013e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrected.lean @@ -0,0 +1,92 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedPattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacementBackground + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkUniversalPatternAggregation Filter +attribute [local instance] Classical.propDecidable +local instance actualGoodCorrectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + +def correctedPrincipal (_hl : lcorrectedFamily C p (restoreOuterBackground C l p bg b) + (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) true true hV + +theorem correctedPrincipal_eq_backgroundMean (hl : lcorrectedGoodFamily C p o (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) hgood) + true true hV := by + unfold correctedPrincipal HistoryBulkPatternIntegralReplacement.backgroundValue backgroundMean + apply congrArg ((backgroundPrior C l).cmean) + funext bg + apply congrArg (patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + funext p b + exact familyValue_correctedFamily C p _ (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) hgood b hV + +theorem exists_corrected_principal_budget (d : Decomposition) (Bs BD Bz H : ℝ) + (hBs : 0 ≤ Bs) {k : ℕ} (hk : 2 ≤ k) (hH : 0 ≤ H) : + ∃ ε : ℝ,0 < ε ∧ ∀ᶠ L : ℝ in atTop,∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + (∀p : spectator.Sample,(FiniteField.correlationBound (residueTransform d p.val):ℝ) ≤ ε) → + ∀ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀(l : ℕ)(hl : lcorrectedGoodFamily C p o (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) hgood) + true true (fun _=>hl) + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedFamily.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd59f3d9d50e02250a742f98aa53d765e54a9e78 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedFamily.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternAggregationFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacementBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexFrequency + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkPrincipalSourceReindex +attribute [local instance] Classical.propDecidable +local instance actualGoodCorrectedFamilyInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +def CorrectedSelectedOuter.rawReference (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) : + HistoryBulkPatternIntegralReplacement.Reference C outside l p where + frame := R.frame he hprime + nonbulk := outerNonbulk C l p o + permutation := R.permutation + representative := R.representative he hprime + mask := 1 + mask_mem := ⟨zero_le_one,le_rfl⟩ + +variable (C p o outside e) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +def correctedRootFamily + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + Option (HistoryBulkPatternIntegralReplacement.Reference C outside l p) := + (selectCorrectedOuterReference C p o outside e i).map (fun R=>R.rawReference he hprime) + +def correctedFamily : HistoryBulkPatternIntegralReplacement.Family C outside l p := + extendCommonRootOption (frequencyBound Bs BD Bz k L) l + (correctedRootFamily C p o outside e he hprime) + +variable (hgood : ¬TransferBadArrangement + (DiagonalPermutationCount.remainingBulkPermutation (2*(bulkSize k L/2)) k l e)) + +def correctedGoodRootFamily + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + Option (HistoryBulkGoodPatternAggregation.Reference C outside l p) := + (selectCorrectedOuterReference C p o outside e i).map (fun R=> + R.goodReference he hprime hgood (density (R.frame he hprime) true) + (density_mem (R.frame he hprime) true)) + +def correctedGoodFamily : HistoryBulkGoodPatternAggregation.Family C outside l p := + extendCommonRootOption (frequencyBound Bs BD Bz k L) l + (correctedGoodRootFamily C p o outside e he hprime hgood) + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..754ae805d3074be1d75c88d4274e1869517aa872 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedPattern.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedFamily + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkGoodPatternPrincipalFrame +open HistoryPairKernelReplacement +open scoped BigOperators +attribute [local instance] Classical.propDecidable +local instance actualGoodCorrectedPatternInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + (hgood : ¬TransferBadArrangement + (DiagonalPermutationCount.remainingBulkPermutation (2*(bulkSize k L/2)) k l e)) + +theorem correctedReference_value + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (R : CorrectedSelectedOuter C p o outside e i) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j rfl + | some R => + exact correctedReference_value C p o outside e he hprime hgood i R b hV + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..e0167fb6c99b170cfddbbce918af641db1b2fe3f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReference.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedReferenceFrame +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreGiantApproximation +open HistoryPairRepresentatives HistoryPairReferenceSourceTransport +open HistoryCompensationRepresentativePatterns HistoryDiagonalRemainingRootMatching +open HistoryPairBulkCoordinates CanonicalHistoryLeafBulk HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance actualGoodCorrectedReferenceInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +theorem representative_prime (q : Block p) : + prime (R.frame he hprime).left (R.frame he hprime).right + (R.representative he hprime q)=(outerBlocks C l p o q).val := by + change prime (R.blockReference he).left.history (R.blockReference he).right.history + ((typedBlockEquiv (R.blockReference he).left (R.blockReference he).right p + (R.blockReference he).natDraw (R.blockReference he).slot_values).symm q)=_ + exact (representativeBlockEquiv_prime _ (R.blockReference he).left.history + (R.blockReference he).right.history (R.blockReference he).left.labels + (R.blockReference he).right.labels p (R.blockReference he).natDraw + (R.blockReference he).slot_values _).trans + (congrArg (R.blockReference he).natDraw.val + ((typedBlockEquiv (R.blockReference he).left (R.blockReference he).right p + (R.blockReference he).natDraw (R.blockReference he).slot_values).apply_symm_apply q)) + +theorem permutation_eq_bulkPermutation : + R.permutation=HistoryBulkIndependentFibreReference.bulkPermutation e he := by + symm + exact inducedBulkPermutation_fullPermutation (2*(bulkSize k L/2)) k l e he + +theorem frame_bulkSamples (u : Fin (2^l)×Fin (2*(bulkSize k L/2))) : + bulkSamples C.sources (2*(bulkSize k L/2)) k l (R.frame he hprime).rightSource u.1 u.2= + bulkSamples C.sources (2*(bulkSize k L/2)) k l (R.frame he hprime).leftSource + (R.permutation u).1 (R.permutation u).2 := + counterpartCurrentAssignment_remainingBulkSamples C + (fibreAssignment C (outerNonbulk C l p o) R.witness.bulk) e he R.witness.compatible u + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReferenceBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReferenceBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..465946d1ffe7e6d01d098f4fc81e09ccfab68c98 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReferenceBasic.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamilyBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterData + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +local instance actualGoodCorrectedReferenceBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + +structure CorrectedSelectedOuter where + data : OuterData C p o + witness : HistoryBulkActualCorrectedReferenceFamily.Witness C outside + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p data.blockDraw data.valid) i) + (rightChoices C (rightBlockDraws C p data.blockDraw data.valid) i) + +def selectCorrectedOuterReference : Option (CorrectedSelectedOuter C p o outside e i) := + match outerData? C p o with + | none => none + | some D => (HistoryBulkActualCorrectedReferenceFamily.selectWitness C outside + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) + D.nonbulk_pos).map (fun r=>⟨D,r⟩) + +theorem selectCorrectedOuterReference_eq_map (D : OuterData C p o) + (hD : outerData? C p o=some D) : + selectCorrectedOuterReference C p o outside e i= + (HistoryBulkActualCorrectedReferenceFamily.selectWitness C outside + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) + D.nonbulk_pos).map (fun r=>⟨D,r⟩) := by + unfold selectCorrectedOuterReference + rw [hD] + +theorem selectCorrectedOuterReference_none_iff (D : OuterData C p o) + (hD : outerData? C p o=some D) : + selectCorrectedOuterReference C p o outside e i=none ↔ + mixedFibreMean C outside (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i)=0 := by + rw [selectCorrectedOuterReference_eq_map C p o outside e i D hD,Option.map_eq_none_iff] + exact HistoryBulkActualCorrectedReferenceFamily.selectWitness_none_iff C outside + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) D.nonbulk_pos + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReferenceFrame.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReferenceFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fd8a0e57cdd09a43c05584eea1c9c84652ace7f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedReferenceFrame.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamilyMatchedReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternAggregationReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceSourceTransportBlocks +import OAI.NumberTheory.Ostmann.Construction.DiagonalPermutationCount + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreGiantApproximation +open HistoryPairRepresentatives HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance actualGoodCorrectedReferenceFrameInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +def blockReference : MatchedBlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p := + HistoryBulkActualCorrectedReferenceFamily.matchedWitnessBlockReference C p + R.data.blockDraw R.data.valid outside (outerNonbulk C l p o) e + i.1.val i.1.val i.2.1 i.2.2 R.witness he + +def frame : Frame (l:=l) C outside := + HistoryBulkActualCorrectedReferenceFamily.witnessFrame C outside + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p R.data.blockDraw R.data.valid) i) + (rightChoices C (rightBlockDraws C p R.data.blockDraw R.data.valid) i) + he R.data.nonbulk_pos (R.data.left_mass i) (R.data.right_mass i) hprime R.witness + +@[simp] theorem frame_left : (R.frame he hprime).left=(R.blockReference he).left.history := rfl +@[simp] theorem frame_right : (R.frame he hprime).right=(R.blockReference he).right.history := rfl +@[simp] theorem frame_s : (R.frame he hprime).s=i.1.val := rfl +@[simp] theorem frame_t : (R.frame he hprime).t=i.1.val := rfl + +def representative : Block p ≃ Representative (R.frame he hprime).left (R.frame he hprime).right := + (typedBlockEquiv (R.blockReference he).left (R.blockReference he).right p + (R.blockReference he).natDraw (R.blockReference he).slot_values).symm + +def permutation (_R : CorrectedSelectedOuter C p o outside e i) : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2))) := + DiagonalPermutationCount.remainingBulkPermutation (2*(bulkSize k L/2)) k l e + +def goodReference (hgood : ¬TransferBadArrangement (R.permutation)) + (mask : ℝ) (hmask : 0 ≤ mask ∧ mask ≤ 1) : + HistoryBulkGoodPatternAggregation.Reference C outside l p where + frame := R.frame he hprime + permutation := R.permutation + good := hgood + representative := R.representative he hprime + mask := mask + mask_mem := hmask + +@[simp] theorem goodReference_frame (hgood : ¬TransferBadArrangement (R.permutation)) + (mask : ℝ) (hmask : 0 ≤ mask ∧ mask ≤ 1) : + (R.goodReference he hprime hgood mask hmask).frame=R.frame he hprime := rfl + +@[simp] theorem goodReference_permutation (hgood : ¬TransferBadArrangement (R.permutation)) + (mask : ℝ) (hmask : 0 ≤ mask ∧ mask ≤ 1) : + (R.goodReference he hprime hgood mask hmask).permutation= + DiagonalPermutationCount.remainingBulkPermutation (2*(bulkSize k L/2)) k l e := rfl + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedSourceSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedSourceSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..be1ca943768be873e840c9396adbe8491f350f0d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedSourceSupport.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedSourceSupportCoordinates +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance actualGoodCorrectedSourceSupportInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (ho : originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y = o) + (hm : originalDrawMass (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y ≠ 0) + +include ho hm + +theorem rightRootSupported_originalDraw : + RightRootSupported (R.blockReference he) (fun _=>C.giant) y := by + have hu := ((originalDrawMass_ne_zero_iff C l p y).mp hm).2 + let hc := reference_compatible_all C outside (outerNonbulk C l p o) e he i.1.val i.1.val + (leftChoices C (leftBlockDraws C p R.data.blockDraw R.data.valid) i) + (rightChoices C (rightBlockDraws C p R.data.blockDraw R.data.valid) i) + R.witness (originalDrawBulk C l p y) + have hmass := reference_right_mass_nonzero C outside (outerNonbulk C l p o) e he i.1.val i.1.val + (leftChoices C (leftBlockDraws C p R.data.blockDraw R.data.valid) i) + (rightChoices C (rightBlockDraws C p R.data.blockDraw R.data.valid) i) + R.witness (originalDrawBulk C l p y) hc hu + apply rightRootSupported_of_assignment (R.blockReference he) (fun _=>C.giant) y + (rightAssignment C (outerNonbulk C l p o) e (originalDrawBulk C l p y) hc) hmass + exact R.matchedReferenceSample_right_assignment he y ho hc + +theorem rightRootSupportIndicator_eq_one : + rightRootSupportIndicator (R.blockReference he) (fun _=>C.giant) y = 1 := by + unfold rightRootSupportIndicator + exact ite_eq_left (R.rightRootSupported_originalDraw he y ho hm) + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedSourceSupportCoordinates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedSourceSupportCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..869296287829e3d8de20f28e1c78f1bec74e6b22 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalCorrectedSourceSupportCoordinates.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamilyMatchedMetadata +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedReferenceFrame +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuter +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelProductReplacementMatchedSelectedSupport + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkIndependentFibreReference HistoryPairPattern HistoryPairReferenceSourceTransport +open HistoryPairKernelProductReplacement HistoryDiagonalRemainingRootMatching +attribute [local instance] Classical.propDecidable +local instance correctedSourceSupportCoordinatesInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _ => C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + +theorem matchedReferenceSample_right_assignment (he : PreservesRemainingBands _ e) + (y : OriginalDraw (fun _ => C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (ho : originalDrawOuter (fun _ => C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y = o) + (hc : Compatible C (outerNonbulk C l p o) e (originalDrawBulk C l p y)) + (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + matchedReferenceSample (R.blockReference he) (fun _ => C.giant) y + (rightMap (R.blockReference he).left.history (R.blockReference he).right.history + (.inr (.inl (rootPosition (R.blockReference he).right j)))) = + ((rightAssignment C (outerNonbulk C l p o) e (originalDrawBulk C l p y) hc j).val : ℤ) := by + have halign := HistoryBulkActualCorrectedReferenceFamily.matchedWitnessBlockReference_rootAligned + C p R.data.blockDraw R.data.valid outside (outerNonbulk C l p o) e + i.1.val i.1.val i.2.1 i.2.2 R.witness he + have hindex := matchedRightRootIndex_eq_of_aligned (R.blockReference he) + (fullPermutation (l+1) _ e he) halign + rw [matchedReferenceSample_right_root,hindex] + have hx := originalDrawAssignment_eq_fibreAssignment C l p y + rw [ho] at hx + change ((originalDrawAssignment C l p y (fullPermutation (l+1) _ e he j)).val : ℤ) = _ + rw [hx] + exact (congrArg (fun n : ℕ => (n : ℤ)) + (counterpartCurrentAssignment_value C + (fibreAssignment C (outerNonbulk C l p o) (originalDrawBulk C l p y)) e he hc j)).symm + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalDensity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..db94098a89f47b85e2f6ef757430ec9d8b46d367 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalDensity.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrameWeighted + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion HistoryBulkFibreGiantApproximation +open HistoryBulkFibreIntegralReplacementFrame +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +def density (r : Frame (l:=l) C outside) (mixed : Bool) : ℝ := + if mixed then (Frame.extractedDensity (C:=C) r.leftSource).re else 1 + +theorem density_nonneg (r : Frame (l:=l) C outside) (mixed : Bool) : + 0 ≤ density r mixed := by + cases mixed + · exact zero_le_one + · simp only [density,ite_true,Frame.extractedDensity,Complex.ofReal_re] + exact Finset.prod_nonneg (fun _ _ => div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _)) + +@[simp] theorem density_cast (r : Frame (l:=l) C outside) (mixed : Bool) : + (density r mixed : ℂ) = rootDensity r mixed := by + cases mixed + · rfl + · simp only [density,rootDensity,ite_true,Frame.extractedDensity,Complex.ofReal_re] + +theorem density_le_one (r : Frame (l:=l) C outside) (mixed : Bool) : + density r mixed ≤ 1 := by + have h := norm_rootDensity_le r mixed + rw [←density_cast,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (density_nonneg r mixed)] at h + exact h + +theorem density_mem (r : Frame (l:=l) C outside) (mixed : Bool) : + 0 ≤ density r mixed ∧ density r mixed ≤ 1 := + ⟨density_nonneg r mixed,density_le_one r mixed⟩ + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalFamily.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..6362972009e37dd4eb528b67946ebffe7e338180 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalFamily.lean @@ -0,0 +1,91 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternAggregationFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexFrequency + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkGoodPatternAggregation HistoryBulkGoodPatternPrincipalFrame +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkPrincipalSourceReindex +open HistoryPairKernelReplacement +attribute [local instance] Classical.propDecidable +local instance actualGoodFamilyInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (hgood : ¬TransferBadArrangement σ) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ R.goodReference hcell hprime hgood (density (R.frame hcell hprime) mixed) + (density_mem (R.frame hcell hprime) mixed)) + +def selectedFamily : Family C outside l p := + extendCommonRootOption (frequencyBound Bs BD Bz k L) l + (selectedRootFamily C p o outside σ hgood J w P Q hactual hl houtside hw hpos hcell hprime mixed) + +def selectedValue + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (corrected : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + rootDensity (R.frame hcell hprime) mixed * + ((∏q : Block p,symbolicKernel mixed (R.frame hcell hprime).left (R.frame hcell hprime).right + (R.frame hcell hprime).left_supported (R.frame hcell hprime).right_supported + (R.representative hcell hprime q) (b q).val : ℝ):ℂ) * + principalOperator (R.frame hcell hprime) corrected mixed σ hV) + +theorem familyValue_selectedFamily + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (corrected : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j rfl + | some R => + simp only [Option.map_some,Option.elim_some,Reference.weight, + MatchedSelectedOuter.goodReference,Complex.ofReal_mul,density_cast] + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e361c8f9583a2374254feee0d7220c5e769fa1e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalMean.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GiantCollisionError +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternAggregation + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalBlockFamily HistoryBulkGoodPatternAggregation +open HistoryBulkUniversalPatternAggregation Filter +attribute [local instance] Classical.propDecidable +local instance actualGoodMeanInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def backgroundMean (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (families : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + OriginalOuter (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → Family C outside l p) + (corrected mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>familyValue (families p (restoreOuterBackground C l p bg b)) b corrected mixed hV)) + +theorem backgroundMean_eq_original (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (families : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + OriginalOuter (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → Family C outside l p) + (corrected mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(blockType p q,outerBlocks C l p o q)) then + familyValue (families p o) (outerBlocks C l p o) corrected mixed hV else 0) := by + symm + simpa only [backgroundMean,outerBlocks_restoreOuterBackground] using + outer_pattern_sum_eq_background_cmean C l + (fun p o=>familyValue (families p o) (outerBlocks C l p o) corrected mixed hV) + +theorem exists_backgroundMean_budget (d : Decomposition) (Bs BD Bz H : ℝ) + (hBs : 0 ≤ Bs) {k : ℕ} (hk : 2 ≤ k) (hH : 0 ≤ H) : + ∃ ε : ℝ,0 < ε ∧ ∀ᶠ L : ℝ in atTop,∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + (∀p : spectator.Sample,(FiniteField.correlationBound (residueTransform d p.val):ℝ) ≤ ε) → + ∀ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀l : ℕ,l ≤ k → + ∃hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → Family C (spectatorList spectator ds) l p) + (corrected mixed : Bool), (corrected=true → lfamilies p (restoreOuterBackground C l p bg b)) corrected mixed hstage + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd2869a9bf05de806a0f1ce4aabd4ee29e9f91a5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPattern.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacementBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkGoodPatternAggregation HistoryBulkGoodPatternPrincipalFrame +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkPrincipalSourceReindex +open HistoryPairKernelReplacement +attribute [local instance] Classical.propDecidable +local instance actualGoodPatternInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (hgood : ¬TransferBadArrangement σ) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ (selectMatchedOuterReference C p o outside σ J w P Q i + hactual hl houtside hw hpos).map (fun R=> { + frame := R.frame hcell hprime + nonbulk := outerNonbulk C l p o + permutation := σ + representative := R.representative hcell hprime + mask := 1 + mask_mem := ⟨zero_le_one,le_refl _⟩ })) + +theorem pattern_after_eq_selectedValue + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (corrected : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j rfl + | some R => + simp only [Option.map_some,Option.elim_some,HistoryBulkPatternIntegralReplacement.Reference.weight, + one_mul,ite_true] + exact (mul_left_comm _ _ _).trans (mul_assoc _ _ _).symm + +theorem pattern_after_eq_goodFamily + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (corrected : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + +theorem plainPattern_after_eq_good (hgood : ¬TransferBadArrangement σ) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + HistoryBulkPatternIntegralReplacement.familyValue true + (plainPatternFamily C spectator ds hactual hl σ mixed p o) b false mixed hV= + familyValue (plainGoodFamily C spectator ds hactual hl σ mixed p o hgood) b false mixed hV) + (pattern_after_eq_goodFamily (α := PrimeDraw C.giant) (spectator := spectator) + C p o (spectatorList spectator ds) σ hgood + (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false b false hV) + (pattern_after_eq_goodFamily (α := MixedDraw C.giantCenter C.giant) (spectator := spectator) + C p o (spectatorList spectator ds) σ hgood + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l))=> + plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) true b false hV +) + mixed + +def plainPrincipal + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jplainPatternFamily C spectator ds hactual hl σ mixed p + (restoreOuterBackground C l p bg b)) false mixed hV + +theorem plainPrincipal_eq_backgroundMean (hgood : ¬TransferBadArrangement σ) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jplainGoodFamily C spectator ds hactual hl σ mixed p o hgood) false mixed hV := + congrArg ((backgroundPrior C l).cmean) (funext fun bg => + congrArg (patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (funext fun p => funext fun b => + plainPattern_after_eq_good C spectator ds hactual hl σ mixed p + (restoreOuterBackground C l p bg b) hgood b hV)) + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPlainDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPlainDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..6f2ee898e62477f27cf0a4fc4966e3d51c36111c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPlainDefs.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacementBackground + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkGoodPatternAggregation HistoryBulkFibreGiantApproximationReference +open HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreGiantErrorAverage HistoryBulkFibreOriginalReference +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +local instance actualGoodPlainDefsInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + +def plainPatternFamily : HistoryBulkPatternIntegralReplacement.Family C (spectatorList spectator ds) l p := + if mixed then + selectedPatternFamily (α := MixedDraw C.giantCenter C.giant) (spectator := spectator) C p o (spectatorList spectator ds) σ + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l))=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + else + selectedPatternFamily (α := PrimeDraw C.giant) (spectator := spectator) C p o (spectatorList spectator ds) σ (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + +def plainGoodFamily (hgood : ¬TransferBadArrangement σ) : Family C (spectatorList spectator ds) l p := + if mixed then + selectedFamily (α := MixedDraw C.giantCenter C.giant) (spectator := spectator) C p o (spectatorList spectator ds) σ hgood + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l))=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) true + else + selectedFamily (α := PrimeDraw C.giant) (spectator := spectator) C p o (spectatorList spectator ds) σ hgood (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPlainSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPlainSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..eefc11592bfc3b9df5302cfbf5bbe2c4999ea7b1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalPlainSelected.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlain + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion Filter HistoryBulkSourceDisintegration + +theorem exists_plain_principal_budget (d : Decomposition) (Bs BD Bz H : ℝ) + (hBs : 0 ≤ Bs) {k : ℕ} (hk : 2 ≤ k) (hH : 0 ≤ H) : + ∃ ε : ℝ,0 < ε ∧ ∀ᶠ L : ℝ in atTop,∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + (∀p : spectator.Sample,(FiniteField.correlationBound (residueTransform d p.val):ℝ) ≤ ε) → + ∀ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∃hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator, + ∀l : ℕ,∀hl : l ≤ k, + ∃hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + ⟨ε,hε.1,(hε.2.and (HistoryBulkFixedReferenceTerm.selected_reference_equality_eventually + d Bs BD Bz (lt_of_lt_of_le (Nat.succ_pos 1) hk))).mono fun _L hL => + fun spectator hband hflat ds E C hG hGu hc hcu hb hd => + let hactual := hL.2 E C hG hc hcu hb hd spectator hband + ⟨hactual,fun l hl => + (hL.1 spectator hband hflat ds E C hG hGu hc hcu hb hd l hl).elim fun hV hbound => + ⟨hV,fun σ hgood mixed => + (congrArg norm (plainPrincipal_eq_backgroundMean C spectator ds hactual hl σ mixed hgood hV)).trans_le + (hbound (fun p o=>plainGoodFamily C spectator ds hactual hl σ mixed p o hgood) + false mixed (fun h=>False.elim (Bool.false_ne_true h)))⟩⟩⟩ + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..5cb6827e9d23b6d0035f31bd36a6e2bae6e500eb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualGoodPrincipalReference.lean @@ -0,0 +1,94 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyMatchedSelectedData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternAggregationReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryPairRepresentatives +open HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance actualGoodPrincipalReferenceInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

+ let hout := (h.2 E C hG hcl hcu hb hd spectator hspec).2.2 + let hV : ∀q∈spectatorList spectator ds,∀j ≤ l,frequencyBound Bs BD Bz k L jExists.elim (List.mem_ofFn.mp hq) + (fun i hi=>hi ▸ hout (ds i) j (hj.trans hl.le)) + ⟨hV,fun e he=>h.1 spectator (fun p=>(hspec p).2) ds E C hG hGu hcl hcu hb hd l hl.le + true true hV (fun _=>hl) + (fun bg p b=>correctedFamily C p (restoreOuterBackground C l p bg b) + (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds))⟩) + +end Ostmann.Arithmetic.HistoryBulkActualIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementCorrectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementCorrectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b3719595374c85e23f75081736ca051f91ffef2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementCorrectedDefs.lean @@ -0,0 +1,13 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementCorrectedDefsBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementCorrectedDefsBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..574b50dbc379bf00bf15e9aec0cdfd65c9d09bbd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementCorrectedDefsBasic.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacementBackground + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualIntegralReplacement +open Construction Conclusion Filter +open HistoryBulkSourceDisintegration HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualGoodPrincipal HistoryBulkPatternIntegralReplacement +open HistoryBulkIndependentFibreReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def correctedBulkPrincipal (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) (_hl : lcorrectedFamily C p (restoreOuterBackground C l p bg b) + (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) true true hV + +end Ostmann.Arithmetic.HistoryBulkActualIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementPlain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementPlain.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb0239e534f84b499a7121265313e0b4f054925e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementPlain.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualIntegralReplacement +open Construction Conclusion Filter +open HistoryBulkSourceDisintegration HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualGoodPrincipal HistoryBulkPatternIntegralReplacement +open HistoryBulkSupportConverse +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem selected_plain_bulk_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) + let hactual := h.1.2 E C hG hcl hcu hb hd spectator hspec + let hout := (h.2 E C hG hcl hcu hb hd spectator hspec).2.2 + ⟨hactual,fun ds l hl=> + let hV : ∀q∈spectatorList spectator ds,∀j ≤ l,frequencyBound Bs BD Bz k L jExists.elim (List.mem_ofFn.mp hq) + (fun i hi=>hi ▸ hout (ds i) j (hj.trans hl)) + ⟨hV,fun σ mixed=>h.1.1 spectator (fun p=>(hspec p).2) ds E C hG hGu hcl hcu hb hd l hl + false mixed hV (fun hf=>False.elim (Bool.false_ne_true hf)) + (fun bg p b=>plainPatternFamily C spectator ds hactual hl σ mixed p + (restoreOuterBackground C l p bg b))⟩⟩) + +end Ostmann.Arithmetic.HistoryBulkActualIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementPlainDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementPlainDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..c3af2f6847e83662ef9ef611a34bab3bf3ca868e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualIntegralReplacementPlainDefs.lean @@ -0,0 +1,31 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacementBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualIntegralReplacement +open Construction Conclusion Filter +open HistoryBulkSourceDisintegration HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualGoodPrincipal HistoryBulkPatternIntegralReplacement +open HistoryBulkSupportConverse +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainBulkPrincipal (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (hV : ∀q∈spectatorList spectator ds,∀j ≤ l,frequencyBound Bs BD Bz k L jplainPatternFamily C spectator ds hactual hl σ mixed p + (restoreOuterBackground C l p bg b)) false mixed hV + +end Ostmann.Arithmetic.HistoryBulkActualIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedFactory.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedFactory.lean new file mode 100644 index 0000000000000000000000000000000000000000..c995194cf96a4a2cb78b2bf96c332a695ec61054 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedFactory.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyMatchedSelectedData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagPrincipalMatchedFamily + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryPairPattern HistoryPairBulkTransport +attribute [local instance] Classical.propDecidable +local instance actualPrincipalMatchedFactoryInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

rfl + rightRootFrequency_eq := fun _ _=>rfl + leftFrequency_eq := fun _ _=>rfl + rightFrequency_eq := fun _ _=>rfl + permutation := selectedLeafPermutation C l σ + rootAligned o ho t := ((selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).get ho).rootAligned t + principal o ho := ((selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).get ho).principalData hcell s hlen hprime hV independent + +theorem matchedPrincipalFamily_reference_giants + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (ho : (matchedPrincipalFamily C p outside σ J w P Q hactual hl houtside hw hpos hcell s hlen hprime hV + independent v f g).active o) : + RootGiantsAgree + ((matchedPrincipalFamily C p outside σ J w P Q hactual hl houtside hw hpos hcell s hlen hprime hV + independent v f g).reference o ho).left.history + ((matchedPrincipalFamily C p outside σ J w P Q hactual hl houtside hw hpos hcell s hlen hprime hV + independent v f g).reference o ho).right.history := + ((selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).get ho).giants + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce8ba75685b3b0a7a4681696f3b4f502dde9a21a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedMean.lean @@ -0,0 +1,97 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyMatchedFactory +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquiv + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryBulkSourceDisintegration HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance actualPrincipalMatchedMeanInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) + +def matchedOriginalPrincipalFlagTerm + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : ℝ := + if ho : F.active o then + (rightRootSupportIndicator (F.reference o ho) (fun _=>C.giant) y * + ‖(F.principal o ho).value corrected mixed u‖) * + family (F.reference o ho).left (F.reference o ho).right + (originalDrawValues (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y ∘ + (typedSourceEquivMatched (F.reference o ho).left (F.reference o ho).right p + (F.reference o ho).natDraw (F.reference o ho).slot_values (F.reference o ho).root_matching).symm) + else 0 + +def matchedWeightedFamilyTerm + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : ℝ := + if hy : F.active (originalDrawOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y) then + F.weight corrected mixed y * family + (F.reference _ hy).left (F.reference _ hy).right + (originalDrawValues (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y ∘ + (typedSourceEquivMatched (F.reference _ hy).left (F.reference _ hy).right p + (F.reference _ hy).natDraw (F.reference _ hy).slot_values (F.reference _ hy).root_matching).symm) + else 0 + +theorem matchedWeightedFamilyTerm_eq + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + matchedWeightedFamilyTerm F corrected mixed y=matchedOriginalPrincipalFlagTerm F corrected mixed y + (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y) + (originalDrawBulk C l p y) := by + unfold matchedWeightedFamilyTerm matchedOriginalPrincipalFlagTerm + by_cases h : F.active (originalDrawOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y) + · rw [dite_eq_left h,dite_eq_left h,F.weight_eq_guarded_principal_norm corrected mixed y h] + · rw [dite_eq_right h,dite_eq_right h] + +def matchedOuterPrincipalFlagTerm + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : ℝ := + matchedOriginalPrincipalFlagTerm F corrected mixed (restoreOriginalDraw C l p o u) o u + +def matchedOuterPrincipalFlagMean : ℝ := + ∑o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p, + outerMass C l p o * (selectedBulkPrior C l).mean (matchedOuterPrincipalFlagTerm F corrected mixed o) + +theorem matched_mean_eq_outerPrincipalFlagMean : + F.mean corrected mixed=matchedOuterPrincipalFlagMean F corrected mixed := by + calc + F.mean corrected mixed = ∑y : OriginalDraw (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p, + originalDrawMass (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y * + matchedOriginalPrincipalFlagTerm F corrected mixed y + (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y) + (originalDrawBulk C l p y) := by + apply Finset.sum_congr rfl + intro y _ + exact congrArg (fun z=>originalDrawMass (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y*z) (matchedWeightedFamilyTerm_eq F corrected mixed y) + _ = _ := by + rw [original_weighted_sum_eq_outer_mean C l p] + unfold matchedOuterPrincipalFlagMean + apply Finset.sum_congr rfl + intro o _ + congr 1 + apply congrArg (selectedBulkPrior C l).mean + funext u + rw [originalDrawOuter_restore,originalDrawBulk_restore] + rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedMetadata.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedMetadata.lean new file mode 100644 index 0000000000000000000000000000000000000000..a53122b6e3962010b92f0f83e13378e87e48d8d5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedMetadata.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyMatchedReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferencePlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBoundsBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryCompensationRepresentativePatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryGiantOriginalMeanFactorization HistorySignedXiTransport +open HistoryPairPattern HistoryGiantReferenceMean HistoryPairBulkTransport +open HistoryGiantReferenceSourceBounds HistoryBulkFibreGiantApproximationReference +attribute [local instance] Classical.propDecidable +local instance actualPrincipalMatchedMetadataInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀i,(expand p b i).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (r : Witness C outside σ a (leftBlockDraws C p b hb) (rightBlockDraws C p b hb) J w P Q i) + +theorem matchedWitnessBlockReference_rootAligned + (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + coordinateSample _ (matchedWitnessBlockReference C p b hb outside σ a J w P Q i r).right.history + (matchedWitnessBlockReference C p b hb outside σ a J w P Q i r).right.labels (.inr (.inl j))= + coordinateSample _ (matchedWitnessBlockReference C p b hb outside σ a J w P Q i r).left.history + (matchedWitnessBlockReference C p b hb outside σ a J w P Q i r).left.labels + (.inr (.inl (selectedLeafPermutation C l σ j))) := by + have hleft := coordinateSample_root_assigned C.sources _ (frequencyBound Bs BD Bz k L) l + (matchedWitnessLeftRoot C p b hb outside σ a J w P Q i r) + (blockLeftChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb i.2.1) + (fibreAssignment C a r.bulk) rfl (Template.assignedSlots_matches _ _ _) + (selectedLeafPermutation C l σ j) + have hright := coordinateSample_root_assigned C.sources _ (frequencyBound Bs BD Bz k L) l + (matchedWitnessRightRoot C p b hb outside σ a J w P Q i r) + (blockRightChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb i.2.2) + (permuteAssignment C σ (fibreAssignment C a r.bulk)) rfl + (Template.assignedSlots_matches _ _ _) j + have hperm := sourceAssignmentPermutation_val C.sources _ (selectedLeafPermutation C l σ) + (selectedLeafPermutation_source C l σ) (fibreAssignment C a r.bulk) j + exact hright.trans ((congrArg (fun n : ℕ => (n : ℤ)) hperm).trans hleft.symm) + +def matchedWitnessPrincipalData + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (leftChoices C (leftBlockDraws C p b hb) i)≠0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (rightChoices C (rightBlockDraws C p b hb) i)≠0) + (hcell : ∀v,w v≠0 → 0

simp only [MatchedBlockReference.left_root,MatchedBlockReference.right_root] <;> rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedSelectedData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedSelectedData.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4a5c921b573cb07a52e100c136eb35c0d20449f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMatchedSelectedData.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyMatchedMetadata +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyMatchedSelection + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryPairBulkTransport HistoryPairPattern +attribute [local instance] Classical.propDecidable +local instance actualPrincipalMatchedSelectedDataInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + +def blockReference : MatchedBlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p := + matchedWitnessBlockReference C p R.data.blockDraw R.data.valid outside σ (outerNonbulk C l p o) + J w P Q i R.witness + +theorem rootAligned (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + coordinateSample _ R.blockReference.right.history R.blockReference.right.labels (.inr (.inl j))= + coordinateSample _ R.blockReference.left.history R.blockReference.left.labels (.inr (.inl (selectedLeafPermutation C l σ j))) := + matchedWitnessBlockReference_rootAligned C p R.data.blockDraw R.data.valid outside σ (outerNonbulk C l p o) + J w P Q i R.witness j + +theorem giants : RootGiantsAgree R.blockReference.left.history R.blockReference.right.history := + matchedWitnessBlockReference_giants C p R.data.blockDraw R.data.valid outside σ (outerNonbulk C l p o) + J w P Q i R.witness + +def principalData + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + +structure MatchedSelectedOuter where + data : OuterData C p o + witness : Witness C outside σ (outerNonbulk C l p o) + (leftBlockDraws C p data.blockDraw data.valid) (rightBlockDraws C p data.blockDraw data.valid) + J w P Q i + +variable {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

none + | some D => (selectWitness C outside σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + J w P Q hactual hl D.nonbulk_pos D.left_mass D.right_mass houtside hw hpos i).map + (fun r=>⟨D,r⟩) + +theorem selectMatchedOuterReference_eq_map (D : OuterData C p o) (hD : outerData? C p o=some D) : + selectMatchedOuterReference C p o outside σ J w P Q i hactual hl houtside hw hpos= + (selectWitness C outside σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + J w P Q hactual hl D.nonbulk_pos D.left_mass D.right_mass houtside hw hpos i).map + (fun r=>⟨D,r⟩) := by + unfold selectMatchedOuterReference + rw [hD] + +theorem selectMatchedOuterReference_none_iff (D : OuterData C p o) (hD : outerData? C p o=some D) : + selectMatchedOuterReference C p o outside σ J w P Q i hactual hl houtside hw hpos=none ↔ + wholeMean C outside σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) J w P Q i=0 := by + rw [selectMatchedOuterReference_eq_map C p o outside σ J w P Q i hactual hl houtside hw hpos D hD, + Option.map_eq_none_iff] + exact selectWitness_none_iff C outside σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + J w P Q hactual hl D.nonbulk_pos D.left_mass D.right_mass houtside hw hpos i + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMetadata.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMetadata.lean new file mode 100644 index 0000000000000000000000000000000000000000..82a0ba1fa28bb813c9f401e961e6bd11ca281ee3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyMetadata.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferencePlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBoundsBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryCompensationRepresentativePatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryGiantOriginalMeanFactorization HistorySignedXiTransport +open HistoryPairPattern HistoryGiantReferenceMean HistoryPairBulkTransport +open HistoryGiantReferenceSourceBounds HistoryBulkFibreGiantApproximationReference +attribute [local instance] Classical.propDecidable +local instance actualPrincipalMetadataInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀i,(expand p b i).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates) + (outside : List ℕ) (a : SelectedNonbulkSample C l) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (r : Witness C outside (Equiv.refl _) a (leftBlockDraws C p b hb) (rightBlockDraws C p b hb) J w P Q i) + +theorem witnessBlockReference_rootAligned + (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + coordinateSample _ (witnessBlockReference C p b hb outside a J w P Q i r).right.history + (witnessBlockReference C p b hb outside a J w P Q i r).right.labels (.inr (.inl j))= + coordinateSample _ (witnessBlockReference C p b hb outside a J w P Q i r).left.history + (witnessBlockReference C p b hb outside a J w P Q i r).left.labels (.inr (.inl j)) := by + have hleft := coordinateSample_root_assigned C.sources _ (frequencyBound Bs BD Bz k L) l + (witnessRoot C p b hb outside a J w P Q i r) + (blockLeftChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb i.2.1) + (fibreAssignment C a r.bulk) rfl (Template.assignedSlots_matches _ _ _) j + have hright := coordinateSample_root_assigned C.sources _ (frequencyBound Bs BD Bz k L) l + (witnessRoot C p b hb outside a J w P Q i r) + (blockRightChoices C.sources _ (frequencyBound Bs BD Bz k L) l p b hb i.2.2) + (fibreAssignment C a r.bulk) rfl (Template.assignedSlots_matches _ _ _) j + exact hright.trans hleft.symm + +def witnessPrincipalData + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (leftChoices C (leftBlockDraws C p b hb) i)≠0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (rightChoices C (rightBlockDraws C p b hb) i)≠0) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + SelectedNonbulkSample C l := + fun i=>o ⟨.inr (.inl i.val),i.property⟩ + +def outerBlocks (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) := + fun q=>o ⟨.inr (.inr q),by simp only [originalIndexIsBulk,not_false_eq_true]⟩ + +def outerGiants (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : Bool → C.giant.Sample := + fun q=>o ⟨.inl q,by simp only [originalIndexIsBulk,not_false_eq_true]⟩ + +@[simp] theorem outerNonbulk_originalDrawOuter + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (i : NonbulkPosition (SelectedTemplate k L l)) : + outerNonbulk C l p (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y) i = + originalDrawAssignment C l p y i.val := rfl + +@[simp] theorem outerBlocks_originalDrawOuter + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) (q : Block p) : + outerBlocks C l p (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y) q = + y (.inr (.inr q)) := rfl + +@[simp] theorem outerGiants_originalDrawOuter + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) (q : Bool) : + outerGiants C l p (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y) q = + y (.inl q) := rfl + +theorem originalDrawAssignment_selectedSourceEquiv + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + selectedSourceEquiv C l (originalDrawAssignment C l p y) = + (outerNonbulk C l p (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y), + originalDrawBulk C l p y) := by + apply Prod.ext + · rfl + · funext u + apply Subtype.ext + rw [selectedSourceEquiv_bulk_val,originalDrawBulk_val] + rfl + +theorem originalDrawAssignment_eq_fibreAssignment + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + originalDrawAssignment C l p y = + fibreAssignment C + (outerNonbulk C l p (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y)) + (originalDrawBulk C l p y) := by + unfold fibreAssignment + rw [←originalDrawAssignment_selectedSourceEquiv C l p y,Equiv.symm_apply_apply] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackground.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackground.lean new file mode 100644 index 0000000000000000000000000000000000000000..43661f98907d154b94bcdcdcf2944173755e30ad --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackground.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkUniversalPatternAggregationBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +local instance outerBackgroundPatternsInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) + +theorem outer_jacobian_sum_eq_background_cmean + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (F : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → ℂ) : + (∑o,(outerMass C l p o:ℂ)*(∏q : Block p,((outerBlocks C l p o q).val:ℂ))*F o) = + (backgroundPrior C l).cmean (fun bg=>∑b, + (patternWeight C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + p b:ℂ)*F (restoreOuterBackground C l p bg b)) := by + simp only [mul_assoc] + rw [outer_weighted_sum_eq_background_cmean C l p] + simp only [patternWeight,Complex.ofReal_mul,Complex.ofReal_prod,Complex.ofReal_natCast, + outerBlocks_restoreOuterBackground,mul_assoc] + +theorem outer_pattern_sum_eq_background_cmean + (F : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → ℂ) : + (∑p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + ∑o,(outerMass C l p o:ℂ)*(∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + (if Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then F p o else 0)) = + (backgroundPrior C l).cmean (fun bg=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>F p (restoreOuterBackground C l p bg b))) := by + simp_rw [outer_jacobian_sum_eq_background_cmean C l] + simp only [outerBlocks_restoreOuterBackground,FinitePrior.cmean,patternComplexSum, + Finset.mul_sum] + rw [Finset.sum_comm] + rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..687d321d7aa13cc2e3c6c2d46da614484f7ea413 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +attribute [local instance] Classical.propDecidable +local instance outerBackgroundDefsInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) + +abbrev Background := (Bool→C.giant.Sample)×SelectedNonbulkSample C l + +def backgroundPrior : FinitePrior (Background C l) := + FinitePrior.pair (dependentProductPrior (fun _ : Bool=>C.giant.law)) + (selectedNonbulkPrior C l) + +variable (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + +def restoreOuterBackground (bg : Background C l) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p + | ⟨.inl q,_⟩ => bg.1 q + | ⟨.inr (.inl i),hi⟩ => bg.2 ⟨i,hi⟩ + | ⟨.inr (.inr q),_⟩ => b q + +@[simp] theorem outerGiants_restoreOuterBackground (bg : Background C l) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + outerGiants C l p (restoreOuterBackground C l p bg b)=bg.1 := rfl + +@[simp] theorem outerNonbulk_restoreOuterBackground (bg : Background C l) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + outerNonbulk C l p (restoreOuterBackground C l p bg b)=bg.2 := rfl + +@[simp] theorem outerBlocks_restoreOuterBackground (bg : Background C l) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + outerBlocks C l p (restoreOuterBackground C l p bg b)=b := rfl + +@[simp] theorem restoreOuterBackground_projections + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : + restoreOuterBackground C l p (outerGiants C l p o,outerNonbulk C l p o) + (outerBlocks C l p o)=o := by + funext i + rcases i with ⟨i,hi⟩ + rcases i with q | i | q <;> rfl + +def outerBackgroundEquiv : + OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p ≃ + Background C l × (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) where + toFun o := ((outerGiants C l p o,outerNonbulk C l p o),outerBlocks C l p o) + invFun z := restoreOuterBackground C l p z.1 z.2 + left_inv := restoreOuterBackground_projections C l p + right_inv z := by + rcases z with ⟨⟨g,a⟩,b⟩ + rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..5030677d88584e57ed7cf6312660520c4795fb71 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +attribute [local instance] Classical.propDecidable +local instance outerBackgroundMassInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + +@[simp] theorem backgroundPrior_mass (bg : Background C l) : + (backgroundPrior C l).mass bg = + (∏q : Bool,C.giant.law.mass (bg.1 q))*(selectedNonbulkPrior C l).mass bg.2 := rfl + +theorem outerMass_eq_background_mass + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + outerMass C l p o = + (backgroundPrior C l).mass (outerGiants C l p o,outerNonbulk C l p o) * + ∏q : Block p,biasedBlockWeight C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q + (outerBlocks C l p o q) := rfl + +@[simp] theorem outerMass_restoreOuterBackground (bg : Background C l) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + outerMass C l p (restoreOuterBackground C l p bg b) = + (backgroundPrior C l).mass bg * + ∏q : Block p,biasedBlockWeight C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q (b q) := rfl + +@[simp] theorem outerBackgroundEquiv_symm_apply (bg : Background C l) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + (outerBackgroundEquiv C l p).symm (bg,b)=restoreOuterBackground C l p bg b := rfl + +theorem sum_outer_eq_background_blocks {A : Type*} [AddCommMonoid A] + (F : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → A) : + (∑o,F o)=∑bg : Background C l,∑b,F (restoreOuterBackground C l p bg b) := by + simpa only [Fintype.sum_prod_type,outerBackgroundEquiv_symm_apply] using + ((outerBackgroundEquiv C l p).symm.sum_comp F).symm + +theorem outer_weighted_sum_eq_background_cmean + (F : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → ℂ) : + (∑o,(outerMass C l p o:ℂ)*F o) = + (backgroundPrior C l).cmean (fun bg=>∑b, + ((∏q : Block p,biasedBlockWeight C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q (b q)):ℂ)* + F (restoreOuterBackground C l p bg b)) := by + rw [sum_outer_eq_background_blocks C l p] + simp only [outerMass_restoreOuterBackground,FinitePrior.cmean,Complex.ofReal_mul,Complex.ofReal_prod, + Finset.mul_sum,mul_assoc] + +theorem outer_weighted_sum_eq_background_mean + (F : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → ℝ) : + (∑o,outerMass C l p o*F o) = + (backgroundPrior C l).mean (fun bg=>∑b, + (∏q : Block p,biasedBlockWeight C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q (b q))* + F (restoreOuterBackground C l p bg b)) := by + rw [sum_outer_eq_background_blocks C l p] + simp only [outerMass_restoreOuterBackground,FinitePrior.mean,Finset.mul_sum,mul_assoc] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterData.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd8f0c53424352c904036097580646d1bb85b5f9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterData.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuter +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryPairSourceLaws +attribute [local instance] Classical.propDecidable +local instance actualPrincipalOuterDataInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +structure OuterData : Type where + typed : Function.Injective (fun q=> (blockType p q,outerBlocks C l p o q)) + valid : ∀i,(outerBlocks C l p o (label p i)).val∈ + (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates + nonbulk_pos : 0 < (selectedNonbulkPrior C l).mass (outerNonbulk C l p o) + left_mass : ∀i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (leftChoices C (leftBlockDraws C p ⟨outerBlocks C l p o,typed⟩ valid) i)≠0 + right_mass : ∀i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (rightChoices C (rightBlockDraws C p ⟨outerBlocks C l p o,typed⟩ valid) i)≠0 + +namespace OuterData +variable {C p o} +def blockDraw (D : OuterData C p o) : + BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) := + ⟨outerBlocks C l p o,D.typed⟩ +@[simp] theorem blockDraw_value (D : OuterData C p o) (q : Block p) : + D.blockDraw.val q=outerBlocks C l p o q := rfl +end OuterData + +def outerData? : Option (OuterData C p o) := by + classical + exact if ht : Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then + if hv : ∀i,(outerBlocks C l p o (label p i)).val∈ + (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates then + if ha : 0 < (selectedNonbulkPrior C l).mass (outerNonbulk C l p o) then + if hc : ∀i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (leftChoices C (leftBlockDraws C p ⟨outerBlocks C l p o,ht⟩ hv) i)≠0 then + if he : ∀i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l + (rightChoices C (rightBlockDraws C p ⟨outerBlocks C l p o,ht⟩ hv) i)≠0 then + some ⟨ht,hv,ha,hc,he⟩ else none else none else none else none else none + +theorem outerData?_isSome_iff : (outerData? C p o).isSome ↔ Nonempty (OuterData C p o) := by + classical + constructor + · intro h + exact ⟨(outerData? C p o).get h⟩ + · rintro ⟨D⟩ + unfold outerData? + simp only [dite_eq_left D.typed,dite_eq_left D.valid,dite_eq_left D.nonbulk_pos, + dite_eq_left D.left_mass,dite_eq_left D.right_mass,Option.isSome_some] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterEquiv.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterEquiv.lean new file mode 100644 index 0000000000000000000000000000000000000000..47748b2890e6fa35de2fc91d6bb4383384a61476 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterEquiv.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance originalOuterFubiniInternalDecidable (template : List SourceSlot) (l : ℕ) : + DecidableEq (Internal template l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + +@[simp] theorem originalDrawOuterEquiv_symm_apply + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : + (originalDrawOuterEquiv C l p).symm (o,u)=restoreOriginalDraw C l p o u := rfl + +theorem sum_originalDraw_eq_outer_bulk {A : Type*} [AddCommMonoid A] + (F : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → A) : + (∑ y,F y)=∑ o,∑ u,F (restoreOriginalDraw C l p o u) := by + simpa only [Fintype.sum_prod_type,originalDrawOuterEquiv_symm_apply] using ((originalDrawOuterEquiv C l p).symm.sum_comp F).symm + +@[simp] theorem originalDrawMass_restore + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : + originalDrawMass (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p + (restoreOriginalDraw C l p o u)=outerMass C l p o*(selectedBulkPrior C l).mass u := by + simpa only [originalDrawOuter_restore,originalDrawBulk_restore] using + originalDrawMass_eq_outerMass_mul_bulkMass C l p (restoreOriginalDraw C l p o u) + +theorem original_weighted_sum_eq_outer_cmean + (F : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → ℂ) : + (∑ y,(originalDrawMass (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y:ℂ)*F y)= + ∑ o,(outerMass C l p o:ℂ)*(selectedBulkPrior C l).cmean + (fun u=>F (restoreOriginalDraw C l p o u)) := by + rw [sum_originalDraw_eq_outer_bulk C l p] + simp only [originalDrawMass_restore,FinitePrior.cmean,Complex.ofReal_mul, + Finset.mul_sum,mul_assoc] + +theorem original_weighted_sum_eq_outer_mean + (F : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → ℝ) : + (∑ y,originalDrawMass (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y*F y)= + ∑ o,outerMass C l p o*(selectedBulkPrior C l).mean + (fun u=>F (restoreOriginalDraw C l p o u)) := by + rw [sum_originalDraw_eq_outer_bulk C l p] + simp only [originalDrawMass_restore,FinitePrior.mean,Finset.mul_sum,mul_assoc] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8fd92949eaa701669553beb893ee03dca1265f0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuter + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance originalOuterEquivInternalDecidable (template : List SourceSlot) (l : ℕ) : + DecidableEq (Internal template l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + +def restoreOriginalDraw + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : + OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p + | .inl b => outerGiants C l p o b + | .inr (.inl i) => fibreAssignment C (outerNonbulk C l p o) u i + | .inr (.inr q) => outerBlocks C l p o q + +@[simp] theorem originalDrawAssignment_restore + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : + originalDrawAssignment C l p (restoreOriginalDraw C l p o u)= + fibreAssignment C (outerNonbulk C l p o) u := rfl + +@[simp] theorem originalDrawOuter_restore + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : + originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p + (restoreOriginalDraw C l p o u)=o := by + funext j + rcases j with ⟨j,hj⟩ + rcases j with b | i | q + · rfl + · exact fibreAssignment_nonbulk C (outerNonbulk C l p o) u ⟨i,hj⟩ + · rfl + +@[simp] theorem originalDrawBulk_restore + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : + originalDrawBulk C l p (restoreOriginalDraw C l p o u)=u := by + have h := congrArg Prod.snd + (originalDrawAssignment_selectedSourceEquiv C l p (restoreOriginalDraw C l p o u)) + rw [originalDrawAssignment_restore,fibreAssignment,Equiv.apply_symm_apply] at h + exact h.symm + +@[simp] theorem restoreOriginalDraw_projections + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + restoreOriginalDraw C l p + (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y) + (originalDrawBulk C l p y)=y := by + funext j + rcases j with b | i | q + · rfl + · exact congrFun (originalDrawAssignment_eq_fibreAssignment C l p y).symm i + · rfl + +def originalDrawOuterEquiv : + OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p ≃ + OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p × + SelectedBulkSample C l where + toFun y := (originalDrawOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y,originalDrawBulk C l p y) + invFun z := restoreOriginalDraw C l p z.1 z.2 + left_inv := restoreOriginalDraw_projections C l p + right_inv z := by + apply Prod.ext + · exact originalDrawOuter_restore C l p z.1 z.2 + · exact originalDrawBulk_restore C l p z.1 z.2 + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterMass.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..4610789407d916c3c964446f0cfc8f78d364e812 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterMass.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuter + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference +open scoped BigOperators +attribute [local instance] Classical.propDecidable +local instance actualPrincipalOuterMassInternalDecidable (template : List SourceSlot) (l : ℕ) : DecidableEq (Internal template l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) +variable (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + +def outerMass (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : ℝ := + (∏q:Bool,C.giant.law.mass (outerGiants C l p o q)) * + (selectedNonbulkPrior C l).mass (outerNonbulk C l p o) * + ∏q:Block p,biasedBlockWeight C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q (outerBlocks C l p o q) + +theorem outerMass_nonneg (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + 0 ≤ outerMass C l p o := by + unfold outerMass + apply mul_nonneg + · exact mul_nonneg (Finset.prod_nonneg (fun q _=>C.giant.law.mass_nonneg _)) + ((selectedNonbulkPrior C l).mass_nonneg _) + · exact Finset.prod_nonneg (fun q _=>HistoryPairSourceFlagReplacement.biasedBlockWeight_nonneg _ _ _ _ _) + +theorem originalDrawMass_eq_outerMass_mul_bulkMass + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + originalDrawMass (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y = + outerMass C l p (originalDrawOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y) * + (selectedBulkPrior C l).mass (originalDrawBulk C l p y) := by + rw [originalDrawMass,mixed_weight_product] + have hm := congrArg (fun x=>(assignmentPrior C.sources (SelectedTemplate k L l)).mass x) + (originalDrawAssignment_eq_fibreAssignment C l p y) + rw [fibreAssignment_mass] at hm + change (∏q:Bool,C.giant.law.mass (y (.inl q))) * + ((assignmentPrior C.sources (SelectedTemplate k L l)).mass (originalDrawAssignment C l p y) * + ∏q:Block p,biasedBlockWeight C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q (y (.inr (.inr q)))) = _ + rw [hm] + simp only [outerMass,outerGiants_originalDrawOuter,outerBlocks_originalDrawOuter] + ring + +theorem originalDrawMass_ne_zero_iff + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : + originalDrawMass (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p y≠0 ↔ + outerMass C l p (originalDrawOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y)≠0 ∧ + (selectedBulkPrior C l).mass (originalDrawBulk C l p y)≠0 := by + rw [originalDrawMass_eq_outerMass_mul_bulkMass,mul_ne_zero_iff] + +theorem outerMass_ne_zero_nonbulk + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (ho : outerMass C l p o≠0) : + (selectedNonbulkPrior C l).mass (outerNonbulk C l p o)≠0 := + (mul_ne_zero_iff.mp (mul_ne_zero_iff.mp ho).1).2 + +theorem outerMass_ne_zero_block + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (ho : outerMass C l p o≠0) (q : Block p) : + biasedBlockWeight C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + p q (outerBlocks C l p o q)≠0 := + (Finset.prod_ne_zero_iff.mp (mul_ne_zero_iff.mp ho).2) q (Finset.mem_univ q) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..f23800f1f07b04a4f7be86cfdb74a3767781d27d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyOuterSupport.lean @@ -0,0 +1,85 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairSourceLawsSupportBasic +import OAI.NumberTheory.Ostmann.Construction.CanonicalHistoryProductChoicesMass + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryPairSourceLaws HistoryCompensationRepresentativePatterns +attribute [local instance] Classical.propDecidable +local instance actualPrincipalOuterSupportInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +theorem outerMass_sourceWeight_ne_zero (ho : outerMass C l p o ≠ 0) + (i : Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) : + sourceWeight C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + i (outerBlocks C l p o (label p i)) ≠ 0 := + biasedBlockWeight_source_nonzero C.sources _ p (label p i) _ + (outerMass_ne_zero_block C l p o ho (label p i)) ⟨i,rfl⟩ + +theorem outerMass_valid (ho : outerMass C l p o ≠ 0) : + ∀ i, (outerBlocks C l p o (label p i)).val ∈ + (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates := by + intro i + have hi := outerMass_sourceWeight_ne_zero C p o ho i + unfold sourceWeight at hi + split_ifs at hi with hm + · exact hm + · exact (hi rfl).elim + +theorem outerData_nonempty_of_mass (ho : outerMass C l p o ≠ 0) + (ht : Function.Injective (fun q=> (blockType p q,outerBlocks C l p o q))) : + Nonempty (OuterData C p o) := by + let hv := outerMass_valid C p o ho + have ha : 0 < (selectedNonbulkPrior C l).mass (outerNonbulk C l p o) := + lt_of_le_of_ne ((selectedNonbulkPrior C l).mass_nonneg _) (Ne.symm (outerMass_ne_zero_nonbulk C l p o ho)) + have hm : ∀ i, (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).law.mass + ⟨(outerBlocks C l p o (label p i)).val,hv i⟩ ≠ 0 := by + intro i + have hi := outerMass_sourceWeight_ne_zero C p o ho i + simpa only [sourceWeight,dite_eq_left (hv i)] using hi + refine ⟨⟨ht,hv,ha,?_,?_⟩⟩ + · intro i + rw [leftChoices,choicesMass_assemble] + change (∏ j : Internal (Template.initial (2*(bulkSize k L/2)) k) l, + (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l (Sum.inl j))).law.mass + ⟨(outerBlocks C l p o (label p (Sum.inl j))).val,hv (Sum.inl j)⟩) ≠ 0 + exact Finset.prod_ne_zero_iff.mpr (fun j _=>hm (Sum.inl j)) + · intro i + rw [rightChoices,choicesMass_assemble] + change (∏ j : Internal (Template.initial (2*(bulkSize k L/2)) k) l, + (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l (Sum.inr j))).law.mass + ⟨(outerBlocks C l p o (label p (Sum.inr j))).val,hv (Sum.inr j)⟩) ≠ 0 + exact Finset.prod_ne_zero_iff.mpr (fun j _=>hm (Sum.inr j)) + +theorem outerData?_isSome_of_mass (ho : outerMass C l p o ≠ 0) + (ht : Function.Injective (fun q=> (blockType p q,outerBlocks C l p o q))) : + (outerData? C p o).isSome := + (outerData?_isSome_iff C p o).mpr (outerData_nonempty_of_mass C p o ho ht) + +theorem outerMass_eq_zero_of_outerData_none + (ht : Function.Injective (fun q=> (blockType p q,outerBlocks C l p o q))) + (hn : outerData? C p o = none) : outerMass C l p o = 0 := by + by_contra ho + have hp := outerData?_isSome_of_mass C p o ho ht + rw [hn] at hp + contradiction + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..48c4e1c6c6846e2409d21781b5f2ab25a2b5c497 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalBlockFamilyReference.lean @@ -0,0 +1,73 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferencePermutation +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagPrincipal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryCompensationRepresentativePatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryGiantOriginalMeanFactorization HistorySignedXiTransport +open HistoryPairPattern HistoryGiantReferenceMean +attribute [local instance] Classical.propDecidable +local instance actualPrincipalReferenceInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀i,(expand p b i).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l i)).candidates) + +abbrev leftBlockDraws : Draws C (l:=l) := + fun i=>blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hb (.inl i) +abbrev rightBlockDraws : Draws C (l:=l) := + fun i=>blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hb (.inr i) + +variable (outside : List ℕ) (a : SelectedNonbulkSample C l) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (r : Witness C outside (Equiv.refl _) a (leftBlockDraws C p b hb) (rightBlockDraws C p b hb) J w P Q i) + +def witnessRoot : State := + giantState (sourceState C.sources _ (fibreAssignment C a r.bulk) i.1.val) (P r.giant) (Q r.giant) + +def witnessBlockReference : + BlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p where + blockDraw := b + valid := hb + leftRoot := witnessRoot C p b hb outside a J w P Q i r + rightRoot := witnessRoot C p b hb outside a J w P Q i r + leftFrequency := i.2.1 + rightFrequency := i.2.2 + leftMatch := Template.assignedSlots_matches C.sources _ (fibreAssignment C a r.bulk) + rightMatch := Template.assignedSlots_matches C.sources _ (fibreAssignment C a r.bulk) + leftSupported := r.supported.1 + rightSupported := by + have h := r.supported.2 + simp only [permute_fibreAssignment,Equiv.refl_apply] at h + exact h + rootPerm := List.Perm.refl _ + +@[simp] theorem witnessBlockReference_left_frequency : + (witnessBlockReference C p b hb outside a J w P Q i r).leftRoot.frequency=i.1.val := rfl +@[simp] theorem witnessBlockReference_right_frequency : + (witnessBlockReference C p b hb outside a J w P Q i r).rightRoot.frequency=i.1.val := rfl + +theorem witnessBlockReference_giants : + RootGiantsAgree (witnessBlockReference C p b hb outside a J w P Q i r).left.history + (witnessBlockReference C p b hb outside a J w P Q i r).right.history := by + constructor <;> simp only [BlockReference.left_root,BlockReference.right_root] <;> rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionBackground.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionBackground.lean new file mode 100644 index 0000000000000000000000000000000000000000..b37219a31979fecffa7554c5e8730584eb5cced6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionBackground.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNumerics +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorActualDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorScaled + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns Filter +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkActualPrincipalBlockFamily +open HistoryBulkPrincipalCollisionError HistoryBulkActualRootReferenceFamily +local instance collisionBackgroundInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def backgroundCollisionMean (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (refs : (bg : Background C l) → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + ∀p:Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → + Option (PrincipalCollisionReference C outside bg.2 p)) + (mask : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ∀p:Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → ℝ) + (corrected mixed guarded : Bool) : ℂ := + (backgroundPrior C l).cmean (fun bg=>∑i, + collisionPrincipalMean C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside bg.2 (refs bg i) (mask bg i) corrected mixed guarded) + +def backgroundErrorProperty (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) (L : ℝ) : Prop := + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) simp only [Bool.false_eq_true,ite_false,ite_true] at hl <;> omega + have hbound : ‖backgroundCollisionMean (l:=l) C outside refs mask corrected mixed true- + backgroundCollisionMean (l:=l) C outside refs mask corrected mixed false‖≤ + (Fintype.card (Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)):ℝ)* + Real.exp (-Real.exp ((1/500:ℝ)*L)) := by + unfold backgroundCollisionMean + rw [GiantCollisionError.cmean_sub_eq] + apply GiantCollisionError.norm_cmean_le_of_mass_ne_zero + intro bg hbg + have ha : (selectedNonbulkPrior C l).mass bg.2≠0 := by + rw [backgroundPrior_mass] at hbg + exact (mul_ne_zero_iff.mp hbg).2 + rw [←Finset.sum_sub_distrib] + refine (norm_sum_le _ _).trans ?_ + calc + _ ≤ ∑_i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + Real.exp (-Real.exp ((1/500:ℝ)*L)) := by + apply Finset.sum_le_sum + intro i _ + have hh := he E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl + outside hlen hout bg.2 ha (refs bg i) (mask bg i) (hm bg i) + simpa only [zero_mul,Real.exp_zero,mul_one] using hh + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + exact ⟨hbound.trans (hn l hl').1,hbound.trans (hn l hl').2⟩ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackground.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackground.lean new file mode 100644 index 0000000000000000000000000000000000000000..d56657066e68009f4ad6082dc8a0ec16512d5a00 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackground.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundBound +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundCanonicalFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundFinalProperty + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkActualPrincipalCollision +open HistoryBulkActualIntegralReplacement + +private theorem correctedCollisionProof + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop, correctedCollisionErrorProperty d Bs BD Bz H k L := + @Filter.Eventually.mono ℝ + (correctedBackgroundErrorProperty d Bs BD Bz H k) + (correctedCollisionErrorProperty d Bs BD Bz H k) atTop + (selected_corrected_background_error_eventually d Bs BD Bz H (k:=k) hBs hH hk) + (fun L hL E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl e he hV=> + correctedCollisionPrincipal_error_le + (ε := Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (θ := Real.exp (-H*(bulkSize k L:ℝ))) + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator ds hl e he hV + (hL E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl e he hV)) + +theorem selected_corrected_collision_error_eventually + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop, correctedCollisionErrorProperty d Bs BD Bz H k L := + correctedCollisionProof d Bs BD Bz H (k:=k) hBs hH hk + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..96d1c3522f570829b509cc9de82c8741b8af3946 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundBound.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundProperty +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMaskBound + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualRootReferenceFamily HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualPrincipalCollision + +theorem selected_corrected_background_error_eventually + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop, correctedBackgroundErrorProperty d Bs BD Bz H k L := + @Filter.Eventually.mono ℝ + (backgroundErrorProperty d Bs BD Bz H k) + (correctedBackgroundErrorProperty d Bs BD Bz H k) atTop + (selected_background_collision_error_eventually d Bs BD Bz H (k:=k) hBs hH hk) + (fun L hL E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl e he hV=> + selectedBackgroundMean_error_le + (ε := Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (θ := Real.exp (-H*(bulkSize k L:ℝ))) (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C (spectatorList spectator ds) e he List.length_ofFn + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) hV + (hL E C hG hGu hcl hcu hb hd spectator hspec l true true hl + (spectatorList spectator ds) (spectatorList_length_le (n:=bulkSize k L) spectator ds) + (spectatorList_source_mass spectator ds hds) + (selectedCollisionReferences (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C (spectatorList spectator ds) e he List.length_ofFn + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) hV) + (fun bg i=>selectedCollisionMask (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) bg i true) + (fun bg i u p b=>selectedCollisionMask_mem (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) bg i true u p b))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundCanonicalFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundCanonicalFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..8352f82229ee83b2373c6bfebeb7961d10d6d7fc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundCanonicalFinite.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundIdentity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSpectatorDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainSupport + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkActualPrincipalCollision +open HistoryBulkActualIntegralReplacement +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem correctedCollisionPrincipal_error_le + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) (hl : lselectedCollisionMask C outside e he hp bg i true) true true guarded := by + exact Eq.trans (Eq.refl _) (Eq.refl _) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundFinalProperty.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundFinalProperty.lean new file mode 100644 index 0000000000000000000000000000000000000000..881f44571a414cf67fe4d907cef31f4276142f6e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundFinalProperty.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundProperty + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualRootReferenceFamily HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualPrincipalCollision +open HistoryBulkActualIntegralReplacement + +def correctedCollisionErrorProperty (d : Decomposition) (Bs BD Bz H : ℝ) + (k : ℕ) (L : ℝ) : Prop := + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ)selectedCollisionMask C outside e he hp bg i true) true true true- + backgroundCollisionMean C outside + (selectedCollisionReferences C outside e he hlen hp hV) + (fun bg i=>selectedCollisionMask C outside e he hp bg i true) true true false‖≤ε ∧ + ‖backgroundCollisionMean C outside + (selectedCollisionReferences C outside e he hlen hp hV) + (fun bg i=>selectedCollisionMask C outside e he hp bg i true) true true true- + backgroundCollisionMean C outside + (selectedCollisionReferences C outside e he hlen hp hV) + (fun bg i=>selectedCollisionMask C outside e he hp bg i true) true true false‖≤θ) : + ‖selectedBackgroundMean C outside e he hlen hp hV true- + selectedBackgroundMean C outside e he hlen hp hV false‖≤ε ∧ + ‖selectedBackgroundMean C outside e he hlen hp hV true- + selectedBackgroundMean C outside e he hlen hp hV false‖≤θ := + error_bounds_of_eq + (selectedBackgroundMean_eq C outside e he hlen hp hV true) + (selectedBackgroundMean_eq C outside e he hlen hp hV false) h + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundIdentity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf7e534f53fe50ad37acdc512a5e290f5fb0bc7f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundIdentity.lean @@ -0,0 +1,36 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedFalse + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +attribute [local instance] Classical.propDecidable +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkIndependentFibreReference HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualIntegralReplacement HistoryBulkPatternIntegralReplacement +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem selectedBackgroundMean_false_eq_correctedBulkPrincipal + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) (hl : l + selectedCollisionMean_false_eq_pattern (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C (spectatorList spectator ds) e he List.length_ofFn + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) hV bg true true) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundProperty.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundProperty.lean new file mode 100644 index 0000000000000000000000000000000000000000..160b4a333c8c22776bb7e10dd7b9620440799fad --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBackgroundProperty.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSpectatorDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualRootReferenceFamily HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualPrincipalCollision + +def correctedBackgroundErrorProperty (d : Decomposition) (Bs BD Bz H : ℝ) + (k : ℕ) (L : ℝ) : Prop := + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) + selectedCollisionMean C outside e he hlen hp hV bg true true guarded) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..bba6eff7177df0cf3e74853de63b3f5565387bbe --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedBasic.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalValueFrameMatchedCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationCollisionGuard + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +open HistoryBulkFibreGiantApproximation HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreSourceMean +open HistoryBulkPrincipalCollisionError HistoryBulkActualPrincipalValueFrame +open HistoryBulkActualPrincipalValueFrameMatched HistoryBulkFibreOriginalReference +open HistoryBulkReferencePeriodicMeanSource HistorySignedResidueFactorization +attribute [local instance] Classical.propDecidable +local instance correctedCollisionInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j (P.amplitude u).residue + +@[simp] theorem fromMatchedData_amplitudeAt (u : SelectedBulkSample C l) : + (fromMatchedData P a u₀ hsmall).amplitudeAt u=P.amplitude u := rfl + +theorem fromMatchedData_value (corrected mixed : Bool) (u : SelectedBulkSample C l) : + (fromMatchedData P a u₀ hsmall).value corrected mixed u=P.value corrected mixed u := rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalse.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfaab4c516c90722f673015fab3583f41c10cca8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalse.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedFalseBlock +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedPattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexPatterns + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkActualPrincipalCollision HistoryBulkIndependentFibreReference +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable actualGoodCorrectedFamilyInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jHistoryBulkPatternIntegralReplacement.familyValue (C:=C) (outside:=outside) (l:=l) (p:=p) false + (correctedFamily (l:=l) C p (restoreOuterBackground C l p bg b) outside e he hp) b corrected mixed hV) := + @Eq.trans ℂ _ _ _ + (@selectedCollisionMean_eq_pattern d Bs BD Bz L k l E C outside e he hlen hp hV bg corrected mixed false) + (patternComplexSum_congr_pointwise + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) _ _ + (fun p b=>@selectedCollisionBlockValue_false_eq_family d Bs BD Bz L k l E C outside e he hlen hp hV bg corrected mixed p b)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalseBlock.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalseBlock.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cb67d7579b8f6c3a7a42b201bd4aa7ae46b264f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalseBlock.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedFalseGlueSum +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedKernel +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexPatterns + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkActualPrincipalCollision HistoryBulkIndependentFibreReference +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable actualGoodCorrectedFamilyInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +theorem correctedFamily_false_eq_sum + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (R.rawReference he hprime).weight b mixed * + (rootDensity (C:=C) (l:=l) (R.frame he hprime) mixed * + bulkMean (C:=C) (l:=l) (R.frame he hprime) corrected mixed + (outerNonbulk C l p o) R.permutation hV)) := by + unfold HistoryBulkPatternIntegralReplacement.familyValue correctedFamily + rw [sum_extendCommonRootOption] + apply Finset.sum_congr rfl + intro i _ + unfold correctedRootFamily + cases hr : selectCorrectedOuterReference C p o outside e i <;> rfl + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalseGlueSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalseGlueSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..aec2f3b19678560afc1afeb076a8a2f4bb48d73f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedFalseGlueSum.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedFalseFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedKernel +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedOptionFalse +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexPatterns + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkActualPrincipalCollision HistoryBulkIndependentFibreReference +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable actualGoodCorrectedFamilyInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (R.rawReference he hp).weight b mixed * + (rootDensity (C:=C) (l:=l) (R.frame he hp) mixed * + bulkMean (C:=C) (l:=l) (R.frame he hp) corrected mixed + (outerNonbulk C l p (restoreOuterBackground C l p bg b)) R.permutation hV)) := + Finset.sum_congr rfl (fun i _=> + @correctedOption_false d Bs BD Bz L k l E C p + (restoreOuterBackground C l p bg b) outside e i he hlen hp hV + (selectCorrectedOuterReference (l:=l) C p (restoreOuterBackground C l p bg b) outside e i) + b corrected mixed) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedGuard.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedGuard.lean new file mode 100644 index 0000000000000000000000000000000000000000..6e0b7c5c6b552907abff969ff2141a69392e2986 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedGuard.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +open HistoryBulkFibreGiantApproximation HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreSourceMean +open HistoryBulkPrincipalCollisionError HistoryBulkActualPrincipalValueFrame +open HistoryBulkActualPrincipalValueFrameMatched HistoryBulkFibreOriginalReference +open HistoryBulkReferencePeriodicMeanSource HistorySignedResidueFactorization +attribute [local instance] Classical.propDecidable +local instance correctedCollisionGuardInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (R.collisionReference he hlen hp hV).value corrected mixed u) = + bulkMean (R.frame he hp) corrected mixed (outerNonbulk C l p o) R.permutation hV := + congrArg (selectedBulkPrior C l).cmean (funext + (R.collisionReference_value_eq_frame he hlen hp hV corrected mixed)) + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedKernel.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..6bc45d9de4c3c519cf498e3934a2a76c7f9eef7b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedKernel.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedHistories +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedIntegral +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedKernelBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +open HistoryBulkFibreGiantApproximation HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreSourceMean +open HistoryBulkPrincipalCollisionError HistoryBulkActualPrincipalValueFrame +open HistoryBulkActualPrincipalValueFrameMatched HistoryBulkFibreOriginalReference +open HistoryBulkReferencePeriodicMeanSource HistorySignedResidueFactorization +open HistoryBulkActualPrincipalCollision +attribute [local instance] Classical.propDecidable +local instance correctedCollisionWeightedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (density (C:=C) (l:=l) (R.frame he hp) mixed:ℂ) * + (R.collisionReference he hlen hp hV).value corrected mixed u) = + (R.rawReference he hp).weight b mixed * + (rootDensity (C:=C) (l:=l) (R.frame he hp) mixed * + bulkMean (C:=C) (l:=l) (R.frame he hp) corrected mixed (outerNonbulk C l p o) R.permutation hV) := by + rw [FinitePrior.cmean_mul_left, collisionReference_cmean_eq_frame, density_cast, + collisionReference_kernel_eq_weight] + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedKernelBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedKernelBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..111943651439ff6846c169f83f42658e141868aa --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedKernelBasic.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedHistories +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedIntegral +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +open HistoryBulkFibreGiantApproximation HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreSourceMean +open HistoryBulkPrincipalCollisionError HistoryBulkActualPrincipalValueFrame +open HistoryBulkActualPrincipalValueFrameMatched HistoryBulkFibreOriginalReference +open HistoryBulkReferencePeriodicMeanSource HistorySignedResidueFactorization +open HistoryBulkActualPrincipalCollision +attribute [local instance] Classical.propDecidable +local instance correctedCollisionKernelInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jF b (o.elim 0 w))= + o.elim 0 (fun a=>F (f a) (w a)) := by + cases o <;> rfl + +theorem option_map_elim_weight_congr {α β : Type*} + (o : Option α) (f : α → β) (w : α → ℝ) (F : β → ℝ → ℂ) + (G : α → ℂ) (h : ∀a, F (f a) (w a)=G a) : + (o.map f).elim 0 (fun b=>F b (o.elim 0 w))=o.elim 0 G := by + cases o with + | none => rfl + | some a => exact h a + +theorem option_kernel_mean_false {α β Ω : Type*} + (M : (Ω → ℂ) → ℂ) (o : Option α) (f : α → β) + (w : α → ℝ) (K : β → ℂ) (value : β → Ω → ℂ) + (pred : Ω → Prop) [DecidablePred pred] (G : α → ℂ) + (h : ∀a, K (f a) * M (fun u=>(w a:ℂ)*value (f a) u)=G a) : + (o.map f).elim 0 (fun b=>K b*M (fun u=>((o.elim 0 w:ℝ):ℂ)* + (if false ∧ pred u then 0 else value b u))) = o.elim 0 G := by + cases o with + | none => rfl + | some a => + simpa only [Option.map_some, Option.elim_some, Bool.false_eq_true, + false_and, ite_false] using h a + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedOptionFalse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedOptionFalse.lean new file mode 100644 index 0000000000000000000000000000000000000000..d607d9387d8dd6efcc486f0028bd8860e32d27e1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedOptionFalse.lean @@ -0,0 +1,77 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedKernel +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedOption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +open HistoryBulkFibreGiantApproximation HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreSourceMean +open HistoryBulkPrincipalCollisionError HistoryBulkActualPrincipalValueFrame +open HistoryBulkActualPrincipalValueFrameMatched HistoryBulkFibreOriginalReference +open HistoryBulkActualPrincipalCollision +attribute [local instance] Classical.propDecidable actualGoodCorrectedFamilyInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ)(e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jreference.collisionReference he hlen hp hV)).elim 0 + (fun reference=>referenceKernel (l:=l) + (ι := Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p o) reference b mixed * + (selectedBulkPrior C l).cmean (fun sample=> + ((O.elim 0 (fun selected=>density (C:=C) (l:=l) (selected.frame he hp) mixed):ℝ):ℂ) * + (if false ∧ ¬fibreSmallOutsideGuard C outside (outerNonbulk C l p o) sample + then 0 else reference.value corrected mixed sample))) = + O.elim 0 (fun reference=>(reference.rawReference he hp).weight b mixed * + (rootDensity (C:=C) (l:=l) (reference.frame he hp) mixed * + bulkMean (C:=C) (l:=l) (reference.frame he hp) corrected mixed + (outerNonbulk C l p o) reference.permutation hV)) := + option_kernel_mean_false + (α := CorrectedSelectedOuter C p o outside e i) + (β := PrincipalCollisionReference (l:=l) + (ι := Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) C outside (outerNonbulk C l p o) p) + (Ω := SelectedBulkSample C l) + (selectedBulkPrior C l).cmean O + (fun R=>R.collisionReference he hlen hp hV) + (fun R=>density (C:=C) (l:=l) (R.frame he hp) mixed) + (fun r=>referenceKernel (l:=l) + (ι := Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p o) r b mixed) + (fun r u=>r.value corrected mixed u) + (fun u=>¬fibreSmallOutsideGuard C outside (outerNonbulk C l p o) u) + (fun R=>(R.rawReference he hp).weight b mixed * + (rootDensity (C:=C) (l:=l) (R.frame he hp) mixed * + bulkMean (C:=C) (l:=l) (R.frame he hp) corrected mixed + (outerNonbulk C l p o) R.permutation hV)) + (fun R=>R.collisionReference_weighted_cmean he hlen hp hV b corrected mixed) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c6d208362963f0dfd28b4bae028aff2d193f3fe --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMask +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedReferences +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSumDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkActualPrincipalCollision HistoryBulkIndependentFibreReference +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance correctedCollisionSelectedFormInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedCollisionReferences (l:=l) C outside e he hlen hp hV bg i) + (fun i=>selectedCollisionMask (l:=l) C outside e he hp bg i mixed) + corrected mixed guarded + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..17debf350104aae9a140c5c2be0c0c397ca933a5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedDefs.lean @@ -0,0 +1,35 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMaskBound +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedReferences +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSum + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +local instance correctedSelectedCollisionDefsInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jdensity (R.frame he hp) mixed) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMaskBound.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMaskBound.lean new file mode 100644 index 0000000000000000000000000000000000000000..e57a438a38c20a90481ab33558a9448cb4acdb14 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMaskBound.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMask + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +local instance correctedSelectedCollisionMaskBoundInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j exact ⟨le_rfl,zero_le_one⟩ + | some R => exact density_mem (R.frame he hp) mixed + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..bb67fd0b99e540ea429380482b1ee633c6c22ec9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMask +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedReferences +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSumDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedCollisionReferences + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hlen hp hV bg i) + (fun i=>selectedCollisionMask + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hp bg i mixed) + corrected mixed guarded + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..32c2e8e44c76a92426c33ef45c50cf59f3fd2996 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanPattern.lean @@ -0,0 +1,81 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSum +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSumDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkUniversalPatternAggregationBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference HistoryBulkUniversalPatternAggregation +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedCollisionReferences + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hlen hp hV bg i p b) + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (u : SelectedBulkSample C l) (p : Pattern (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) (b : Block p → CommonSample (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))=>selectedCollisionMask + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hp bg i mixed u p b) + corrected mixed guarded + +theorem selectedCollisionMean_eq_blockPattern : + selectedCollisionMean + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hlen hp hV bg corrected mixed guarded = + patternComplexSum + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (selectedCollisionBlockValue + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hlen hp hV bg corrected mixed guarded) := + selectedMeanPatternProof + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hlen hp hV bg corrected mixed guarded + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedNormalForm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedNormalForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..6d9f21f8a2e86ff273d8d71ea74debc2b01b42a5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedNormalForm.lean @@ -0,0 +1,14 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexPatterns + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce2a82ad372410216b6e218047c8f6d54bde3c57 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedPattern.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedOption +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedBlockDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSelectedNormalForm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkActualPrincipalCollision HistoryBulkIndependentFibreReference +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable correctedSelectedCollisionDefsInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedCollisionReferences (l:=l) C outside e he hlen hp hV bg i) + (fun i=>selectedCollisionMask (l:=l) C outside e he hp bg i mixed) + corrected mixed guarded + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedReferences.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedReferences.lean new file mode 100644 index 0000000000000000000000000000000000000000..ccd24b91d0245197bac283178ed6f61135847940 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSelectedReferences.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorActualDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +local instance correctedSelectedCollisionInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jR.collisionReference he hlen hp hV) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSpectatorDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSpectatorDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..ace424e1688a99a8848cd391987b9a4e02c8e849 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedSpectatorDefs.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBackgroundScalarDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkIndependentFibreReference HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualPrincipalCollision +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def correctedCollisionPrincipal + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) (he : PreservesRemainingBands _ e) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jreferenceKernel C origin τ outside a r b mixed * + (selectedBulkPrior C l).cmean (fun u=>(mask i u p b:ℂ)* + (if guarded ∧ ¬fibreSmallOutsideGuard C outside a u then 0 else + r.value corrected mixed u))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedValue.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4ea5ed51f7d95fa82774544465b25302b1fde7d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionCorrectedValue.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryPairPattern HistoryDiagonalRemainingRootMatching +open HistoryBulkFibreGiantApproximation HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreSourceMean +open HistoryBulkPrincipalCollisionError HistoryBulkActualPrincipalValueFrame +open HistoryBulkActualPrincipalValueFrameMatched HistoryBulkFibreOriginalReference +open HistoryBulkReferencePeriodicMeanSource HistorySignedResidueFactorization +attribute [local instance] Classical.propDecidable +local instance correctedCollisionValueInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j Frame.extractedDensity (C:=C) (R.frame he hp).leftSource * z) + (R.collisionReference_value_eq_frame he hlen hp hV true true u) + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalse.lean new file mode 100644 index 0000000000000000000000000000000000000000..28962acb036f7d82b810a419549804c335e33821 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalse.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseCollision +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseFamily + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable collisionSelectedFormInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

funext (h p)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseCollision.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseCollision.lean new file mode 100644 index 0000000000000000000000000000000000000000..4717f81319d025d2f122c09d85066a3173a6a934 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseCollision.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseTerm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedNormalForm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable collisionSelectedFormInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

rfl + | some R => + simp only [Option.elim_some] + have hterm := R.collisionReference_weighted_cmean_eq_normal (l:=l) hcell hlen hp hV corrected mixed b + simpa only [outerNonbulk_restoreOuterBackground] using hterm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..7de1d6940b7d717ed3ada396f23486f7bbbc0e23 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseDefs.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrameWeighted + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreIntegralReplacementFrame +open HistoryPairKernelReplacement +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalBlockFamily.actualGoodPrincipalReferenceInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ rootDensity (R.frame hcell hprime) mixed * + ((∏q : Block p,symbolicKernel mixed (R.frame hcell hprime).left (R.frame hcell hprime).right + (R.frame hcell hprime).left_supported (R.frame hcell hprime).right_supported + (R.representative hcell hprime q) (b q).val : ℝ):ℂ) * + bulkMean (R.frame hcell hprime) corrected mixed (outerNonbulk C l p o) σ hV) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseFamily.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..0699cb7d763d82dc25826c396b38034bb485c5a0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseFamily.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkPrincipalSourceReindex +open HistoryPairKernelReplacement HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualGoodPrincipal.actualGoodPatternInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

rfl + | some R => + simp only [Option.map_some,Option.elim_some,HistoryBulkPatternIntegralReplacement.Reference.weight, + one_mul,Bool.false_eq_true,ite_false] + exact (mul_left_comm _ _ _).trans (mul_assoc _ _ _).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..c0ceb0acebf4863b481abc43478eb528c525d62a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseMean.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalse +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedPattern + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable collisionSelectedPatternInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

HistoryBulkPatternIntegralReplacement.familyValue + (C:=C) (outside:=outside) (l:=l) (p:=p) false + (selectedPatternFamily (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (α:=α) (spectator:=spectator) C p (restoreOuterBackground C l p bg b) outside σ J w P Q + hactual hl houtside hw hpos hcell hp) b corrected mixed hV) := + @Eq.trans ℂ _ _ _ + (@selectedCollisionMean_eq_pattern d Bs BD Bz L k l E C outside σ J α + (inferInstance : Fintype α) w P Q spectator hactual hl houtside hw hpos + hcell hlen hp hV bg corrected mixed false) + (patternComplexSum_congr_pointwise (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) _ _ + (fun p b=>@selectedCollisionBlockValue_false_eq_family d Bs BD Bz L k l E C outside σ J + α (inferInstance : Fintype α) w P Q spectator hactual hl houtside hw hpos + hcell hlen hp hV bg corrected mixed p b)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseTerm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseTerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..98de95b2b7387c5316e8ac4ed59e916557e45ae0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionFalseTerm.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionIntegral +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalCollisionError HistoryBulkFibreIntegralReplacementFrame +open HistoryBulkActualPrincipalCollision HistoryBulkActualGoodPrincipal HistoryPairKernelReplacement +open HistoryBulkActualPrincipalValueFrameMatched +attribute [local instance] Classical.propDecidable +attribute [local instance] actualCollisionIntegralInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

(density (R.frame hcell hp) mixed : ℂ) * + (R.collisionReference hcell hlen hp hV).value corrected mixed u) = + rootDensity (R.frame hcell hp) mixed * + ((∏q : Block p,HistoryPairKernelReplacement.symbolicKernel (l:=l) mixed + (R.frame hcell hp).left (R.frame hcell hp).right + (R.frame hcell hp).left_supported (R.frame hcell hp).right_supported + (R.representative hcell hp q) (b q).val : ℝ):ℂ) * + bulkMean (R.frame hcell hp) corrected mixed (outerNonbulk C l p o) σ hV := by + rw [FinitePrior.cmean_mul_left,density_cast, + R.collisionReference_cmean_eq_frame hcell hlen hp hV corrected mixed] + unfold referenceKernel + rw [←mul_assoc] + congr 1 + exact mul_comm _ _ +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionGuardAlgebra.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionGuardAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..0357e688eb786791f1c218986b299a9e44ee6099 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionGuardAlgebra.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationCollisionGuard + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkReferencePeriodicMeanSource HistoryBulkPrincipalCollisionError +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference HistorySignedResidueFactorization +attribute [local instance] Classical.propDecidable + +private theorem guard_product_reorder (g : Prop) (D z K : ℂ) : + guardIndicator g * (D * (z*K))=K*(D*(if ¬g then 0 else z)) := by + by_cases hg : g + · simp only [guardIndicator,hg,not_true_eq_false,ite_true,ite_false,one_mul] + exact (mul_assoc D z K).symm.trans (mul_comm (D*z) K) + · simp only [guardIndicator,hg,not_false_eq_true,ite_true,ite_false,zero_mul,mul_zero] + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +theorem Frame.plain_guard_density_product (r : Frame (l:=l) C outside) + (σ : Equiv.Perm (Frame.Slots (depth:=k) (L:=L) (l:=l))) + (a : SelectedNonbulkSample C l) (u : SelectedBulkSample C l) + (mixed : Bool) (z K : ℂ) : + staticPairMask (r.newLeft (fibreAssignment C a u)) + (r.newRight (permuteAssignment C σ (fibreAssignment C a u))) outside * + (rootDensity r mixed * (z*K))= + K*((density r mixed:ℂ)*(if ¬fibreSmallOutsideGuard C outside a u then 0 else z)) := by + rw [r.plain_staticPairMask_eq_fibreSmallOutsideGuard σ a u,density_cast] + exact guard_product_reorder (fibreSmallOutsideGuard C outside a u) (rootDensity r mixed) z K + +theorem Frame.corrected_guard_density_product (r : Frame (l:=l) C outside) + (a : SelectedNonbulkSample C l) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (u : SelectedBulkSample C l) + (hc : Compatible C a e u) (mixed : Bool) (z K : ℂ) : + staticPairMask (r.newLeft (fibreAssignment C a u)) + (r.newRight (rightAssignment C a e u hc)) outside * + (rootDensity r mixed * (z*K))= + K*((density r mixed:ℂ)*(if ¬fibreSmallOutsideGuard C outside a u then 0 else z)) := by + rw [r.corrected_staticPairMask_eq_fibreSmallOutsideGuard a e he u hc,density_cast] + exact guard_product_reorder (fibreSmallOutsideGuard C outside a u) (rootDensity r mixed) z K + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionIntegral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..314d0d5469f85d79e4041ea816a7abcfe744f953 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionIntegral.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalCollisionError HistoryBulkFibreIntegralReplacementFrame +open HistoryBulkActualPrincipalCollision HistoryBulkActualGoodPrincipal HistoryPairKernelReplacement +open HistoryBulkActualPrincipalValueFrameMatched +attribute [local instance] Classical.propDecidable +local instance actualCollisionIntegralInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

+ (R.collisionReference hcell hlen hp hV).value corrected mixed u) = + bulkMean (R.frame hcell hp) corrected mixed (outerNonbulk C l p o) σ hV := + congrArg (selectedBulkPrior C l).cmean (funext + (R.collisionReference_value_eq_frame hcell hlen hp hV corrected mixed)) + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernel.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..2baa70243c19a20d044856cf63619dad28f463d5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernel.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalCollisionError +open HistoryBulkActualPrincipalCollision HistoryCompensationRepresentativePatterns +open HistoryPairRepresentatives HistoryPairKernelReplacement HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable actualCollisionInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

(z:ℂ)) + exact symbolic_product_eq_blocks R.blockReference.left.history R.blockReference.right.history + R.blockReference.left.supported R.blockReference.right.supported + (R.representative hcell hp) (fun q=>(outerBlocks C l p o q).val) hh mixed + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..64cabc1514505422dcdc12a5ad23b70d83d898ca --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelBasic.lean @@ -0,0 +1,34 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelReplacementPointwise +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagExpectationMatchedReference + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairRepresentatives HistoryPairKernelReplacement +open HistoryPairReferenceSourceTransport HistoryCompensationRepresentativePatterns +attribute [local instance] Classical.propDecidable HistoryPairReferenceFlagExpectation.matchedReferenceInternalDecidable + +theorem symbolic_product_eq_blocks {b : Type} [Fintype b] + {V : ℕ→ℕ} {outside : List ℕ} {l : ℕ} (h g : History l) + (hs : h.Supported V outside) (gs : g.Supported V outside) + (e : b ≃ Representative h g) (x : b→ℕ) + (hp : ∀q,prime h g (e q)=x q) (mixed : Bool) : + (∏r : Representative h g,symbolicKernel mixed h g hs gs r (prime h g r)) = + ∏q : b,symbolicKernel mixed h g hs gs (e q) (x q) := by + calc + _ = ∏q : b,symbolicKernel mixed h g hs gs (e q) (prime h g (e q)) := (e.prod_comp (fun r : Representative h g=>symbolicKernel mixed h g hs gs r (prime h g r))).symm + _ = _ := by + apply Finset.prod_congr rfl + intro q _ + rw [hp q] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelCollision.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelCollision.lean new file mode 100644 index 0000000000000000000000000000000000000000..af32cc44a47a7a05d1b590f306606871e11a5ed1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelCollision.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernel +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelTerm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalCollisionError +open HistoryBulkActualPrincipalCollision HistoryCompensationRepresentativePatterns +open HistoryPairRepresentatives HistoryPairKernelReplacement HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable kernelStageValueInternalDecidable +private theorem guarded_product_congr (p : Prop) {s t : Decidable p} + {a b c d density : ℂ} (hab : a=b) (hcd : c=d) : + a * (density * @ite ℂ p s 0 c) = b * (density * @ite ℂ p t 0 d) := by + cases hab + cases hcd + exact congrArg (fun x : ℂ => a * (density * x)) + ((ite_eq_ite (h:=s) (h':=t) p (0:ℂ) c).2 trivial) + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

+ referenceKernel (l:=l) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside bg.2 (R.collisionReference hcell hlen hp hV) b mixed * + (selectedBulkPrior C l).cmean (fun u => (density (R.frame hcell hp) mixed:ℂ) * + (if true ∧ ¬fibreSmallOutsideGuard C outside bg.2 u then 0 else + (R.collisionReference hcell hlen hp hV).value corrected mixed u))) + +private theorem collisionBlockTrueNormal_eq_raw_proof + (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + collisionBlockTrueNormal C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b = + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + @Option.elim + (MatchedSelectedOuter (l:=l) C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i) ℂ + (selectMatchedOuterReference C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i hactual hl houtside hw hpos) 0 + (fun R => + referenceKernel (l:=l) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside bg.2 (R.collisionReference hcell hlen hp hV) b mixed * + (selectedBulkPrior C l).cmean (fun u => (density (R.frame hcell hp) mixed:ℂ) * + (if true ∧ ¬fibreSmallOutsideGuard C outside bg.2 u then 0 else + (R.collisionReference hcell hlen hp hV).value corrected mixed u))) := rfl + +theorem collisionBlockTrueNormal_eq_raw + (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + collisionBlockTrueNormal C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b = + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + @Option.elim + (MatchedSelectedOuter (l:=l) C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i) ℂ + (selectMatchedOuterReference C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i hactual hl houtside hw hpos) 0 + (fun R => + referenceKernel (l:=l) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside bg.2 (R.collisionReference hcell hlen hp hV) b mixed * + (selectedBulkPrior C l).cmean (fun u => (density (R.frame hcell hp) mixed:ℂ) * + (if true ∧ ¬fibreSmallOutsideGuard C outside bg.2 u then 0 else + (R.collisionReference hcell hlen hp hV).value corrected mixed u))) := + collisionBlockTrueNormal_eq_raw_proof C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b + +private theorem selectedCollisionBlockValue_true_eq_normal_proof + (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + selectedCollisionBlockValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) (α:=α) (spectator:=spectator) + C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hlen hp hV + bg corrected mixed true p b = + collisionBlockTrueNormal C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b := rfl + +theorem selectedCollisionBlockValue_true_eq_normal + (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + selectedCollisionBlockValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) (α:=α) (spectator:=spectator) + C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hlen hp hV + bg corrected mixed true p b = + collisionBlockTrueNormal C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b := + selectedCollisionBlockValue_true_eq_normal_proof C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageCollisionNormalRestored.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageCollisionNormalRestored.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e580c1534a113e517443300786676d62eb9101c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageCollisionNormalRestored.lean @@ -0,0 +1,115 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageCollisionNormal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable collisionSelectedFormInternalDecidable + +private theorem ite_decision_eq (p : Prop) (d₁ d₂ : Decidable p) (x y : ℂ) : + @ite ℂ p d₁ x y = @ite ℂ p d₂ x y := + congrArg (fun d : Decidable p => @ite ℂ p d x y) (Subsingleton.elim d₁ d₂) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ referenceKernel (l:=l) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p (restoreOuterBackground C l p bg b)) + (R.collisionReference hcell hlen hp hV) + (outerBlocks C l p (restoreOuterBackground C l p bg b)) mixed * + (selectedBulkPrior C l).cmean (fun u => (density (R.frame hcell hp) mixed:ℂ) * + (@ite ℂ ((true : Bool) ∧ ¬fibreSmallOutsideGuard C outside + (outerNonbulk C l p (restoreOuterBackground C l p bg b)) u) + (Classical.propDecidable _) 0 + ((R.collisionReference hcell hlen hp hV).value corrected mixed u)))) := by + rw [collisionBlockTrueNormal_eq_raw] + apply Finset.sum_congr rfl + intro i _ + cases ho : selectMatchedOuterReference C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i hactual hl houtside hw hpos with + | none => rfl + | some R => + apply congrArg (fun z : ℂ => referenceKernel (l:=l) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside bg.2 (R.collisionReference hcell hlen hp hV) b mixed * z) + apply FinitePrior.cmean_congr_support + intro u _ + exact congrArg (fun z : ℂ => (density (R.frame hcell hp) mixed : ℂ)*z) + (ite_decision_eq _ _ _ _ _) + +theorem collisionBlockTrueNormal_eq_restored_raw + (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + collisionBlockTrueNormal C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b = + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + @Option.elim + (MatchedSelectedOuter (l:=l) C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i) ℂ + (selectMatchedOuterReference C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i hactual hl houtside hw hpos) 0 + (fun R => + referenceKernel (l:=l) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p (restoreOuterBackground C l p bg b)) + (R.collisionReference hcell hlen hp hV) + (outerBlocks C l p (restoreOuterBackground C l p bg b)) mixed * + (selectedBulkPrior C l).cmean (fun u => (density (R.frame hcell hp) mixed:ℂ) * + (@ite ℂ ((true : Bool) ∧ ¬fibreSmallOutsideGuard C outside + (outerNonbulk C l p (restoreOuterBackground C l p bg b)) u) + (Classical.propDecidable _) 0 + ((R.collisionReference hcell hlen hp hV).value corrected mixed u)))) := + collisionBlockTrueNormal_eq_restored_raw_proof C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageCollisionRestoredBlock.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageCollisionRestoredBlock.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d034b50b7364734949b9bca138fb8cbd837e4b5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageCollisionRestoredBlock.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageCollisionNormalRestored + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable collisionSelectedFormInternalDecidable + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ referenceKernel (l:=l) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p (restoreOuterBackground C l p bg b)) + (R.collisionReference hcell hlen hp hV) + (outerBlocks C l p (restoreOuterBackground C l p bg b)) mixed * + (selectedBulkPrior C l).cmean (fun u => (density (R.frame hcell hp) mixed:ℂ) * + (@ite ℂ ((true : Bool) ∧ ¬fibreSmallOutsideGuard C outside + (outerNonbulk C l p (restoreOuterBackground C l p bg b)) u) + (Classical.propDecidable _) 0 + ((R.collisionReference hcell hlen hp hV).value corrected mixed u))))) = + selectedCollisionBlockValue C outside σ (J bg) w P Q hactual hl houtside hw hpos + hcell hlen hp hV bg corrected mixed true p b := + @Eq.trans ℂ _ _ _ + (collisionBlockTrueNormal_eq_restored_raw C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b).symm + (selectedCollisionBlockValue_true_eq_normal C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageFubini.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageFubini.lean new file mode 100644 index 0000000000000000000000000000000000000000..43f22aa04a85a39b5fbd92e9e6ce281fc2f2b020 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageFubini.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageSum +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStagePattern + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalKernelStage HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalKernelStage.kernelStageOptionInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 true corrected mixed) = + (backgroundPrior C l).cmean (fun bg => + patternComplexSum + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b => ∑ i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedBulkPrior C l).cmean (fun u => + selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (α:=α) (spectator:=spectator) C p outside σ + (fun o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 + (restoreOuterBackground C l p bg b) true corrected mixed u))) := by + simp_rw [sum_selectedKernelMean_eq_background (l:=l) C outside σ + (fun p o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV] + exact kernelStage_sum_cmean_pattern + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + (κ:=Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (α:=SelectedBulkSample C l) (β:=Background C l) + C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (backgroundPrior C l) (selectedBulkPrior C l) + (fun i bg u p b => selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (α:=α) (spectator:=spectator) C p outside σ + (fun o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 + (restoreOuterBackground C l p bg b) true corrected mixed u) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelNormal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelNormal.lean new file mode 100644 index 0000000000000000000000000000000000000000..71a20be529ac3b255e81859f6905ef9c1fa54c88 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelNormal.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageOption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalKernelStage +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalKernelStage.kernelStageOptionInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (α:=α) (spectator:=spectator) C p outside σ + (fun o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 + (restoreOuterBackground C l p bg b) true corrected mixed u)) = + (∑ i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + FinitePrior.cmean (ι:=SelectedBulkSample C l) (selectedBulkPrior C l) + (fun u : SelectedBulkSample C l => + @Option.elim + (MatchedSelectedOuter C p (restoreOuterBackground C l p bg b) outside σ (J bg) w P Q i) + ℂ (selectMatchedOuterReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) + (l:=l) (E:=E) (α:=α) (spectator:=spectator) C p (restoreOuterBackground C l p bg b) + outside σ (J bg) w P Q i hactual hl houtside hw hpos) (0:ℂ) + (fun (R : MatchedSelectedOuter C p (restoreOuterBackground C l p bg b) outside σ (J bg) w P Q i) => + R.kernelTerm (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (C:=C) (p:=p) (o:=restoreOuterBackground C l p bg b) (outside:=outside) + (σ:=σ) (J:=J bg) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) + hcell hlen hp hV true corrected mixed u))) := rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelValue.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..fe4fd3d63eed944fb15418727c4f02dc44fca7a9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelValue.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageOption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalKernelStage +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalKernelStage.kernelStageOptionInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (α:=α) (spectator:=spectator) C p outside σ + (fun o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 + (restoreOuterBackground C l p bg b) true corrected mixed u)) + +private theorem kernelBlockTrueValue_eq_raw_proof + (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + kernelBlockTrueValue C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b = + (∑ i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + FinitePrior.cmean (ι:=SelectedBulkSample C l) (selectedBulkPrior C l) + (fun u : SelectedBulkSample C l => + selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (α:=α) (spectator:=spectator) C p outside σ + (fun o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 + (restoreOuterBackground C l p bg b) true corrected mixed u)) := + rfl + +theorem kernelBlockTrueValue_eq_raw + (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + kernelBlockTrueValue C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b = + (∑ i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + FinitePrior.cmean (ι:=SelectedBulkSample C l) (selectedBulkPrior C l) + (fun u : SelectedBulkSample C l => + selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (α:=α) (spectator:=spectator) C p outside σ + (fun o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 + (restoreOuterBackground C l p bg b) true corrected mixed u)) := + kernelBlockTrueValue_eq_raw_proof C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelValueMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelValueMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..b63a899c7548c736286d98d10a800ecbde8ecb0d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageKernelValueMean.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageFubini +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageKernelValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalKernelStage HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalKernelStage.kernelStageOptionInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 true corrected mixed) = + (backgroundPrior C l).cmean (fun bg => + patternComplexSum + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b => kernelBlockTrueValue C outside σ J w P Q hactual hl houtside + hw hpos hcell hlen hp hV bg corrected mixed p b)) := by + exact sum_selectedKernelMean_eq_background_pattern C outside σ J w P Q + hactual hl houtside hw hpos hcell hlen hp hV corrected mixed + +theorem sum_selectedKernelMean_eq_background_kernelValue (corrected mixed : Bool) : + (∑ i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ∑ p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (α:=α) (spectator:=spectator) C p outside σ + (fun o => J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 true corrected mixed) = + (backgroundPrior C l).cmean (fun bg => + patternComplexSum + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b => kernelBlockTrueValue C outside σ J w P Q hactual hl houtside + hw hpos hcell hlen hp hV bg corrected mixed p b)) := + sum_selectedKernelMean_eq_background_kernelValue_proof C outside σ J w P Q + hactual hl houtside hw hpos hcell hlen hp hV corrected mixed + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c2dd64a1e5136ea8afbe2b52ab33bc7283d7460 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageMean.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageKernelValueMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedPattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryKernelBlock + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkActualPrincipalKernelStage HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalKernelStage.kernelStageOptionInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

J (outerGiants C l p o, outerNonbulk C l p o)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV i.1 i.2.1 i.2.2 true corrected mixed) = + (backgroundPrior C l).cmean (fun bg => + selectedCollisionMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (α:=α) (spectator:=spectator) C outside σ (J bg) w P Q hactual hl houtside hw hpos + hcell hlen hp hV bg corrected mixed true) := + @Eq.trans ℂ _ _ _ + (@sum_selectedKernelMean_eq_background_kernelValue d Bs BD Bz L k l E C outside σ J α (inferInstance : Fintype α) w P Q spectator hactual hl houtside hw hpos hcell hlen hp hV corrected mixed) + (FinitePrior.cmean_congr_support (α:=Background C l) (backgroundPrior C l) _ _ + (fun bg _ => @Eq.trans ℂ _ _ _ + (patternComplexSum_congr_pointwise + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) _ _ + (fun p b => + (kernelValueCollisionRawProof C outside σ J w P Q hactual hl houtside hw hpos + hcell hlen hp hV bg corrected mixed p b).trans + (restoredCollisionRaw_eq_selectedCollisionBlockValue C outside σ J w P Q + hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b))) + (@Eq.symm ℂ _ _ (@selectedCollisionMean_eq_pattern d Bs BD Bz L k l E C outside σ (J bg) α (inferInstance : Fintype α) w P Q spectator hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed true)))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..180aad0b9b8d1924c0e9a34577d77920a13f212e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionBasic.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelCollision + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalBlockFamily.kernelStageValueInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +variable + (hcell : ∀v,w v≠0 → 0

R.kernelTerm (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV true corrected mixed u) = + @Option.elim (MatchedSelectedOuter C p o outside σ J w P Q i) ℂ opt (0:ℂ) (fun (R : MatchedSelectedOuter C p o outside σ J w P Q i)=> + referenceKernel (l:=l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p o) (R.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV) + (outerBlocks C l p o) mixed * + ((density (l:=l) (C:=C) (outside:=outside) (R.frame (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hp) mixed:ℂ) * + @ite ℂ (¬fibreSmallOutsideGuard (l:=l) C outside (outerNonbulk C l p o) u) + (Classical.propDecidable _) 0 + ((R.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV).value (l:=l) (C:=C) (outside:=outside) (a:=outerNonbulk C l p o) + (τ:=pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + corrected mixed u))) := by + cases opt with + | none => rfl + | some R => + exact R.kernelTerm_symbolic_eq_collisionIntegrand + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (C:=C) (p:=p) (o:=o) (outside:=outside) + (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) + hcell hlen hp hV corrected mixed u + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionGuardBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionGuardBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..2949232437e625fca5edacc92f2141c9cc9d86e7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionGuardBasic.lean @@ -0,0 +1,35 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageOptionMeanBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction + +private theorem ite_true_guard (p : Prop) (s : Decidable p) + (t : Decidable ((true : Bool) ∧ p)) (x : ℂ) : + @ite ℂ p s 0 x = @ite ℂ ((true : Bool) ∧ p) t 0 x := by + classical + by_cases hp : p <;> simp [hp] + +theorem option_cmean_eq_of_point_true_guard {α δ : Type*} [Fintype α] + (μ : FinitePrior α) (opt : Option δ) + (A : δ → α → ℂ) (K D : δ → ℂ) (V : δ → α → ℂ) + (p : α → Prop) (s : ∀u,Decidable (p u)) + (t : ∀u,Decidable ((true : Bool) ∧ p u)) + (h : ∀r u,A r u=K r*(D r*@ite ℂ (p u) (s u) 0 (V r u))) : + μ.cmean (fun u=>opt.elim 0 (fun r=>A r u)) = + opt.elim 0 (fun r=>K r*μ.cmean (fun u=> + D r*@ite ℂ ((true : Bool) ∧ p u) (t u) 0 (V r u))) := + option_cmean_eq_of_point μ opt A K + (fun r u=>D r*@ite ℂ ((true : Bool) ∧ p u) (t u) 0 (V r u)) + (fun r u=>(h r u).trans (congrArg (fun x : ℂ=>K r*(D r*x)) + (ite_true_guard (p u) (s u) (t u) (V r u)))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionGuardIntegral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionGuardIntegral.lean new file mode 100644 index 0000000000000000000000000000000000000000..11fa2b6ea2b482ac60caf773a194a1042dc6e7e9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionGuardIntegral.lean @@ -0,0 +1,105 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageOptionBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageOptionGuardBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalBlockFamily.kernelStageValueInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +variable + (hcell : ∀v,w v≠0 → 0

opt.elim 0 (fun matched => + matched.kernelTerm (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) + (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV true corrected mixed sample)) = + opt.elim 0 (fun matched => + referenceKernel (l:=l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p o) + (matched.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) + (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV) + (outerBlocks C l p o) mixed * μ.cmean (fun sample => + (density (l:=l) (C:=C) (outside:=outside) + (matched.frame (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) + (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hp) mixed : ℂ) * + @ite ℂ ((true : Bool) ∧ ¬fibreSmallOutsideGuard (l:=l) C outside + (outerNonbulk C l p o) sample) (guardDecidable sample) 0 + ((matched.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) + (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV).value + (l:=l) (C:=C) (outside:=outside) (a:=outerNonbulk C l p o) + (τ:=pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + corrected mixed sample))) := + option_cmean_eq_of_point_true_guard (α:=SelectedBulkSample C l) (δ:=MatchedSelectedOuter C p o outside σ J w P Q i) + μ opt + (fun (R : MatchedSelectedOuter C p o outside σ J w P Q i) (u : SelectedBulkSample C l) => + R.kernelTerm (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV true corrected mixed u) + (fun (R : MatchedSelectedOuter C p o outside σ J w P Q i) => + referenceKernel (l:=l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p o) (R.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV) + (outerBlocks C l p o) mixed) + (fun (R : MatchedSelectedOuter C p o outside σ J w P Q i) => + (density (l:=l) (C:=C) (outside:=outside) (R.frame (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hp) mixed:ℂ)) + (fun (R : MatchedSelectedOuter C p o outside σ J w P Q i) (u : SelectedBulkSample C l) => + ((R.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=o) (outside:=outside) (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) hcell hlen hp hV).value (l:=l) (C:=C) (outside:=outside) (a:=outerNonbulk C l p o) + (τ:=pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + corrected mixed u)) + (fun u : SelectedBulkSample C l => + ¬fibreSmallOutsideGuard (l:=l) C outside (outerNonbulk C l p o) u) + (fun u : SelectedBulkSample C l =>Classical.propDecidable + (¬fibreSmallOutsideGuard (l:=l) C outside (outerNonbulk C l p o) u)) + guardDecidable + (fun (R : MatchedSelectedOuter C p o outside σ J w P Q i) (u : SelectedBulkSample C l) => + R.kernelTerm_symbolic_eq_collisionIntegrand + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (C:=C) (p:=p) (o:=o) (outside:=outside) + (σ:=σ) (J:=J) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) + hcell hlen hp hV corrected mixed u) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionMeanBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionMeanBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..1fe9b984e4503d4acf9d5ef6a9fb98814f8e3299 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionMeanBasic.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageSum + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction + +theorem option_cmean_eq_of_point {α δ : Type*} [Fintype α] + (μ : FinitePrior α) (opt : Option δ) + (A : δ → α → ℂ) (K : δ → ℂ) (F : δ → α → ℂ) + (h : ∀r u,A r u=K r*F r u) : + μ.cmean (fun u=>opt.elim 0 (fun r=>A r u)) = + opt.elim 0 (fun r=>K r*μ.cmean (F r)) := by + have he : (fun u=>opt.elim 0 (fun r=>A r u)) = + (fun u=>opt.elim 0 (fun r=>K r*F r u)) := by + funext u + cases opt with + | none => rfl + | some r => exact h r u + exact (congrArg μ.cmean he).trans (kernelStage_option_cmean_mul μ opt K F) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1f929a671183d8c10480128dc173d059707f12d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageOptionSum.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageOptionGuardIntegral + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalBlockFamily.kernelStageValueInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ selectMatchedOuterReference (l:=l) (α:=α) C p outer outside σ (J bg) w P Q index + hactual hl houtside hw hpos + (∑ index, (selectedBulkPrior C l).cmean (fun sample => (option index).elim 0 (fun matched => + matched.kernelTerm (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) + (E:=E) (C:=C) (p:=p) (o:=outer) (outside:=outside) (σ:=σ) (J:=J bg) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=index) hcell hlen hp hV true corrected mixed sample))) = + ∑ index, (option index).elim 0 (fun matched => + referenceKernel (l:=l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p outer) + (matched.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) + (l:=l) (E:=E) (C:=C) (p:=p) (o:=outer) (outside:=outside) (σ:=σ) (J:=J bg) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=index) hcell hlen hp hV) + (outerBlocks C l p outer) mixed * (selectedBulkPrior C l).cmean (fun sample => + (density (l:=l) (C:=C) (outside:=outside) + (matched.frame (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) + (E:=E) (C:=C) (p:=p) (o:=outer) (outside:=outside) (σ:=σ) (J:=J bg) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=index) hcell hp) mixed : ℂ) * + @ite ℂ ((true : Bool) ∧ ¬fibreSmallOutsideGuard (l:=l) C outside + (outerNonbulk C l p outer) sample) (Classical.propDecidable _) 0 + ((matched.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=outer) (outside:=outside) + (σ:=σ) (J:=J bg) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=index) hcell hlen hp hV).value + (l:=l) (C:=C) (outside:=outside) (a:=outerNonbulk C l p outer) + (τ:=pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + corrected mixed sample))) := + Finset.sum_congr + (ι:=Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) (M:=ℂ) + (s₁:=Finset.univ) (s₂:=Finset.univ) rfl + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ => + kernelOption_symbolic_cmean_eq_collisionTrueGuard + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (C:=C) (p:=p) (o:=restoreOuterBackground C l p bg b) (outside:=outside) + (σ:=σ) (J:=J bg) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=i) + hcell hlen hp hV (selectedBulkPrior C l) + (selectMatchedOuterReference (l:=l) (α:=α) C p + (restoreOuterBackground C l p bg b) outside σ (J bg) w P Q i + hactual hl houtside hw hpos) + corrected mixed + (guardDecidable:=fun u : SelectedBulkSample C l =>Classical.propDecidable + ((true : Bool) ∧ ¬fibreSmallOutsideGuard (l:=l) C outside + (outerNonbulk C l p (restoreOuterBackground C l p bg b)) u))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePair.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePair.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb21c4f5bca9e369c7ce93fd064de43260a9cb01 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePair.lean @@ -0,0 +1,85 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageKernelNormal +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageOptionSum + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalKernelStage +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkActualPrincipalKernelStage.kernelStageOptionInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ selectMatchedOuterReference (l:=l) (α:=α) C p outer outside σ (J bg) w P Q index + hactual hl houtside hw hpos + (∑ index : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedBulkPrior C l).cmean (fun sample => + selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (α:=α) (spectator:=spectator) C p outside σ + (fun original => J (outerGiants C l p original, outerNonbulk C l p original)) w P Q + hactual hl houtside hw hpos hcell hlen hp hV index.1 index.2.1 index.2.2 + outer true corrected mixed sample)) = + ∑ index, (option index).elim 0 (fun matched => + referenceKernel (l:=l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + C (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p outer) + (matched.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) + (l:=l) (E:=E) (C:=C) (p:=p) (o:=outer) (outside:=outside) (σ:=σ) (J:=J bg) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=index) hcell hlen hp hV) + (outerBlocks C l p outer) mixed * (selectedBulkPrior C l).cmean (fun sample => + (density (l:=l) (C:=C) (outside:=outside) + (matched.frame (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) + (E:=E) (C:=C) (p:=p) (o:=outer) (outside:=outside) (σ:=σ) (J:=J bg) + (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=index) hcell hp) mixed : ℂ) * + @ite ℂ ((true : Bool) ∧ ¬fibreSmallOutsideGuard (l:=l) C outside + (outerNonbulk C l p outer) sample) (Classical.propDecidable _) 0 + ((matched.collisionReference (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) (C:=C) (p:=p) (o:=outer) (outside:=outside) + (σ:=σ) (J:=J bg) (α:=α) (w:=w) (P:=P) (Q:=Q) (i:=index) hcell hlen hp hV).value + (l:=l) (C:=C) (outside:=outside) (a:=outerNonbulk C l p outer) + (τ:=pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (p:=p) + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + corrected mixed sample))) := + @Eq.trans ℂ _ _ _ + (@selectedKernelOptionValue_cmean_sum_eq_kernelTermSum d Bs BD Bz L k l E C outside σ J α (inferInstance : Fintype α) w P Q spectator hactual hl houtside hw hpos hcell hlen hp hV bg corrected mixed p b) + (@selectedKernelOptionSum_eq_collisionOptionSum d Bs BD Bz L k l E C outside σ J α (inferInstance : Fintype α) w P Q spectator hactual hl houtside hw hpos hcell hlen hp hV bg p b corrected mixed) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlain.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b2936d63f72edd44f8727627f13d368365a158e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlain.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainKernelIdentity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion HistoryBulkActualTotalReplacement HistoryBulkSourceDisintegration +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + +theorem plainKernelValue_symbolic_eq_collisionSourceValue (mixed : Bool) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) : + plainKernelValue C spectator D hl σ mixed true ds = + plainKernelCollisionSourceValue C spectator ds D.reference hl σ mixed (D.residues ds) := + @Eq.trans ℂ _ + (plainKernelSourceValue C spectator D.reference hl σ mixed ds (D.residues ds)) _ + (plainKernelValue_eq_plainKernelSourceValue C spectator D hl σ mixed ds) + (plainKernelSourceValue_eq_collisionSourceValue C spectator D.reference hl σ mixed ds (D.residues ds)) + +theorem plainKernelAverage_symbolic_eq_collisionSourceAverage (mixed : Bool) : + plainKernelAverage C spectator D hl σ mixed true = + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds=> + plainKernelCollisionSourceValue C spectator ds D.reference hl σ mixed (D.residues ds)) := + FinitePrior.cmean_congr_support (spectatorPrior spectator (2*(bulkSize k L/2))) _ _ + (fun ds _=>plainKernelValue_symbolic_eq_collisionSourceValue C spectator D hl σ mixed ds) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..65e9ebc79dc2f7cfc2f1db4868642824003b104f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalSmallOriginalMeanDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkActualPrincipalBlockFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainKernelCollisionSourceValue (C : InitialSourceChoice d Bs BD Bz k L E) + (spectator : PrimeSource) (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + if mixed then + selectedCollisionMean (α:=MixedDraw C.giantCenter C.giant) (spectator:=spectator) + C (spectatorList spectator ds) σ + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (u : SelectedBulkSample C l) (P Q : ℤ)=> + (HistoryDiagonalSmallOriginalMean.smallMultiplier C (spectatorList spectator ds) + (fibreAssignment C bg.2 u) i.1.val P Q : ℂ)) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg false true true + else + selectedCollisionMean (α:=PrimeDraw C.giant) (spectator:=spectator) + C (spectatorList spectator ds) σ + (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg false false true) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionIdentity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3b5daebb077d9932658ff54253e22e80abae93e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionIdentity.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainKernelCollisionSourceValue_eq_plainCollisionPrincipal + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j plainMixedLawMultiplier C (spectatorList spectator ds) + (outerGiants C l p o,outerNonbulk C l p o)) + hactual hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV i.1 i.2.1 i.2.2 true + else + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p, + primeKernelMean C p (spectatorList spectator ds) σ + (fun o => primeLawMultiplier C (outerGiants C l p o,outerNonbulk C l p o)) + hactual hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV i.1 i.2.1 i.2.2 true + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainKernelIdentity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainKernelIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e760f97102a94244a94f5a668936e76049371d7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainKernelIdentity.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion HistoryBulkActualTotalReplacement +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainKernelValue_eq_plainKernelSourceValue + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) : + plainKernelValue C spectator D hl σ mixed true ds = + plainKernelSourceValue C spectator D.reference hl σ mixed ds (D.residues ds) := by + unfold plainKernelSourceValue + rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainLaw.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..68e2e81052f1c7f0f88f5b20c3d8d2f158cfe6f1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainLaw.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStageMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + +private theorem plainKernelSourceValue_prime_eq_collisionSourceValue + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) (HistoryGiantReferenceMean.primeWeight_nonneg C.giant) + (fun r _=>HistoryGiantReferenceMean.primeDraw_positive C.giant r) + (fun r hr=>HistoryBulkFibreGiantApproximationReference.prime_draw_cells C r (lt_of_le_of_ne (HistoryGiantReferenceMean.primeWeight_nonneg C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV false false + +private theorem plainKernelSourceValue_mixed_eq_collisionSourceValue + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) (HistoryGiantReferenceMean.mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>HistoryGiantReferenceMean.mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>HistoryBulkFibreGiantApproximationReference.mixed_draw_cells C r (lt_of_le_of_ne (HistoryGiantReferenceMean.mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV false true + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..55ea5bfc6d98ac709e6bd93b301884f856275de8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStagePlainSource.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainLaw + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + +theorem plainKernelSourceValue_eq_collisionSourceValue (mixed : Bool) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + unfold plainKernelSourceValue plainKernelCollisionSourceValue + exact @sum_selectedKernelMean_eq_collisionPrincipal d Bs BD Bz L k l E C + (spectatorList spectator ds) σ (HistoryBulkActualBSquareReplacement.primeLawMultiplier C) + (HistoryGiantReferenceMean.PrimeDraw C.giant) inferInstance + (HistoryGiantReferenceMean.primeWeight C.giant) (HistoryGiantReferenceMean.primeP C.giant) + (HistoryGiantReferenceMean.primeQ C.giant) spectator hactual hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun index hindex => ⟨ds index,hindex⟩)) + (HistoryGiantReferenceMean.primeWeight_nonneg C.giant) + (fun reference _ => HistoryGiantReferenceMean.primeDraw_positive C.giant reference) + (fun reference hreference => HistoryBulkFibreGiantApproximationReference.prime_draw_cells C reference + (lt_of_le_of_ne (HistoryGiantReferenceMean.primeWeight_nonneg C.giant reference) (Ne.symm hreference))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV false false + | true => + unfold plainKernelSourceValue plainKernelCollisionSourceValue + exact @sum_selectedKernelMean_eq_collisionPrincipal d Bs BD Bz L k l E C + (spectatorList spectator ds) σ + (HistoryBulkActualBSquareReplacement.plainMixedLawMultiplier C (spectatorList spectator ds)) + (HistoryGiantReferenceMean.MixedDraw C.giantCenter C.giant) inferInstance + (HistoryGiantReferenceMean.mixedWeight C.giantCenter C.giant) + (HistoryGiantReferenceMean.mixedP C.giantCenter C.giant) + (HistoryGiantReferenceMean.mixedQ C.giantCenter C.giant) spectator hactual hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun index hindex => ⟨ds index,hindex⟩)) + (HistoryGiantReferenceMean.mixedWeight_nonneg C.giantCenter C.giant) + (fun reference _ => HistoryGiantReferenceMean.mixedDraw_positive C.giantCenter C.giant reference) + (fun reference hreference => HistoryBulkFibreGiantApproximationReference.mixed_draw_cells C reference + (lt_of_le_of_ne (HistoryGiantReferenceMean.mixedWeight_nonneg C.giantCenter C.giant reference) + (Ne.symm hreference))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV false true + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f3115270aa536ab1a92257524977928c24e1fab --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelStageSum.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexPatterns +import OAI.NumberTheory.Ostmann.Construction.OffDiagonalExpectations + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +variable {ι κ α β : Type*} [Fintype ι] [DecidableEq ι] + [Fintype κ] [Fintype α] [Fintype β] + +private theorem kernelStage_pattern_mul (sources : SourceFamily) (origin τ : ι → ℕ) + (c : ℂ) (F : ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + patternComplexSum sources origin τ (fun p b => c * F p b) = + c * patternComplexSum sources origin τ F := by + classical + unfold patternComplexSum + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + split_ifs <;> ring + +private theorem kernelStage_pattern_cmean (sources : SourceFamily) (origin τ : ι → ℕ) + (μ : FinitePrior α) + (F : α → ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + patternComplexSum sources origin τ (fun p b => μ.cmean (fun u => F u p b)) = + μ.cmean (fun u => patternComplexSum sources origin τ (F u)) := by + unfold FinitePrior.cmean + rw [patternComplexSum_sum] + apply Finset.sum_congr rfl + intro u _ + exact kernelStage_pattern_mul sources origin τ (μ.mass u : ℂ) (F u) + +theorem kernelStage_sum_cmean_pattern (sources : SourceFamily) (origin τ : ι → ℕ) + (ν : FinitePrior β) (μ : FinitePrior α) + (F : κ → β → α → ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + (∑ i : κ, ν.cmean (fun bg => μ.cmean (fun u => + patternComplexSum sources origin τ (F i bg u)))) = + ν.cmean (fun bg => patternComplexSum sources origin τ + (fun p b => ∑ i : κ, μ.cmean (fun u => F i bg u p b))) := by + rw [←FinitePrior.cmean_sum] + apply congrArg ν.cmean + funext bg + rw [←FinitePrior.cmean_sum] + rw [patternComplexSum_sum, FinitePrior.cmean_sum] + apply Finset.sum_congr rfl + intro i _ + exact (kernelStage_pattern_cmean sources origin τ μ (F i bg)).symm + +theorem kernelStage_option_cmean_mul {δ : Type*} (μ : FinitePrior α) + (o : Option δ) (K : δ → ℂ) (F : δ → α → ℂ) : + μ.cmean (fun u => o.elim 0 (fun r => K r * F r u)) = + o.elim 0 (fun r => K r * μ.cmean (F r)) := by + cases o with + | none => simp only [Option.elim_none, FinitePrior.cmean, mul_zero, Finset.sum_const_zero] + | some r => exact FinitePrior.cmean_mul_left μ (K r) (F r) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelTerm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelTerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d2a3907f7d0f8e1d27b23573bd0c80aaa080a3c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionKernelTerm.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionGuardAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelExpansion +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryPairRepresentatives HistoryPairKernelReplacement +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +attribute [local instance] kernelStageValueInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

(refs p b).elim 0 (fun r=> + referenceKernel C origin τ outside a r b mixed * + (selectedBulkPrior C l).cmean (fun u=> (mask u p b:ℂ)* + (if guarded ∧ ¬fibreSmallOutsideGuard C outside a u then 0 else + r.value corrected mixed u)))) := by + unfold collisionPrincipalMean + dsimp only + unfold principalTest collisionAmplitude + let test := fun (u : SelectedBulkSample C l) (p : Pattern τ) + (b : Block p → CommonSample C.sources origin) => + if guarded ∧ ¬fibreSmallOutsideGuard C outside a u then (0:ℂ) else + (match refs p b with | none => 0 | some r => r.value corrected mixed u) * + ((∏q,optionalDrawSymbolicPatternKernel C.sources origin τ mixed + (frequencyBound Bs BD Bz k L) outside l + (collisionPatternReferences C origin τ outside a refs) p b q:ℝ):ℂ) + change originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask + (fun u p b=>test u p b.val)=_ + rw [originalBulkPrincipalSum_eq_patternComplexSum C.sources origin τ (selectedBulkPrior C l) mask test] + dsimp only [test] + apply congrArg (patternComplexSum C.sources origin τ) + funext p b + cases hr : refs p b with + | none => + simp only [Option.elim_none,zero_mul] + simp only [ite_self,mul_zero,FinitePrior.cmean,Finset.sum_const_zero] + | some r => + simp only [Option.elim_some, + collisionPatternReferences,optionalDrawSymbolicPatternKernel,hr,Option.map_some, + PrincipalCollisionReference.patternReference] + rw [←FinitePrior.cmean_mul_left] + apply congrArg (selectedBulkPrior C l).cmean + funext u + dsimp only [referenceKernel] + split_ifs <;> ring + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionNumerics.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionNumerics.lean new file mode 100644 index 0000000000000000000000000000000000000000..c9be5ad2e72dc05bdad2226214b56126bb84f1f0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionNumerics.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceFrequencyFamilyRoots +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantFrequencyCount +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedRootFlagErrorRates + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion Filter HistoryGiantFrequencyCount HistorySelectedRootFlagError HistoryBulkReferenceFrequencyFamily + +theorem selected_index_collision_error_eventually (Bs BD Bz H : ℝ) + (hH : 0≤H) {k : ℕ} (hk : 0 test p b.val) = + patternComplexSum sources origin τ (fun p b => (mask p b : ℂ) * test p b) := by + unfold originalPrincipalSum + exact sum_pattern_original_eq_patternComplexSum sources origin τ + (fun p b => (mask p b : ℂ) * test p b) + +theorem originalBulkPrincipalSum_eq_patternComplexSum + (sources : SourceFamily) (origin τ : ι → ℕ) (μ : FinitePrior Ω) + (mask : Ω → ∀ p : Pattern τ, (Block p → CommonSample sources origin) → ℝ) + (test : Ω → ∀ p : Pattern τ, (Block p → CommonSample sources origin) → ℂ) : + originalBulkPrincipalSum sources origin τ μ mask (fun u p b => test u p b.val) = + patternComplexSum sources origin τ (fun p b => μ.cmean (fun u => + (mask u p b : ℂ) * test u p b)) := by + unfold originalBulkPrincipalSum + exact sum_pattern_original_eq_patternComplexSum sources origin τ + (fun p b => μ.cmean (fun u => (mask u p b : ℂ) * test u p b)) + +theorem patternComplexSum_eq_originalBulkPrincipalSum + (sources : SourceFamily) (origin τ : ι → ℕ) (μ : FinitePrior Ω) + (mask : Ω → ∀ p : Pattern τ, (Block p → CommonSample sources origin) → ℝ) + (test : Ω → ∀ p : Pattern τ, (Block p → CommonSample sources origin) → ℂ) : + patternComplexSum sources origin τ (fun p b => μ.cmean (fun u => + (mask u p b : ℂ) * test u p b)) = + originalBulkPrincipalSum sources origin τ μ mask (fun u p b => test u p b.val) := + (originalBulkPrincipalSum_eq_patternComplexSum sources origin τ μ mask test).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPattern + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainBackground.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainBackground.lean new file mode 100644 index 0000000000000000000000000000000000000000..24bf0aae6306ad9feaa0b51204c77d87c53cfc9d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainBackground.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainMixedData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainPrimeData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainSupport + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualRootReferenceFamily HistoryBulkActualPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + plainMixedWeight C (spectatorList spectator ds) bg.2 i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg false true guarded + else + selectedCollisionMean (α:=PrimeDraw C.giant) (spectator:=spectator) + C (spectatorList spectator ds) σ + (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg false false guarded + +def plainCollisionPrincipal (guarded : Bool) : ℂ := + (backgroundPrior C l).cmean (fun bg=>plainCollisionMean C spectator ds hactual hl σ mixed hV bg guarded) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainErrorProperty.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainErrorProperty.lean new file mode 100644 index 0000000000000000000000000000000000000000..513c97cd63fc0436af3690e7d17fda468ab1e6cc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainErrorProperty.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns Filter +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkActualPrincipalBlockFamily +open HistoryBulkPrincipalCollisionError HistoryBulkActualRootReferenceFamily +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +open HistoryBulkFibreGiantErrorAverage HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable + +def plainPrimeErrorProperty (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) (L : ℝ) : Prop := + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) plainPrimeErrorProperty d Bs BD Bz H k L ∧ plainMixedErrorProperty d Bs BD Bz H k L) + (plainErrorProperty d Bs BD Bz H k) atTop + ((selected_plainPrimeCollisionPrincipal_error_eventually d Bs BD Bz H hBs hH hk).and + (selected_plainMixedCollisionPrincipal_error_eventually d Bs BD Bz H hBs hH hk)) + (fun _ hh E C hG hGu hcl hcu hb hd spectator hspec hactual ds hds l hl σ mixed hV => + match mixed with + | false => hh.1 E C hG hGu hcl hcu hb hd spectator hspec hactual ds hds l hl σ hV + | true => hh.2 E C hG hGu hcl hcu hb hd spectator hspec hactual ds hds l hl σ hV) +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainFalse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainFalse.lean new file mode 100644 index 0000000000000000000000000000000000000000..506c1383c11d966bb3b8d9316ff99e0a8e30d461 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainFalse.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionFalseMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainFalseDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkActualPrincipalBlockFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximationReference +open HistoryBulkFibreGiantApproximation HistoryGiantReferenceMean +open HistoryBulkFibreGiantErrorAverage HistoryBulkFibreOriginalReference +open HistoryBulkActualGoodPrincipal HistoryBulkPatternIntegralReplacement +open HistoryBulkUniversalPatternAggregation HistoryBulkActualIntegralReplacement +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkPatternIntegralReplacement.bulkBackgroundInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (mixed : Bool) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + exact @selectedCollisionMean_false_eq_pattern d Bs BD Bz L k l E C + (spectatorList spectator ds) σ + (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (PrimeDraw C.giant) inferInstance (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + spectator hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg false false + | true => + exact @selectedCollisionMean_false_eq_pattern d Bs BD Bz L k l E C + (spectatorList spectator ds) σ + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l))=> + plainMixedWeight C (spectatorList spectator ds) bg.2 i.1.val) + (MixedDraw C.giantCenter C.giant) inferInstance + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + spectator hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg false true + +theorem plainCollisionPrincipal_false_eq_plainBulkPrincipal : + plainCollisionPrincipal C spectator ds hactual hl σ mixed hV false = + plainBulkPrincipal C spectator ds hactual hl σ mixed hV := + (FinitePrior.cmean_congr_support (backgroundPrior C l) _ _ + (fun bg _=>plainCollisionMean_false_eq_plainBulkPattern C spectator ds hactual hl σ mixed hV bg)).trans + (plainBulkPrincipal_eq_background_pattern C spectator ds hactual hl σ mixed hV).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainFalseDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainFalseDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..0fa1e808a90096117e4c5bc259a743569217fc88 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainFalseDefs.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkActualPrincipalBlockFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximationReference +open HistoryBulkFibreGiantApproximation HistoryGiantReferenceMean +open HistoryBulkFibreGiantErrorAverage HistoryBulkFibreOriginalReference +open HistoryBulkActualGoodPrincipal HistoryBulkPatternIntegralReplacement +open HistoryBulkUniversalPatternAggregation HistoryBulkActualIntegralReplacement +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkPatternIntegralReplacement.bulkBackgroundInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (mixed : Bool) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jfamilyValue (C:=C) (outside:=spectatorList spectator ds) (l:=l) (p:=p) false + (plainPatternFamily C spectator ds hactual hl σ mixed p (restoreOuterBackground C l p bg b)) + b false mixed hV) + +theorem plainBulkPrincipal_eq_background_pattern : + plainBulkPrincipal C spectator ds hactual hl σ mixed hV = + (backgroundPrior C l).cmean (plainBulkPattern C spectator ds hactual hl σ mixed hV) := rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainMixedData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainMixedData.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d86ad3362b0a257ddadb8085a278612301a0069 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainMixedData.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualRootReferenceFamily HistoryBulkActualPrincipalBlockFamily +open HistoryBulkPrincipalCollisionError HistoryPairSourceLaws +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximationReference +open HistoryBulkFibreGiantApproximation HistoryGiantReferenceMean +open HistoryBulkFibreGiantErrorAverage HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + plainMixedWeight C (spectatorList spectator ds) bg.2 i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (HistoryBulkFibreGiantErrorAverage.spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg i + +def plainMixedMask (bg : Background C l) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + SelectedBulkSample C l → ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → ℝ := +selectedCollisionMask (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (α:=MixedDraw C.giantCenter C.giant) (spectator:=spectator) + C (spectatorList spectator ds) σ + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) => + plainMixedWeight C (spectatorList spectator ds) bg.2 i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (HistoryBulkFibreGiantErrorAverage.spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) bg i true + +theorem plainMixedMask_mem (bg : Background C l) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (u : SelectedBulkSample C l) (p) (b) : + 0 ≤ plainMixedMask C spectator ds hactual hl σ bg i u p b ∧ + plainMixedMask C spectator ds hactual hl σ bg i u p b ≤ 1 := + selectedCollisionMask_mem (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) (α:=MixedDraw C.giantCenter C.giant) (spectator:=spectator) + C (spectatorList spectator ds) σ + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) => + plainMixedWeight C (spectatorList spectator ds) bg.2 i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) bg i true u p b + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainMixedEstimate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainMixedEstimate.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d2be1f2bf1cb8d9dd8b13e5e49ff10204430cea --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainMixedEstimate.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNumerics +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainErrorProperty +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainMixedData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainSupport +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns Filter +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkActualPrincipalBlockFamily +open HistoryBulkPrincipalCollisionError HistoryBulkActualRootReferenceFamily +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +open HistoryBulkFibreGiantErrorAverage HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable selectedCollisionInternalDecidable + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +private theorem mixedCollisionEstimateProof + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ scale : ℝ in atTop, plainMixedErrorProperty d Bs BD Bz H k scale := + @Filter.Eventually.mono ℝ + (backgroundErrorProperty d Bs BD Bz H k) + (plainMixedErrorProperty d Bs BD Bz H k) atTop + (selected_background_collision_error_eventually d Bs BD Bz H (k:=k) hBs hH hk) + (fun _ he E C hG hGu hcl hcu hb hd spectator hspec hactual ds hds l hl σ hV => + plainMixedCollisionPrincipal_error_le C spectator ds hactual hl σ hV + (he E C hG hGu hcl hcu hb hd spectator hspec l false true hl + (spectatorList spectator ds) (spectatorList_length_le spectator ds) + (spectatorList_source_mass spectator ds hds) + (plainMixedReferences C spectator ds hactual hl σ hV) + (plainMixedMask C spectator ds hactual hl σ) + (plainMixedMask_mem C spectator ds hactual hl σ))) + +theorem selected_plainMixedCollisionPrincipal_error_eventually + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ)1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (HistoryBulkFibreGiantErrorAverage.spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + hV bg i + +def plainPrimeMask (bg : Background C l) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + SelectedBulkSample C l → ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → ℝ := +selectedCollisionMask (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) (α:=PrimeDraw C.giant) (spectator:=spectator) + C (spectatorList spectator ds) σ + (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (HistoryBulkFibreGiantErrorAverage.spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) bg i false + +theorem plainPrimeMask_mem (bg : Background C l) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (u : SelectedBulkSample C l) (p) (b) : + 0 ≤ plainPrimeMask C spectator ds hactual hl σ bg i u p b ∧ + plainPrimeMask C spectator ds hactual hl σ bg i u p b ≤ 1 := + selectedCollisionMask_mem (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) (α:=PrimeDraw C.giant) (spectator:=spectator) + C (spectatorList spectator ds) σ + (fun (_ : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) bg i false u p b + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainPrimeEstimate.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainPrimeEstimate.lean new file mode 100644 index 0000000000000000000000000000000000000000..516b2c990595881108643ebf1128e14336b2fa78 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionPlainPrimeEstimate.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNumerics +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainErrorProperty +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainPrimeData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainSupport +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns Filter +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkActualPrincipalBlockFamily +open HistoryBulkPrincipalCollisionError HistoryBulkActualRootReferenceFamily +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +open HistoryBulkFibreGiantErrorAverage HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable selectedCollisionInternalDecidable + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +private theorem primeCollisionEstimateProof + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ scale : ℝ in atTop, plainPrimeErrorProperty d Bs BD Bz H k scale := + @Filter.Eventually.mono ℝ + (backgroundErrorProperty d Bs BD Bz H k) + (plainPrimeErrorProperty d Bs BD Bz H k) atTop + (selected_background_collision_error_eventually d Bs BD Bz H (k:=k) hBs hH hk) + (fun _ he E C hG hGu hcl hcu hb hd spectator hspec hactual ds hds l hl σ hV => + plainPrimeCollisionPrincipal_error_le C spectator ds hactual hl σ hV + (he E C hG hGu hcl hcu hb hd spectator hspec l false false hl + (spectatorList spectator ds) (spectatorList_length_le spectator ds) + (spectatorList_source_mass spectator ds hds) + (plainPrimeReferences C spectator ds hactual hl σ hV) + (plainPrimeMask C spectator ds hactual hl σ) + (plainPrimeMask_mem C spectator ds hactual hl σ))) + +theorem selected_plainPrimeCollisionPrincipal_error_eventually + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ)C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

.residue + +@[simp] theorem collisionReference_value (corrected mixed : Bool) (u : SelectedBulkSample C l) : + (R.collisionReference hcell hlen hp hV).value corrected mixed u = + (R.principalData hcell (bulkSize k L/2) hlen hp hV true).value corrected mixed u := rfl + +@[simp] theorem collisionReference_left : + (R.collisionReference hcell hlen hp hV).amplitude.left=(R.frame hcell hp).left := rfl +@[simp] theorem collisionReference_right : + (R.collisionReference hcell hlen hp hV).amplitude.right=(R.frame hcell hp).right := rfl + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..c887cfc1fc9e31e06e0ac14a36ee9c43725e918f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedDefs.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorActualDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +local instance selectedCollisionInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

R.collisionReference hcell hlen hp hV) + +def selectedCollisionMask (mixed : Bool) (_u : SelectedBulkSample C l) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℝ := + (selectMatchedOuterReference C p (restoreOuterBackground C l p bg b) outside σ J w P Q i + hactual hl houtside hw hpos).elim 0 (fun R=>density (R.frame hcell hp) mixed) + +theorem selectedCollisionMask_mem (mixed : Bool) (u : SelectedBulkSample C l) (p) (b) : + 0 ≤ selectedCollisionMask C outside σ J w P Q hactual hl houtside hw hpos hcell hp bg i mixed u p b ∧ + selectedCollisionMask C outside σ J w P Q hactual hl houtside hw hpos hcell hp bg i mixed u p b ≤ 1 := by + unfold selectedCollisionMask + cases hr : selectMatchedOuterReference C p (restoreOuterBackground C l p bg b) outside σ J w P Q i + hactual hl houtside hw hpos with + | none => exact ⟨le_rfl,zero_le_one⟩ + | some R => exact density_mem (R.frame hcell hp) mixed + +def selectedCollisionMean (corrected mixed guarded : Bool) : ℂ := + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + collisionPrincipalMean C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside bg.2 + (selectedCollisionReferences C outside σ J w P Q hactual hl houtside hw hpos hcell hlen hp hV bg i) + (selectedCollisionMask C outside σ J w P Q hactual hl houtside hw hpos hcell hp bg i mixed) + corrected mixed guarded + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedNormalForm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedNormalForm.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5fb44470370af7a98ed7395f033b921cb4b795f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedNormalForm.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexPatterns + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance collisionSelectedFormInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ referenceKernel C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) outside bg.2 (R.collisionReference hcell hlen hp hV) b mixed * + (selectedBulkPrior C l).cmean (fun u=> (density (R.frame hcell hp) mixed:ℂ)* + (if guarded ∧ ¬fibreSmallOutsideGuard C outside bg.2 u then 0 else + (R.collisionReference hcell hlen hp hV).value corrected mixed u))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..af940602a5ee04516e5d2c4f23d27e36b4b12178 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionSelectedPattern.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionSelectedNormalForm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkPrincipalCollisionError HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance collisionSelectedPatternInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalCollision + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionValue.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..12820fb58969abaec8119e6c2887cea89f902394 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalCollisionValue.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalValueFrameMatched + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalCollisionError HistoryBulkFibreIntegralReplacementFrame +open HistoryBulkActualPrincipalValueFrameMatched +attribute [local instance] Classical.propDecidable +local instance actualCollisionValueInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

(selectedBulkPrior C l).cmean (fun u=> + expression C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i + true corrected mixed)) = + ∑p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean C p outside σ (fun o=>J (outerGiants C l p o,outerNonbulk C l p o)) + w P Q hactual hl houtside hw hpos hcell hout hp hV i.1 i.2.1 i.2.2 false corrected mixed := by + rw [sum_selectedKernelMean_eq_background] + apply congrArg (backgroundPrior C l).cmean + funext bg + rw [mean_expression_probability_eq_kernel_pattern] + apply congrArg (selectedBulkPrior C l).cmean + funext u + apply congrArg (patternComplexSum C.sources _ _) + funext p b + rfl + +theorem background_probability_rootExpression_eq_kernel_sum (corrected mixed : Bool) : + (backgroundPrior C l).cmean (fun bg=>(selectedBulkPrior C l).cmean (fun u=> + rootExpression C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u + true corrected mixed)) = + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ∑p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + selectedKernelMean C p outside σ (fun o=>J (outerGiants C l p o,outerNonbulk C l p o)) + w P Q hactual hl houtside hw hpos hcell hout hp hV i.1 i.2.1 i.2.2 false corrected mixed := by + unfold rootExpression + simp_rw [FinitePrior.cmean_sum] + apply Finset.sum_congr rfl + intro i _ + exact background_probability_expression_eq_kernel_mean C outside σ J w P Q hactual hl houtside hw hpos + hcell hp hAd hout hV i corrected mixed + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageAmplitude.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..22ce0c8f80bab62673456c70dae237d132413ae2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageAmplitude.lean @@ -0,0 +1,57 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalValueFrameMatched +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSplice + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkFibreIntegralReplacementFrame +open HistoryBulkActualPrincipalValueFrameMatched HistoryBulkPrincipalBSquareReference +attribute [local instance] Classical.propDecidable +local instance kernelStageAmplitudeInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

cases mixed <;> rfl + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..acfb2c07a0f814b1dad1eacb2e51d07bb061f11a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageBasic.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquiv +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedDensityBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance kernelStageBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +theorem densityPrincipalProductMean_eq_outer_cmean (symbolic : Bool) + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask) : + densityPrincipalProductMean symbolic F X corrected mixed mask = + ∑o,(outerMass C l p o:ℂ)*(selectedBulkPrior C l).cmean (fun u=> + densityPrincipalProductTerm symbolic F X corrected mixed mask + (restoreOriginalDraw C l p o u)) := + original_weighted_sum_eq_outer_cmean C l p _ + +theorem densityPrincipalProductMean_eq_background_cmean (symbolic : Bool) + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask) : + densityPrincipalProductMean symbolic F X corrected mixed mask = + (backgroundPrior C l).cmean (fun bg=>∑b, + ((∏q : Block p,biasedBlockWeight C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q (b q)):ℂ)* + (selectedBulkPrior C l).cmean (fun u=> + densityPrincipalProductTerm symbolic F X corrected mixed mask + (restoreOriginalDraw C l p (restoreOuterBackground C l p bg b) u))) := by + rw [densityPrincipalProductMean_eq_outer_cmean] + exact outer_weighted_sum_eq_background_cmean C l p _ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..7955fdf17101937d4f028aca71519a452057d659 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinates.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCoordinatesRoot +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelReplacementGiantFree + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryPairRepresentatives +open HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance actualKernelStageCoordinatesInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

(n:ℝ)) + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesRepresentative.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesRepresentative.lean new file mode 100644 index 0000000000000000000000000000000000000000..41737ec667e316878c7a6c39580eaff620f44ff5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesRepresentative.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCoordinates + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryPairRepresentatives +open HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance actualKernelStageRepresentativeInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

(n:ℤ)) hp.symm + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesRoot.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesRoot.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb8d0447f0a28d911027d58029387e91ddb8ebbb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesRoot.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceScalarCoordinatesLeft +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsInsertion +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceSourceTransportBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReference +open Construction CanonicalOccurrenceTransport Conclusion +open HistoryPairPattern HistoryPairBulkCoordinates HistoryPairBulkTransport +open HistoryBulkFibreGiantApproximation HistoryPairReferenceSourceTransport +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +theorem fixedB_root (f : Frame (l:=l) C outside) (x : Frame.Source (C:=C) (l:=l)) + (hfixed : ∀j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length, + ((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get j).role ≠ .bulk → + (x j).val = (f.leftSource j).val) + (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + f.fixedB x (rootKey f.left f.right (rootPosition (leftDraw f) j)) = ((x j).val : ℤ) := by + have he := insertOrderedGiants_left_coordinate C.sources (2*(bulkSize k L/2)) k + (frequencyBound Bs BD Bz k L) l f.s f.P.toNat f.Q.toNat 1 1 + f.leftSource x f.leftChoices f.right f.left_supported hfixed 0 0 (.inr (.inl j)) + have hc := congrFun (integerInsertOrderedGiants_cast (2*(bulkSize k L/2)) k + f.left f.right f.left_supported + (root_matches (assignedLabels C.sources _ _ l f.s f.P.toNat f.Q.toNat f.leftSource f.leftChoices)) + (orderedIntegerSourceValues C.sources (2*(bulkSize k L/2)) k l x) (fun _ => 0)) + (rootKey f.left f.right (rootPosition (leftDraw f) j)) + simp only [orderedIntegerSourceValues_cast,Int.cast_zero] at hc + simp only [newSourceSample_assigned_root,Rat.cast_natCast,ite_self,Int.cast_zero] at he + have hh : (f.fixedB x (rootKey f.left f.right (rootPosition (leftDraw f) j)) : ℝ) = + ((x j).val : ℝ) := hc.trans he + exact_mod_cast hh + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesSmall.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesSmall.lean new file mode 100644 index 0000000000000000000000000000000000000000..6cd55001e34c622df2a8eb6e1e72f4d656f97d22 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCoordinatesSmall.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCoordinatesRepresentative + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryPairRepresentatives +open HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance actualKernelStageCoordinatesSmallInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

ν.cmean (fun b => ∑ i, F a b i)) = + ∑ i, μ.cmean (fun a => ν.cmean (fun b => F a b i)) := + (congrArg μ.cmean (funext fun a => + ν.cmean_sum Finset.univ (fun i b => F a b i))).trans + (μ.cmean_sum Finset.univ (fun i a => ν.cmean (fun b => F a b i))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedAmplitude.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..8b6f4b125684fccf898f56684d31eab4028a4506 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedAmplitude.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedValue +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalValueFrameMatchedCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSplice + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkIndependentFibreReference +open HistoryPairRepresentatives HistoryPairKernelReplacement HistoryBulkReferencePeriodicMeanSource +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualCorrectedPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hout : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(z:ℂ)) + (symbolic_product_eq_blocks (R.blockReference (l:=l) he).left.history + (R.blockReference (l:=l) he).right.history (R.blockReference (l:=l) he).left.supported + (R.blockReference (l:=l) he).right.supported (R.representative (l:=l) he hp) + (fun q=>(outerBlocks C l p o q).val) + (fun q=>R.representative_prime (l:=l) he hp q) true) + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..dda9b3765d72e79b11dc189a66c1436a793864b1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMean.lean @@ -0,0 +1,11 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CorrectedCollisionMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchange.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchange.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d053656179b17b2868e3eb5844fc9dc656c3bce --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchange.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CorrectedOptionScalar +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchangeBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedPattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkUniversalPatternAggregationBasic +import OAI.NumberTheory.Ostmann.Construction.CanonicalHistoryProductChoicesDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalSourceReindex +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + patternComplexSum (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedBulkPrior C l).cmean (fun u=> + selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C p outside e he hlen hprime hV + i.1 i.2.1 i.2.2 (restoreOuterBackground C l p bg b) true u))) := + (Finset.sum_congr rfl (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) _=> + sum_selectedKernelMean_eq_background (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C outside e he hlen hprime hV i.1 i.2.1 i.2.2 true)).trans + (sum_pattern_cmean_exchange (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) + (α:=SelectedBulkSample C l) (β:=Background C l) + (κ:=Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (selectedBulkPrior C l) (backgroundPrior C l) + (fun (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) bg u p b=> + selectedKernelOptionValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hlen hprime hV i.1 i.2.1 i.2.2 (restoreOuterBackground C l p bg b) true u)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchangeBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchangeBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..5e4c03823fd7d14bcf93fc666b0a4a0b68c16274 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionMeanExchangeBasic.lean @@ -0,0 +1,31 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexExchange + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalSourceReindex + +theorem sum_pattern_cmean_exchange {ι α β κ : Type*} + [Fintype ι] [DecidableEq ι] [Fintype α] [Fintype β] [Fintype κ] + (sources : SourceFamily) (origin τ : ι → ℕ) (μ : FinitePrior α) (ν : FinitePrior β) + (F : κ → β → α → ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + (∑i,ν.cmean (fun bg=>μ.cmean (fun u=>patternComplexSum sources origin τ (F i bg u)))) = + ν.cmean (fun bg=>patternComplexSum sources origin τ + (fun p b=>∑i,μ.cmean (fun u=>F i bg u p b))) := by + rw [←FinitePrior.cmean_sum] + apply congrArg ν.cmean + funext bg + rw [←FinitePrior.cmean_sum,←pattern_root_cmean_exchange] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fa47434bed7421a857099c7462f8edf9de50e68 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionBasic.lean @@ -0,0 +1,27 @@ +import OAI.NumberTheory.Ostmann.Construction.OffDiagonalExpectations + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction + +theorem cmean_option_scale {α β Ω : Type*} [Fintype Ω] + (μ : FinitePrior Ω) (z : Option α) (ρ : α→β) + (f : α→Ω→ℂ) (K : β→ℂ) (D : α→ℂ) (G : β→Ω→ℂ) + (hf : ∀r u,f r u=K (ρ r)*(D r*G (ρ r) u)) : + μ.cmean (fun u=>z.elim 0 (fun r=>f r u))= + (z.map ρ).elim 0 (fun r=>K r*μ.cmean (fun u=>z.elim 0 D*G r u)) := by + cases z with + | none => simp only [Option.elim_none,Option.map_none,FinitePrior.cmean,Finset.sum_const_zero,mul_zero] + | some r => + simp only [Option.elim_some,Option.map_some,hf] + exact μ.cmean_mul_left _ _ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionRealBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionRealBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..91b7f345875674f064afd61129c83ee6050d69e2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionRealBasic.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction + +theorem cmean_option_real_scale {α β Ω : Type*} [Fintype Ω] + (μ : FinitePrior Ω) (z : Option α) (ρ : α → β) + (f : α → Ω → ℂ) (K : β → ℂ) (D : α → ℝ) (G : β → Ω → ℂ) + (hf : ∀ r u, f r u = K (ρ r) * ((D r : ℂ) * G (ρ r) u)) : + μ.cmean (fun u => z.elim 0 (fun r => f r u)) = + (z.map ρ).elim 0 (fun r => K r * μ.cmean (fun u => ((z.elim 0 D : ℝ) : ℂ) * G r u)) := by + cases z with + | none => + simp only [Option.elim_none, Option.map_none, FinitePrior.cmean, + Finset.sum_const_zero, mul_zero] + | some r => + simp only [Option.elim_some, Option.map_some, hf] + exact μ.cmean_mul_left _ _ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionScalar.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..84a1d7e780b4f89279033ab2514c64c38f298524 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCollisionScalar.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedGuard +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedValue +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal.CorrectedSelectedOuter +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximation HistoryBulkPrincipalCollisionError +open HistoryBulkReferencePeriodicMeanSource HistorySignedResidueFactorization +open HistoryBulkActualCorrectedPrincipalBlockFamily +local instance correctedKernelCollisionScalarInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : CorrectedSelectedOuter (l:=l) C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +open HistoryBulkFibreOriginalReference +open HistoryPairPattern HistoryPairBulkCoordinates HistoryPairRepresentativeVariables HistoryPairBulkTransport +open HistoryPairKernelReplacement HistoryPairKernelProductReplacement +open HistoryBulkPrincipalKernelReplacementMatched HistoryBulkPrincipalBSquareReference +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates +open HistoryCompensationRepresentativePatterns HistoryOccurrenceVariables + +theorem fixedB_root (u : SelectedBulkSample C l) + (j : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length) : + (R.frame (l:=l) he hprime).fixedB (fibreAssignment C (outerNonbulk C l p o) u) + (rootKey (R.frame (l:=l) he hprime).left (R.frame (l:=l) he hprime).right + (rootPosition (leftDraw (R.frame (l:=l) he hprime)) j)) = + ((fibreAssignment C (outerNonbulk C l p o) u j).val : ℤ) := by + exact HistoryBulkPrincipalBSquareReference.fixedB_root (R.frame (l:=l) he hprime) + (fibreAssignment C (outerNonbulk C l p o) u) + (fibreAssignment_nonbulk_fixed C (outerNonbulk C l p o) u R.witness.bulk) j + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesProduct.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..403e5d8818d7285bb470ca6d6ac876970e2952ba --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesProduct.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesSmall +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelReplacementGiantFree + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreGiantApproximation +open HistoryPairRepresentatives HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance correctedKernelCoordinatesProductInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +open HistoryBulkFibreOriginalReference +open HistoryPairPattern HistoryPairBulkCoordinates HistoryPairRepresentativeVariables HistoryPairBulkTransport +open HistoryPairKernelReplacement HistoryPairKernelProductReplacement +open HistoryBulkPrincipalKernelReplacementMatched HistoryBulkPrincipalBSquareReference +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates +open HistoryCompensationRepresentativePatterns HistoryOccurrenceVariables + +theorem probabilityProduct_eq_restored_referenceSample (mixed : Bool) + (u : SelectedBulkSample C l) : + probabilityProduct (R.frame (l:=l) he hprime) mixed + (fibreAssignment C (outerNonbulk C l p o) u)= + ∏r : Representative (R.blockReference (l:=l) he).left.history (R.blockReference (l:=l) he).right.history, + actualProbability mixed (R.blockReference (l:=l) he).left.history (R.blockReference (l:=l) he).right.history + (R.blockReference (l:=l) he).left.supported (R.blockReference (l:=l) he).right.supported r + ((referenceSample (C:=C) (l:=l) (R.blockReference (l:=l) he) (restoreOriginalDraw C l p o u) + (representativeMap (R.blockReference (l:=l) he).left.history (R.blockReference (l:=l) he).right.history r)).toNat) + (referenceSample (C:=C) (l:=l) (R.blockReference (l:=l) he) (restoreOriginalDraw C l p o u)) := by + unfold probabilityProduct + apply Finset.prod_congr rfl + intro r _ + rw [R.restored_referenceSample_representative he u r,Int.toNat_natCast] + exact actualProbability_congr_small mixed _ _ _ _ r _ _ _ + (R.fixedB_eq_restored_referenceSample_small he hprime u) + +theorem restored_sampledJacobian_eq (u : SelectedBulkSample C l) : + sampledJacobian (C:=C) (l:=l) (R.blockReference (l:=l) he) + (referenceSample (C:=C) (l:=l) (R.blockReference (l:=l) he) (restoreOriginalDraw C l p o u))= + ∏q : Block p,((outerBlocks C l p o q).val:ℝ) := by + unfold sampledJacobian + simp only [R.restored_referenceSample_representative,Int.toNat_natCast] + exact representative_product_eq_blocks _ (R.blockReference (l:=l) he).left.history + (R.blockReference (l:=l) he).right.history (R.blockReference (l:=l) he).left.labels (R.blockReference (l:=l) he).right.labels p + (R.blockReference (l:=l) he).natDraw (R.blockReference (l:=l) he).slot_values (fun n:ℕ=>(n:ℝ)) + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesRepresentative.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesRepresentative.lean new file mode 100644 index 0000000000000000000000000000000000000000..e8ec21f3ec8d9424fd9e2ebbad18dd8db16a6b22 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesRepresentative.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCoordinates +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelProductReplacementMatchedRepresentative + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreGiantApproximation +open HistoryPairRepresentatives HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance correctedKernelCoordinatesRepresentativeInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +open HistoryBulkFibreOriginalReference +open HistoryPairPattern HistoryPairBulkCoordinates HistoryPairRepresentativeVariables HistoryPairBulkTransport +open HistoryPairKernelReplacement HistoryPairKernelProductReplacement +open HistoryBulkPrincipalKernelReplacementMatched HistoryBulkPrincipalBSquareReference +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates +open HistoryCompensationRepresentativePatterns HistoryOccurrenceVariables + +theorem restored_referenceSample_representative (u : SelectedBulkSample C l) + (r : Representative (R.blockReference (l:=l) he).left.history (R.blockReference (l:=l) he).right.history) : + referenceSample (C:=C) (l:=l) (R.blockReference (l:=l) he) (restoreOriginalDraw C l p o u) + (representativeMap (R.blockReference (l:=l) he).left.history (R.blockReference (l:=l) he).right.history r)= + (prime (R.blockReference (l:=l) he).left.history (R.blockReference (l:=l) he).right.history r:ℤ) := by + exact (matchedReferenceSample_representative (R.blockReference (l:=l) he) + (fun _=>C.giant) (restoreOriginalDraw C l p o u) r).trans + (congrArg (fun n:ℕ=>(n:ℤ)) (matchedReference_prime (R.blockReference (l:=l) he) r).symm) + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesSmall.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesSmall.lean new file mode 100644 index 0000000000000000000000000000000000000000..189998f52d8bd419f2646b882c92e4c8a3300c81 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesSmall.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesRepresentative + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkFibreGiantApproximation +open HistoryPairRepresentatives HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +local instance correctedKernelCoordinatesSmallInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +open HistoryBulkFibreOriginalReference +open HistoryPairPattern HistoryPairBulkCoordinates HistoryPairRepresentativeVariables HistoryPairBulkTransport +open HistoryPairKernelReplacement HistoryPairKernelProductReplacement +open HistoryBulkPrincipalKernelReplacementMatched HistoryBulkPrincipalBSquareReference +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates +open HistoryCompensationRepresentativePatterns HistoryOccurrenceVariables + +theorem fixedB_eq_restored_referenceSample_small (u : SelectedBulkSample C l) + (j : PairKey (R.blockReference (l:=l) he).left.history (R.blockReference (l:=l) he).right.history) + (hj : ∃a:ℕ×ℤ,j.val=Sum.inr a) : + (R.frame (l:=l) he hprime).fixedB (fibreAssignment C (outerNonbulk C l p o) u) j= + referenceSample (C:=C) (l:=l) (R.blockReference (l:=l) he) (restoreOriginalDraw C l p o u) j := by + obtain ⟨q,rfl⟩ := (typedSourceEquivMatched (R.blockReference (l:=l) he).left (R.blockReference (l:=l) he).right p + (R.blockReference (l:=l) he).natDraw (R.blockReference (l:=l) he).slot_values (R.blockReference (l:=l) he).root_matching).surjective j + rcases q with t | j | q + · rcases hj with ⟨a,ha⟩ + cases ha + · rw [typedSourceEquivMatched_root] + refine (R.fixedB_root he hprime u j).trans ?_ + rw [←typedSourceEquivMatched_root (R.blockReference (l:=l) he).left (R.blockReference (l:=l) he).right p + (R.blockReference (l:=l) he).natDraw (R.blockReference (l:=l) he).slot_values (R.blockReference (l:=l) he).root_matching j] + simp only [referenceSample,Function.comp_apply,Equiv.symm_apply_apply] + rfl + · rw [typedSourceEquivMatched_block] + exact (fixedB_representative (R.frame (l:=l) he hprime) _ _).trans + (R.restored_referenceSample_representative he u _).symm + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..bdf67a9928107ad06b0228c0c46a9b26b0458ec0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedDefs.lean @@ -0,0 +1,15 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMaskDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedFamily.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..22dff2bc76619d6c2cb64c421d6d2f39b7e979ac --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedFamily.lean @@ -0,0 +1,71 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedFamilySquare +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOptionBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFactors + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference HistoryBulkActualPrincipalKernelStageCorrected +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jselectedKernelOptionValue (l:=l) C p outside e he hout hp hV + i.1 i.2.1 i.2.2 (restoreOuterBackground C l p bg b) false u) := by + unfold expression densityBExpressionSum + apply congrArg (patternComplexSum C.sources _ _) + funext p b + rw [densityPatternFactor_eq] + unfold selectedTerm selectedOuter selectedKernelOptionValue + cases hr : selectCorrectedOuterReference (l:=l) C p + (restoreOuterBackground C l p bg b) outside e i with + | none => rfl + | some R => + exact squareTerm_true_eq_kernelTerm (l:=l) C outside e he hp hAd hout hV bg u i p b R hu + +theorem mean_expression_probability_eq_kernel_pattern : + (selectedBulkPrior C l).cmean (fun u=> + expression (l:=l) C outside e he hp hAd hout hV bg u i true) = + (selectedBulkPrior C l).cmean (fun u=> + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>selectedKernelOptionValue (l:=l) C p outside e he hout hp hV + i.1 i.2.1 i.2.2 (restoreOuterBackground C l p bg b) false u)) := by + apply FinitePrior.cmean_congr_support + intro u hu + exact expression_probability_eq_kernel_pattern (l:=l) C outside e he hp hAd hout hV bg u i hu + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedFamilySquare.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedFamilySquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..d28ed4c5fed85dd8aa9f9ec6fe519b62284c008c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedFamilySquare.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedSquare +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedValue +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedTerms +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSplice + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : Prop := + match selectCorrectedOuterReference (l:=l) C p (originalDrawOuter (fun _=>C.giant) C.sources _ l p y) outside e (v,f,g) with + | none => False + | some R => R.kernelStatic (l:=l) he hprime (originalDrawBulk C l p y) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..7095051d2aa4da81114248b0c477bc5ac3a2c172 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMean.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanDisintegration +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanOuter +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanOuterStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jc*F b)=c*r.elim 0 F := by + cases r <;> simp only [Option.elim_none,Option.elim_some,mul_zero] + +theorem option_elim_mul_of_eq {β : Type*} (r : Option β) (c : ℂ) + (F G : β → ℂ) (h : ∀b,F b=c*G b) : + r.elim 0 F=c*r.elim 0 G := by + cases r with + | none => exact (mul_zero c).symm + | some b => exact h b + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..13276e606aed3ac45afbef923faf11d06bf352a1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanBasic.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanOption +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedTerm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) + (ho : outerMass C l p o≠0) (hu : (selectedBulkPrior C l).mass u≠0) : + JacobianOptionEquality (l:=l) C p outside e he hlen hprime hV v f g o symbolic u := + (densityPrincipalProductTerm_eq_restoredOption (l:=l) C p outside e he hlen hprime hV v f g o symbolic u).trans + (restoredOption_eq_jacobian_option (l:=l) C p outside e he hlen hprime hV v f g o symbolic u ho hu) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanDisintegration.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanDisintegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8225459bfd61dbf0be176cfda1433ab74e65e26 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanDisintegration.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance correctedMeanDisintegrationInternalDecidable (seed : List SourceSlot) (j : ℕ) : DecidableEq (Internal seed j) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + densityPrincipalProductTerm (C:=C) (l:=l) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u)) := + HistoryBulkActualPrincipalKernelStage.densityPrincipalProductMean_eq_outer_cmean + (C:=C) (l:=l) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanMass.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanMass.lean new file mode 100644 index 0000000000000000000000000000000000000000..5bca08763ff71a27b7397714cd29a3abb5bb6854 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanMass.lean @@ -0,0 +1,35 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquiv + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkActualPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +local instance correctedMeanMassInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + +theorem originalDrawMass_restore_ne_zero + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) + (ho : outerMass C l p o≠0) (hu : (selectedBulkPrior C l).mass u≠0) : + originalDrawMass (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p (restoreOriginalDraw C l p o u)≠0 := by + rw [originalDrawMass_restore C l p o u] + exact mul_ne_zero ho hu + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOption.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOption.lean new file mode 100644 index 0000000000000000000000000000000000000000..89f5f7d56886ceac953e4a0441c7fd3a09bae901 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOption.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedNormalize +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOptionDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedRestored + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) + (ho : outerMass C l p o≠0) (hu : (selectedBulkPrior C l).mass u≠0) : + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).elim 0 + (fun R : CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g) => + CorrectedSelectedOuter.restoredKernelTerm (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u) = + (∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u := + option_elim_mul_of_eq + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)) + (∏q : Block p,((outerBlocks C l p o q).val:ℂ)) + (fun R : CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g) => + CorrectedSelectedOuter.restoredKernelTerm (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u) + (fun R : CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g) => + CorrectedSelectedOuter.kernelTerm (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u) + (fun R : CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g) => + CorrectedSelectedOuter.restoredKernelTerm_eq_jacobian_mul (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u + (originalDrawMass_restore_ne_zero C l p o u ho hu)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOuter.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOuter.lean new file mode 100644 index 0000000000000000000000000000000000000000..0d59b5b76af9696afa4be4deda4e39d9cfd64c3e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOuter.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanSum + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance correctedKernelMeanOuterInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + densityPrincipalProductTerm (C:=C) (l:=l) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u))) = + ∑o, (outerMass C l p o : ℂ) * (∏q : Block p, ((outerBlocks C l p o q).val : ℂ)) * + (selectedBulkPrior C l).cmean (fun u => + selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u) := + weighted_cmean_factor + (α := OriginalOuter (fun _ => C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (β := SelectedBulkSample C l) + (outerMass C l p) (selectedBulkPrior C l) + (fun o => ∏q : Block p, ((outerBlocks C l p o q).val : ℂ)) + (fun o u => + densityPrincipalProductTerm (C:=C) (l:=l) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u)) + (fun o u => selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u) + (fun o ho u hu => densityPrincipalProductTerm_eq_jacobian_option (l:=l) + C p outside e he hlen hprime hV v f g o symbolic u ho hu) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOuterStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOuterStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..2b1353c79f4b711194d9520898e22d7da16295c9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanOuterStatement.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance correctedMeanOuterStatementInternalDecidable (seed : List SourceSlot) (j : ℕ) : DecidableEq (Internal seed j) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..1a6f93744a4bc913e83edd200ccb3c438dffbf61 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMaskDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagExpectationSource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) + : Prop := + densityPrincipalProductTerm (C:=C) (l:=l) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u) = + (∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa689206fd7ab206427710075925b91df451380e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedMeanSum.lean @@ -0,0 +1,33 @@ +import OAI.NumberTheory.Ostmann.Construction.JoinedRemaining +import OAI.NumberTheory.Ostmann.Construction.OffDiagonalExpectations + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction + +theorem weighted_cmean_factor {α β : Type*} [Fintype α] [Fintype β] + (w : α→ℝ) (μ : FinitePrior β) (J : α→ℂ) (F G : α→β→ℂ) + (h : ∀a,w a≠0→∀b,μ.mass b≠0→F a b=J a*G a b) : + (∑a,(w a:ℂ)*μ.cmean (F a)) = + ∑a,(w a:ℂ)*J a*μ.cmean (G a) := by + classical + apply Finset.sum_congr rfl + intro a _ + by_cases ha : w a=0 + · simp only [ha,Complex.ofReal_zero,zero_mul] + · rw [mul_assoc] + apply congrArg ((w a:ℂ)*·) + rw [←FinitePrior.cmean_mul_left] + apply FinitePrior.cmean_congr_support + exact h a ha + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedNormalize.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedNormalize.lean new file mode 100644 index 0000000000000000000000000000000000000000..93aea0426d275fb5a6a45754689e97bb2e2d69a1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedNormalize.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedSourceSupport +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesProduct +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedNormalizeBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedProduct + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkIndependentFibreReference +open HistoryPairRepresentatives HistoryPairKernelReplacement HistoryBulkReferencePeriodicMeanSource +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualCorrectedPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +local instance correctedNormalizeInternalDecidable (seed : List SourceSlot) (j : ℕ) : DecidableEq (Internal seed j) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter (l:=l) C p o outside e i) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hout : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p (restoreOriginalDraw C l p o u)≠0) : + R.restoredKernelTerm (l:=l) he hout hprime hV symbolic u = + (∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + R.kernelTerm (l:=l) he hout hprime hV symbolic u := by + have hs1 := R.rightRootSupportIndicator_eq_one (l:=l) he (restoreOriginalDraw C l p o u) + (originalDrawOuter_restore C l p o u) hm + have hj := R.restored_sampledJacobian_eq (l:=l) he u + have hk := R.restoredKernelProduct_eq (l:=l) he hprime symbolic u + exact normalize_guard_product_of_equalities (R.kernelStatic he hprime u) + (Frame.extractedDensity (C:=C) (R.frame he hprime).leftSource) + ((principalData R he (bulkSize k L/2) hout hprime hV).value true true u) + (HistoryBulkPrincipalKernelReplacementMatched.sampledJacobian (C:=C) (l:=l) (R.blockReference he) + (HistoryBulkPrincipalKernelReplacementMatched.referenceSample (C:=C) (l:=l) (R.blockReference he) + (restoreOriginalDraw C l p o u)):ℂ) + (R.restoredKernelProduct (l:=l) he symbolic u:ℂ) + (HistoryPairKernelProductReplacement.rightRootSupportIndicator (R.blockReference he) + (fun _=>C.giant) (restoreOriginalDraw C l p o u):ℂ) + (∏q : Block p,((outerBlocks C l p o q).val:ℂ)) (R.kernelProduct he hprime symbolic u:ℂ) + (congrArg (fun z : ℝ => (z:ℂ)) hs1) + ((congrArg (fun z : ℝ => (z:ℂ)) hj).trans (by simp only [Complex.ofReal_prod,Complex.ofReal_natCast])) + (congrArg (fun z : ℝ => (z:ℂ)) hk) + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedNormalizeBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedNormalizeBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..8dbefec54877a3fe1e9d23959999ae9488909bdc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedNormalizeBasic.lean @@ -0,0 +1,24 @@ +import Mathlib.Basic.Complex.Basic + +namespace OAI + +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +theorem normalize_guard_product (P : Prop) [Decidable P] (density amplitude jac kernel : ℂ) : + density*(if P then (1:ℂ)*jac*amplitude*kernel else 0)= + jac*((if P then (1:ℂ) else 0)*(density*(amplitude*kernel))) := by + by_cases hP : P + · simpa only [ite_eq_left hP,one_mul,mul_assoc] using + (mul_left_comm density jac (amplitude*kernel)) + · simp only [ite_eq_right hP,mul_zero,zero_mul] + +theorem normalize_guard_product_of_equalities (P : Prop) [Decidable P] + (density amplitude jac kernel guard jac' kernel' : ℂ) + (hg : guard=1) (hj : jac=jac') (hk : kernel=kernel') : + density*(if P then guard*jac*amplitude*kernel else 0)= + jac'*((if P then (1:ℂ) else 0)*(density*(amplitude*kernel'))) := by + rw [hg,hj,hk] + exact normalize_guard_product _ _ _ _ _ + +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOption.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOption.lean new file mode 100644 index 0000000000000000000000000000000000000000..55d4be602f72cd7cba5a446041b8c8df29873831 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOption.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOptionDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) : + (if Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then + selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u else 0) = + selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u := + selectedCorrectedOuter_elim_typed (l:=l) C p o outside e (v,f,g) + (fun R=>R.kernelTerm (l:=l) he hlen hprime hV symbolic u) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..8322440eaeba39d9d00aa4971cbb95d676d13ea5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionBasic.lean @@ -0,0 +1,12 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CorrectedOptionScalar +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOptionTyped + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..441029eed57fb1a23ebf0fb49c50e3eedd09d26d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionDefs.lean @@ -0,0 +1,12 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOptionBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionTyped.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionTyped.lean new file mode 100644 index 0000000000000000000000000000000000000000..8fd31041edbebafc110f7bf278c3d4750d552535 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedOptionTyped.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedReferenceBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +private theorem option_guard_eq {α : Type} (P : Prop) [Decidable P] + (hp : α→P) (o : Option α) (f : α→ℂ) : + (if P then o.elim 0 f else 0)=o.elim 0 f := by + cases o with + | none => simp only [Option.elim_none,ite_self] + | some x => rw [ite_eq_left (hp x)] + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + +theorem selectedCorrectedOuter_elim_typed + (F : CorrectedSelectedOuter (l:=l) C p o outside e i → ℂ) : + (if Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then + (selectCorrectedOuterReference (l:=l) C p o outside e i).elim 0 F else 0)= + (selectCorrectedOuterReference (l:=l) C p o outside e i).elim 0 F := + option_guard_eq (α:=CorrectedSelectedOuter (l:=l) C p o outside e i) + (Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q))) + (fun R=>R.data.typed) (selectCorrectedOuterReference (l:=l) C p o outside e i) F + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f21b89abbe93a5e20f49d855bee0f60fe8b8bf9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPattern.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedPatternAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedPatternStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g symbolic) + (fun p => ∑o,(outerMass C l p o:ℂ)*(∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + (selectedBulkPrior C l).cmean (fun u=> + selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u)) + _ + (fun p => selectedKernelMean_eq_outerOption (l:=l) C p outside e he hlen hprime hV v f g symbolic) + (HistoryBulkActualPrincipalKernelStage.typed_kernel_fubini C + (fun p o u=>selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g o symbolic u) + (fun p o u=>selectedKernelOptionValue_typed (l:=l) C p outside e he hlen hprime hV v f g o symbolic u)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPatternAlgebra.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPatternAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..1b9a4011cca0357e65368fbe446aee7584c377f7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPatternAlgebra.lean @@ -0,0 +1,20 @@ +import OAI.NumberTheory.Ostmann.Construction.OffDiagonalExpectations + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +theorem sum_eq_of_pointwise {ι : Type*} [Fintype ι] + (F G : ι → ℂ) (z : ℂ) (h : ∀i,F i=G i) (hg : (∑i,G i)=z) : + (∑i,F i)=z := + (Finset.sum_congr rfl (fun i _=>h i)).trans hg + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPatternStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPatternStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..0997b512970d51ee3ac4b36cf4381f8114265e40 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedPatternStatement.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOption +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedOptionDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageFubini + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(selectedBulkPrior C l).cmean (fun u=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>selectedKernelOptionValue (l:=l) C p outside e he hlen hprime hV v f g + (restoreOuterBackground C l p bg b) symbolic u))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedProduct.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedProduct.lean new file mode 100644 index 0000000000000000000000000000000000000000..58063890deeba4f8219f449cf976e8f0d059a2bb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedProduct.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCoordinatesProduct +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedRestored + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkIndependentFibreReference +open HistoryPairRepresentatives HistoryPairKernelReplacement HistoryBulkReferencePeriodicMeanSource +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualCorrectedPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hout : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hout : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) y:ℂ)* + (HistoryBulkPrincipalKernelReplacementMatched.sampledJacobian (R.blockReference he) z:ℂ)* + (principalData R he (bulkSize k L/2) hout hprime hV).value true true u * + (R.restoredKernelProduct (l:=l) he symbolic u:ℂ) + else 0) + +end CorrectedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedSquare.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..8183f9e0c8b3db16870228b3956f07e99d9a9d19 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedSquare.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedAmplitude +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSplice + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkIndependentFibreReference +open HistoryPairRepresentatives HistoryPairKernelReplacement HistoryBulkReferencePeriodicMeanSource +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualCorrectedPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hout : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) : + densityPrincipalProductTerm symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u) = + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).elim 0 + (fun R=>CorrectedSelectedOuter.restoredKernelTerm (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u) := + (densityPrincipalProductTerm_eq_restoredProjected + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hlen hprime hV v f g o symbolic u).trans + (projectedDensityProductTerm_eq_restoredOption + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hlen hprime hV v f g o symbolic u) + +public theorem densityPrincipalProductTerm_eq_restoredOption + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) : + densityPrincipalProductTerm symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u) = + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).elim 0 + (fun R=>CorrectedSelectedOuter.restoredKernelTerm (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u) := + densityPrincipalProductTerm_restoredOptionProof C p outside e he hlen hprime hV v f g o symbolic u + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..8a40c727df1fec0add69cf593fd1e4ef4c856e1f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermBasic.lean @@ -0,0 +1,18 @@ +import Mathlib.Data.Option.Basic + +namespace OAI + +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +theorem option_dite_get_eq_elim_inst {α β : Type*} (r : Option α) (z : β) + [Decidable (r.isSome = true)] + (F : (h : r.isSome) → β) (G : α → β) + (hFG : ∀h, F h = G (r.get h)) : + (if h : r.isSome then F h else z) = r.elim z G := by + cases r with + | none => simp only [Option.isSome_none,Bool.false_eq_true,dite_false,Option.elim_none] + | some a => simpa only [Option.isSome_some,dite_true,Option.get_some,Option.elim_some] using hFG rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMask.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMask.lean new file mode 100644 index 0000000000000000000000000000000000000000..49bd8225f5ad1f90b85d034005cdf05b8fd54cef --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMask.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedTermMaskBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalKernelStage +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance correctedKernelStageTermMaskInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) + (ho : originalDrawOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y=o) + (hu : originalDrawBulk C l p y=u) : + selectedKernelMask (l:=l) C p outside e he hprime v f g y = + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).elim False + (fun R : CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g) => + CorrectedSelectedOuter.kernelStatic (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hprime u) := by + subst o + subst u + unfold selectedKernelMask + cases selectCorrectedOuterReference (l:=l) C p + (originalDrawOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p y) outside e (v,f,g) <;> rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMaskBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMaskBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..447dd9533b722c0ee5d08b6611d3044851c8d647 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMaskBasic.lean @@ -0,0 +1,13 @@ +import Mathlib.Data.Option.Basic + +namespace OAI + +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +theorem option_match_eq_elim {α β : Type*} (r : Option α) (z : β) (F : α → β) : + (match r with | none => z | some a => F a) = r.elim z F := by + cases r <;> rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMaskGet.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMaskGet.lean new file mode 100644 index 0000000000000000000000000000000000000000..8773fb94aad0ae1e8630b4c64935ece1a80b4d52 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermMaskGet.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedTermMask +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageTermBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalKernelStage +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hprime : ∀q∈outside,q.Prime) + (v : AllowedFrequency (frequencyBound Bs BD Bz k L) l) + (f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l) + +theorem selectedKernelMask_restore_get + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) + (ho : (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).isSome) : + selectedKernelMask (l:=l) C p outside e he hprime v f g + (restoreOriginalDraw C l p o u) = + CorrectedSelectedOuter.kernelStatic (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) + ((selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).get ho) + he hprime u := + (selectedKernelMask_of_projections + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hprime v f g + (restoreOriginalDraw C l p o u) o u + (originalDrawOuter_restore C l p o u) (originalDrawBulk_restore C l p o u)).trans + (option_match_get + (α:=CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g)) (β:=Prop) + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)) False + (fun R : CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g) => + CorrectedSelectedOuter.kernelStatic (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hprime u) ho) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermProjected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermProjected.lean new file mode 100644 index 0000000000000000000000000000000000000000..822273e5f8fa5aeeac6a4f521447fe907c14b382 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermProjected.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMaskDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedRestored +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedTermBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedTermMaskGet +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageProjected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +section +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalKernelStage +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) : + projectedDensityProductTerm (C:=C) (l:=l) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u) o u = + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).elim 0 + (fun R=>CorrectedSelectedOuter.restoredKernelTerm (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u) := by + unfold projectedDensityProductTerm + apply @option_dite_get_eq_elim_inst + (CorrectedSelectedOuter (l:=l) C p o outside e (v,f,g)) ℂ + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)) (0:ℂ) + (Classical.propDecidable _) + intro ho + rw [selectedKernelMask_restore_get + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hprime v f g o u ho] + dsimp only [correctedPrincipalFamily,correctedDensitySources, + CorrectedSelectedOuter.restoredKernelTerm,CorrectedSelectedOuter.restoredKernelProduct,ite_true] + rw [ite_eq_left (rfl : true = true)] + +public theorem projectedDensityProductTerm_eq_restoredOption + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) : + projectedDensityProductTerm (C:=C) (l:=l) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u) o u = + (selectCorrectedOuterReference (l:=l) C p o outside e (v,f,g)).elim 0 + (fun R=>CorrectedSelectedOuter.restoredKernelTerm (C:=C) (l:=l) (p:=p) (o:=o) + (outside:=outside) (e:=e) (i:=(v,f,g)) R he hlen hprime hV symbolic u) := + projectedDensityProductTerm_eq_restoredOption_core C p outside e he hlen hprime hV v f g o symbolic u + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermProjection.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..7e755dea996a80b2b38fb6acc6eb1b7e12895b20 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedTermProjection.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMaskDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageProjected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +section +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalKernelStage +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic : Bool) (u : SelectedBulkSample C l) : + densityPrincipalProductTerm symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u) = + projectedDensityProductTerm symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u) o u := + (densityPrincipalProductTerm_eq_projected + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (C:=C) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u)).trans + (congrArg₂ + (projectedDensityProductTerm + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + (C:=C) (outside:=outside) (f:=f) (g:=g) (p:=p) symbolic + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g) + (restoreOriginalDraw C l p o u)) + (originalDrawOuter_restore C l p o u) (originalDrawBulk_restore C l p o u)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedValue.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..ebff9d0df1764df8f711c775ca36e07aa6d66a1a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageCorrectedValue.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkIndependentFibreReference +open HistoryPairRepresentatives HistoryPairKernelReplacement HistoryBulkReferencePeriodicMeanSource +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualCorrectedPrincipalBlockFamily +attribute [local instance] Classical.propDecidable +local instance correctedKernelStageValueInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hout : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ ((selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).get ho).frame hcell hprime |>.leftSource + +def selectedKernelOuterMask + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (x : Frame.Source (C:=C) (l:=l)) : Prop := + match selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos with + | none => False + | some R => + let r := R.frame hcell hprime + ((r.newLeft x).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime ∧ + ((r.newRight (permuteAssignment C σ x)).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime + +def selectedKernelMask + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) : Prop := + selectedKernelOuterMask C p outside σ J w P Q hactual hl houtside hw hpos hcell hprime v f g + (originalDrawOuter (fun _=>C.giant) C.sources _ l p y) (originalDrawAssignment C l p y) + +def selectedKernelMean (symbolic corrected mixed : Bool) : ℂ := + densityPrincipalProductMean symbolic + (matchedPrincipalFamily C p outside σ J w P Q hactual hl houtside hw hpos hcell + (bulkSize k L/2) hlen hprime hV true v f g) + (selectedKernelDensitySources C p outside σ J w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g) + corrected mixed + (selectedKernelMask C p outside σ J w P Q hactual hl houtside hw hpos hcell hprime v f g) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageFamily.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..b73a1d9381c0fc647d4e48dbba86c310867e32c1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageFamily.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageFamilySquare +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageOption +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyFactors + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource HistoryBulkUniversalPatternAggregation +open HistoryBulkActualPrincipalKernelStage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

selectedKernelOptionValue C p outside σ (fun _=>J) w P Q hactual hl houtside hw hpos hcell + hout hp hV i.1 i.2.1 i.2.2 (restoreOuterBackground C l p bg b) false corrected mixed u) := by + unfold expression densityBExpressionSum + apply congrArg (patternComplexSum C.sources _ _) + funext p b + rw [densityPatternFactor_eq] + unfold selectedTerm selectedOuter selectedKernelOptionValue + cases hr : selectMatchedOuterReference C p (restoreOuterBackground C l p bg b) + outside σ J w P Q i hactual hl houtside hw hpos with + | none => rfl + | some R => + exact squareTerm_true_eq_kernelTerm C outside σ J w P Q hcell hp hAd hout hV bg u i p b R hu corrected mixed + +theorem mean_expression_probability_eq_kernel_pattern (corrected mixed : Bool) : + (selectedBulkPrior C l).cmean (fun u=> + expression C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i + true corrected mixed) = + (selectedBulkPrior C l).cmean (fun u=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>selectedKernelOptionValue C p outside σ (fun _=>J) w P Q hactual hl houtside hw hpos hcell + hout hp hV i.1 i.2.1 i.2.2 (restoreOuterBackground C l p bg b) false corrected mixed u)) := by + apply FinitePrior.cmean_congr_support + intro u hu + exact expression_probability_eq_kernel_pattern C outside σ J w P Q hactual hl houtside hw hpos hcell + hp hAd hout hV bg u i hu corrected mixed + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageFamilySquare.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageFamilySquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..e77cdc43607a59d3e135fda1ea091070b16f185a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageFamilySquare.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSquare +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageValue +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyTerms +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSplice + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + SelectedBulkSample C l → ℂ) + (hK : ∀p o u, + (if Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then K p o u else 0)=K p o u) : + (∑p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + ∑o,(outerMass C l p o:ℂ)*(∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + (selectedBulkPrior C l).cmean (K p o)) = + (backgroundPrior C l).cmean (fun bg=>(selectedBulkPrior C l).cmean (fun u=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>K p (restoreOuterBackground C l p bg b) u))) := by + have he : ∀p o, + (selectedBulkPrior C l).cmean (K p o)= + if Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then + (selectedBulkPrior C l).cmean (K p o) else 0 := by + intro p o + by_cases ht : Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) + · rw [ite_eq_left ht] + · rw [ite_eq_right ht] + have hz : ∀u,K p o u=0 := by + intro u + simpa only [ite_eq_right ht] using (hK p o u).symm + simp only [FinitePrior.cmean,hz,mul_zero,Finset.sum_const_zero] + calc + _ = ∑p,∑o,(outerMass C l p o:ℂ)*(∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + (if Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then + (selectedBulkPrior C l).cmean (K p o) else 0) := by + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro o _ + rw [←he] + _ = (backgroundPrior C l).cmean (fun bg=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>(selectedBulkPrior C l).cmean (K p (restoreOuterBackground C l p bg b)))) := + outer_pattern_sum_eq_background_cmean C l _ + _ = _ := by + apply congrArg (backgroundPrior C l).cmean + funext bg + unfold patternComplexSum + simp_rw [FinitePrior.cmean_sum] + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + rw [FinitePrior.cmean_mul_left] + by_cases ht : Function.Injective (fun q=>(blockType p q,b q)) + · simp only [ite_eq_left ht] + · simp only [ite_eq_right ht,FinitePrior.cmean,mul_zero,Finset.sum_const_zero] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..a8e98883ec2ac83f579e4458ce2c4743574a19df --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageMean.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageMeanBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageOption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkActualPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +open HistoryBulkReferencePeriodicMeanSource HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance kernelStageMeanInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ selectedKernelOptionValue C p outside σ J w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g o symbolic corrected mixed u) := by + unfold selectedKernelMean + rw [densityPrincipalProductMean_eq_outer_cmean (C:=C) (l:=l)] + apply Finset.sum_congr rfl + intro o _ + by_cases ho : outerMass C l p o=0 + · simp only [ho,Complex.ofReal_zero,zero_mul] + · rw [mul_assoc] + apply congrArg ((outerMass C l p o:ℂ)*·) + rw [←FinitePrior.cmean_mul_left] + apply FinitePrior.cmean_congr_support + intro u hu + exact densityPrincipalProductTerm_eq_jacobian_option (l:=l) C p outside σ J w P Q + hactual hl houtside hw hpos hcell hlen hprime hV v f g o symbolic corrected mixed u ho hu + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageMeanBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageMeanBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..09b841e29252911734f67eb7dd01971ce4f8a921 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageMeanBasic.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageNormalize +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageOption +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageTerm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkActualPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +open HistoryBulkReferencePeriodicMeanSource HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance kernelStageMeanBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

c*F b)=c*r.elim 0 F := by + cases r <;> simp only [Option.elim_none,Option.elim_some,mul_zero] + +theorem densityPrincipalProductTerm_eq_jacobian_option + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic corrected mixed : Bool) (u : SelectedBulkSample C l) + (ho : outerMass C l p o≠0) (hu : (selectedBulkPrior C l).mass u≠0) : + densityPrincipalProductTerm (C:=C) (l:=l) symbolic + (matchedPrincipalFamily C p outside σ J w P Q hactual hl houtside hw hpos hcell + (bulkSize k L/2) hlen hprime hV true v f g) + (selectedKernelDensitySources C p outside σ J w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g) + corrected mixed + (selectedKernelMask C p outside σ J w P Q hactual hl houtside hw hpos hcell hprime v f g) + (restoreOriginalDraw C l p o u) = + (∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + selectedKernelOptionValue C p outside σ J w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g o symbolic corrected mixed u := by + rw [densityPrincipalProductTerm_eq_restoredOption (l:=l) C p outside σ J w P Q + hactual hl houtside hw hpos hcell hlen hprime hV v f g o symbolic corrected mixed u] + unfold selectedKernelOptionValue + trans (selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).elim 0 (fun R=> + (∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + R.kernelTerm (l:=l) hcell hlen hprime hV symbolic corrected mixed u) + · apply congrArg (fun F=>(selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).elim 0 F) + funext R + exact R.restoredKernelTerm_eq_jacobian_mul (l:=l) hcell hlen hprime hV symbolic corrected mixed u + (by rw [originalDrawMass_restore]; exact mul_ne_zero ho hu) + · exact option_elim_mul _ _ _ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageNormalize.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageNormalize.lean new file mode 100644 index 0000000000000000000000000000000000000000..e20ba4fcf0aed1e2397c24549bfaa343cc07654c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageNormalize.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCoordinatesProduct +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageRestored +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelProductReplacementMatchedSelectedSupport + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryPairRepresentatives HistoryPairKernelReplacement +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +local instance kernelStageNormalizeInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p (restoreOriginalDraw C l p o u)≠0) : + R.restoredKernelTerm hcell hout hprime hV symbolic corrected mixed u = + (∏q : Block p,((outerBlocks C l p o q).val:ℂ))* + R.kernelTerm hcell hout hprime hV symbolic corrected mixed u := by + have hs := HistoryPairKernelProductReplacement.rightRootSupported_selected_permutation + C R.blockReference σ R.rootAligned (fun _=>C.giant) (restoreOriginalDraw C l p o u) hm + have hs1 : HistoryPairKernelProductReplacement.rightRootSupportIndicator + R.blockReference (fun _=>C.giant) (restoreOriginalDraw C l p o u)=1 := by + exact ite_eq_left hs + cases symbolic <;> unfold restoredKernelTerm kernelTerm kernelProduct + all_goals dsimp only + all_goals rw [hs1,R.restored_sampledJacobian_eq] + · simp only [Bool.false_eq_true,ite_false,Complex.ofReal_one,one_mul, + Complex.ofReal_prod,Complex.ofReal_natCast] + rw [R.probabilityProduct_eq_restored_referenceSample] + simp only [Complex.ofReal_prod] + unfold staticPairMask HistorySignedResidueFactorization.guardIndicator + split_ifs <;> simp only [one_mul,zero_mul,mul_zero] <;> ac_rfl + · simp only [ite_true,R.restored_referenceSample_representative,Int.toNat_natCast, + Complex.ofReal_one,one_mul,Complex.ofReal_prod,Complex.ofReal_natCast] + unfold staticPairMask HistorySignedResidueFactorization.guardIndicator + split_ifs <;> simp only [one_mul,zero_mul,mul_zero] <;> ac_rfl + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageOption.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageOption.lean new file mode 100644 index 0000000000000000000000000000000000000000..f3e78b6f0371040af9eecd6a1decd146bd83ee22 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageOption.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkActualPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +open HistoryBulkReferencePeriodicMeanSource HistoryBulkFibreOriginalReference +attribute [local instance] Classical.propDecidable +local instance kernelStageOptionInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic corrected mixed : Bool) (u : SelectedBulkSample C l) : ℂ := + (selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).elim 0 + (fun R=>R.kernelTerm hcell hlen hprime hV symbolic corrected mixed u) + +theorem selectedKernelOptionValue_typed + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic corrected mixed : Bool) (u : SelectedBulkSample C l) : + (if Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q)) then + selectedKernelOptionValue C p outside σ J w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g o symbolic corrected mixed u else 0) = + selectedKernelOptionValue C p outside σ J w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g o symbolic corrected mixed u := by + unfold selectedKernelOptionValue + cases hr : selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos with + | none => simp only [Option.elim_none,ite_self] + | some R => rw [ite_eq_left R.data.typed] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStagePattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStagePattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc2684e7bec693c7645d7935138c56090164e98d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStagePattern.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageFubini +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkActualPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +open HistoryBulkReferencePeriodicMeanSource HistoryBulkFibreOriginalReference +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +local instance kernelStagePatternInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

(selectedBulkPrior C l).cmean (fun u=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>selectedKernelOptionValue C p outside σ (J p) w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g (restoreOuterBackground C l p bg b) symbolic corrected mixed u))) := by + simp_rw [selectedKernelMean_eq_outerOption] + exact typed_kernel_fubini C + (fun p o u=>selectedKernelOptionValue C p outside σ (J p) w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g o symbolic corrected mixed u) + (fun p o u=>selectedKernelOptionValue_typed C p outside σ (J p) w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g o symbolic corrected mixed u) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageProjected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageProjected.lean new file mode 100644 index 0000000000000000000000000000000000000000..de5844b1f0da8ca910919e5ae272f0f002a1639d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageProjected.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundMass +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquiv +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedDensityBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +local instance kernelStageProjectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +def projectedDensityProductTerm (symbolic : Bool) + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask : OriginalDraw (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p → Prop) + (y : OriginalDraw (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (u : SelectedBulkSample C l) : ℂ := + if ho : F.active o then + let R := F.reference o ho + let z := referenceSample R y + (if mixed then HistoryBulkFibreGiantApproximation.Frame.extractedDensity (X o ho) else 1) * + (if mask y then + (HistoryPairKernelProductReplacement.rightRootSupportIndicator R (fun _=>C.giant) y:ℂ)* + (sampledJacobian R z:ℂ)*(F.principal o ho).value corrected mixed u * + ((∏r : HistoryPairRepresentatives.Representative R.left.history R.right.history, + if symbolic then HistoryPairKernelReplacement.symbolicKernel mixed R.left.history R.right.history + R.left.supported R.right.supported r + (z (HistoryPairRepresentativeVariables.representativeMap R.left.history R.right.history r)).toNat + else HistoryPairKernelReplacement.actualProbability mixed R.left.history R.right.history + R.left.supported R.right.supported r + (z (HistoryPairRepresentativeVariables.representativeMap R.left.history R.right.history r)).toNat z:ℝ):ℂ) + else 0) + else 0 + +theorem densityPrincipalProductTerm_eq_projected (symbolic : Bool) + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask) (y) : + densityPrincipalProductTerm symbolic F X corrected mixed mask y = + projectedDensityProductTerm symbolic F X corrected mixed mask y + (originalDrawOuter (fun _=>C.giant) C.sources _ l p y) (originalDrawBulk C l p y) := by + unfold densityPrincipalProductTerm densityFactor principalProductTerm projectedDensityProductTerm + split <;> simp_all only [mul_zero] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageRestored.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageRestored.lean new file mode 100644 index 0000000000000000000000000000000000000000..8f4d4f643fdc94b4be01627ed4adb731444d7094 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageRestored.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterEquivBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageValue +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryPairRepresentatives HistoryPairKernelReplacement +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +local instance kernelStageRestoredInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) y:ℂ)* + (HistoryBulkPrincipalKernelReplacementMatched.sampledJacobian R.blockReference z:ℂ)* + (R.principalData hcell (bulkSize k L/2) hout hprime hV true).value corrected mixed u * + ((∏q : Representative R.blockReference.left.history R.blockReference.right.history, + if symbolic then symbolicKernel mixed R.blockReference.left.history R.blockReference.right.history + R.blockReference.left.supported R.blockReference.right.supported q + (z (HistoryPairRepresentativeVariables.representativeMap R.blockReference.left.history R.blockReference.right.history q)).toNat + else actualProbability mixed R.blockReference.left.history R.blockReference.right.history + R.blockReference.left.supported R.blockReference.right.supported q + (z (HistoryPairRepresentativeVariables.representativeMap R.blockReference.left.history R.blockReference.right.history q)).toNat z:ℝ):ℂ) + else 0) + +end MatchedSelectedOuter +end Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9b42a7e003b55ce684bb028e03f0935866d27a7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelected.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedDensityRoot +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkActualPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched Filter +attribute [local instance] Classical.propDecidable +local instance selectedKernelSumInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_kernel_sum_errors_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 0C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + (α : Type) [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

∑v,∑f,∑g,∑p, + selectedKernelMean C p outside σ (J p) w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g symbolic corrected mixed + ‖S false-S true‖≤Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖S false-S true‖≤Real.exp (-H*(bulkSize k L:ℝ)) := + (((HistoryBulkFixedReferenceTerm.selected_reference_equality_eventually d Bs BD Bz hk).and + (HistoryBulkSupportConverse.selected_source_inputs_eventually d Bs BD Bz hk)).and + (selected_root_density_principal_kernel_error_eventually d Bs BD Bz 0 H hBs hH hk)).mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec => + let hactual := h.1.1 E C hG hcl hcu hb hd spectator hspec + let hsf := (h.1.2 E C hG hcl hcu hb hd spectator hspec).2.2 + ⟨hactual,fun outside houtside hlen l hl => + let hprime : ∀q∈outside,q.Prime := fun q hq => + (houtside q hq).elim (fun r hr => hr ▸ spectator.prime r.val r.property) + let hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (houtside q hq).elim (fun r hr => hr ▸ hsf r j (hj.trans hl)) + ⟨hprime,hV,fun σ J _α _ w P Q hw hpos hcell corrected mixed hdepth => + let F := fun v f g p => matchedPrincipalFamily C p outside σ (J p) w P Q + hactual hl houtside hw hpos hcell (bulkSize k L/2) hlen hprime hV true v f g + let X := fun v f g p => selectedKernelDensitySources C p outside σ (J p) w P Q + hactual hl houtside hw hpos hcell hlen hprime hV v f g + let mask := fun v f g p => selectedKernelMask C p outside σ (J p) w P Q + hactual hl houtside hw hpos hcell hprime v f g + four_sum_zero_cost_bounds + (fun v f g p => densityPrincipalProductMean false (F v f g p) (X v f g p) corrected mixed (mask v f g p)) + (fun v f g p => densityPrincipalProductMean true (F v f g p) (X v f g p) corrected mixed (mask v f g p)) + (fun v f g p => densityPrincipalDifferenceMean (F v f g p) (X v f g p) corrected mixed (mask v f g p)) + (fun v f g p => densityPrincipalProductMean_sub (F v f g p) (X v f g p) corrected mixed (mask v f g p)) + L (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (h.2 E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hdepth outside + (fun q hq => (hprime q hq).pos) + (hlen.symm ▸ Nat.mul_div_le (bulkSize k L) 2) + (fun q hq => (houtside q hq).elim (fun r hr => hr ▸ (hspec r).2)) + F (fun v f g p o ho => matchedPrincipalFamily_reference_giants C p outside σ (J p) w P Q + hactual hl houtside hw hpos hcell (bulkSize k L/2) hlen hprime hV true v f g o ho) + X mask)⟩⟩) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..4de8944f24e5b490eb38b94f3bbbd80e57e72dd0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrected.lean @@ -0,0 +1,33 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedPrincipalBlockFamilyDensitySelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction Conclusion HistoryBulkActualCorrectedPrincipalBlockFamily Filter + +theorem selected_kernel_sum_errors_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 0 < k) : + SelectedKernelSumEstimate d Bs BD Bz H k := by + exact (selected_corrected_principal_factory_density_kernel_error_eventually + d Bs BD Bz 0 H hBs hH hk).mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec outside houtside hlen l hl e he => + (h E C hG hGu hcl hcu hb hd spectator hspec outside houtside + (bulkSize k L/2) hlen (hlen.trans_le (Nat.mul_div_le (bulkSize k L) 2)) l hl e he).elim + (fun hprime hex => hex.elim (fun hV hbound => + ⟨hprime,hV,selectedKernelMean_zero_cost_bounds (l:=l) C outside e he hlen hprime hV + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (hbound (fun v f g p => selectedKernelMask (l:=l) C p outside e he hprime v f g))⟩))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d9478645ef346f8e9a22fc495aea86fe5e476515 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasic.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasicMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedFinite + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +open HistoryBulkActualPrincipalKernelStage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j selectedKernelMask (l:=l) C p outside e he hprime v f g) ≤ r₁ ∧ + Real.exp (0*(L+1)^2)*correctedDensityKernelError (l:=l) + C outside e he (bulkSize k L/2) hlen hprime hV + (fun v f g p => selectedKernelMask (l:=l) C p outside e he hprime v f g) ≤ r₂) : + ‖(∑v,∑f,∑g,∑p,selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g false)- + (∑v,∑f,∑g,∑p,selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g true)‖ ≤ r₁ ∧ + ‖(∑v,∑f,∑g,∑p,selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g false)- + (∑v,∑f,∑g,∑p,selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g true)‖ ≤ r₂ := + let F := fun v f g p => correctedPrincipalFamily (l:=l) C p outside e he + (bulkSize k L/2) hlen hprime hV v f g + let X := fun v f g p => correctedDensitySources (l:=l) C outside e he + (bulkSize k L/2) hlen hprime hV p v f g + let mask := fun v f g p => selectedKernelMask (l:=l) C p outside e he hprime v f g + four_sum_zero_cost_bounds + (fun v f g p => selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g false) + (fun v f g p => selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g true) + (fun v f g p => densityPrincipalDifferenceMean (F v f g p) (X v f g p) true true (mask v f g p)) + (fun v f g p => selectedKernelMean_sub C p outside e he hlen hprime hV v f g) + L r₁ r₂ hb + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasicMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasicMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..f569e7ff7e4e269f62e96dad1227fb09c170831a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedBasicMean.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily HistoryBulkPrincipalKernelReplacementMatched +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j a-b) + (selectedKernelMean.eq_def C p outside e he hlen hprime hV v f g false) + (selectedKernelMean.eq_def C p outside e he hlen hprime hV v f g true)).trans + (densityPrincipalProductMean_sub + (correctedPrincipalFamily (l:=l) C p outside e he (bulkSize k L/2) hlen hprime hV v f g) + (correctedDensitySources (l:=l) C outside e he (bulkSize k L/2) hlen hprime hV p v f g) + true true (selectedKernelMask (l:=l) C p outside e he hprime v f g)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndex.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..70ccc89e17a572e6a9f193c791836bd1ff9674cb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndex.lean @@ -0,0 +1,24 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexConversion +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +theorem selected_kernel_index_errors_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 0 < k) : + SelectedKernelIndexEstimate d Bs BD Bz H k := + selectedKernelSumEstimate_to_index d Bs BD Bz H k + (selected_kernel_sum_errors_eventually d Bs BD Bz H hBs hH hk) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..778cc9b85fb2ab85325618cef001cfdba6ae5e0e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexBasic.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedIndexFinite + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction Conclusion HistoryBulkIndependentFibreReference +open HistoryBulkActualRootReferenceFamily Filter +open HistoryBulkActualPrincipalKernelStage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g symbolic + (‖(∑v,∑f,∑g,∑p,F false v f g p)-(∑v,∑f,∑g,∑p,F true v f g p)‖ ≤ r₁ ∧ + ‖(∑v,∑f,∑g,∑p,F false v f g p)-(∑v,∑f,∑g,∑p,F true v f g p)‖ ≤ r₂) → + (‖(∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p,F false i.1 i.2.1 i.2.2 p)- + (∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p,F true i.1 i.2.1 i.2.2 p)‖ ≤ r₁ ∧ + ‖(∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p,F false i.1 i.2.1 i.2.2 p)- + (∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p,F true i.1 i.2.1 i.2.2 p)‖ ≤ r₂) := + let F := fun symbolic v f g p => + selectedKernelMean (l:=l) C p outside e he hlen hprime hV v f g symbolic + fun hb => four_sum_bounds_to_index (F false) (F true) r₁ r₂ hb + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexConversion.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexConversion.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b666df39db25a143e67104924689b2e64f02753 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexConversion.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction Conclusion Filter + +theorem selectedKernelSumEstimate_to_index (d : Decomposition) + (Bs BD Bz H : ℝ) (k : ℕ) + (h : SelectedKernelSumEstimate d Bs BD Bz H k) : + SelectedKernelIndexEstimate d Bs BD Bz H k := by + exact h.mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec outside houtside hlen l hl e he => + (h E C hG hGu hcl hcu hb hd spectator hspec outside houtside hlen l hl e he).elim + (fun hprime hex => hex.elim (fun hV hbound => + ⟨hprime,hV,selectedKernelMean_index_bounds (l:=l) C outside e he hlen hprime hV + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) hbound⟩))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a548591dd0507f297e711d7d59c23f016d171ec --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedCorrectedIndexStatement.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedCorrectedStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction Conclusion HistoryBulkIndependentFibreReference +open HistoryBulkActualRootReferenceFamily Filter +attribute [local instance] Classical.propDecidable + +def SelectedKernelIndexEstimate (d : Decomposition) + (Bs BD Bz H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ q:spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (q:ℕ) ∧ + Real.log (q:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (outside : List ℕ) (_houtside : ∀ q∈outside, ∃ r:spectator.Sample, (r:ℕ)=q) + (hlen : outside.length=2*(bulkSize k L/2)), + ∀ l, l + (norm_sum_le _ _).trans (Finset.sum_le_sum (fun j _ => + (norm_sum_le _ _).trans (Finset.sum_le_sum (fun k _ => norm_sum_le _ _)))))) + +theorem four_sum_zero_cost_bounds {α β γ δ : Type*} + [Fintype α] [Fintype β] [Fintype γ] [Fintype δ] + (a b c : α → β → γ → δ → ℂ) + (h : ∀i j k p,a i j k p-b i j k p=c i j k p) + (L r₁ r₂ : ℝ) + (hb : Real.exp (0*(L+1)^2)*(∑i,∑j,∑k,∑p,‖c i j k p‖)≤r₁ ∧ + Real.exp (0*(L+1)^2)*(∑i,∑j,∑k,∑p,‖c i j k p‖)≤r₂) : + ‖(∑i,∑j,∑k,∑p,a i j k p)-(∑i,∑j,∑k,∑p,b i j k p)‖≤r₁ ∧ + ‖(∑i,∑j,∑k,∑p,a i j k p)-(∑i,∑j,∑k,∑p,b i j k p)‖≤r₂ := by + simp only [zero_mul,Real.exp_zero,one_mul] at hb + exact ⟨(norm_four_sum_sub_le a b c h).trans hb.1, + (norm_four_sum_sub_le a b c h).trans hb.2⟩ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedIndexFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedIndexFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..74e5cc59d5cbbca95bf97b393e42090c64f791d8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedIndexFinite.lean @@ -0,0 +1,30 @@ +import Mathlib + +namespace OAI + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +theorem index_sum_eq_four_sum {α β γ δ : Type*} + [Fintype α] [Fintype β] [Fintype γ] [Fintype δ] + (a : α → β → γ → δ → ℂ) : + (∑i : α×(β×γ),∑p,a i.1 i.2.1 i.2.2 p)=∑i,∑j,∑k,∑p,a i j k p := by + simp only [Fintype.sum_prod_type] + +theorem four_sum_bounds_to_index {α β γ δ : Type*} + [Fintype α] [Fintype β] [Fintype γ] [Fintype δ] + (a b : α → β → γ → δ → ℂ) (r₁ r₂ : ℝ) + (h : ‖(∑i,∑j,∑k,∑p,a i j k p)-(∑i,∑j,∑k,∑p,b i j k p)‖≤r₁ ∧ + ‖(∑i,∑j,∑k,∑p,a i j k p)-(∑i,∑j,∑k,∑p,b i j k p)‖≤r₂) : + ‖(∑i : α×(β×γ),∑p,a i.1 i.2.1 i.2.2 p)- + (∑i : α×(β×γ),∑p,b i.1 i.2.1 i.2.2 p)‖≤r₁ ∧ + ‖(∑i : α×(β×γ),∑p,a i.1 i.2.1 i.2.2 p)- + (∑i : α×(β×γ),∑p,b i.1 i.2.1 i.2.2 p)‖≤r₂ := by + simpa only [index_sum_eq_four_sum] using h + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLaws.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..a914f5204e64b964e7bc084d7609a9bcf641372d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLaws.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedLawsBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean Filter +attribute [local instance] Classical.propDecidable +local instance selectedKernelLawsInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_law_kernel_sum_errors_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 0C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ), + let Sp := fun symbolic => ∑v,∑f,∑g,∑p, + primeKernelMean C p outside σ (Jprime p) hactual hl houtside hlen hprime hV v f g symbolic + let Sm := fun symbolic => ∑v,∑f,∑g,∑p, + mixedKernelMean C p outside σ (Jmixed p) hactual hl houtside hlen hprime hV v f g symbolic + (‖Sp false-Sp true‖≤Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖Sp false-Sp true‖≤Real.exp (-H*(bulkSize k L:ℝ))) ∧ + (‖Sm false-Sm true‖≤Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖Sm false-Sm true‖≤Real.exp (-H*(bulkSize k L:ℝ))) := + (selected_kernel_sum_errors_eventually d Bs BD Bz H hBs hH hk).mono + (fun _L h E C hG hGu hcl hcu hb hd spectator hspec => + (h E C hG hGu hcl hcu hb hd spectator hspec).elim (fun hactual h => + ⟨hactual,fun outside houtside hlen l hl => + (h outside houtside hlen l hl).elim (fun hprime h => h.elim (fun hV h => + ⟨hprime,hV,fun σ Jprime Jmixed => + ⟨h σ Jprime (PrimeDraw C.giant) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + (primeWeight_nonneg C.giant) (fun r _ => primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) false false hl, + h σ Jmixed (MixedDraw C.giantCenter C.giant) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) false true hl⟩⟩))⟩)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLawsBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLawsBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..cecac9c25c57132adf731bf60b6166e43dc59688 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLawsBasic.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + hlen hprime hV v f g symbolic false false + +def mixedKernelMean (symbolic : Bool) : ℂ := + selectedKernelMean C p outside σ J (mixedWeight C.giantCenter C.giant) + (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl houtside (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + hlen hprime hV v f g symbolic false true + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLawsIndex.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLawsIndex.lean new file mode 100644 index 0000000000000000000000000000000000000000..3f58a5574e1b42259276e150a0f186d78ba5af16 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSelectedLawsIndex.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedIndexFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedLawsBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean Filter +attribute [local instance] Classical.propDecidable +local instance selectedKernelLawsIndexInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_law_kernel_index_errors_eventually (d : Decomposition) + (Bs BD Bz H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 0C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ), + let Sp := fun symbolic => + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p, + primeKernelMean C p outside σ (Jprime p) hactual hl houtside hlen hprime hV + i.1 i.2.1 i.2.2 symbolic + let Sm := fun symbolic => + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p, + mixedKernelMean C p outside σ (Jmixed p) hactual hl houtside hlen hprime hV + i.1 i.2.1 i.2.2 symbolic + (‖Sp false-Sp true‖≤Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖Sp false-Sp true‖≤Real.exp (-H*(bulkSize k L:ℝ))) ∧ + (‖Sm false-Sm true‖≤Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖Sm false-Sm true‖≤Real.exp (-H*(bulkSize k L:ℝ))) := + (selected_law_kernel_sum_errors_eventually d Bs BD Bz H hBs hH hk).mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec => + (h E C hG hGu hcl hcu hb hd spectator hspec).elim (fun hactual h => + ⟨hactual,fun outside houtside hlen l hl => + (h outside houtside hlen l hl).elim (fun hprime h => h.elim (fun hV h => + ⟨hprime,hV,fun σ Jprime Jmixed => + ⟨four_sum_bounds_to_index + (fun v f g p => primeKernelMean C p outside σ (Jprime p) hactual hl houtside hlen hprime hV v f g false) + (fun v f g p => primeKernelMean C p outside σ (Jprime p) hactual hl houtside hlen hprime hV v f g true) + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) (h σ Jprime Jmixed).1, + four_sum_bounds_to_index + (fun v f g p => mixedKernelMean C p outside σ (Jmixed p) hactual hl houtside hlen hprime hV v f g false) + (fun v f g p => mixedKernelMean C p outside σ (Jmixed p) hactual hl houtside hlen hprime hV v f g true) + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) (h σ Jprime Jmixed).2⟩⟩))⟩)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSquare.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..49be9d696505553503cacdb890db51e157275eae --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageSquare.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageAmplitude +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSplice + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReference +attribute [local instance] Classical.propDecidable +local instance kernelStageSquareInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (symbolic corrected mixed : Bool) (u : SelectedBulkSample C l) : + densityPrincipalProductTerm symbolic + (matchedPrincipalFamily C p outside σ J w P Q hactual hl houtside hw hpos hcell + (bulkSize k L/2) hlen hprime hV true v f g) + (selectedKernelDensitySources C p outside σ J w P Q hactual hl houtside hw hpos hcell + hlen hprime hV v f g) + corrected mixed + (selectedKernelMask C p outside σ J w P Q hactual hl houtside hw hpos hcell hprime v f g) + (restoreOriginalDraw C l p o u) = + (selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).elim 0 + (fun R=>R.restoredKernelTerm hcell hlen hprime hV symbolic corrected mixed u) := by + rw [densityPrincipalProductTerm_eq_projected,originalDrawOuter_restore,originalDrawBulk_restore] + unfold projectedDensityProductTerm + apply @option_dite_get_eq_elim _ _ + (selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos) (Classical.propDecidable _) (0:ℂ) + intro ho + have hmask : + selectedKernelMask C p outside σ J w P Q hactual hl houtside hw hpos hcell hprime v f g + (restoreOriginalDraw C l p o u) = + (let r := ((selectMatchedOuterReference C p o outside σ (J o) w P Q (v,f,g) + hactual hl houtside hw hpos).get ho).frame (l:=l) hcell hprime + let x := fibreAssignment C (outerNonbulk C l p o) u + ((r.newLeft x).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime ∧ + ((r.newRight (permuteAssignment C σ x)).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime) := by + unfold selectedKernelMask + rw [originalDrawOuter_restore,originalDrawAssignment_restore] + unfold selectedKernelOuterMask + exact congrArg + (fun s : Option (MatchedSelectedOuter C p o outside σ (J o) w P Q (v,f,g)) => + match s with + | none => False + | some R => + let r := R.frame (l:=l) hcell hprime + let x := fibreAssignment C (outerNonbulk C l p o) u + ((r.newLeft x).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime ∧ + ((r.newRight (permuteAssignment C σ x)).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime) + (Option.some_get ho).symm + rw [hmask] + dsimp only [matchedPrincipalFamily,selectedKernelDensitySources,MatchedSelectedOuter.restoredKernelTerm] + congr 1 + exact ite_congr rfl (fun _=>rfl) (fun _=>rfl) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageTermBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageTermBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..82d163882d118dd1d572c3854c85fc5dd5d8d25b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageTermBasic.lean @@ -0,0 +1,26 @@ +import Mathlib.Data.Option.Basic + +namespace OAI + +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +theorem option_match_get {α β : Type*} (r : Option α) (z : β) (F : α → β) + (h : r.isSome) : + r.elim z F = F (r.get h) := by + cases r with + | none => cases h + | some a => rfl + +theorem option_dite_get_eq_elim {α β : Type*} (r : Option α) [Decidable (r.isSome)] (z : β) + (F : (h : r.isSome) → β) (G : α → β) + (hFG : ∀h, F h = G (r.get h)) : + (if h : r.isSome then F h else z) = r.elim z G := by + cases r with + | none => simp only [Option.isSome_none,Bool.false_eq_true,dite_false,Option.elim_none] + | some a => + simp only [Option.isSome_some,dite_true,Option.elim_some] + exact hFG rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageValue.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..0000184ed8d2874d1e0551c7a141f3eb62ea0234 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalKernelStageValue.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryPairRepresentatives HistoryPairKernelReplacement +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +local instance kernelStageValueInternalDecidable (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

F bg.2) := by + unfold backgroundPrior + rw [FinitePrior.pair_cmean] + symm + let μ := dependentProductPrior (fun _ : Bool=>C.giant.law) + change μ.cmean (fun _=>(selectedNonbulkPrior C l).cmean F)=_ + simp only [FinitePrior.cmean,←Finset.sum_mul,←Complex.ofReal_sum,μ.mass_total, + Complex.ofReal_one,one_mul] + +theorem originalSourceAverage_eq_backgroundPatternMean (spectator : PrimeSource) + (F : (Fin (2*(bulkSize k L/2))→spectator.Sample) → SelectedNonbulkSample C l → + Draws C (l:=l) → Draws C (l:=l) → RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → ℂ) : + originalSourceAverage C spectator F= + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds=> + (backgroundPrior C l).cmean (fun bg=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l, + drawPatternValue C spectator F ds bg.2 i p b))) := by + rw [originalSourceAverage_eq_patternMean] + apply congrArg (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + funext ds + exact nonbulk_cmean_eq_background C _ + +theorem background_pattern_congr + (F G : Background C l → ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → ℂ) + (h : ∀bg p b,outerMass C l p (restoreOuterBackground C l p bg b)≠0 → + Function.Injective (fun q=>(blockType p q,b q)) → F bg p b=G bg p b) : + (backgroundPrior C l).cmean (fun bg=>patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (F bg))= + (backgroundPrior C l).cmean (fun bg=>patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (G bg)) := by + classical + apply FinitePrior.cmean_congr_support + intro bg hbg + unfold patternComplexSum + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + by_cases hw : patternWeight C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p b=0 + · simp only [hw,Complex.ofReal_zero,zero_mul] + by_cases ht : Function.Injective (fun q=>(blockType p q,b q)) + · have hp : (∏q : Block p,biasedBlockWeight C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) p q (b q))≠0 := + (mul_ne_zero_iff.mp hw).1 + have ho : outerMass C l p (restoreOuterBackground C l p bg b)≠0 := by + rw [outerMass_restoreOuterBackground] + exact mul_ne_zero hbg hp + rw [ite_eq_left ht,ite_eq_left ht,h bg p b ho ht] + · simp only [ht,ite_false] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexBackgroundRoot.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexBackgroundRoot.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc2b1fc72a177315f9caf32f5a1f8100b9083d91 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexBackgroundRoot.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexBackground + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualPrincipalBlockFamily HistoryBulkUniversalPatternAggregation +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkReferenceFrequencyFamily HistoryPairSourceLaws +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + +theorem background_pattern_root_congr {β : Type*} [Fintype β] + (F G : Background C l → β → + ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → ℂ) + (h : ∀bg i p b,outerMass C l p (restoreOuterBackground C l p bg b)≠0 → + Function.Injective (fun q=>(blockType p q,b q)) → F bg i p b=G bg i p b) : + (backgroundPrior C l).cmean (fun bg=>patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑i:β,F bg i p b))= + (backgroundPrior C l).cmean (fun bg=>patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑i:β,G bg i p b)) := + background_pattern_congr C _ _ + (fun bg p b ho ht=>Finset.sum_congr rfl (fun i _=>h bg i p b ho ht)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensation.lean new file mode 100644 index 0000000000000000000000000000000000000000..50a8eb8e438ce6756e852d4f526ff2c665da5afc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensation.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensationBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAveragePrincipal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensation +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkPrincipalSourceReindex HistoryPairSourceLaws +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkReferencePeriodicMeanSource HistoryGiantReferenceMean +local instance compensationPrincipalInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀j,(expand p b j).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) + +theorem primeWitnessPrincipal_div_blockJacobian + (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (r : Witness C outside σ a (leftDraws C p b hb) (rightDraws C p b hb) + (fun _ _ _ _ => 1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C (leftDraws C p b hb) i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C (rightDraws C p b hb) i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : + let f := primeWitnessFrame C outside σ a (leftDraws C p b hb) (rightDraws C p b hb) + (fun _ _ _ _ => 1) r ha hc he hp + primeWitnessPrincipal C outside σ a (leftDraws C p b hb) (rightDraws C p b hb) + r ha hc he hp / blockJacobian C p b = + (selectedBulkPrior C l).cmean (fun u => + staticPairMask (f.newLeft (fibreAssignment C a u)) + (f.newRight (permuteAssignment C σ (fibreAssignment C a u))) outside * + f.principal σ (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u))) := by + dsimp only + dsimp only [primeWitnessPrincipal] + rw [frame_oldCompensation] + change ((pairedChoiceCompensation C (leftChoices C (leftDraws C p b hb) i) + (rightChoices C (rightDraws C p b hb) i):ℂ)*_) / blockJacobian C p b = _ + rw [pairedChoiceCompensation_eq_blockJacobian] + rw [mul_comm,mul_div_cancel_right₀ _ (blockJacobian_ne_zero C p b)] + +theorem mixedWitnessPrincipal_div_blockJacobian + (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (r : Witness C outside σ a (leftDraws C p b hb) (rightDraws C p b hb) + (fun i => plainMixedWeight C outside a i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C (leftDraws C p b hb) i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C (rightDraws C p b hb) i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : + let f := mixedWitnessFrame C outside σ a (leftDraws C p b hb) (rightDraws C p b hb) + (fun i => plainMixedWeight C outside a i.1.val) r ha hc he hp + mixedWitnessPrincipal C outside σ a (leftDraws C p b hb) (rightDraws C p b hb) + r ha hc he hp / blockJacobian C p b = + (selectedBulkPrior C l).cmean (fun u => + staticPairMask (f.newLeft (fibreAssignment C a u)) + (f.newRight (permuteAssignment C σ (fibreAssignment C a u))) outside * + f.principalMixed σ (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u))) := by + dsimp only + dsimp only [mixedWitnessPrincipal] + rw [frame_oldCompensation] + change ((pairedChoiceCompensation C (leftChoices C (leftDraws C p b hb) i) + (rightChoices C (rightDraws C p b hb) i):ℂ)*_) / blockJacobian C p b = _ + rw [pairedChoiceCompensation_eq_blockJacobian] + rw [mul_comm,mul_div_cancel_right₀ _ (blockJacobian_ne_zero C p b)] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..c82b14cf00f1349b1185d6d1bef228af12379753 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationBasic.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexCancellation +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexWitnessBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensation +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkPrincipalSourceReindex HistoryPairSourceLaws +local instance compensationInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀j,(expand p b j).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) + +theorem pairedChoiceCompensation_eq_blockJacobian + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) : + (pairedChoiceCompensation C (leftChoices C (leftDraws C p b hb) i) + (rightChoices C (rightDraws C p b hb) i):ℂ)=blockJacobian C p b := by + have h := pairedChoiceCompensation_assemble C i.2.1 i.2.2 + (HistoryCompensationRepresentativePatterns.blockSourceDraws C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p b hb) + change (pairedChoiceCompensation C (leftChoices C (leftDraws C p b hb) i) + (rightChoices C (rightDraws C p b hb) i):ℂ)=_ at h + rw [h] + apply congrArg (occurrenceJacobian C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + funext j + apply Subtype.ext + rfl + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationComplete.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationComplete.lean new file mode 100644 index 0000000000000000000000000000000000000000..bcc2a9b45aaf18d8407318052b159d02c1818be9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationComplete.lean @@ -0,0 +1,12 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensation +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensationCorrected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..abcbc9780ec6af645b9989ef0e5cda069a176d50 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCompensationCorrected.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensationBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensation +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkPrincipalSourceReindex HistoryPairSourceLaws +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkReferencePeriodicMeanSource HistoryGiantReferenceMean +open HistoryBulkIndependentFibreReference HistoryDiagonalRemainingRootMatching +local instance compensationCorrectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀j,(expand p b j).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) + +theorem correctedWitnessPrincipal_div_blockJacobian + (outside : List ℕ) (a : SelectedNonbulkSample C l) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (s t : ℤ) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (r : HistoryBulkActualCorrectedReferenceFamily.Witness C outside a e s t + (leftChoices C (leftDraws C p b hb) i) (rightChoices C (rightDraws C p b hb) i)) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C (leftDraws C p b hb) i) ≠ 0) + (hd : choicesMass C.sources _ _ l (rightChoices C (rightDraws C p b hb) i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : + let f := HistoryBulkActualCorrectedReferenceFamily.witnessFrame C outside a e s t + (leftChoices C (leftDraws C p b hb) i) (rightChoices C (rightDraws C p b hb) i) + he ha hc hd hp r + correctedWitnessPrincipal C outside a e he s t + (leftChoices C (leftDraws C p b hb) i) (rightChoices C (rightDraws C p b hb) i) + r ha hc hd hp / blockJacobian C p b = + (selectedBulkPrior C l).cmean (fun u => + let y := rightAssignment C a e u (reference_compatible_all C outside a e he s t + (leftChoices C (leftDraws C p b hb) i) (rightChoices C (rightDraws C p b hb) i) r u) + staticPairMask (f.newLeft (fibreAssignment C a u)) (f.newRight y) outside * + f.principalCorrectedMixed (bulkPermutation e he) (fibreAssignment C a u) y) := by + dsimp only + dsimp only [correctedWitnessPrincipal] + rw [frame_oldCompensation] + change ((pairedChoiceCompensation C (leftChoices C (leftDraws C p b hb) i) + (rightChoices C (rightDraws C p b hb) i):ℂ)*_) / blockJacobian C p b = _ + rw [pairedChoiceCompensation_eq_blockJacobian] + rw [mul_comm,mul_div_cancel_right₀ _ (blockJacobian_ne_zero C p b)] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..732a881ed4c93baeb4544fa9ac07a901cf2efa7d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrected.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualGoodPrincipal +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkIndependentFibreReference +open HistoryBulkFibreGiantApproximationReference HistoryPairRepresentatives +open HistoryPairReferenceSourceTransport HistoryBulkActualPrincipalBlockFamily +open HistoryBulkPrincipalBSquareReference HistoryBulkPrincipalBSquareReplacement +open HistoryBulkActualPrincipalSourceReindex HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource CanonicalHistoryLeafBulk +open HistoryDiagonalRemainingRootMatching +attribute [local instance] Classical.propDecidable +local instance correctedSquareInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +variable (had : PairAdmissible (R.frame he hprime).left (R.frame he hprime).right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} +namespace CorrectedSelectedOuter +variable (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) (hprime : ∀q∈outside,q.Prime) + +def squareRightSource (u : SelectedBulkSample C l) : Frame.Source (C:=C) (l:=l) := + rightAssignment C (outerNonbulk C l p o) e u + (reference_compatible_all C outside (outerNonbulk C l p o) e he i.1.val i.1.val + (leftChoices C (leftBlockDraws C p R.data.blockDraw R.data.valid) i) + (rightChoices C (rightBlockDraws C p R.data.blockDraw R.data.valid) i) R.witness u) + +theorem squareSource_mass (R : CorrectedSelectedOuter C p o outside e i) (u : SelectedBulkSample C l) + (hu : (selectedBulkPrior C l).mass u≠0) : + (assignmentPrior C.sources _).mass (fibreAssignment C (outerNonbulk C l p o) u)≠0 := + (fibreAssignment_mass_pos C _ u R.data.nonbulk_pos + (lt_of_le_of_ne ((selectedBulkPrior C l).mass_nonneg u) (Ne.symm hu))).ne' + +variable (had : PairAdmissible (R.frame he hprime).left (R.frame he hprime).right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedOuter (l:=l) C outside e bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) he hp)))= + (selectedBulkPrior C l).cmean (fun u=>∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>densityPatternFactor (C:=C) (l:=l) + (referenceFamily (l:=l) C outside e he hp hAd hout hV bg u i) + (densitySources (l:=l) C outside e he hp bg u i) false true true + (staticMask (l:=l) C outside e he hp bg u i) p b)) := + pattern_root_cmean_exchange_of_point + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) + (α:=SelectedBulkSample C l) + (β:=Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (selectedBulkPrior C l) + (fun i p b=>(selectedOuter (l:=l) C outside e bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) he hp))) + (fun i u p b=>densityPatternFactor (C:=C) (l:=l) + (referenceFamily (l:=l) C outside e he hp hAd hout hV bg u i) + (densitySources (l:=l) C outside e he hp bg u i) false true true + (staticMask (l:=l) C outside e he hp bg u i) p b) + (fun i p b=>corrected_raw_option_cmean_eq_densityFactor (l:=l) + C outside e he hp hAd hout hV hfreq bg i p b) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..a149b4cccd1b17ba5e72364e4f49a5530a09e892 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanDefs.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkUniversalPatternAggregationBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +local instance correctedRawSourceMeanInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jpatternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedOuter (l:=l) C outside e bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) he hp)))) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanExchange.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanExchange.lean new file mode 100644 index 0000000000000000000000000000000000000000..1eb100e5f85557873b9da8baa1de3d17ce32ab83 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanExchange.lean @@ -0,0 +1,34 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexExchange + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable + +theorem pattern_root_cmean_exchange_of_point + {ι α β : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] [Fintype β] + (sources : SourceFamily) (origin τ : ι → ℕ) (μ : FinitePrior α) + (F : β → ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) + (G : β → α → ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) + (h : ∀i p b,F i p b=μ.cmean (fun u=>G i u p b)) : + patternComplexSum sources origin τ (fun p b=>∑i:β,F i p b)= + μ.cmean (fun u=>∑i:β,patternComplexSum sources origin τ (G i u)) := by + have he : (fun p b=>∑i:β,F i p b)= + (fun p b=>∑i:β,μ.cmean (fun u=>G i u p b)) := by + funext p b + exact Finset.sum_congr rfl (fun i _=>h i p b) + exact (congrArg (patternComplexSum sources origin τ) he).trans + (pattern_root_cmean_exchange sources origin τ μ G) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanOption.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanOption.lean new file mode 100644 index 0000000000000000000000000000000000000000..aa73291f5ddc0db1ee92e1dbf59ce810880be028 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanOption.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexExchange +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkActualPrincipalSourceReindex +open HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open HistoryBulkIndependentFibreReference HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) he hp))= + (selectedBulkPrior C l).cmean + (fun u=>(selectedOuter (l:=l) C outside e bg i p b).elim 0 + (fun R=>R.squareBTerm (l:=l) he hp (hAd (R.frame (l:=l) he hp)) hout hV u)) := by + have hmean := fun R : CorrectedSelectedOuter C p + (restoreOuterBackground C l p bg b) outside e i => + R.mean_rawBTerm_eq_squareBTerm (l:=l) he hp + (hAd (R.frame (l:=l) he hp)) hout hV hfreq + exact (congrArg ((selectedOuter (l:=l) C outside e bg i p b).elim (0:ℂ)) + (funext hmean)).trans + (option_cmean (selectedBulkPrior C l) + (selectedOuter (l:=l) C outside e bg i p b) + (fun R=>R.squareBTerm (l:=l) he hp + (hAd (R.frame (l:=l) he hp)) hout hV)) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanPoint.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..a3bcf43f6421d36af439b04a49c349d7dbb7f53b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedMeanPoint.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedMeanOption +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFactors + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +local instance correctedRawSourceMeanPointInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) he hp))= + (selectedBulkPrior C l).cmean (fun u=>densityPatternFactor + (referenceFamily (l:=l) C outside e he hp hAd hout hV bg u i) + (densitySources (l:=l) C outside e he hp bg u i) false true true + (staticMask (l:=l) C outside e he hp bg u i) p b) := by + refine (raw_option_cmean_eq_square (l:=l) C outside e he hp hAd hout hV hfreq bg i p b).trans ?_ + apply congrArg (selectedBulkPrior C l).cmean + funext u + exact (HistoryBulkActualPrincipalSourceReindexFamilyCorrected.densityPatternFactor_false_eq + (l:=l) C outside e he hp hAd hout hV bg u i p b).symm + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4bdac6c62d6fcada0800232bbe3ff4dc5d368d4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexCorrectedSource.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementCorrectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexRawCorrected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualPrincipalBlockFamily HistoryBulkUniversalPatternAggregation +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkFibreGiantErrorAverage +open HistoryBulkReferenceFrequencyFamily HistoryPairSourceLaws +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open HistoryBulkActualPrincipalSourceReindexOption HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantApproximation +open HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (e : HistoryBulkIndependentFibreReference.RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + +theorem original_corrected_principal_eq_B_sourceMean + (hAd : ∀ds : Fin (2*(bulkSize k L/2))→spectator.Sample, + ∀r : Frame (l:=l) C (spectatorList spectator ds), + PairAdmissible r.left r.right (spectatorList spectator ds)) + (hV : ∀ds : Fin (2*(bulkSize k L/2))→spectator.Sample, + ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + @correctedSourceMean d Bs BD Bz L k l E C (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (hAd ds) List.length_ofFn (hV ds) false) := + (@original_corrected_principal_eq_rawSourceMean d Bs BD Bz L k l E C spectator e he).trans + (FinitePrior.cmean_congr_support (spectatorPrior spectator (2*(bulkSize k L/2))) _ _ + (fun ds _=>@correctedRawSourceMean_eq_correctedSourceMean d Bs BD Bz L k l E + C (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (hAd ds) List.length_ofFn (hV ds) (hfreq ds))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexExchange.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexExchange.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c0e043e8156524fc5f1959a5525f63b470882b2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexExchange.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexBackground + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryBulkUniversalPatternAggregation HistoryBulkPrincipalSourceReindex +attribute [local instance] Classical.propDecidable +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem patternComplexSum_mul_left (sources : SourceFamily) (origin τ : ι → ℕ) + (c : ℂ) (F : ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + patternComplexSum sources origin τ (fun p b=>c*F p b)=c*patternComplexSum sources origin τ F := by + classical + unfold patternComplexSum + simp only [Finset.mul_sum] + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + split_ifs <;> ring + +theorem patternComplexSum_cmean {α : Type*} [Fintype α] + (sources : SourceFamily) (origin τ : ι → ℕ) (μ : FinitePrior α) + (F : α → ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + patternComplexSum sources origin τ (fun p b=>μ.cmean (fun u=>F u p b))= + μ.cmean (fun u=>patternComplexSum sources origin τ (F u)) := by + unfold FinitePrior.cmean + rw [patternComplexSum_sum] + apply Finset.sum_congr rfl + intro u _ + exact patternComplexSum_mul_left sources origin τ (μ.mass u:ℂ) (F u) + +theorem option_cmean {α β : Type*} [Fintype α] (μ : FinitePrior α) + (r : Option β) (F : β → α → ℂ) : + r.elim 0 (fun v=>μ.cmean (F v))=μ.cmean (fun u=>r.elim 0 (fun v=>F v u)) := by + cases r with + | none => simp only [Option.elim_none,FinitePrior.cmean,mul_zero,Finset.sum_const_zero] + | some r => rfl + +theorem pattern_root_cmean_exchange {α β : Type*} [Fintype α] [Fintype β] + (sources : SourceFamily) (origin τ : ι → ℕ) (μ : FinitePrior α) + (F : β → α → ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + patternComplexSum sources origin τ (fun p b=>∑i:β,μ.cmean (fun u=>F i u p b))= + μ.cmean (fun u=>∑i:β,patternComplexSum sources origin τ (F i u)) := by + rw [patternComplexSum_sum,FinitePrior.cmean_sum] + apply Finset.sum_congr rfl + intro i _ + exact patternComplexSum_cmean sources origin τ μ (F i) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..52a23c65992061cbafb7b73ea658fd236acfd02e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyBasic.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensityBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyBasic +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkFibreGiantApproximation +open HistoryBulkPrincipalBSquareReplacement +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + (R : ReferenceFamily C outside l) (X : DensitySources C l) + (probability corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + +theorem factor_of_some (S : PrincipalSquareReference C outside l p b) (h : R p b=some S) : + densityPatternFactor R X probability corrected mixed mask p b = + (if mixed then Frame.extractedDensity (C:=C) (X p b) else 1) * + ((if mask p b then 1 else 0) * + (S.principal.value corrected mixed S.newBulk * + (if probability then probabilityProduct S mixed else bMean S mixed))) := by + unfold densityPatternFactor densityFactor principalPatternFactor principalValue optionalPrincipalBFactor + rw [h] + +theorem factor_of_none (h : R p b=none) : + densityPatternFactor R X probability corrected mixed mask p b=0 := by + unfold densityPatternFactor principalPatternFactor principalValue optionalPrincipalBFactor + rw [h] + simp only [mul_zero] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyBasic + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..273d37161c57faf93db76bfef52d0e736df9d4aa --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedDefs.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensityBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + if hu : (selectedBulkPrior C l).mass u≠0 then + (selectedOuter C outside e bg i p b).map + (fun R=>R.squareReference (l:=l) he hp (hAd (R.frame (l:=l) he hp)) hout hV u hu) + else none + +def densitySources : DensitySources C l := fun p b=> + (selectedOuter C outside e bg i p b).elim + (fibreAssignment C bg.2 u) (fun R=>(R.frame (l:=l) he hp).leftSource) + +variable (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + +def staticCondition + (R : CorrectedSelectedOuter C p (restoreOuterBackground C l p bg b) outside e i) : Prop := + let f := R.frame (l:=l) he hp + let x := fibreAssignment C bg.2 u + let y := R.squareRightSource (l:=l) he u + (((f.newLeft x).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime ∧ + ((f.newRight y).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime) + +def staticMask : Prop := + (selectedBulkPrior C l).mass u≠0 ∧ + (selectedOuter C outside e bg i p b).elim False + (fun R=>staticCondition C outside e he hp bg u i p b R) + +def expression (probability : Bool) : ℂ := + densityBExpressionSum + (referenceFamily C outside e he hp hAd hout hV bg u i) + (densitySources C outside e he hp bg u i) probability true true + (staticMask C outside e he hp bg u i) + +def rootExpression (probability : Bool) : ℂ := + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + expression C outside e he hp hAd hout hV bg u i probability + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFactors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..9df409edad0284c57787210fd08f247274dd674c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFactors.lean @@ -0,0 +1,113 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFalse + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + have hf : referenceFamily C outside e he hp hAd hout hV bg u i p b=none := by + unfold referenceFamily + rw [dite_eq_left hu,hr] + rfl + rw [HistoryBulkActualPrincipalSourceReindexFamilyBasic.factor_of_none _ _ _ _ _ _ _ _ hf] + unfold selectedTerm + rw [hr] + rfl + | some R => + let S : PrincipalSquareReference C outside l p b := + R.squareReference (l:=l) he hp (hAd (R.frame (l:=l) he hp)) hout hV u hu + have hf : referenceFamily C outside e he hp hAd hout hV bg u i p b=some S := by + unfold referenceFamily + rw [dite_eq_left hu,hr] + rfl + rw [HistoryBulkActualPrincipalSourceReindexFamilyBasic.factor_of_some _ _ _ _ _ _ _ _ S hf] + have hx : densitySources C outside e he hp bg u i p b=(R.frame (l:=l) he hp).leftSource := by + unfold densitySources + rw [hr] + rfl + rw [hx] + have hm : staticMask C outside e he hp bg u i p b = + staticCondition C outside e he hp bg u i p b R := by + apply propext + unfold staticMask + rw [hr] + exact and_iff_right hu + rw [hm] + have ht : selectedTerm C outside e he hp hAd hout hV bg u i p b probability = + (if staticCondition C outside e he hp bg u i p b R then 1 else 0) * + (Frame.extractedDensity (C:=C) (R.frame (l:=l) he hp).leftSource * + (S.principal.value true true S.newBulk * + (if probability then probabilityProduct S true else bMean S true))) := by + unfold selectedTerm + rw [hr] + change squareTerm C outside e he hp hAd hout hV bg u i p b R probability = _ + unfold squareTerm + rw [dite_eq_left hu] + rfl + rw [ht] + exact mul_left_comm _ _ _ + · have hf : referenceFamily C outside e he hp hAd hout hV bg u i p b=none := by + unfold referenceFamily + rw [dite_eq_right hu] + rw [HistoryBulkActualPrincipalSourceReindexFamilyBasic.factor_of_none _ _ _ _ _ _ _ _ hf] + unfold selectedTerm + cases selectedOuter C outside e bg i p b with + | none => rfl + | some R => + change 0 = squareTerm C outside e he hp hAd hout hV bg u i p b R probability + unfold squareTerm + rw [dite_eq_right hu] + +theorem densityPatternFactor_false_eq : + densityPatternFactor + (referenceFamily C outside e he hp hAd hout hV bg u i) + (densitySources C outside e he hp bg u i) false true true + (staticMask C outside e he hp bg u i) p b = + (selectedOuter C outside e bg i p b).elim 0 + (fun R=>R.squareBTerm (l:=l) he hp (hAd (R.frame (l:=l) he hp)) hout hV u) := by + rw [densityPatternFactor_eq] + unfold selectedTerm + cases selectedOuter C outside e bg i p b with + | none => rfl + | some R => exact squareTerm_false C outside e he hp hAd hout hV bg u i p b R + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFalse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFalse.lean new file mode 100644 index 0000000000000000000000000000000000000000..6ec882fbcad36b13e2175f50319ce42723cfbb2a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyCorrectedFalse.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrectedTerms + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jsquareTerm C outside e he hp hAd hout hV bg u i p b R probability) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..ad46e1940b6ce1c061a7e93bd9347ed5f9cab8d8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyDefs.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensityBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +local instance reindexFamilyDefsInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ if hu : (selectedBulkPrior C l).mass u≠0 then + (selectedOuter C outside σ J w P Q hactual hl houtside hw hpos bg i p b).map + (fun R=>R.squareReference (l:=l) hcell hp (hAd (R.frame (l:=l) hcell hp)) + hout hV u hu) + else none + +def densitySources : DensitySources C l := fun p b=> + (selectedOuter C outside σ J w P Q hactual hl houtside hw hpos bg i p b).elim + (fibreAssignment C bg.2 u) (fun R=>(R.frame (l:=l) hcell hp).leftSource) + +def staticCondition (r : Frame (l:=l) C outside) : Prop := + let x := fibreAssignment C bg.2 u + let y := permuteAssignment C σ x + (((r.newLeft x).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime ∧ + ((r.newRight y).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime) + +def staticMask + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : Prop := + (selectedBulkPrior C l).mass u≠0 ∧ + (selectedOuter C outside σ J w P Q hactual hl houtside hw hpos bg i p b).elim + False (fun R=>staticCondition C outside σ bg u (R.frame (l:=l) hcell hp)) + +def expression (probability corrected mixed : Bool) : ℂ := + densityBExpressionSum + (referenceFamily C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i) + (densitySources C outside σ J w P Q hactual hl houtside hw hpos hcell hp bg u i) + probability corrected mixed + (staticMask C outside σ J w P Q hactual hl houtside hw hpos hcell hp bg u i) + +def rootExpression (probability corrected mixed : Bool) : ℂ := + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + expression C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i + probability corrected mixed + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyFactors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..d90b18f8ddaa9d289237d89eb6fda79768084cdd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyFactors.lean @@ -0,0 +1,91 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyFalse + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ simp only [densityPatternFactor, densityFactor, principalPatternFactor, principalValue, + optionalPrincipalBFactor, referenceFamily, densitySources, staticMask, selectedTerm, + hr, Option.elim_none, and_false, ↓reduceIte, + mul_zero, zero_mul] + | some R => + simp only [densityPatternFactor, densityFactor, principalPatternFactor, principalValue, + optionalPrincipalBFactor, referenceFamily, densitySources, staticMask, selectedTerm, + squareTerm, hr, Option.elim_some] + rw [dite_eq_left hu, dite_eq_left hu] + simp only [and_iff_right hu] + change _ = (if staticCondition C outside σ bg u (R.frame (l:=l) hcell hp) then 1 else 0) * _ + exact mul_left_comm _ _ _ + · simp only [densityPatternFactor, principalPatternFactor, principalValue, + optionalPrincipalBFactor, referenceFamily, staticMask, selectedTerm, + hu, ↓reduceDIte, false_and, ↓reduceIte, mul_zero] + cases selectedOuter C outside σ J w P Q hactual hl houtside hw hpos bg i p b with + | none => rfl + | some R => simp only [Option.elim_some, squareTerm, hu, ↓reduceDIte] + +theorem densityPatternFactor_false_eq : + ∀ corrected mixed : Bool, + densityPatternFactor + (referenceFamily C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i) + (densitySources C outside σ J w P Q hactual hl houtside hw hpos hcell hp bg u i) + false corrected mixed + (staticMask C outside σ J w P Q hactual hl houtside hw hpos hcell hp bg u i) p b = + (selectedOuter C outside σ J w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>R.squareBTerm (l:=l) hcell hp (hAd (R.frame (l:=l) hcell hp)) hout hV corrected mixed u) := by + intro corrected mixed + rw [densityPatternFactor_eq] + unfold selectedTerm + cases selectedOuter C outside σ J w P Q hactual hl houtside hw hpos bg i p b with + | none => rfl + | some R => exact squareTerm_false C outside σ J w P Q hcell hp hAd hout hV bg u i p b R corrected mixed + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyFalse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyFalse.lean new file mode 100644 index 0000000000000000000000000000000000000000..f14186ff8daa408cae83c6fef61a7e9f10f71fe2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexFamilyFalse.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyTerms + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

squareTerm C outside σ J w P Q hcell hp hAd hout hV bg u i p b R + probability corrected mixed) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexGeometry.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexGeometry.lean new file mode 100644 index 0000000000000000000000000000000000000000..d704248585ce486368fb2e40ded47265029fcbab --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexGeometry.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion Filter HistoryBulkFibreGiantApproximation +open HistoryBulkPrincipalBSquareReference HistoryBulkSupportConverse +open HistoryGiantReferenceMean HistoryRepresentativeSourceSeparation + +theorem selected_square_geometry_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k : ℕ} (hk : 0hf j (hj.trans hl),?_⟩ + · intro q hq j hj + exact hs ⟨q,hout q hq⟩ j (hj.trans hl) + · intro r + exact (hframe E C hG hcl hcu hb hd spectator hspec + (spectatorList spectator ds) hout l hl r).1 + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMatched.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMatched.lean new file mode 100644 index 0000000000000000000000000000000000000000..103a813818fa25066b9d209dfd6ca8d4805b94ee --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMatched.lean @@ -0,0 +1,102 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexSquare + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamily +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryPairRepresentatives +open HistoryPairReferenceSourceTransport +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +namespace MatchedSelectedOuter +variable (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

rawSourceBackground_eq (l:=l) C outside σ J w P Q hactual hl houtside hw hpos + hcell hp hAd hout hV hfreq corrected mixed hmode bg) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackground.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackground.lean new file mode 100644 index 0000000000000000000000000000000000000000..ce33de42c2f08f24f2d3dd4821f97c7ea6c97364 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackground.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanBackgroundLiteral +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkPrincipalBSquareReplacement.squareDensityBasicInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) hcell hp corrected mixed)))= + (selectedBulkPrior C l).cmean (fun u=>rootExpression (l:=l) + C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u false corrected mixed) := + rawSourceBackground_literal_eq (l:=l) C outside σ J w P Q hactual hl houtside hw hpos + hcell hp hAd hout hV hfreq corrected mixed hmode bg + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundExchange.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundExchange.lean new file mode 100644 index 0000000000000000000000000000000000000000..767aa9e76c5422e4d5ca698a773441e88d299c3b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundExchange.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedMeanExchange +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanBackgroundFunctions + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkPrincipalBSquareReplacement.squareDensityBasicInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + rawBackgroundPoint C outside σ J w P Q hactual hl houtside hw hpos hcell hp corrected mixed bg i p b)= + (selectedBulkPrior C l).cmean (fun u=>∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (densityBackgroundPoint C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV corrected mixed bg i u)) := + pattern_root_cmean_exchange_of_point + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ Internal (Template.initial (2*(bulkSize k L/2)) k) l) + (α:=SelectedBulkSample C l) + (β:=Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (selectedBulkPrior C l) + (rawBackgroundPoint C outside σ J w P Q hactual hl houtside hw hpos hcell hp corrected mixed bg) + (densityBackgroundPoint C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV corrected mixed bg) + (fun i p b=>rawBackgroundPoint_eq_density C outside σ J w P Q hactual hl houtside hw hpos + hcell hp hAd hout hV corrected mixed bg i hfreq hmode p b) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundFunctions.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundFunctions.lean new file mode 100644 index 0000000000000000000000000000000000000000..96dadf5e96a1f709e28ff8d43af2d079a4c47d8f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundFunctions.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanPoint + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkPrincipalBSquareReplacement.squareDensityBasicInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) hcell hp corrected mixed)) + +def densityBackgroundPoint (u : SelectedBulkSample C l) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + densityPatternFactor (C:=C) (l:=l) + (referenceFamily (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i) + (densitySources (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) + false corrected mixed + (staticMask (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) p b + +variable (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j)) +include hfreq + +theorem rawBackgroundPoint_eq_density (hmode : corrected=false ∨ mixed=true) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + rawBackgroundPoint C outside σ J w P Q hactual hl houtside hw hpos hcell hp corrected mixed bg i p b = + (selectedBulkPrior C l).cmean (fun u=> + densityBackgroundPoint C outside σ J w P Q hactual hl houtside hw hpos hcell hp hAd hout hV corrected mixed bg i u p b) := + raw_point_eq_density_cmean (l:=l) C outside σ J w P Q hactual hl houtside hw hpos + hcell hp hAd hout hV hfreq corrected mixed hmode bg p b i + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundLiteral.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundLiteral.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d9a4a3f30a2cc925a43eea83e4d8dde202f6a71 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanBackgroundLiteral.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanBackgroundExchange +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +attribute [local instance] HistoryBulkPrincipalBSquareReplacement.squareDensityBasicInternalDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) hcell hp corrected mixed)))= + (selectedBulkPrior C l).cmean (fun u=>∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>densityPatternFactor (C:=C) (l:=l) + (referenceFamily (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i) + (densitySources (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) + false corrected mixed + (staticMask (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) p b)) := + rawSourceBackground_functions_eq (l:=l) C outside σ J w P Q hactual hl houtside hw hpos + hcell hp hAd hout hV hfreq corrected mixed hmode bg + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec2baba554f614d562cdf34bc68578cb05fcf958 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanDefs.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + (selectedOuter C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) hcell hp corrected mixed)))) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanOption.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanOption.lean new file mode 100644 index 0000000000000000000000000000000000000000..b22e6c3143b2079ec1dde7fd0881d4fbe7ecf6d7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanOption.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatched +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanOptionBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) hcell hp false false))= + (selectedBulkPrior C l).cmean + (fun u=>(selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>R.squareBTerm (l:=l) hcell hp (hAd (R.frame (l:=l) hcell hp)) hout hV false false u)) := by + exact option_cmean_congr (selectedBulkPrior C l) + (selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b) + (fun R=>R.rawBTerm (l:=l) hcell hp false false) + (fun R=>R.squareBTerm (l:=l) hcell hp (hAd (R.frame (l:=l) hcell hp)) hout hV false false) + (fun R=>R.mean_rawBTerm_prime_eq_squareBTerm (l:=l) hcell hp + (hAd (R.frame (l:=l) hcell hp)) hout hV hfreq) + +theorem plain_mixed_raw_option_cmean_eq_square (corrected : Bool) (bg : Background C l) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : + (selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) hcell hp corrected true))= + (selectedBulkPrior C l).cmean + (fun u=>(selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>R.squareBTerm (l:=l) hcell hp (hAd (R.frame (l:=l) hcell hp)) hout hV corrected true u)) := by + exact option_cmean_congr (selectedBulkPrior C l) + (selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b) + (fun R=>R.rawBTerm (l:=l) hcell hp corrected true) + (fun R=>R.squareBTerm (l:=l) hcell hp (hAd (R.frame (l:=l) hcell hp)) hout hV corrected true) + (fun R=>R.mean_rawBTerm_mixed_eq_squareBTerm (l:=l) hcell hp + (hAd (R.frame (l:=l) hcell hp)) hout hV hfreq corrected) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanOptionBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanOptionBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..01e2e3e698730ea2eb523de0f04da125c8cdf4ac --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanOptionBasic.lean @@ -0,0 +1,25 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexExchange +import OAI.NumberTheory.Ostmann.Construction.FiniteTransfer + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction + +theorem option_cmean_congr {α β : Type*} [Fintype α] + (μ : FinitePrior α) (o : Option β) (f g : β → α → ℂ) + (h : ∀r, μ.cmean (f r)=μ.cmean (g r)) : + o.elim 0 (fun r=>μ.cmean (f r)) = + μ.cmean (fun u=>o.elim 0 (fun r=>g r u)) := + (congrArg (o.elim (0:ℂ)) (funext h)).trans (option_cmean μ o g) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanPoint.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..4bd1a438b92d02988db716869b8564d3fa6c7e95 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMeanPoint.lean @@ -0,0 +1,93 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexFamilyFactors +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanOption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreOriginalReference +open HistoryBulkPrincipalBSquareReplacement HistoryRepresentativeSourceSeparation +open HistoryBulkReferenceFrequencyFamily +open HistoryBulkActualPrincipalSourceReindexFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (J : Background C l → Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ (selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>R.squareBTerm (l:=l) hcell hp (hAd (R.frame (l:=l) hcell hp)) hout hV corrected mixed u)) = + (selectedBulkPrior C l).cmean (fun u=>densityPatternFactor + (referenceFamily (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i) + (densitySources (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) + false corrected mixed + (staticMask (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) p b) := by + exact FinitePrior.cmean_congr_support (selectedBulkPrior C l) _ _ + (fun u _ => (densityPatternFactor_false_eq (l:=l) C outside σ (J bg) w P Q + hactual hl houtside hw hpos hcell hp hAd hout hV bg u i p b corrected mixed).symm) + +variable (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j)) +include hfreq + +theorem raw_point_eq_density_cmean (corrected mixed : Bool) + (hmode : corrected=false ∨ mixed=true) (bg : Background C l) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + (selectedOuter (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos bg i p b).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm (l:=l) hcell hp corrected mixed))= + (selectedBulkPrior C l).cmean (fun u=>densityPatternFactor + (referenceFamily (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp hAd hout hV bg u i) + (densitySources (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) + false corrected mixed + (staticMask (l:=l) C outside σ (J bg) w P Q hactual hl houtside hw hpos hcell hp bg u i) p b) := by + cases mixed with + | false => + have hc : corrected=false := hmode.elim id (fun h=>False.elim (Bool.noConfusion h)) + subst corrected + exact (plain_prime_raw_option_cmean_eq_square (l:=l) C outside σ J w P Q + hactual hl houtside hw hpos hcell hp hAd hout hV hfreq bg i p b).trans + (square_option_cmean_eq_density (l:=l) C outside σ J w P Q + hactual hl houtside hw hpos hcell hp hAd hout hV false false bg p b i) + | true => + exact (plain_mixed_raw_option_cmean_eq_square (l:=l) C outside σ J w P Q + hactual hl houtside hw hpos hcell hp hAd hout hV hfreq corrected bg i p b).trans + (square_option_cmean_eq_density (l:=l) C outside σ J w P Q + hactual hl houtside hw hpos hcell hp hAd hout hV corrected true bg p b i) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..465bf48fe10fe9f882b3d069132217c487fd6556 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMixed.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMixedLaw +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexRawMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexSpectator + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualPrincipalBlockFamily HistoryBulkUniversalPatternAggregation +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkFibreGiantErrorAverage +open HistoryBulkReferenceFrequencyFamily HistoryPairSourceLaws +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalSourceReindexFamily +open HistoryBulkActualPrincipalSourceReindexOption HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantApproximation +open HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + +theorem original_mixed_principal_eq_B_sourceMean + (hAd : ∀ds : Fin (2*(bulkSize k L/2))→spectator.Sample, + ∀r : Frame (l:=l) C (spectatorList spectator ds), + PairAdmissible r.left r.right (spectatorList spectator ds)) + (hV : ∀ds : Fin (2*(bulkSize k L/2))→spectator.Sample, + ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + plainMixedSourceMean (l:=l) C (spectatorList spectator ds) σ hactual hl + (spectatorList_source spectator ds) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (hAd ds) (spectatorList_length_eq spectator ds) (hV ds) false) := + (original_mixed_principal_eq_rawSourceMean (l:=l) C spectator hactual hl σ).trans + (FinitePrior.cmean_congr_support (spectatorPrior spectator (2*(bulkSize k L/2))) _ _ + (fun ds _=>rawMixedSourceMean_eq_plainMixedSourceMean (l:=l) C (spectatorList spectator ds) σ + hactual hl (spectatorList_source spectator ds) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (hAd ds) (spectatorList_length_eq spectator ds) (hV ds) (hfreq ds))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMixedLaw.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMixedLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d44bd94718234885123c3d66e9c10977f8146ac --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexMixedLaw.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jmixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + hp false true = plainMixedSourceMean C outside σ hactual hl houtside hp hAd hout hV false := + rawSourceMean_eq_sourceMean (l:=l) C outside σ (plainMixedLawMultiplier (l:=l) C outside) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) hactual hl houtside + (mixedWeight_nonneg C.giantCenter C.giant) (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + hp hAd hout hV hfreq false true (Or.inl rfl) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionAlgebra.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionAlgebra.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7028a12bd5bb43ccdf49ebcbde746bae60ddd39 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionAlgebra.lean @@ -0,0 +1,21 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +theorem option_elim_div_map {α β : Type*} (x : Option α) (f : α→β) + (g : α→ℂ) (h : β→ℂ) (c : ℂ) (heq : ∀a,g a/c=h (f a)) : + x.elim 0 g/c=(x.map f).elim 0 h := + Option.rec (zero_div c) (fun a=>heq a) x + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..33361f62af3f3db43ccdaeb8432d199b00ddcb98 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionBasic.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterSupport +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCompensationComplete +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPatternSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +local instance optionSourceInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + +theorem outerData_left_mass (D : OuterData C p o) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) : + (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass + (leftDraws C p D.blockDraw D.valid)≠0 := by + simpa only [leftChoices,choicesMass_assemble,leftDraws,leftBlockDraws,OuterData.blockDraw,HistoryGiantOriginalMeanFactorization.Seed] using D.left_mass i + +theorem outerData_right_mass (D : OuterData C p o) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) : + (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass + (rightDraws C p D.blockDraw D.valid)≠0 := by + simpa only [rightChoices,choicesMass_assemble,rightDraws,rightBlockDraws,OuterData.blockDraw,HistoryGiantOriginalMeanFactorization.Seed] using D.right_mass i + +theorem exists_outerData_eq_some (ho : outerMass C l p o≠0) + (ht : Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q))) : + ∃D : OuterData C p o,outerData? C p o=some D := by + have hs := outerData?_isSome_of_mass C p o ho ht + cases hd : outerData? C p o with + | none => simp only [hd,Option.isSome_none,Bool.false_eq_true] at hs + | some D => exact ⟨D,rfl⟩ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionConstructors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionConstructors.lean new file mode 100644 index 0000000000000000000000000000000000000000..f40840b43189b7cec7f466b16e505b12e12d8de0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionConstructors.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionMeanProjection + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexCompensation HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximation +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (hp : ∀q∈outside,q.Prime) + +theorem prime_constructor_quotient + (r : Witness C outside σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i) + (hcell : ∀v,primeWeight C.giant v≠0 → 01) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i).rawBTerm (l:=l) + hcell hp false false) := + (@quotient_frameRawMean d Bs BD Bz L k l E C outside σ (outerNonbulk C l p o) + (primeWitnessFrame C outside σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + (fun _ _ _ _=>1) r D.nonbulk_pos (D.left_mass i) (D.right_mass i) hp) + ((⟨D,r⟩ : MatchedSelectedOuter C p o outside σ (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i).frame (l:=l) hcell hp) + false + (primeWitnessPrincipal C outside σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) hp) + (blockJacobian C p D.blockDraw) + (@primeWitnessPrincipal_div_blockJacobian d Bs BD Bz L k l E C p D.blockDraw D.valid + outside σ (outerNonbulk C l p o) i r D.nonbulk_pos (D.left_mass i) (D.right_mass i) hp) + (@outer_constructor_prime_frame d Bs BD Bz L k l E C p o D outside σ (fun _ _ _ _=>1) + i hp r hcell)).trans + (rawBTerm_mean_eq_frameRawMean (l:=l) C outside σ + (⟨D,r⟩ : MatchedSelectedOuter C p o outside σ (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i) hcell hp false).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionConstructorsMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionConstructorsMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0a45aceeaf5615079608dae0818ebbc4d5b2984 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionConstructorsMixed.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionMeanProjection + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexCompensation HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximation +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (hp : ∀q∈outside,q.Prime) + +theorem mixed_constructor_quotient + (r : Witness C outside σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C outside (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i) + (hcell : ∀v,mixedWeight C.giantCenter C.giant v≠0 → 0 < mixedP C.giantCenter C.giant v ∧ 0 < mixedQ C.giantCenter C.giant v ∧ + |Real.log (mixedP C.giantCenter C.giant v:ℝ)-(C.giantCenter:ℝ)|≤1 ∧ + |Real.log (mixedQ C.giantCenter C.giant v:ℝ)-(C.giantCenter:ℝ)|≤1) : + mixedWitnessPrincipal C outside σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) hp / blockJacobian C p D.blockDraw = + (selectedBulkPrior C l).cmean ((⟨D,r⟩ : MatchedSelectedOuter C p o outside σ + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C outside (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i).rawBTerm (l:=l) + hcell hp false true) := by + let R : MatchedSelectedOuter C p o outside σ + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C outside (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i := ⟨D,r⟩ + have hq := @mixedWitnessPrincipal_div_blockJacobian d Bs BD Bz L k l E C p D.blockDraw D.valid + outside σ (outerNonbulk C l p o) i r D.nonbulk_pos (D.left_mass i) (D.right_mass i) hp + have hf := @outer_constructor_mixed_frame d Bs BD Bz L k l E C p o D outside σ + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C outside (outerNonbulk C l p o) i.1.val) + i hp r hcell + have hr := rawBTerm_mean_eq_frameRawMean (l:=l) C outside σ R hcell hp true + exact (quotient_frameRawMean C outside σ (outerNonbulk C l p o) true _ _ hq hf).trans hr.symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ea6ec09da1a99bda54ddd2f7bb71de92bb765f8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrected.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionCorrectedMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionCorrectedSelector +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionCorrectedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionMap + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryBulkActualGoodPrincipal HistoryBulkIndependentFibreReference +open HistoryBulkFibreOriginalReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem corrected_patternValue_eq_rawOption_of_outerData + (D : OuterData C p o) (hD : outerData? C p o=some D) : + drawPatternValue C spectator (correctedSelectedPrincipal (l:=l) C spectator e he) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o)= + (selectCorrectedOuterReference C p o (spectatorList spectator ds) e i).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds))) := + let W := HistoryBulkActualCorrectedReferenceFamily.Witness C (spectatorList spectator ds) + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) + let T := CorrectedSelectedOuter C p o (spectatorList spectator ds) e i + let S : Option W := HistoryBulkActualCorrectedReferenceFamily.selectWitness C + (spectatorList spectator ds) (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) D.nonbulk_pos + let S' : Option T := selectCorrectedOuterReference C p o (spectatorList spectator ds) e i + let mk : W→T := fun r=>⟨D,r⟩ + let g : W→ℂ := fun r=>correctedWitnessPrincipal C (spectatorList spectator ds) + (outerNonbulk C l p o) e he i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) r D.nonbulk_pos + (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + let h : T→ℂ := fun R=> + (selectedBulkPrior C l).cmean (R.rawBTerm he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) + (@correctedOuterPattern_eq_option d Bs BD Bz L k l E C p o spectator e he ds i D).trans + (@option_div_of_map W T S S' mk g h (blockJacobian C p D.blockDraw) + (@corrected_constructor_div d Bs BD Bz L k l E C p o spectator e he ds i D) + (@correctedSelector_map d Bs BD Bz L k l E C p o spectator e ds i D hD)) + +theorem corrected_patternValue_eq_rawOption + (ho : outerMass C l p o≠0) + (ht : Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q))) : + drawPatternValue C spectator (correctedSelectedPrincipal (l:=l) C spectator e he) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o)= + (selectCorrectedOuterReference C p o (spectatorList spectator ds) e i).elim 0 + (fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds))) := + Exists.elim (@exists_outerData_eq_some d Bs BD Bz L k l E C p o ho ht) + (fun D hD=>@corrected_patternValue_eq_rawOption_of_outerData d Bs BD Bz L k l E C p o spectator e he ds i D hD) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..6223d2bcad034e7ddca1de879e4d50f2de9ec2f3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedMean.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionCorrectedSource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryBulkActualGoodPrincipal HistoryBulkIndependentFibreReference +open HistoryBulkFibreOriginalReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +private theorem rawBTerm_eq_bulkPermutation + (R : CorrectedSelectedOuter C p o (spectatorList spectator ds) e i) + (u : SelectedBulkSample C l) : + R.rawBTerm he (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) u = + let f := R.frame he (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + let x := fibreAssignment C (outerNonbulk C l p o) u + let y := R.squareRightSource he u + HistoryBulkReferencePeriodicMeanSource.staticPairMask + (f.newLeft x) (f.newRight y) (spectatorList spectator ds)* + f.principalCorrectedMixed (bulkPermutation e he) x y := + congrArg (fun σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))=> + let f := R.frame he (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + let x := fibreAssignment C (outerNonbulk C l p o) u + let y := R.squareRightSource he u + HistoryBulkReferencePeriodicMeanSource.staticPairMask + (f.newLeft x) (f.newRight y) (spectatorList spectator ds)* + f.principalCorrectedMixed σ x y) + (R.permutation_eq_bulkPermutation he) + +theorem corrected_constructor_div + (D : OuterData C p o) + (r : HistoryBulkActualCorrectedReferenceFamily.Witness C (spectatorList spectator ds) + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i)) : + correctedWitnessPrincipal C (spectatorList spectator ds) (outerNonbulk C l p o) e he + i.1.val i.1.val (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) r D.nonbulk_pos + (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) / + blockJacobian C p D.blockDraw = + (selectedBulkPrior C l).cmean + ((⟨D,r⟩ : CorrectedSelectedOuter C p o (spectatorList spectator ds) e i).rawBTerm he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) := + (correctedWitnessPrincipal_div_blockJacobian (l:=l) C p D.blockDraw D.valid + (spectatorList spectator ds) (outerNonbulk C l p o) e he i.1.val i.1.val i r + D.nonbulk_pos (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)).trans + (congrArg ((selectedBulkPrior C l).cmean) + (funext fun u=>rawBTerm_eq_bulkPermutation C p o spectator e he ds i ⟨D,r⟩ u)).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedSelector.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedSelector.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4137d7ccbde99327090530bcc97dd3c86b8e67a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedSelector.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrectedReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionCorrectedSource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryBulkActualGoodPrincipal HistoryBulkIndependentFibreReference +open HistoryBulkFibreOriginalReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem correctedSelector_map (D : OuterData C p o) (hD : outerData? C p o=some D) : + (HistoryBulkActualCorrectedReferenceFamily.selectWitness C (spectatorList spectator ds) + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) D.nonbulk_pos).map + (fun r=>(⟨D,r⟩ : CorrectedSelectedOuter C p o (spectatorList spectator ds) e i))= + selectCorrectedOuterReference C p o (spectatorList spectator ds) e i := + (selectCorrectedOuterReference_eq_map (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) + (L:=L) (k:=k) (l:=l) (E:=E) C p o + (spectatorList spectator ds) e i D hD).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..f4c018b113b2d2fbc8f301ce7bfef40bb5d65cba --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionCorrectedSource.lean @@ -0,0 +1,93 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryBulkIndependentFibreReference +open HistoryBulkFibreOriginalReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +private theorem correctedSelectedPrincipal_eq_option + (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) + (ha : 0<(selectedNonbulkPrior C l).mass a) + (hx : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass x≠0) + (hy : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass y≠0) : + correctedSelectedPrincipal (l:=l) C spectator e he ds a x y i= + (HistoryBulkActualCorrectedReferenceFamily.selectWitness C (spectatorList spectator ds) + a e i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) ha).elim 0 + (fun r=>correctedWitnessPrincipal C (spectatorList spectator ds) a e he + i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) r ha + (leftChoices_mass_of_draws C x hx i) (rightChoices_mass_of_draws C y hy i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) := + (dite_eq_left ha).trans ((dite_eq_left hx).trans (dite_eq_left hy)) + +private theorem correctedPattern_eq_option + (a : SelectedNonbulkSample C l) + (b : BlockDraw p (CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀j,(expand p b j).val∈ + (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) + (ha : 0<(selectedNonbulkPrior C l).mass a) + (hx : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass + (leftBlockDraws C p b hb)≠0) + (hy : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass + (rightBlockDraws C p b hb)≠0) : + drawPatternValue C spectator (correctedSelectedPrincipal (l:=l) C spectator e he) + ds a i p b.val= + (HistoryBulkActualCorrectedReferenceFamily.selectWitness C (spectatorList spectator ds) + a e i.1.val i.1.val (leftChoices C (leftBlockDraws C p b hb) i) + (rightChoices C (rightBlockDraws C p b hb) i) ha).elim 0 + (fun r=>correctedWitnessPrincipal C (spectatorList spectator ds) a e he + i.1.val i.1.val (leftChoices C (leftBlockDraws C p b hb) i) + (rightChoices C (rightBlockDraws C p b hb) i) r ha + (leftChoices_mass_of_draws C _ hx i) (rightChoices_mass_of_draws C _ hy i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) / + blockJacobian C p b := + (drawPatternValue_of_valid (l:=l) C spectator + (correctedSelectedPrincipal (l:=l) C spectator e he) ds a i p b hb).trans + (congrArg (fun z : ℂ=>z/blockJacobian C p b) + (correctedSelectedPrincipal_eq_option C spectator e he ds i a + (leftBlockDraws C p b hb) (rightBlockDraws C p b hb) ha hx hy)) + +theorem correctedOuterPattern_eq_option (D : OuterData C p o) : + drawPatternValue C spectator (correctedSelectedPrincipal (l:=l) C spectator e he) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o)= + (HistoryBulkActualCorrectedReferenceFamily.selectWitness C (spectatorList spectator ds) + (outerNonbulk C l p o) e i.1.val i.1.val + (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) D.nonbulk_pos).elim 0 + (fun r=>correctedWitnessPrincipal C (spectatorList spectator ds) (outerNonbulk C l p o) + e he i.1.val i.1.val (leftChoices C (leftBlockDraws C p D.blockDraw D.valid) i) + (rightChoices C (rightBlockDraws C p D.blockDraw D.valid) i) r D.nonbulk_pos + (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) / + blockJacobian C p D.blockDraw := + @correctedPattern_eq_option d Bs BD Bz L k l E C p spectator e he ds i + (outerNonbulk C l p o) D.blockDraw D.valid D.nonbulk_pos + (@outerData_left_mass d Bs BD Bz L k l E C p o D i) + (@outerData_right_mass d Bs BD Bz L k l E C p o D i) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionFrames.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionFrames.lean new file mode 100644 index 0000000000000000000000000000000000000000..ffc09d7e435021ac7364336f103233e2e0be6ec7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionFrames.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalValueFrameFactories + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkFibreGiantApproximation HistoryBulkActualPrincipalValueFrame +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)→SelectedBulkSample C l→ℤ→ℤ→ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (r : Witness C outside σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) J w P Q i) + (hcell : ∀v,w v≠0 → 0

v.elim 0 h) hmap) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..915735938a268642a71b0e00903f55da46403b48 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMean.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionFrames + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkReferencePeriodicMeanSource +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) + +def frameRawMean (f : Frame (l:=l) C outside) (mixed : Bool) : ℂ := + (selectedBulkPrior C l).cmean (fun u=> + let x := fibreAssignment C a u + let y := permuteAssignment C σ x + staticPairMask (f.newLeft x) (f.newRight y) outside * + (if mixed then f.principalMixed σ x y else f.principal σ x y)) + +theorem frameRawMean_congr {f g : Frame (l:=l) C outside} (mixed : Bool) (h : f=g) : + frameRawMean C outside σ a f mixed=frameRawMean C outside σ a g mixed := + congrArg (fun f=>frameRawMean C outside σ a f mixed) h + + theorem quotient_frameRawMean {f g : Frame (l:=l) C outside} + (mixed : Bool) (x c : ℂ) + (hq : x/c=frameRawMean C outside σ a f mixed) (h : g=f) : + x/c=frameRawMean C outside σ a g mixed := + hq.trans (frameRawMean_congr C outside σ a mixed h).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMeanProjection.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMeanProjection.lean new file mode 100644 index 0000000000000000000000000000000000000000..9d2fccaf341c1d0fd421afb32d779e4651497da6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMeanProjection.lean @@ -0,0 +1,37 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreOriginalReference HistoryBulkReferencePeriodicMeanSource +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + +open CanonicalOccurrenceTransport CompensationEqualityPatterns HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualRootReferenceFamily +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)→SelectedBulkSample C l→ℤ→ℤ→ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +theorem rawBTerm_mean_eq_frameRawMean + (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem mixed_patternValue_eq_rawOption_of_outerData + (D : OuterData C p o) (hD : outerData? C p o=some D) : + drawPatternValue C spectator (mixedSelectedPrincipal C spectator hactual hl σ) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o)= + mixedRawOption C p o spectator hactual hl σ ds i := + let W := Witness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i + let T := MatchedSelectedOuter C p o (spectatorList spectator ds) σ + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i + let S : Option W := selectWitness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) i + let S' : Option T := selectMatchedOuterReference C p o (spectatorList spectator ds) σ + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i hactual hl + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + let mk : W→T := fun r=>⟨D,r⟩ + let g : W→ℂ := fun r=>mixedWitnessPrincipal C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + let h : T→ℂ := fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm + (fun v hv=>mixed_draw_cells C v (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant v) (Ne.symm hv))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false true) + (@mixedOuterPattern_eq_option d Bs BD Bz L k l E C p o spectator hactual hl σ ds i D).trans + (@option_div_of_map W T S S' mk g h (blockJacobian C p D.blockDraw) + (@mixed_constructor_div d Bs BD Bz L k l E C p o spectator σ ds i D) + (@mixedSelector_map d Bs BD Bz L k l E C p o spectator hactual hl σ ds i D hD)) + +theorem mixed_patternValue_eq_rawOption + (ho : outerMass C l p o≠0) + (ht : Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q))) : + drawPatternValue C spectator (mixedSelectedPrincipal C spectator hactual hl σ) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o)= + mixedRawOption C p o spectator hactual hl σ ds i := + Exists.elim (@exists_outerData_eq_some d Bs BD Bz L k l E C p o ho ht) + (fun D hD=>@mixed_patternValue_eq_rawOption_of_outerData d Bs BD Bz L k l E C p o + spectator hactual hl σ ds i D hD) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedConstructor.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedConstructor.lean new file mode 100644 index 0000000000000000000000000000000000000000..181c2e9011d7fd4c07b3577ddae1ee0979bcbcd3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedConstructor.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionConstructorsMixed + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem mixed_constructor_div + (D : OuterData C p o) + (r : Witness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + (fun i=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i) : + mixedWitnessPrincipal C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) / + blockJacobian C p D.blockDraw = + (selectedBulkPrior C l).cmean ((⟨D,r⟩ : MatchedSelectedOuter C p o + (spectatorList spectator ds) σ (fun i=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i).rawBTerm (l:=l) + (fun v hv=>mixed_draw_cells C v (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant v) (Ne.symm hv))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false true) := + @mixed_constructor_quotient d Bs BD Bz L k l E C p o D (spectatorList spectator ds) σ i + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) r + (fun v hv=>mixed_draw_cells C v + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant v) (Ne.symm hv))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..9233c887562f425fba804809bd49415ccd152583 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedDefs.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionAlgebra + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +def mixedRawOption : ℂ := + (selectMatchedOuterReference C p o (spectatorList spectator ds) σ (fun i=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i hactual hl + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r)).elim 0 (fun R=> + (selectedBulkPrior C l).cmean (R.rawBTerm + (fun v hv=>mixed_draw_cells C v (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant v) (Ne.symm hv))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false true)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedSelector.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedSelector.lean new file mode 100644 index 0000000000000000000000000000000000000000..5d66c6dd679a697811db316cbd361a0c62531b05 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedSelector.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionMixedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem mixedSelector_map (D : OuterData C p o) (hD : outerData? C p o=some D) : + (selectWitness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) i).map + (fun r=>(⟨D,r⟩ : MatchedSelectedOuter C p o (spectatorList spectator ds) σ + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i)) = + selectMatchedOuterReference C p o (spectatorList spectator ds) σ (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i hactual hl + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) := + (selectMatchedOuterReference_eq_map (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) + (L:=L) (k:=k) (l:=l) (E:=E) C p o (spectatorList spectator ds) σ (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i hactual hl + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) D hD).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..db7edc9f3ce04f1e03b8780a61654c828561f5f9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionMixedSource.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionAlgebra + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem mixedOuterPattern_eq_option (D : OuterData C p o) : + drawPatternValue C spectator (mixedSelectedPrincipal C spectator hactual hl σ) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o) = + (selectWitness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun i=>@HistoryBulkFibreGiantApproximation.plainMixedWeight d Bs BD Bz L k l E C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) i).elim 0 + (fun r=>mixedWitnessPrincipal C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) / + blockJacobian C p D.blockDraw := + @mixedSelectedPrincipal_patternValue_eq_option d Bs BD Bz L k l E C spectator hactual hl σ ds + (outerNonbulk C l p o) p D.blockDraw D.valid D.nonbulk_pos + (@outerData_left_mass d Bs BD Bz L k l E C p o D i) + (@outerData_right_mass d Bs BD Bz L k l E C p o D i) i + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..50b4ac1534dcc1dab313f2862d339a0213fd74db --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrime.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionMap +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionPrimeConstructor +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionPrimeDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionPrimeSelector +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionPrimeSource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem prime_patternValue_eq_rawOption_of_outerData + (D : OuterData C p o) (hD : outerData? C p o=some D) : + drawPatternValue C spectator (primeSelectedPrincipal C spectator hactual hl σ) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o)= + primeRawOption C p o spectator hactual hl σ ds i := + let W := Witness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i + let T := MatchedSelectedOuter C p o (spectatorList spectator ds) σ + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i + let S : Option W := selectWitness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) i + let S' : Option T := selectMatchedOuterReference C p o (spectatorList spectator ds) σ + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i hactual hl + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + let mk : W→T := fun r=>⟨D,r⟩ + let g : W→ℂ := fun r=>primeWitnessPrincipal C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + let h : T→ℂ := fun R=>(selectedBulkPrior C l).cmean (R.rawBTerm + (fun v hv=>prime_draw_cells C v (lt_of_le_of_ne (primeWeight_nonneg C.giant v) (Ne.symm hv))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false false) + (@primeOuterPattern_eq_option d Bs BD Bz L k l E C p o spectator hactual hl σ ds i D).trans + (@option_div_of_map W T S S' mk g h (blockJacobian C p D.blockDraw) + (@prime_constructor_div d Bs BD Bz L k l E C p o spectator σ ds i D) + (@primeSelector_map d Bs BD Bz L k l E C p o spectator hactual hl σ ds i D hD)) + +theorem prime_patternValue_eq_rawOption + (ho : outerMass C l p o≠0) + (ht : Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q))) : + drawPatternValue C spectator (primeSelectedPrincipal C spectator hactual hl σ) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o)= + primeRawOption C p o spectator hactual hl σ ds i := + Exists.elim (@exists_outerData_eq_some d Bs BD Bz L k l E C p o ho ht) + (fun D hD=>@prime_patternValue_eq_rawOption_of_outerData d Bs BD Bz L k l E C p o + spectator hactual hl σ ds i D hD) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeConstructor.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeConstructor.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1fe0dd71dbeba6852a2452112432ed369eabd6a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeConstructor.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionAlgebra +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionConstructors + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem prime_constructor_div + (D : OuterData C p o) + (r : Witness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i) : + primeWitnessPrincipal C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftDraws C p D.blockDraw D.valid) (rightDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) / + blockJacobian C p D.blockDraw = + (selectedBulkPrior C l).cmean ((⟨D,r⟩ : MatchedSelectedOuter C p o + (spectatorList spectator ds) σ (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i).rawBTerm (l:=l) + (fun v hv=>prime_draw_cells C v (lt_of_le_of_ne (primeWeight_nonneg C.giant v) (Ne.symm hv))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false false) := + @prime_constructor_quotient d Bs BD Bz L k l E C p o D (spectatorList spectator ds) σ i + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) r + (fun v hv=>prime_draw_cells C v (lt_of_le_of_ne (primeWeight_nonneg C.giant v) (Ne.symm hv))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..e7b99f47f704a448a1452ec70e07b8724ccd1cf3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeDefs.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMatchedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionAlgebra + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +def primeRawOption : ℂ := + (selectMatchedOuterReference C p o (spectatorList spectator ds) σ (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i hactual hl + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r)).elim 0 (fun R=> + (selectedBulkPrior C l).cmean (R.rawBTerm + (fun v hv=>prime_draw_cells C v (lt_of_le_of_ne (primeWeight_nonneg C.giant v) (Ne.symm hv))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false false)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeSelector.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeSelector.lean new file mode 100644 index 0000000000000000000000000000000000000000..3349027aa1984bc32a22c7784f3b74dfa052749e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeSelector.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionPrimeDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem primeSelector_map (D : OuterData C p o) (hD : outerData? C p o=some D) : + (selectWitness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) i).map + (fun r=>(⟨D,r⟩ : MatchedSelectedOuter C p o (spectatorList spectator ds) σ + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i)) = + selectMatchedOuterReference C p o (spectatorList spectator ds) σ (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i hactual hl + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) := + (selectMatchedOuterReference_eq_map (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) + (L:=L) (k:=k) (l:=l) (E:=E) C p o (spectatorList spectator ds) σ (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i hactual hl + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) D hD).symm + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9a787be31be0c45b31d8eff087d8e2c0a8abf0e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexOptionPrimeSource.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionAlgebra + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +open HistoryBulkActualPrincipalBlockFamily HistoryPairReferenceFlagExpectation +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkActualPrincipalSourceReindexCompensation +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + +variable (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem primeOuterPattern_eq_option (D : OuterData C p o) : + drawPatternValue C spectator (primeSelectedPrincipal C spectator hactual hl σ) + ds (outerNonbulk C l p o) i p (outerBlocks C l p o) = + (selectWitness C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + (fun _ _ _ _=>1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) i).elim 0 + (fun r=>primeWitnessPrincipal C (spectatorList spectator ds) σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + r D.nonbulk_pos (D.left_mass i) (D.right_mass i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) / + blockJacobian C p D.blockDraw := + @primeSelectedPrincipal_patternValue_eq_option d Bs BD Bz L k l E C spectator hactual hl σ ds + (outerNonbulk C l p o) p D.blockDraw D.valid D.nonbulk_pos + (@outerData_left_mass d Bs BD Bz L k l E C p o D i) + (@outerData_right_mass d Bs BD Bz L k l E C p o D i) i + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOption + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ecaa03c3bcd90628c899da2d1107a25954a2cd6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPattern.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPatternBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPattern +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkPrincipalSourceReindex HistoryBulkUniversalPatternAggregation +open HistoryBulkFibreGiantErrorAverage +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + +theorem originalSourceAverage_eq_patternMean + (F : (Fin (2*(bulkSize k L/2))→spectator.Sample) → SelectedNonbulkSample C l → + Draws C (l:=l) → Draws C (l:=l) → RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → ℂ) : + originalSourceAverage C spectator F = + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds=> + (selectedNonbulkPrior C l).cmean (fun a=> + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l, + drawPatternValue C spectator F ds a i p b))) := by + unfold originalSourceAverage + apply congrArg (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + funext ds + apply congrArg (selectedNonbulkPrior C l).cmean + funext a + rw [internal_cmean_pair C] + rw [FinitePrior.cmean_sum,patternComplexSum_sum] + apply Finset.sum_congr rfl + intro i hi + exact source_cmean_eq_patternComplexSum C.sources _ _ _ + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPattern + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPatternBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPatternBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..73813fb2d0bf94296edf5c2b03fa796d9034dcb5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPatternBasic.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexWitnessBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPattern +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkPrincipalSourceReindex HistoryBulkUniversalPatternAggregation +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + +def drawPatternValue + (F : (Fin (2*(bulkSize k L/2))→spectator.Sample) → SelectedNonbulkSample C l → + Draws C (l:=l) → Draws C (l:=l) → RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → ℂ) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) (a : SelectedNonbulkSample C l) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + sourcePatternValue C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun z=>F ds a (fun j=>z (Sum.inl j)) (fun j=>z (Sum.inr j)) i) p b + +theorem internal_cmean_pair + (F : Draws C (l:=l) → Draws C (l:=l) → ℂ) : + (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).cmean (fun x=> + (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).cmean (fun y=>F x y)) = + (pairedInternalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).cmean + (fun z=>F (fun j=>z (Sum.inl j)) (fun j=>z (Sum.inr j))) := by + simpa only [FinitePrior.cmean,Finset.mul_sum,mul_assoc] using + (sum_pairedInternalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l F).symm + +theorem drawPatternValue_of_valid + (F : (Fin (2*(bulkSize k L/2))→spectator.Sample) → SelectedNonbulkSample C l → + Draws C (l:=l) → Draws C (l:=l) → RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → ℂ) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) (a : SelectedNonbulkSample C l) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀j,(expand p b j).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) : + drawPatternValue C spectator F ds a i p b.val = + F ds a (leftDraws C p b hb) (rightDraws C p b hb) i / blockJacobian C p b := by + have he : extendSourceTest C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (fun z=>F ds a (fun j=>z (Sum.inl j)) (fun j=>z (Sum.inr j)) i) (expand p b) = + F ds a (leftDraws C p b hb) (rightDraws C p b hb) i := + dite_eq_left hb + exact congrArg (fun z : ℂ=>z/blockJacobian C p b) he + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPattern + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPatternSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPatternSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f5531a000ec6558e315ea0617ed7a4987554286 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPatternSelected.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPattern + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPattern +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkFibreGiantErrorAverage HistoryBulkPrincipalSourceReindexWitness HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximation +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) (a : SelectedNonbulkSample C l) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hb : ∀j,(expand p b j).val∈(C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) + (ha : 0<(selectedNonbulkPrior C l).mass a) + (hx : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass (leftDraws C p b hb)≠0) + (hy : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass (rightDraws C p b hb)≠0) + (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) + +theorem primeSelectedPrincipal_patternValue_eq_option : + drawPatternValue C spectator (primeSelectedPrincipal C spectator hactual hl σ) ds a i p b.val = + (selectWitness C (spectatorList spectator ds) σ a + (leftDraws C p b hb) (rightDraws C p b hb) (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl ha (leftChoices_mass_of_draws C _ hx) (rightChoices_mass_of_draws C _ hy) + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) i).elim 0 + (fun r=>primeWitnessPrincipal C (spectatorList spectator ds) σ a + (leftDraws C p b hb) (rightDraws C p b hb) r ha + (leftChoices_mass_of_draws C _ hx i) (rightChoices_mass_of_draws C _ hy i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) / blockJacobian C p b := by + rw [drawPatternValue_of_valid C spectator _ ds a i p b hb] + simp only [primeSelectedPrincipal,dite_eq_left ha,dite_eq_left hx,dite_eq_left hy] + +theorem mixedSelectedPrincipal_patternValue_eq_option : + drawPatternValue C spectator (mixedSelectedPrincipal C spectator hactual hl σ) ds a i p b.val = + (selectWitness C (spectatorList spectator ds) σ a + (leftDraws C p b hb) (rightDraws C p b hb) + (fun i=>plainMixedWeight C (spectatorList spectator ds) a i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl ha (leftChoices_mass_of_draws C _ hx) (rightChoices_mass_of_draws C _ hy) + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) i).elim 0 + (fun r=>mixedWitnessPrincipal C (spectatorList spectator ds) σ a + (leftDraws C p b hb) (rightDraws C p b hb) r ha + (leftChoices_mass_of_draws C _ hx i) (rightChoices_mass_of_draws C _ hy i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) / blockJacobian C p b := by + rw [drawPatternValue_of_valid C spectator _ ds a i p b hb] + simp only [mixedSelectedPrincipal,dite_eq_left ha,dite_eq_left hx,dite_eq_left hy] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPattern + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..6242c13b7e35d99269808851542bdac8631e2f96 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPrime.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPrimeLaw +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexRawPrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexSpectator + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualPrincipalBlockFamily HistoryBulkUniversalPatternAggregation +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkFibreGiantErrorAverage +open HistoryBulkReferenceFrequencyFamily HistoryPairSourceLaws +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalSourceReindexFamily +open HistoryBulkActualPrincipalSourceReindexOption HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantApproximation +open HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + +theorem original_prime_principal_eq_B_sourceMean + (hAd : ∀ds : Fin (2*(bulkSize k L/2))→spectator.Sample, + ∀r : Frame (l:=l) C (spectatorList spectator ds), + PairAdmissible r.left r.right (spectatorList spectator ds)) + (hV : ∀ds : Fin (2*(bulkSize k L/2))→spectator.Sample, + ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + primeSourceMean (l:=l) C (spectatorList spectator ds) σ hactual hl + (spectatorList_source spectator ds) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (hAd ds) (spectatorList_length_eq spectator ds) (hV ds) false) := + (original_prime_principal_eq_rawSourceMean (l:=l) C spectator hactual hl σ).trans + (FinitePrior.cmean_congr_support (spectatorPrior spectator (2*(bulkSize k L/2))) _ _ + (fun ds _=>rawPrimeSourceMean_eq_primeSourceMean (l:=l) + C (spectatorList spectator ds) σ hactual hl (spectatorList_source spectator ds) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (hAd ds) (spectatorList_length_eq spectator ds) (hV ds) (hfreq ds))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPrimeLaw.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPrimeLaw.lean new file mode 100644 index 0000000000000000000000000000000000000000..39f9f621af6b07e8613176535d3d14c89e73386e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexPrimeLaw.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement +open Construction Conclusion HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkFibreGiantApproximationReference +open HistoryGiantReferenceMean HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hp : ∀q∈outside,q.Prime) + (hAd : ∀r : Frame (l:=l) C outside, PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jprimeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + hp false false = primeSourceMean C outside σ hactual hl houtside hp hAd hout hV false := + rawSourceMean_eq_sourceMean (l:=l) C outside σ (primeLawMultiplier (l:=l) C) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) hactual hl houtside + (primeWeight_nonneg C.giant) (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + hp hAd hout hV hfreq false false (Or.inl rfl) + +end Ostmann.Arithmetic.HistoryBulkActualBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..1cf7bad5bdd93f935ee380d8adae3cb46e526a86 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawCorrected.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementCorrectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexBackgroundRoot +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionCorrected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualPrincipalBlockFamily HistoryBulkUniversalPatternAggregation +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkFibreGiantErrorAverage +open HistoryBulkReferenceFrequencyFamily HistoryPairSourceLaws +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalSourceReindexFamilyCorrected +open HistoryBulkActualPrincipalSourceReindexOption HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantApproximation +open HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (e : HistoryBulkIndependentFibreReference.RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + +theorem original_corrected_principal_eq_rawSourceMean : + originalSourceAverage C spectator (correctedSelectedPrincipal (l:=l) C spectator e he)= + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds=> + correctedRawSourceMean (l:=l) C (spectatorList spectator ds) e he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) := + (originalSourceAverage_eq_backgroundPatternMean (l:=l) C spectator + (correctedSelectedPrincipal (l:=l) C spectator e he)).trans + (FinitePrior.cmean_congr_support (spectatorPrior spectator (2*(bulkSize k L/2))) _ _ + (fun ds _=>background_pattern_root_congr (l:=l) C _ _ + (fun bg i p b ho ht=>corrected_patternValue_eq_rawOption (l:=l) + C p (restoreOuterBackground C l p bg b) spectator e he ds i ho ht))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..66ccd7f0f580dab8574a0afdc17e3cbb70460107 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawMixed.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexBackgroundRoot +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationFibreIdentities + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualPrincipalBlockFamily HistoryBulkUniversalPatternAggregation +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkFibreGiantErrorAverage +open HistoryBulkReferenceFrequencyFamily HistoryPairSourceLaws +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalSourceReindexFamily +open HistoryBulkActualPrincipalSourceReindexOption HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantApproximation +open HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + +theorem original_mixed_principal_eq_rawSourceMean : + originalSourceAverage C spectator (mixedSelectedPrincipal (l:=l) C spectator hactual hl σ)= + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds=> + rawSourceMean (l:=l) C (spectatorList spectator ds) σ (plainMixedLawMultiplier (l:=l) C (spectatorList spectator ds)) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) hactual hl + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false true) := + (originalSourceAverage_eq_backgroundPatternMean (l:=l) C spectator + (mixedSelectedPrincipal (l:=l) C spectator hactual hl σ)).trans + (FinitePrior.cmean_congr_support (spectatorPrior spectator (2*(bulkSize k L/2))) _ _ + (fun ds _=>background_pattern_root_congr (l:=l) C _ _ + (fun bg i p b ho ht=>mixed_patternValue_eq_rawOption (l:=l) + C p (restoreOuterBackground C l p bg b) spectator hactual hl σ ds i ho ht))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ec8fd181c5e34acd877449da575e0dd6fb7ffe2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexRawPrime.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexBackgroundRoot +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMeanDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexOptionPrime + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkActualPrincipalBlockFamily HistoryBulkUniversalPatternAggregation +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalSourceReindexPattern HistoryBulkFibreGiantErrorAverage +open HistoryBulkReferenceFrequencyFamily HistoryPairSourceLaws +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalSourceReindexFamily +open HistoryBulkActualPrincipalSourceReindexOption HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantApproximation +open HistoryRepresentativeSourceSeparation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + +theorem original_prime_principal_eq_rawSourceMean : + originalSourceAverage C spectator (primeSelectedPrincipal (l:=l) C spectator hactual hl σ)= + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds=> + rawSourceMean (l:=l) C (spectatorList spectator ds) σ (primeLawMultiplier (l:=l) C) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) hactual hl + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false false) := + (originalSourceAverage_eq_backgroundPatternMean (l:=l) C spectator + (primeSelectedPrincipal (l:=l) C spectator hactual hl σ)).trans + (FinitePrior.cmean_congr_support (spectatorPrior spectator (2*(bulkSize k L/2))) _ _ + (fun ds _=>background_pattern_root_congr (l:=l) C _ _ + (fun bg i p b ho ht=>prime_patternValue_eq_rawOption (l:=l) + C p (restoreOuterBackground C l p bg b) spectator hactual hl σ ds i ho ht))) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexSpectator.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexSpectator.lean new file mode 100644 index 0000000000000000000000000000000000000000..088c7b5c5e457e5fe38dcb0defeb77b23c60df7d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexSpectator.lean @@ -0,0 +1,14 @@ +import OAI.NumberTheory.Ostmann.Construction.ActualAmplitude + +namespace OAI + +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction + +theorem spectatorList_length_eq (spectator : PrimeSource) {m : ℕ} + (ds : Fin m → spectator.Sample) : (spectatorList spectator ds).length=m := by + simp only [spectatorList,List.length_ofFn] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexSquare.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexSquare.lean new file mode 100644 index 0000000000000000000000000000000000000000..956e187824cf0e1281f2c2a9514e8e4b99a97f60 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualPrincipalSourceReindexSquare.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceDensity + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkFibreGiantApproximation HistoryBulkPrincipalBSquareReference +open HistoryBulkPrincipalBSquareReplacement HistoryCompensationRepresentativePatterns +open HistoryPairRows HistoryRepresentativeSourceSeparation CanonicalHistoryLeafBulk +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +local instance sourceSquareInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + (r : Frame (l:=l) C outside) (x : Frame.Source (C:=C) (l:=l)) + (hx : (assignmentPrior C.sources _).mass x≠0) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hslots : ∀i,(slot r.left r.right (pairedInternalEquiv + (Template.initial (2*(bulkSize k L/2)) k) r.left r.right + (leftDraw r).labels (rightDraw r).labels i)).value=(expand p b i).val) + (had : PairAdmissible r.left r.right outside) + (hout : outside.length=2*(bulkSize k L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ}{e : RemainingPermutation (k:=k) (L:=L) (l:=l)} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +theorem correctedPrincipalData_value_eq_frame + (R : CorrectedSelectedOuter C p o outside e i) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j((u j).val:ℝ)) + else primeGiantScalar C.giantCenter (logCellMass C.giantCenter ∅) + (jointCorrectedScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (boolEquiv r.left r.right) (orderedBulkEquiv r)) + (fun j=>((u j).val:ℝ)) + else + if mixed then mixedGiantScalar C.giantCenter (logCellMass C.giantCenter ∅) + (jointScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (optionEquiv r.left r.right) (orderedBulkEquiv r)) + (fun j=>((u j).val:ℝ)) + else primeGiantScalar C.giantCenter (logCellMass C.giantCenter ∅) + (jointScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (boolEquiv r.left r.right) (orderedBulkEquiv r)) + (fun j=>((u j).val:ℝ)) := by + have hm : r.mixedScalar (fibreAssignment C a u) = fun v => + jointScalar C (bulkSize k L/2) r.left r.right r.left_supported r.right_supported + (optionEquiv r.left r.right) (orderedBulkEquiv r) v (fun j=>((u j).val:ℝ)) := by + unfold Frame.mixedScalar + rw [orderedSourceValues_fibreAssignment] + rfl + have hc : r.correctedMixedScalar (fibreAssignment C a u) = fun v => + jointCorrectedScalar C (bulkSize k L/2) r.left r.right r.left_supported r.right_supported + (optionEquiv r.left r.right) (orderedBulkEquiv r) v (fun j=>((u j).val:ℝ)) := by + unfold Frame.correctedMixedScalar + rw [orderedSourceValues_fibreAssignment] + rfl + cases corrected <;> cases mixed <;> + simp only [giantValue, Bool.false_eq_true, ↓reduceIte, Frame.mixedIntegralValue, + hm, hc, primeGiantScalar, mixedGiantScalar, + HistoryBulkGiantCorrectedBounds.primeJointCutoff, + HistoryBulkGiantCorrectedBounds.mixedJointCutoff, + orderedSourceValues_fibreAssignment] + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalValueFrame + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamily.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamily.lean new file mode 100644 index 0000000000000000000000000000000000000000..3191f05b64869df25308cd13e831e1128ed662ed --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamily.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilySelection + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator HistorySignedXiTransport +open HistoryGiantOriginalMeanFactorization (Choices history) +open HistoryBulkFibreReference (originalMean) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +variable (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) +variable (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) +variable {α : Type} [Fintype α] (w : α → ℝ) (P Q : α → ℤ) + +variable {spectator : PrimeSource} +variable (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : ∀ i, choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (leftChoices C x i) ≠ 0) + (he : ∀ i, choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (rightChoices C y i) ≠ 0) + (houtside : ∀ q∈outside, ∃ p : spectator.Sample, (p:ℕ)=q) + (hw : ∀ r, 0 ≤ w r) (hpos : ∀ r, w r ≠ 0 → 0 < P r ∧ 0 < Q r) + +def referenceFamily : RootReferenceFamily C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l x y := + fun i => (selectWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i).map + (fun r => r.toReference) + +def presentWitness (i : RootPresent (referenceFamily C outside σ a x y J w P Q + hactual hl ha hc he houtside hw hpos)) : Witness C outside σ a x y J w P Q i.val := + (selectWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i.val).get + (by simpa only [referenceFamily,Option.isSome_map] using i.property) + +theorem rootSelected_eq_presentWitness + (i : RootPresent (referenceFamily C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos)) : + rootSelected (referenceFamily C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos) i = + (presentWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i).toReference := by + simp only [rootSelected,referenceFamily,presentWitness,Option.get_map] + +theorem referenceFamily_none_iff + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + referenceFamily C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i = none ↔ + wholeMean C outside σ a x y J w P Q i = 0 := by + simpa only [referenceFamily,Option.map_eq_none_iff] using + selectWitness_none_iff C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i + +def actualData + (hcell : ∀ v, w v ≠ 0 → 0 < P v ∧ 0 < Q v ∧ + |Real.log (P v:ℝ)-(C.giantCenter:ℝ)| ≤ 1 ∧ + |Real.log (Q v:ℝ)-(C.giantCenter:ℝ)| ≤ 1) + (i : RootPresent (referenceFamily C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos)) : + ActualReferenceData C σ i.val + (rootSelected (referenceFamily C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos) i) := by + rw [rootSelected_eq_presentWitness] + exact Witness.toActualData C outside σ a x y J w P Q + (presentWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i) ha (hc i.val) (he i.val) hcell + +theorem wholeMean_eq_selectedReferenceMean + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + wholeMean C outside σ a x y J w P Q i = + (selectWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i).elim 0 + (fun r => originalMean (selectedBulkPrior C l).mass w (fun u z => + weightedFibreReferenceTerm C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (J i) k r.bulk (P r.giant) (Q r.giant) + r.supported u (P z) (Q z))) := by + cases hs : selectWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i with + | none => + simpa only [hs,Option.elim_none] using + (selectWitness_none_iff C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i).mp hs + | some r => + simpa only [hs,Option.elim_some] using r.mean_eq + +end Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyData.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa9e2995202d5275dc25533eb3c65db69b2ed579 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyData.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator HistorySignedXiTransport +open HistoryGiantOriginalMeanFactorization (Choices history) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +variable (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) +variable (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) +variable {α : Type} [Fintype α] (w : α → ℝ) (P Q : α → ℤ) + +variable {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +def Witness.toReference (r : Witness C outside σ a x y J w P Q i) : + SupportedReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l x y i.1.val i.1.val i.2 where + left := giantState (sourceState C.sources _ (fibreAssignment C a r.bulk) i.1.val) + (P r.giant) (Q r.giant) + right := giantState (sourceState C.sources _ + (permuteAssignment C σ (fibreAssignment C a r.bulk)) i.1.val) (P r.giant) (Q r.giant) + left_frequency := rfl + right_frequency := rfl + left_matches := Template.assignedSlots_matches _ _ _ + right_matches := Template.assignedSlots_matches _ _ _ + left_supported := r.supported.1 + right_supported := r.supported.2 + +def Witness.toActualData (r : Witness C outside σ a x y J w P Q i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (leftChoices C x i) ≠ 0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (rightChoices C y i) ≠ 0) + (hcell : ∀ v, w v ≠ 0 → 0 < P v ∧ 0 < Q v ∧ + |Real.log (P v:ℝ)-(C.giantCenter:ℝ)| ≤ 1 ∧ + |Real.log (Q v:ℝ)-(C.giantCenter:ℝ)| ≤ 1) : + ActualReferenceData C σ i r.toReference where + assignment := fibreAssignment C a r.bulk + plus := P r.giant + minus := Q r.giant + assignment_mass := (fibreAssignment_mass_pos C a r.bulk ha r.bulk_pos).ne' + left_choice_mass := hc + right_choice_mass := he + plus_pos := (hcell r.giant r.giant_pos.ne').1 + minus_pos := (hcell r.giant r.giant_pos.ne').2.1 + plus_cell := (hcell r.giant r.giant_pos.ne').2.2.1 + minus_cell := (hcell r.giant r.giant_pos.ne').2.2.2 + left_eq := rfl + right_eq := rfl + +end Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyLaws.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..bfcca4f47cc1d5c450000610cd2b8c1b681c9aeb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyLaws.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilySymbolic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkReferenceFrequencyFamily +open HistoryCompensationRepresentativePatterns HistoryPairRepresentatives +open HistoryBulkUniversalPatternAggregation HistoryBulkSelectedUniversalOperator +open HistoryGiantReferenceMean HistoryBulkFibreGiantApproximationReference HistoryBulkFibreOriginalReference +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) +variable (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hvalid : ∀ j, (expand p b j).val ∈ (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) +variable (J : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → SelectedBulkSample C l → ℤ → ℤ → ℂ) +variable {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : ∀ i, choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l (leftChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) i) ≠ 0) + (he : ∀ i, choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l (rightChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) i) ≠ 0) + (houtside : ∀ q∈outside, ∃ v : spectator.Sample, (v:ℕ)=q) + +def primePatternFamily : SymbolicPatternFamily C outside l p := + symbolicPatternFamily C outside σ a p b hvalid J + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl ha hc he houtside (primeWeight_nonneg C.giant) + (fun r _ => primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + +theorem primePatternFamily_none_iff (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) : + (primePatternFamily C outside σ a p b hvalid J hactual hl ha hc he houtside).refs i = none ↔ + weightedPrimeFibreMean C outside σ a i.1.val i.1.val + (leftChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) i) (rightChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) i) (J i) = 0 := by + simpa only [primePatternFamily,symbolicPatternFamily,weightedPrimeFibreMean_eq_weighted,wholeMean] using + referenceFamily_none_iff C outside σ a (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) J + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl ha hc he houtside (primeWeight_nonneg C.giant) + (fun r _ => primeDraw_positive C.giant r) i + +def mixedPatternFamily : SymbolicPatternFamily C outside l p := + symbolicPatternFamily C outside σ a p b hvalid J + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl ha hc he houtside (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + +theorem mixedPatternFamily_none_iff (i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l) : + (mixedPatternFamily C outside σ a p b hvalid J hactual hl ha hc he houtside).refs i = none ↔ + weightedMixedFibreMean C outside σ a i.1.val i.1.val + (leftChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) i) (rightChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) i) (J i) = 0 := by + simpa only [mixedPatternFamily,symbolicPatternFamily,weightedMixedFibreMean_eq_weighted,wholeMean] using + referenceFamily_none_iff C outside σ a (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) J + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl ha hc he houtside (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) i + +end Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilySelection.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilySelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..059ee061c829c47a9a96e48cafbbc3e57c9b07ac --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilySelection.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator HistorySignedXiTransport +open HistoryGiantOriginalMeanFactorization (Choices history) +open HistoryBulkFibreReference (originalMean) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +variable (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) +variable (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) +variable {α : Type} [Fintype α] (w : α → ℝ) (P Q : α → ℤ) + +variable {spectator : PrimeSource} +variable (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : ∀ i, choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (leftChoices C x i) ≠ 0) + (he : ∀ i, choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (rightChoices C y i) ≠ 0) + (houtside : ∀ q∈outside, ∃ p : spectator.Sample, (p:ℕ)=q) + (hw : ∀ r, 0 ≤ w r) (hpos : ∀ r, w r ≠ 0 → 0 < P r ∧ 0 < Q r) + +def selectWitness (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + Option (Witness C outside σ a x y J w P Q i) := by + classical + exact if hn : wholeMean C outside σ a x y J w P Q i = 0 then none else + some (Classical.choice (witness_nonempty C outside σ a x y J w P Q + hactual hl ha hc he houtside hw hpos i hn)) + +theorem selectWitness_none_iff (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + selectWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i = none ↔ + wholeMean C outside σ a x y J w P Q i = 0 := by + classical + unfold selectWitness + split_ifs <;> simp_all + +theorem selectWitness_isSome_iff (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + (selectWitness C outside σ a x y J w P Q hactual hl ha hc he houtside hw hpos i).isSome ↔ + wholeMean C outside σ a x y J w P Q i ≠ 0 := by + classical + unfold selectWitness + split_ifs <;> simp_all + +end Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilySymbolic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilySymbolic.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d1579c4d0c5be87d6c1d676c93afa19400b5407 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilySymbolic.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkUniversalPatternAggregationFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCompensationRepresentativePatternsDecoded + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkReferenceFrequencyFamily +open HistoryCompensationRepresentativePatterns HistoryPairRepresentatives +open HistoryBulkUniversalPatternAggregation HistoryBulkSelectedUniversalOperator +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) +variable (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) + (hvalid : ∀ j, (expand p b j).val ∈ (C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l j)).candidates) +variable (J : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → SelectedBulkSample C l → ℤ → ℤ → ℂ) +variable {α : Type} [Fintype α] (w : α → ℝ) (P Q : α → ℤ) +variable {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : ∀ i, choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l (leftChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) i) ≠ 0) + (he : ∀ i, choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l (rightChoices C (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) i) ≠ 0) + (houtside : ∀ q∈outside, ∃ v : spectator.Sample, (v:ℕ)=q) + (hw : ∀ r, 0 ≤ w r) (hpos : ∀ r, w r ≠ 0 → 0 < P r ∧ 0 < Q r) + +def representativeEquiv + (i : RootPresent (referenceFamily C outside σ a (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) J w P Q + hactual hl ha hc he houtside hw hpos)) : + Block p ≃ Representative + (rootLeftHistory (referenceFamily C outside σ a (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) J w P Q + hactual hl ha hc he houtside hw hpos) i) + (rootRightHistory (referenceFamily C outside σ a (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) J w P Q + hactual hl ha hc he houtside hw hpos) i) := + (decodedRepresentativeBlockEquiv C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l p b hvalid + (rootSelected _ i).left (rootSelected _ i).right i.val.2.1 i.val.2.2 + (rootSelected _ i).left_matches (rootSelected _ i).right_matches).symm + +def symbolicPatternFamily + (hcell : ∀ v, w v ≠ 0 → 0 < P v ∧ 0 < Q v ∧ + |Real.log (P v:ℝ)-(C.giantCenter:ℝ)| ≤ 1 ∧ + |Real.log (Q v:ℝ)-(C.giantCenter:ℝ)| ≤ 1) : + SymbolicPatternFamily C outside l p where + permutation := σ + left := (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) + right := (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) + refs := referenceFamily C outside σ a (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) J w P Q hactual hl ha hc he houtside hw hpos + data := actualData C outside σ a (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inl j)) (fun j => blockSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l p b hvalid (Sum.inr j)) J w P Q hactual hl ha hc he houtside hw hpos hcell + representative := representativeEquiv C outside σ a p b hvalid J w P Q + hactual hl ha hc he houtside hw hpos + mask := fun _ => 1 + mask_mem := fun _ => ⟨zero_le_one,le_rfl⟩ + +end Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyWitness.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..66e12c955b03f0a6aa672ab0a7bb3d9aad62c066 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualRootReferenceFamilyWitness.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceWeighted +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedUniversalOperatorActualData + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator HistorySignedXiTransport +open HistoryGiantOriginalMeanFactorization (Choices history) +open HistoryBulkFibreReference (originalMean) + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) +abbrev Index := RootFrequencyIndex (frequencyBound Bs BD Bz k L) l +abbrev Draws := InternalSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l + +variable (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) +variable (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → SelectedBulkSample C l → ℤ → ℤ → ℂ) +variable {α : Type} [Fintype α] (w : α → ℝ) (P Q : α → ℤ) + +def leftChoices (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : Choices (l:=l) C := + assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l i.2.1 x + +def rightChoices (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : Choices (l:=l) C := + assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l i.2.2 y + +def wholeMean (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : ℂ := + originalMean (selectedBulkPrior C l).mass w (fun u r => + weightedFibreTerm C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (J i) u (P r) (Q r)) + +structure Witness (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) where + bulk : SelectedBulkSample C l + giant : α + bulk_pos : 0 < (selectedBulkPrior C l).mass bulk + giant_pos : 0 < w giant + term_ne : weightedFibreTerm C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (J i) bulk (P giant) (Q giant) ≠ 0 + supported : FibreSupported C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) bulk (P giant) (Q giant) + equality : ∀ u r, (selectedBulkPrior C l).mass u ≠ 0 → w r ≠ 0 → + weightedFibreTerm C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (J i) u (P r) (Q r) = + weightedFibreReferenceTerm C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (J i) k bulk (P giant) (Q giant) supported u (P r) (Q r) + mean_eq : wholeMean C outside σ a x y J w P Q i = + originalMean (selectedBulkPrior C l).mass w (fun u r => + weightedFibreReferenceTerm C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (J i) k bulk (P giant) (Q giant) supported u (P r) (Q r)) + +theorem witness_nonempty {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : ∀ i, choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (leftChoices C x i) ≠ 0) + (he : ∀ i, choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l (rightChoices C y i) ≠ 0) + (houtside : ∀ q∈outside, ∃ p : spectator.Sample, (p:ℕ)=q) + (hw : ∀ r, 0 ≤ w r) (hpos : ∀ r, w r ≠ 0 → 0 < P r ∧ 0 < Q r) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (hn : wholeMean C outside σ a x y J w P Q i ≠ 0) : + Nonempty (Witness C outside σ a x y J w P Q i) := by + have hs := weightedWholeFibreMean_fixed_reference C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (J i) hactual k hl hl ha (hc i) (he i) + houtside w P Q hw hpos + rcases hs with hz | ⟨u,r,hu,hr,ht,hs,hall,hmean⟩ + · exact False.elim (hn hz) + · exact ⟨⟨u,r,hu,hr,ht,hs,hall,hmean⟩⟩ + +end Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementBounds.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..f2a3f19acb5117287bdb78f24244671c4d7db857 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementBounds.lean @@ -0,0 +1,22 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceDisintegration + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +abbrev SpectatorResidueBounds (_C : InitialSourceChoice d Bs BD Bz k L E) + (spectator : PrimeSource) (l : ℕ) : Prop := + ∀ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀q∈spectatorList spectator ds,∀j ≤ l,frequencyBound Bs BD Bz k L j plainCollisionSourceError_to_point d Bs BD Bz H k L h) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointConversion.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointConversion.lean new file mode 100644 index 0000000000000000000000000000000000000000..216ba1471c4a82079310f047c721cf9d6d5dbc62 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointConversion.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointSourceErrorStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointValueIdentity + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkActualPrincipalCollision + +theorem plainCollisionSourceError_to_point (d : Decomposition) (Bs BD Bz H : ℝ) + (k : ℕ) (L : ℝ) (h : PlainCollisionSourceError d Bs BD Bz H k L) : + PlainCollisionPoint d Bs BD Bz H k L := by + intro E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed ds hds + dsimp only + rw [plainCollisionBulkValue_eq_sourceValue C spectator D hl σ mixed ds, + plainKernelValue_symbolic_eq_collisionSourceValue C spectator D hl σ mixed ds] + exact h E C hG hGu hcl hcu hb hd spectator hspec D.reference ds hds l hl σ mixed (D.residues ds) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceErrorConversion.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceErrorConversion.lean new file mode 100644 index 0000000000000000000000000000000000000000..64f926695b232186d7c85114cedb31f9cf29d269 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceErrorConversion.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionIdentity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainErrorProperty +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainSupport +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointSourceErrorStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointSourceFalse + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkActualPrincipalCollision + +theorem plainCollisionErrorProperty_to_source (d : Decomposition) (Bs BD Bz H : ℝ) + (k : ℕ) (L : ℝ) (h : plainErrorProperty d Bs BD Bz H k L) : + PlainCollisionSourceError d Bs BD Bz H k L := by + intro E C hG hGu hcl hcu hb hd spectator hspec hactual ds hds l hl σ mixed hV + exact error_bounds_of_eq + (plainKernelCollisionSourceValue_eq_plainCollisionPrincipal C spectator ds hactual hl σ mixed hV) + (plainCollisionSourceBulkValue_eq_false C spectator ds hactual hl σ mixed hV) + (h E C hG hGu hcl hcu hb hd spectator hspec hactual ds hds l hl σ mixed hV) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceErrorStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceErrorStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..881ecd897715cfaad4e22d26b933c276e240488b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceErrorStatement.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionKernelStagePlainCollisionDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointSourceValueDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkActualPrincipalCollision + +def PlainCollisionSourceError (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) (L : ℝ) : Prop := + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) plainCollisionErrorProperty_to_source d Bs BD Bz H k L h) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceFalse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceFalse.lean new file mode 100644 index 0000000000000000000000000000000000000000..e1041c8fc36052635d96b4825a1f4b32246b11ad --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionPointSourceFalse.lean @@ -0,0 +1,31 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionPlainFalse +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointSourceValueDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkActualPrincipalCollision +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainCollisionSourceBulkValue_eq_false + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jplainCollisionBulkValue C spectator D hl σ mixed ds) + r₁ r₂ (fun ds hds=>h ds + (fun i=>Finset.prod_ne_zero_iff.mp + (show (∏j,spectator.law.mass (ds j))≠0 from hds) i (Finset.mem_univ i))) + let heq := congrArg (fun z : ℂ=>‖plainKernelAverage C spectator D hl σ mixed true-z‖) + (plainBulkAverage_eq_collisionBulkValue_mean C spectator D hl σ mixed) + ⟨heq.trans_le hmean.1,heq.trans_le hmean.2⟩ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageConversion.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageConversion.lean new file mode 100644 index 0000000000000000000000000000000000000000..6608871f7d5b4266a44ddba34f6824123773fc04 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageConversion.lean @@ -0,0 +1,28 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter + +theorem plainCollisionPoint_to_stage (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) + (h : ∀ᶠL : ℝ in atTop,PlainCollisionPoint d Bs BD Bz H k L) : + ∀ᶠL : ℝ in atTop,PlainCollisionStage d Bs BD Bz H k L := + h.mono (fun L h E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed => + plain_collision_stage_average_bound C spectator D hl σ mixed + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (fun ds hds=>h E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed ds hds)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageSourceMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageSourceMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5bcaa721211519cf32de131aa0fb7f89839b72d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageSourceMean.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointSourceValueDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainBulkDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainBulkAverage_eq_sourceValue_mean + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (mixed : Bool) (hV : SpectatorResidueBounds C spectator l) : + plainBulkAverage C spectator hactual hl σ mixed hV = + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (fun ds=>plainCollisionSourceBulkValue C spectator ds hactual hl σ mixed (hV ds)) := by + unfold plainBulkAverage plainCollisionSourceBulkValue + rfl + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageValueMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageValueMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..3bf7067a6a4a5e412d36005e2ae760cec3e7d9dd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStageValueMean.lean @@ -0,0 +1,33 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionPointValueDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionStageSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainBulkDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainBulkAverage_eq_collisionBulkValue_mean + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) (mixed : Bool) : + plainBulkAverage C spectator D.reference hl σ mixed D.residues = + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (plainCollisionBulkValue C spectator D hl σ mixed) := by + refine (plainBulkAverage_eq_sourceValue_mean C spectator D.reference hl σ mixed D.residues).trans ?_ + apply congrArg (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + funext ds + unfold plainCollisionBulkValue + rfl + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..17ef6dae64dd16d4dc59817213f434e0ad219746 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCollisionStatement.lean @@ -0,0 +1,37 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainBulkDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter + +def PlainCollisionStage (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) (L : ℝ) : Prop := + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) ?_⟩ + have h01 := hgiant indices choice hG hGu hcl hcu hb hd spectator hspec level hl permutation + have hB := hsquare indices choice hG hGu hcl hcu hb hd spectator hspec level hl stageData permutation + have hK := hkernel indices choice hG hGu hcl hcu hb hd spectator hspec level hl stageData permutation + have h34 := hcollision indices choice hG hGu hcl hcu hb hd spectator hspec level hl stageData permutation + have h45 := hfinal indices choice hG hGu hcl hcu hb hd spectator hspec level hl stageData.residues permutation + exact corrected_total_of_stage_bounds choice spectator stageData hl permutation H hm h01 hB hK h34 h45 + +public theorem selected_corrected_total_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + CorrectedTotalEstimate d Bs BD Bz H k := + correctedActualProof d Bs BD Bz H hBs hH hk + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedBulkDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedBulkDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..f639ef6140309a1c4f258e01abb0c1840a3c7d1f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedBulkDefs.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualIntegralReplacement HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def correctedBulkAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hl : l < k) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (hV : SpectatorResidueBounds C spectator l) : ℂ := + if he : PreservesRemainingBands _ e then + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (fun ds => correctedBulkPrincipal C spectator ds hl e he (hV ds)) + else 0 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionBulkAverage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionBulkAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..18e2ab54844ab037befe29a3ea71c38e0bcc6642 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionBulkAverage.lean @@ -0,0 +1,36 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedBulkDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkActualIntegralReplacement +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem correctedBulkAverage_eq_guarded + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hl : l correctedBulkPrincipal (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) C spectator ds hl e he (hV ds)) + else 0 := by + by_cases he : PreservesRemainingBands _ e + · simp only [correctedBulkAverage, dite_eq_left he] + · simp only [correctedBulkAverage, dite_eq_right he] + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionKernelAverage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionKernelAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..e16ddda041d73e5dc51547fc6c89b395827b2298 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionKernelAverage.lean @@ -0,0 +1,33 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem correctedKernelAverage_eq_guarded + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l + corrected_collision_stage_average_from_collision_bound + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator D hl e + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (Real.exp_pos _).le (Real.exp_pos _).le + (fun he ds hds => hL E C hG hGu hcl hcu hb hd spectator hspec ds + (HistoryBulkFibreGiantErrorAverage.spectator_mass_ne_zero + (k:=k) (L:=L) spectator ds hds) + l hl e he (D.residues ds))) + +public theorem selected_corrected_collision_stage_eventually + (d : Decomposition) (Bs BD Bz H : ℝ) {k : ℕ} + (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ scale : ℝ in atTop, correctedCollisionStageProperty d Bs BD Bz H k scale := + correctedCollisionStageProof d Bs BD Bz H hBs hH hk + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionStageError.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionStageError.lean new file mode 100644 index 0000000000000000000000000000000000000000..67acf190890e89c7644d8c497dc72355b32538c4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionStageError.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedSpectatorDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedBulkDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedCollisionBulkAverage +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedCollisionKernelAverage +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedCollisionPointError +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelFinite + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +section +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference HistoryBulkActualPrincipalCollisionCorrected +open HistoryBulkActualIntegralReplacement +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +private theorem transport_two_errors {x x' y y' : ℂ} {a b : ℝ} + (hx : x=x') (hy : y=y') (h : ‖x'-y'‖≤a ∧ ‖x'-y'‖≤b) : + ‖x-y‖≤a ∧ ‖x-y‖≤b := hx.symm ▸ hy.symm ▸ h + +public theorem corrected_collision_stage_average_from_collision_bound + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l correctedKernelValue (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) C spectator D hl e he true) + (fun he ds => correctedBulkPrincipal (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) C spectator ds hl e he (D.residues ds)) + r₁ r₂ hr₁ hr₂ + (fun he ds hds => correctedKernelValue_error_le + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator D hl e he ds r₁ r₂ (h he ds hds))) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionStageProperty.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionStageProperty.lean new file mode 100644 index 0000000000000000000000000000000000000000..4aa7e3ee8657bed56ddad14e4a4bd5f7ec49407b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedCollisionStageProperty.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedBulkDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkIndependentFibreReference + +def correctedCollisionStageProperty + (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) (L : ℝ) : Prop := + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) ?_⟩ + have h01 := hgiant E C hG hGu hcl hcu hb hd spectator hspec l hl e + have hB := hsquare E C hG hGu hcl hcu hb hd spectator hspec l hl D e + have hK := hkernel E C hG hGu hcl hcu hb hd spectator hspec l hl D e + have h34 := hcollision E C hG hGu hcl hcu hb hd spectator hspec l hl D e + have h45 := hfinal E C hG hGu hcl hcu hb hd spectator hspec l hl D.residues e + exact corrected_total_of_stage_bounds C spectator D hl e H hm h01 hB hK h34 h45 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..875a6a0213711f3cfb8bb27beb4eadc99b1bc7eb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedDefs.lean @@ -0,0 +1,31 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def correctedFinalAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hl : lcorrectedPrincipal C spectator ds hl e he (hV ds)) + else 0 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..41237ba8f3b8720d01eb308ccca77a0a71c016a8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStage.lean @@ -0,0 +1,32 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedFinalStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedFinalStageStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualIntegralReplacement HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem selected_corrected_final_stage_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + CorrectedFinalStageEstimate d Bs BD Bz H k := + (selected_corrected_bulk_error_eventually d Bs BD Bz H hBs hH hk).mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec l hl hV e => + corrected_final_stage_average_bound C spectator hl e hV + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) (Real.exp_nonneg _) (Real.exp_nonneg _) + (fun he ds => (h E C hG hGu hcl hcu hb hd spectator hspec ds l hl).choose_spec e he)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStageBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStageBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..3747190ff9bf3b63adf01f7203e1bcab33bb2fc5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStageBasic.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementCorrectedDefsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedBulkDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelFinite + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualIntegralReplacement HistoryBulkActualGoodPrincipal +open HistoryBulkIndependentFibreReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem corrected_final_stage_average_bound + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hl : l < k) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (hV : SpectatorResidueBounds C spectator l) (B D : ℝ) (hB : 0 ≤ B) (hD : 0 ≤ D) + (h : ∀ he : PreservesRemainingBands _ e, ∀ ds, + ‖correctedBulkPrincipal C spectator ds hl e he (hV ds)- + correctedPrincipal C spectator ds hl e he (hV ds)‖ ≤ B ∧ + ‖correctedBulkPrincipal C spectator ds hl e he (hV ds)- + correctedPrincipal C spectator ds hl e he (hV ds)‖ ≤ D) : + ‖correctedBulkAverage C spectator hl e hV- + correctedFinalAverage C spectator hl e hV‖ ≤ B ∧ + ‖correctedBulkAverage C spectator hl e hV- + correctedFinalAverage C spectator hl e hV‖ ≤ D := + @norm_guarded_cmean_sub_le_both + (Fin (2*(bulkSize k L/2)) → spectator.Sample) inferInstance + (spectatorPrior spectator (2*(bulkSize k L/2))) + (PreservesRemainingBands _ e) (Classical.propDecidable _) + (fun he ds => correctedBulkPrincipal (l:=l) C spectator ds hl e he (hV ds)) + (fun he ds => correctedPrincipal (l:=l) C spectator ds hl e he (hV ds)) + B D hB hD (fun he ds _ => h he ds) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStageStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStageStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..30b2b11a80de707cf8797fab2e4c42715ff18545 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedFinalStageStatement.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedBulkDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference + +def CorrectedFinalStageEstimate (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l < k), + ∀ hV : SpectatorResidueBounds C spectator l, + ∀ (e : RemainingPermutation (k:=k) (L:=L) (l:=l)), + ‖correctedBulkAverage C spectator hl e hV- + correctedFinalAverage C spectator hl e hV‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖correctedBulkAverage C spectator hl e hV- + correctedFinalAverage C spectator hl e hV‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedInitial.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..663bf1efedcb9ef4fd323cdf20f40ff07a80a288 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedInitial.lean @@ -0,0 +1,37 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexCorrectedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedSquareDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementInitialGuard +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedScalarDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantErrorAverage HistoryBulkActualPrincipalSourceReindex +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem correctedGuardedPrincipalAverage_eq_correctedSquareAverage + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l < k) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) : + correctedGuardedPrincipalAverage C spectator e = + correctedSquareAverage C spectator D hl e false := + @same_guard_congr (PreservesRemainingBands _ e) (Classical.propDecidable _) + (fun he => originalSourceAverage C spectator (correctedSelectedPrincipal C spectator e he)) + (fun he => (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (correctedSquareValue C spectator D hl e he false)) + (fun he => @original_corrected_principal_eq_B_sourceMean d Bs BD Bz L k l E + C spectator e he D.admissible D.residues D.frequencies) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedJoin.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedJoin.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed8f196d175a8366d97f64ea85d0b718934bc95c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedJoin.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedBulkDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedInitial +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedProbabilityKernel +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedSquareDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainJoinFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedScalarDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantErrorAverage HistoryBulkIndependentFibreReference +open HistoryActualComparisonDecayArithmetic +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem corrected_total_of_stage_bounds + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l < k) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (H : ℝ) (hm : 1 ≤ (bulkSize k L : ℝ)) + (h0 : ‖@InitialSourceChoice.selectedDiagonalCovariance d Bs BD Bz k L E C spectator (bulkSize k L/2) C.scale l e- + @correctedGuardedPrincipalAverage d Bs BD Bz L k l E C spectator e‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@InitialSourceChoice.selectedDiagonalCovariance d Bs BD Bz k L E C spectator (bulkSize k L/2) C.scale l e- + @correctedGuardedPrincipalAverage d Bs BD Bz L k l E C spectator e‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h1 : ‖@correctedSquareAverage d Bs BD Bz L k l E C spectator D hl e false- + @correctedSquareAverage d Bs BD Bz L k l E C spectator D hl e true‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@correctedSquareAverage d Bs BD Bz L k l E C spectator D hl e false- + @correctedSquareAverage d Bs BD Bz L k l E C spectator D hl e true‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h2 : ‖@correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e false- + @correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e true‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e false- + @correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e true‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h3 : ‖@correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e true- + @correctedBulkAverage d Bs BD Bz L k l E C spectator hl e D.residues‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e true- + @correctedBulkAverage d Bs BD Bz L k l E C spectator hl e D.residues‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h4 : ‖@correctedBulkAverage d Bs BD Bz L k l E C spectator hl e D.residues- + @correctedFinalAverage d Bs BD Bz L k l E C spectator hl e D.residues‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@correctedBulkAverage d Bs BD Bz L k l E C spectator hl e D.residues- + @correctedFinalAverage d Bs BD Bz L k l E C spectator hl e D.residues‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + : ‖@InitialSourceChoice.selectedDiagonalCovariance d Bs BD Bz k L E C spectator (bulkSize k L/2) C.scale l e- + @correctedFinalAverage d Bs BD Bz L k l E C spectator hl e D.residues‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖@InitialSourceChoice.selectedDiagonalCovariance d Bs BD Bz k L E C spectator (bulkSize k L/2) C.scale l e- + @correctedFinalAverage d Bs BD Bz L k l E C spectator hl e D.residues‖ ≤ Real.exp (-H*(bulkSize k L:ℝ)) := by + exact @five_stage_bounds_of_eq (frequencyBudget Bs BD Bz k L l) H (bulkSize k L:ℝ) hm + (@InitialSourceChoice.selectedDiagonalCovariance d Bs BD Bz k L E C spectator (bulkSize k L/2) C.scale l e) + (@correctedGuardedPrincipalAverage d Bs BD Bz L k l E C spectator e) + (@correctedSquareAverage d Bs BD Bz L k l E C spectator D hl e false) + (@correctedSquareAverage d Bs BD Bz L k l E C spectator D hl e true) + (@correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e false) + (@correctedKernelAverage d Bs BD Bz L k l E C spectator D hl e true) + (@correctedBulkAverage d Bs BD Bz L k l E C spectator hl e D.residues) + (@correctedFinalAverage d Bs BD Bz L k l E C spectator hl e D.residues) + (@correctedGuardedPrincipalAverage_eq_correctedSquareAverage d Bs BD Bz L k l E C spectator D hl e) + (@correctedSquareAverage_probability_eq_kernel d Bs BD Bz L k l E C spectator D hl e) + h0 h1 h2 h3 h4 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..d379e624420b441684161ca4ef402d0c68e73510 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelDefs.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementStageData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalKernelStageCorrected +attribute [local instance] Classical.propDecidable +local instance totalCorrectedKernelInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def correctedKernelValue (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (_hl : l + (hL E C hG hGu hcl hcu hb hd spectator hspec + (spectatorList spectator ds) + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + List.length_ofFn l hl e he).elim (fun hp hex => hex.elim (fun hV hbound => + correctedKernelValue_bounds C spectator D hl e he ds hp hV + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) hbound))) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelPointFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelPointFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..49ceab2d685a3a6c3726101e794bcce9b269f880 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelPointFinite.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedMeanScalarDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelEqualityFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelPointValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion CanonicalOccurrenceTransport +open HistoryBulkActualRootReferenceFamily HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalKernelStageCorrected +attribute [local instance] Classical.propDecidable +local instance kernelPointFiniteInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem correctedKernelValue_bounds (C : InitialSourceChoice d Bs BD Bz k L E) + (spectator : PrimeSource) (D : PlainStageData C spectator l) (hl : l + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p, + selectedKernelMean (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) + (k:=k) (l:=l) (E:=E) C p (spectatorList spectator ds) e he List.length_ofFn hp hV + i.1 i.2.1 i.2.2 b + ‖f false-f true‖≤r₁ ∧ ‖f false-f true‖≤r₂) : + ‖correctedKernelValue C spectator D hl e he false ds- + correctedKernelValue C spectator D hl e he true ds‖≤r₁ ∧ + ‖correctedKernelValue C spectator D hl e he false ds- + correctedKernelValue C spectator D hl e he true ds‖≤r₂ := + norm_sub_bounds_of_eq + (correctedKernelValue_eq C spectator D hl e he ds hp hV false) + (correctedKernelValue_eq C spectator D hl e he ds hp hV true) h + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelPointStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelPointStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..e014c061fdc6ab7d7fad117babde5e2e8016ba97 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelPointStatement.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference + +def SelectedCorrectedKernelPointEstimate (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l correctedKernelValue C spectator D hl e he false) + (fun he => correctedKernelValue C spectator D hl e he true) + r₁ r₂ hr₁ hr₂ (fun he ds _ => h he ds) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelStageConversion.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelStageConversion.lean new file mode 100644 index 0000000000000000000000000000000000000000..0588cbb363714fa0cb9490f39178d62aac5d11ea --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelStageConversion.lean @@ -0,0 +1,31 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelPointStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelStageStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable + +theorem correctedKernelPointEstimate_to_stage (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) + (h : SelectedCorrectedKernelPointEstimate d Bs BD Bz H k) : + SelectedCorrectedKernelStageEstimate d Bs BD Bz H k := + h.mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec l hl D e => + corrected_kernel_stage_average_bound C spectator D hl e + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) (Real.exp_nonneg _) (Real.exp_nonneg _) + (fun he ds => h E C hG hGu hcl hcu hb hd spectator hspec l hl D e he ds)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelStageStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelStageStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..65ded530093b86c893951ecfe30e121f052e8b5b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedKernelStageStatement.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable + +def SelectedCorrectedKernelStageEstimate (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l + ⟨ε,hε.1,hε.2.mono fun L hL => fun E C hG hGu hcl hcu hb hd spectator hspec hflat j hj => + let μ := spectatorPrior spectator (2*(bulkSize k L/2)) + let hpoint := fun ds : Fin (2*(bulkSize k L/2)) → spectator.Sample => + hL spectator hspec hflat ds E C hG hGu hcl hcu hb hd j hj + let hV : SpectatorResidueBounds C spectator j := fun ds => (hpoint ds).choose + ⟨hV,fun e he hgood => + (congrArg norm (show correctedFinalAverage C spectator hj e hV = + μ.cmean (fun ds=>HistoryBulkActualGoodPrincipal.correctedPrincipal C spectator ds + hj e he (hV ds)) from dite_eq_left he)).trans_le + ((μ.norm_cmean_le _).trans + ((μ.mean_mono (fun ds=>(hpoint ds).choose_spec e he hgood)).trans_eq + (μ.mean_const _)))⟩⟩ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedProbabilityKernel.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedProbabilityKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..eded777c7ac2ec0875fd21e66f5b4bc7710412dc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedProbabilityKernel.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedProbabilityKernelPoint +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedSquareDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementInitialGuard + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalSourceReindexFamilyCorrected +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (correctedSquareValue C spectator D hl e he true)) + (fun he => (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (correctedKernelValue C spectator D hl e he false)) + (fun he => congrArg (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (funext (fun ds => correctedSquareValue_probability_eq_kernel C spectator D hl e he ds))) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedProbabilityKernelPoint.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedProbabilityKernelPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..1852bf03695067228d7151c8d043aa513dad0cb8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedProbabilityKernelPoint.lean @@ -0,0 +1,36 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedAggregate +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedSquareDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalSourceReindexFamilyCorrected +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + List.length_ofFn l hl + exact (hbound e he).2 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedSquareStage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedSquareStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..f461172ff340ab89ba09826444936f41301362a3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedSquareStage.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedSquarePoint +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable + +theorem selected_corrected_square_stage_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l h E C hG hGu hcl hcu hb hd spectator hspec l hl D e he ds) + · simp only [correctedSquareAverage,dite_eq_right he,sub_self,norm_zero] + exact ⟨(Real.exp_pos _).le,(Real.exp_pos _).le⟩ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..4e0ff6c0711619be1af4e6da59a97a911301d3aa --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedStatement.lean @@ -0,0 +1,41 @@ +import Mathlib.Basic.Real.Basic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedDefs +import OAI.NumberTheory.Ostmann.Construction.SelectedDiagonalEnvironment +import OAI.NumberTheory.Ostmann.Setup + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference + +def CorrectedTotalEstimate (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l < k), ∃ hV : SpectatorResidueBounds C spectator l, + ∀ e : RemainingPermutation (k:=k) (L:=L) (l:=l), + ‖C.selectedDiagonalCovariance spectator (bulkSize k L/2) C.scale l e- + correctedFinalAverage C spectator hl e hV‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖C.selectedDiagonalCovariance spectator (bulkSize k L/2) C.scale l e- + correctedFinalAverage C spectator hl e hV‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedStatementExpansion.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedStatementExpansion.lean new file mode 100644 index 0000000000000000000000000000000000000000..9baf3ae68ff13afe95bfeb6e96494b9cc7f065f9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementCorrectedStatementExpansion.lean @@ -0,0 +1,42 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCorrectedStatement +import OAI.NumberTheory.Ostmann.Construction.SelectedDiagonalEnvironment + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference + +theorem correctedTotalEstimate_eq (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) : + CorrectedTotalEstimate d Bs BD Bz H k = ( + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l < k), ∃ hV : SpectatorResidueBounds C spectator l, + ∀ e : RemainingPermutation (k:=k) (L:=L) (l:=l), + ‖C.selectedDiagonalCovariance spectator (bulkSize k L/2) C.scale l e- + correctedFinalAverage C spectator hl e hV‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖C.selectedDiagonalCovariance spectator (bulkSize k L/2) C.scale l e- + correctedFinalAverage C spectator hl e hV‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ))) := by + rfl + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementInitialGuard.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementInitialGuard.lean new file mode 100644 index 0000000000000000000000000000000000000000..a4c998f323dec41cf86b76b29f26439ad11b49a9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementInitialGuard.lean @@ -0,0 +1,18 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementBounds + +namespace OAI + +open Erdos970 + +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +theorem same_guard_congr {P : Prop} [Decidable P] (f g : P → ℂ) + (h : ∀ hp, f hp = g hp) : + (if hp : P then f hp else 0) = (if hp : P then g hp else 0) := by + split_ifs with hp + · exact h hp + · rfl + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..cd734b11e44d1f24c6338e55c0f989f18b4d0544 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelDefs.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedLawsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementStageData + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualPrincipalKernelStage +attribute [local instance] Classical.propDecidable +local instance totalKernelInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainKernelValue (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (mixed symbolic : Bool) (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) : ℂ := + if mixed then + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p, + mixedKernelMean C p (spectatorList spectator ds) σ + (fun o => plainMixedLawMultiplier C (spectatorList spectator ds) + (outerGiants C l p o,outerNonbulk C l p o)) + D.reference hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (D.residues ds) i.1 i.2.1 i.2.2 symbolic + else + ∑i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l),∑p, + primeKernelMean C p (spectatorList spectator ds) σ + (fun o => primeLawMultiplier C (outerGiants C l p o,outerNonbulk C l p o)) + D.reference hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + List.length_ofFn (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (D.residues ds) i.1 i.2.1 i.2.2 symbolic + +def plainKernelAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed symbolic : Bool) : ℂ := + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (plainKernelValue C spectator D hl σ mixed symbolic) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelPoint.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..f20d98df5c5880d4dad88decb89cffb67b7c5c76 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelPoint.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageSelectedLawsIndex +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualPrincipalKernelStage + +theorem selected_plain_kernel_point_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l ≤ k) (D : PlainStageData C spectator l) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample), + ‖plainKernelValue C spectator D hl σ mixed false ds- + plainKernelValue C spectator D hl σ mixed true ds‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖plainKernelValue C spectator D hl σ mixed false ds- + plainKernelValue C spectator D hl σ mixed true ds‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) := + (selected_law_kernel_index_errors_eventually d Bs BD Bz H hBs hH hk).mono + (fun _L h E C hG hGu hcl hcu hb hd spectator hspec l hl _D σ mixed ds => + (h E C hG hGu hcl hcu hb hd spectator hspec).elim (fun _hactual h => + (h (spectatorList spectator ds) + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + List.length_ofFn l hl).elim (fun _hp h => h.elim (fun _hV h => + let hs := h σ + (fun p o => primeLawMultiplier C (outerGiants C l p o,outerNonbulk C l p o)) + (fun p o => plainMixedLawMultiplier C (spectatorList spectator ds) + (outerGiants C l p o,outerNonbulk C l p o)) + Bool.rec hs.1 hs.2 mixed)))) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelStage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..1e59f882fa1bab621cbc57dd758d5a66d536d42d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementKernelStage.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelPoint +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily + +theorem selected_plain_kernel_stage_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l ≤ k) (D : PlainStageData C spectator l) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool), + ‖plainKernelAverage C spectator D hl σ mixed false- + plainKernelAverage C spectator D hl σ mixed true‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖plainKernelAverage C spectator D hl σ mixed false- + plainKernelAverage C spectator D hl σ mixed true‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) := + (selected_plain_kernel_point_eventually d Bs BD Bz H hBs hH hk).mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed => + norm_cmean_sub_le_both (spectatorPrior spectator (2*(bulkSize k L/2))) + (plainKernelValue C spectator D hl σ mixed false) + (plainKernelValue C spectator D hl σ mixed true) + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (fun ds _ => h E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed ds)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..cc8d708aa6a1f9f861efc0c04e1f31ce9f6a997d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementMean.lean @@ -0,0 +1,28 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GiantCollisionError + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction + +theorem norm_cmean_sub_le {α : Type*} [Fintype α] (μ : FinitePrior α) + (f g : α → ℂ) (B : ℝ) (h : ∀ a, μ.mass a ≠ 0 → ‖f a-g a‖ ≤ B) : + ‖μ.cmean f-μ.cmean g‖ ≤ B := + (congrArg norm (GiantCollisionError.cmean_sub_eq μ f g)).trans_le + (GiantCollisionError.norm_cmean_le_of_mass_ne_zero μ _ B h) + +theorem norm_cmean_sub_le_both {α : Type*} [Fintype α] (μ : FinitePrior α) + (f g : α → ℂ) (B D : ℝ) + (h : ∀ a, μ.mass a ≠ 0 → ‖f a-g a‖ ≤ B ∧ ‖f a-g a‖ ≤ D) : + ‖μ.cmean f-μ.cmean g‖ ≤ B ∧ ‖μ.cmean f-μ.cmean g‖ ≤ D := + ⟨norm_cmean_sub_le μ f g B (fun a ha => (h a ha).1), + norm_cmean_sub_le μ f g D (fun a ha => (h a ha).2)⟩ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementOriginalDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementOriginalDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a64331342950cdfb59fadf287848254fdd0a242 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementOriginalDefs.lean @@ -0,0 +1,25 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceDisintegration + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantErrorAverage +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainOriginalAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) (mixed : Bool) : ℂ := + if mixed then originalSourceAverage C spectator (mixedOriginalValue C spectator σ) + else originalSourceAverage C spectator (primeOriginalValue C spectator σ) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..b0de9d04a85db8ea5c26a0b07418a945fad8c72f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainActual.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryActualComparisonDecayArithmeticSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementCollisionStage +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelStage +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainFinalStage +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainGiant +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainJoin +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementSquareStage + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryActualComparisonDecayArithmetic + +theorem selected_plain_total_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + PlainTotalEstimate d Bs BD Bz H k := by + have hk0 : 0 < k := lt_of_lt_of_le (Nat.zero_lt_succ 1) hk + have hreserve : 0 ≤ H+5 := add_nonneg hH (Nat.cast_nonneg 5) + filter_upwards [selected_plain_stage_data_eventually d Bs BD Bz hk0, + selected_plain_giant_stage_eventually d Bs BD Bz (H+5) hBs hreserve hk, + selected_plain_square_stage_eventually d Bs BD Bz (H+5) hBs hreserve hk, + selected_plain_kernel_stage_eventually d Bs BD Bz (H+5) hBs hreserve hk0, + selected_plain_collision_stage_eventually d Bs BD Bz (H+5) hBs hreserve hk, + selected_plain_final_stage_eventually d Bs BD Bz (H+5) hBs hreserve hk, + (bulkSize_tendsto_atTop hk0).eventually_ge_atTop 1] + with L hdata hgiant hsquare hkernel hcollision hfinal hm + intro E C hG hGu hcl hcu hb hd spectator hspec + obtain ⟨hactual,hgiant⟩ := hgiant E C hG hGu hcl hcu hb hd spectator hspec + refine ⟨hactual,fun l hl => ?_⟩ + let D := hdata E C hG hcl hcu hb hd spectator hspec l hl + refine ⟨D.residues,fun σ mixed => ?_⟩ + have h01 := hgiant l hl σ mixed + have hB := hsquare E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed + have hK := hkernel E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed + have h34 := hcollision E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed + have h45 := hfinal E C hG hGu hcl hcu hb hd spectator hspec hactual l hl D.residues σ mixed + exact plain_total_of_stage_bounds C spectator D hl σ mixed H hm h01 hB hK h34 h45 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainBulkDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainBulkDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..91cb063fa5997098460040e291db970cf9880721 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainBulkDefs.lean @@ -0,0 +1,27 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualIntegralReplacement HistoryBulkActualGoodPrincipal +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainBulkAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (hV : SpectatorResidueBounds C spectator l) : ℂ := + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (fun ds => plainBulkPrincipal C spectator ds hactual hl σ mixed (hV ds)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..90ef3b7b7d1db9f3496a355e6e78ee939fa96053 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainDefs.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantErrorAverage HistoryBulkActualGoodPrincipal +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainFinalAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (hV : SpectatorResidueBounds C spectator l) : ℂ := + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (fun ds=>plainPrincipal C spectator ds hactual hl σ mixed (hV ds)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..52a6ec9f2c6ca7393984a435a9b50fe9f9d801e7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStage.lean @@ -0,0 +1,33 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainFinalStageBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainFinalStageStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualIntegralReplacement HistoryBulkActualGoodPrincipal +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem selected_plain_final_stage_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + PlainFinalStageEstimate d Bs BD Bz H k := + (selected_plain_bulk_error_eventually d Bs BD Bz H hBs hH hk).mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec => + (h E C hG hGu hcl hcu hb hd spectator hspec).elim fun _ hpoint => + fun hactual l hl hV σ mixed => + plain_final_stage_average_bound C spectator hactual hl σ mixed hV + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (fun ds => (hpoint ds l hl).choose_spec σ mixed)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStageBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStageBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..fdb3687ce6bc48c0680a6e98f003305446d7cd4b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStageBasic.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualIntegralReplacementPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainBulkDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualIntegralReplacement HistoryBulkActualGoodPrincipal +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plain_final_stage_average_bound + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (hV : SpectatorResidueBounds C spectator l) (B D : ℝ) + (h : ∀ ds, ‖plainBulkPrincipal C spectator ds hactual hl σ mixed (hV ds)- + plainPrincipal C spectator ds hactual hl σ mixed (hV ds)‖ ≤ B ∧ + ‖plainBulkPrincipal C spectator ds hactual hl σ mixed (hV ds)- + plainPrincipal C spectator ds hactual hl σ mixed (hV ds)‖ ≤ D) : + ‖plainBulkAverage C spectator hactual hl σ mixed hV- + plainFinalAverage C spectator hactual hl σ mixed hV‖ ≤ B ∧ + ‖plainBulkAverage C spectator hactual hl σ mixed hV- + plainFinalAverage C spectator hactual hl σ mixed hV‖ ≤ D := + norm_cmean_sub_le_both (spectatorPrior spectator (2*(bulkSize k L/2))) + (fun ds => plainBulkPrincipal C spectator ds hactual hl σ mixed (hV ds)) + (fun ds => plainPrincipal C spectator ds hactual hl σ mixed (hV ds)) B D (fun ds _ => h ds) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStageStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStageStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..23fc96e572cfdb8afdc7a263198b8d1d3633338e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainFinalStageStatement.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainBulkDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration + +def PlainFinalStageEstimate (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator, + ∀ (l : ℕ) (hl : l ≤ k), + ∀ hV : SpectatorResidueBounds C spectator l, + ∀ (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool), + ‖plainBulkAverage C spectator hactual hl σ mixed hV- + plainFinalAverage C spectator hactual hl σ mixed hV‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖plainBulkAverage C spectator hactual hl σ mixed hV- + plainFinalAverage C spectator hactual hl σ mixed hV‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainGiant.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainGiant.lean new file mode 100644 index 0000000000000000000000000000000000000000..68a63640c2f3cf99c574c4328ecc37c79f36b07d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainGiant.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementOriginalDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainGiantDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageActualMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageActualPrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantErrorAverage +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem selected_plain_giant_stage_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∃ hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator, + ∀ (l : ℕ) (hl : l ≤ k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool), + ‖plainOriginalAverage C spectator σ mixed-plainGiantAverage C spectator hactual hl σ mixed‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖plainOriginalAverage C spectator σ mixed-plainGiantAverage C spectator hactual hl σ mixed‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [actual_prime_error_eventually d Bs BD Bz H hBs hH + (lt_of_lt_of_le (Nat.zero_lt_succ 1) hk), + actual_mixed_error_eventually d Bs BD Bz H hBs hH + (lt_of_lt_of_le (Nat.zero_lt_succ 1) hk)] with L hp hm + intro E C hG hGu hcl hcu hb hd spectator hspec + obtain ⟨hactual,hp⟩ := hp E C hG hGu hcl hcu hb hd spectator hspec + obtain ⟨hactual',hm⟩ := hm E C hG hGu hcl hcu hb hd spectator hspec + refine ⟨hactual,fun l hl σ mixed => ?_⟩ + cases mixed + · exact hp l hl σ + · exact hm l hl σ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainGiantDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainGiantDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..564b74d05065ca33e6844912a5ab36f24317f281 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainGiantDefs.lean @@ -0,0 +1,28 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementOriginalDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantErrorAverage +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainGiantAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) : ℂ := + if mixed then originalSourceAverage C spectator (mixedSelectedPrincipal C spectator hactual hl σ) + else originalSourceAverage C spectator (primeSelectedPrincipal C spectator hactual hl σ) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitial.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitial.lean new file mode 100644 index 0000000000000000000000000000000000000000..c61b7e5ceb8b638ddc89f2905d873460af6bdd72 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitial.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainInitialMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainInitialPrime + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainGiantAverage_eq_plainSquareAverage + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l ≤ k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) : + plainGiantAverage (l:=l) C spectator D.reference hl σ mixed = + plainSquareAverage (l:=l) C spectator D hl σ mixed false := by + cases mixed + · exact plainGiantAverage_eq_plainSquareAverage_prime C spectator D hl σ + · exact plainGiantAverage_eq_plainSquareAverage_mixed C spectator D hl σ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitialMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitialMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..d681b948701235be226e85dd17cfb7f97e078761 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitialMixed.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainGiantDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementSquareDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalSourceReindex +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainGiantAverage_eq_plainSquareAverage_mixed + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l ≤ k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) : + plainGiantAverage (l:=l) C spectator D.reference hl σ true = + plainSquareAverage (l:=l) C spectator D hl σ true false := + original_mixed_principal_eq_B_sourceMean (l:=l) C spectator D.reference hl σ + D.admissible D.residues D.frequencies + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitialPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitialPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed3876f02193eb41dcadb02d5a7e056c80410f16 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainInitialPrime.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexPrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainGiantDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementSquareDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalSourceReindex +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainGiantAverage_eq_plainSquareAverage_prime + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l ≤ k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) : + plainGiantAverage (l:=l) C spectator D.reference hl σ false = + plainSquareAverage (l:=l) C spectator D hl σ false false := + original_prime_principal_eq_B_sourceMean (l:=l) C spectator D.reference hl σ + D.admissible D.residues D.frequencies + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainJoin.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainJoin.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d502ef4dfc2dad5f8a70a0bc0148c974ad92f0a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainJoin.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainBulkDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainGiantDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainInitial +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainJoinFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementProbabilityKernel +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementSquareDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryActualComparisonDecayArithmetic +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plain_total_of_stage_bounds + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l ≤ k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (H : ℝ) (hm : 1 ≤ (bulkSize k L : ℝ)) + (h0 : ‖@plainOriginalAverage d Bs BD Bz L k l E C spectator σ mixed- + @plainGiantAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@plainOriginalAverage d Bs BD Bz L k l E C spectator σ mixed- + @plainGiantAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h1 : ‖@plainSquareAverage d Bs BD Bz L k l E C spectator D hl σ mixed false- + @plainSquareAverage d Bs BD Bz L k l E C spectator D hl σ mixed true‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@plainSquareAverage d Bs BD Bz L k l E C spectator D hl σ mixed false- + @plainSquareAverage d Bs BD Bz L k l E C spectator D hl σ mixed true‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h2 : ‖@plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed false- + @plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed true‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed false- + @plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed true‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h3 : ‖@plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed true- + @plainBulkAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed true- + @plainBulkAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + (h4 : ‖@plainBulkAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues- + @plainFinalAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-(H+5)*(bulkSize k L:ℝ)) ∧ + ‖@plainBulkAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues- + @plainFinalAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues‖ ≤ Real.exp (-(H+5)*(bulkSize k L:ℝ))) + : ‖@plainOriginalAverage d Bs BD Bz L k l E C spectator σ mixed- + @plainFinalAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖@plainOriginalAverage d Bs BD Bz L k l E C spectator σ mixed- + @plainFinalAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues‖ ≤ Real.exp (-H*(bulkSize k L:ℝ)) := + @five_stage_bounds_of_eq (frequencyBudget Bs BD Bz k L l) H (bulkSize k L:ℝ) hm + (@plainOriginalAverage d Bs BD Bz L k l E C spectator σ mixed) + (@plainGiantAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed) + (@plainSquareAverage d Bs BD Bz L k l E C spectator D hl σ mixed false) + (@plainSquareAverage d Bs BD Bz L k l E C spectator D hl σ mixed true) + (@plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed false) + (@plainKernelAverage d Bs BD Bz L k l E C spectator D hl σ mixed true) + (@plainBulkAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues) + (@plainFinalAverage d Bs BD Bz L k l E C spectator D.reference hl σ mixed D.residues) + (@plainGiantAverage_eq_plainSquareAverage d Bs BD Bz L k l E C spectator D hl σ mixed) + (@plainSquareAverage_probability_eq_kernel d Bs BD Bz L k l E C spectator D hl σ mixed) + h0 h1 h2 h3 h4 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainJoinFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainJoinFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..15646182d1b5da48947e999d2efa44e9653ebb48 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainJoinFinite.lean @@ -0,0 +1,28 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryActualComparisonDecayArithmetic + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open HistoryActualComparisonDecayArithmetic + +theorem five_stage_bounds_of_eq {F H m : ℝ} (hm : 1 ≤ m) + (a b b' c c' d e f : ℂ) (hb : b = b') (hc : c = c') + (h0 : ‖a-b‖ ≤ Real.exp (-F-(H+5)*m) ∧ ‖a-b‖ ≤ Real.exp (-(H+5)*m)) + (h1 : ‖b'-c‖ ≤ Real.exp (-F-(H+5)*m) ∧ ‖b'-c‖ ≤ Real.exp (-(H+5)*m)) + (h2 : ‖c'-d‖ ≤ Real.exp (-F-(H+5)*m) ∧ ‖c'-d‖ ≤ Real.exp (-(H+5)*m)) + (h3 : ‖d-e‖ ≤ Real.exp (-F-(H+5)*m) ∧ ‖d-e‖ ≤ Real.exp (-(H+5)*m)) + (h4 : ‖e-f‖ ≤ Real.exp (-F-(H+5)*m) ∧ ‖e-f‖ ≤ Real.exp (-(H+5)*m)) : + ‖a-f‖ ≤ Real.exp (-F-H*m) ∧ ‖a-f‖ ≤ Real.exp (-H*m) := + let hb' := congrArg (fun z : ℂ => ‖z-c‖) hb + let hc' := congrArg (fun z : ℂ => ‖z-d‖) hc + ⟨five_stage_exp_le hm a b c d e f h0.1 (hb'.trans_le h1.1) + (hc'.trans_le h2.1) h3.1 h4.1, + five_stage_bulk_exp_le hm a b c d e f h0.2 (hb'.trans_le h1.2) + (hc'.trans_le h2.2) h3.2 h4.2⟩ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainPrincipal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainPrincipal.lean new file mode 100644 index 0000000000000000000000000000000000000000..29afcff7714175ee63afe5e3aff898ea82b2f81d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainPrincipal.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlainSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs +import OAI.NumberTheory.Ostmann.Conclusion.LowLevelBadPairs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter +open HistoryBulkSourceDisintegration HistoryBulkActualTotalReplacement + +theorem exists_plainFinalAverage_budget + (d : Decomposition) (Bs BD Bz H : ℝ) (hBs : 0 ≤ Bs) {k : ℕ} (hk : 2 ≤ k) (hH : 0 ≤ H) : + ∃ ε : ℝ, 0 < ε ∧ ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + (∀ p : spectator.Sample, + (FiniteField.correlationBound (residueTransform d p.val):ℝ) ≤ ε) → + ∀ hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator, + ∀ (j : ℕ) (hj : j ≤ k), + ∃ hV : SpectatorResidueBounds C spectator j, + ∀ (σ : Equiv.Perm (Fin (2^j) × Fin (2*(bulkSize k L/2)))), + ¬TransferBadArrangement σ → ∀ mixed : Bool, + ‖plainFinalAverage C spectator hactual hj σ mixed hV‖ ≤ + Real.exp (-H*(2:ℝ)^j*(bulkSize k L:ℝ)) := + (HistoryBulkActualGoodPrincipal.exists_plain_principal_budget + d Bs BD Bz H hBs hk hH).elim fun ε hε => + ⟨ε,hε.1,hε.2.mono fun L hL => fun E C hG hGu hcl hcu hb hd spectator hspec hflat _hactual j hj => + let μ := spectatorPrior spectator (2*(bulkSize k L/2)) + let hpoint := fun ds : Fin (2*(bulkSize k L/2)) → spectator.Sample => + hL spectator hspec hflat ds E C hG hGu hcl hcu hb hd + let hV : SpectatorResidueBounds C spectator j := fun ds => + ((hpoint ds).choose_spec j hj).choose + ⟨hV,fun σ hgood mixed => + (μ.norm_cmean_le _).trans + ((μ.mean_mono (fun ds => + ((hpoint ds).choose_spec j hj).choose_spec σ hgood mixed)).trans_eq + (μ.mean_const _))⟩⟩ + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e286c55b91573f13189a192ab259e5e8593c831 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementPlainStatement.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementOriginalDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration + +def PlainTotalEstimate (d : Decomposition) (Bs BD Bz H : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∃ hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator, + ∀ (l : ℕ) (hl : l ≤ k), ∃ hV : SpectatorResidueBounds C spectator l, + ∀ (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool), + ‖plainOriginalAverage (l:=l) C spectator σ mixed- + plainFinalAverage (l:=l) C spectator hactual hl σ mixed hV‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖plainOriginalAverage (l:=l) C spectator σ mixed- + plainFinalAverage (l:=l) C spectator hactual hl σ mixed hV‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementProbabilityKernel.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementProbabilityKernel.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f15fd4c190335bffc52f87721a83e2d799b5729 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementProbabilityKernel.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStage +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementKernelDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementSquareDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualPrincipalSourceReindexFamily +open HistoryBulkFibreGiantApproximationReference HistoryGiantReferenceMean +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l≤k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + +theorem plainSquareValue_probability_eq_kernel + (mixed : Bool) (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) : + plainSquareValue C spectator D hl σ mixed true ds = + plainKernelValue C spectator D hl σ mixed false ds := by + cases mixed with + | false => + exact background_probability_rootExpression_eq_kernel_sum C (spectatorList spectator ds) σ + (primeLawMultiplier C) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + D.reference hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + (primeWeight_nonneg C.giant) (fun r _ => primeDraw_positive C.giant r) + (fun r hr => prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (D.admissible ds) List.length_ofFn (D.residues ds) false false + | true => + exact background_probability_rootExpression_eq_kernel_sum C (spectatorList spectator ds) σ + (plainMixedLawMultiplier C (spectatorList spectator ds)) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) D.reference hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _ => mixedDraw_positive C.giantCenter C.giant r) + (fun r hr => mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (D.admissible ds) List.length_ofFn (D.residues ds) false true + +theorem plainSquareAverage_probability_eq_kernel (mixed : Bool) : + plainSquareAverage C spectator D hl σ mixed true = + plainKernelAverage C spectator D hl σ mixed false := by + unfold plainSquareAverage plainKernelAverage + apply congrArg (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + funext ds + exact plainSquareValue_probability_eq_kernel C spectator D hl σ mixed ds + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquareDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquareDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..67cb288a05684ac93671105cb5a127784bf3d30f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquareDefs.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementStageData + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def plainSquareValue (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l ≤ k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (mixed probability : Bool) (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample) : ℂ := + if mixed then + plainMixedSourceMean C (spectatorList spectator ds) σ D.reference hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (D.admissible ds) List.length_ofFn (D.residues ds) probability + else + primeSourceMean C (spectatorList spectator ds) σ D.reference hl + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) + (D.admissible ds) List.length_ofFn (D.residues ds) probability + +def plainSquareAverage (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (D : PlainStageData C spectator l) (hl : l ≤ k) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed probability : Bool) : ℂ := + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + (plainSquareValue C spectator D hl σ mixed probability) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquarePoint.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquarePoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..9128675d0adb520863b78b371edfb6b51ee103df --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquarePoint.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualBSquareReplacementLawsSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementSquareDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily + +theorem selected_plain_square_point_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l ≤ k) (D : PlainStageData C spectator l) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool) + (ds : Fin (2*(bulkSize k L/2)) → spectator.Sample), + ‖plainSquareValue C spectator D hl σ mixed false ds- + plainSquareValue C spectator D hl σ mixed true ds‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖plainSquareValue C spectator D hl σ mixed false ds- + plainSquareValue C spectator D hl σ mixed true ds‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [selected_law_errors_eventually d Bs BD Bz H hBs hH hk] with L h + intro E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed ds + obtain ⟨hactual,h⟩ := h E C hG hGu hcl hcu hb hd spectator hspec + obtain ⟨hp,hAd,hV,h⟩ := h (spectatorList spectator ds) + (fun _q hq => (List.mem_ofFn.mp hq).elim (fun i hi => ⟨ds i,hi⟩)) List.length_ofFn l hl + cases mixed + · exact (h σ).2.2.1 + · exact (h σ).2.2.2 + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquareStage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquareStage.lean new file mode 100644 index 0000000000000000000000000000000000000000..20d83b65246a781f6b0f6b95cc69f7c436c99b1f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementSquareStage.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementSquarePoint + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkActualBSquareReplacement HistoryBulkActualPrincipalBlockFamily + +theorem selected_plain_square_stage_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (hl : l ≤ k) (D : PlainStageData C spectator l) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (mixed : Bool), + ‖plainSquareAverage C spectator D hl σ mixed false- + plainSquareAverage C spectator D hl σ mixed true‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖plainSquareAverage C spectator D hl σ mixed false- + plainSquareAverage C spectator D hl σ mixed true‖ ≤ + Real.exp (-H*(bulkSize k L:ℝ)) := + (selected_plain_square_point_eventually d Bs BD Bz H hBs hH hk).mono + (fun L h E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed => + norm_cmean_sub_le_both (spectatorPrior spectator (2*(bulkSize k L/2))) + (plainSquareValue C spectator D hl σ mixed false) + (plainSquareValue C spectator D hl σ mixed true) + (Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ))) + (Real.exp (-H*(bulkSize k L:ℝ))) + (fun ds _ => h E C hG hGu hcl hcu hb hd spectator hspec l hl D σ mixed ds)) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementStageData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementStageData.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f2b490bfa1831dba3a1d0be09318b1f1d9a7e41 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualTotalReplacementStageData.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalSourceReindexGeometry +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualTotalReplacement +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryGiantReferenceMean HistoryRepresentativeSourceSeparation +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +structure PlainStageData (C : InitialSourceChoice d Bs BD Bz k L E) + (spectator : PrimeSource) (l : ℕ) : Prop where + reference : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator + residues : SpectatorResidueBounds C spectator l + frequencies : ∀ _ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀ j ≤ l, ∀ origin, (C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j) + admissible : ∀ ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀ r : Frame (l:=l) C (spectatorList spectator ds), + PairAdmissible r.left r.right (spectatorList spectator ds) + +theorem selected_plain_stage_data_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ l ≤ k, PlainStageData C spectator l := + ((HistoryBulkActualPrincipalSourceReindex.selected_square_geometry_eventually d Bs BD Bz hk).and + (HistoryBulkFixedReferenceTerm.selected_reference_equality_eventually d Bs BD Bz hk)).mono + (fun _L h E C hG hcl hcu hb hd spectator hspec l hl => + let hp := fun ds => h.1 E C hG hcl hcu hb hd spectator hspec ds l hl + ⟨h.2 E C hG hcl hcu hb hd spectator hspec, + fun ds => (hp ds).1, fun ds => (hp ds).2.1, fun ds => (hp ds).2.2⟩) + +end Ostmann.Arithmetic.HistoryBulkActualTotalReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparison.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparison.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fc0d35676680dffa6779c08589c010df87c35fb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparison.lean @@ -0,0 +1,27 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonActual +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonProviderAssembly +import OAI.NumberTheory.Ostmann.Conclusion.ActualComparisonProviders + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalComparison +open Construction Conclusion Filter + +theorem actual_singleComparisonProvider (d : Decomposition) : + ActualSingleComparisonProvider d 17 := + single_provider_of_universal_estimates d (actual_universal_comparisons_eventually d) + +theorem actual_badCovarianceComparisonProvider (d : Decomposition) : + ActualBadCovarianceComparisonProvider d 17 := + bad_provider_of_universal_estimates d (actual_universal_comparisons_eventually d) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalComparison + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8e44bc61fbb093f20428dfe41bd5ce2103e82d2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonActual.lean @@ -0,0 +1,27 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainActual +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonAssembly +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonPrincipal +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalComparison +open Construction Conclusion Filter HistoryBulkActualTotalReplacement + +theorem actual_universal_comparisons_eventually (d : Decomposition) (BD Bz : ℝ) + (hBD : 0≤BD) (hBz : 9≤Bz) (k : ℕ) (hk : 2≤k) : + ActualUniversalEstimates d BD Bz k := + universal_comparisons_of_estimates d BD Bz k hk + (actual_plainFinal_eventually d BD Bz hBD hBz k hk) + (selected_plain_total_error_eventually d 200 BD Bz 0 (by norm_num) (by norm_num) hk) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalComparison + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonAssembly.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonAssembly.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc9e737799ab1c73a1da1ca7df4024cba4386b9d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonAssembly.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonPrincipalStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedComparisonAbsorption + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalComparison +open Construction Conclusion Filter HistoryBulkActualTotalReplacement + +theorem universal_comparisons_of_estimates (d : Decomposition) (BD Bz : ℝ) + (k : ℕ) (hk : 2≤k) + (hprincipal : ActualPlainFinalEstimate d BD Bz k) + (hresidual : PlainTotalEstimate d 200 BD Bz 0 k) : + ActualUniversalEstimates d BD Bz k := by + have hkpos : 0hsource.band p.val p.property) + intro l hl + obtain ⟨hV,hfinal⟩ := hfinal l hl + obtain ⟨hV',herror⟩ := herror l hl + have horiginal (mixed : Bool) : + ‖plainOriginalAverage C (harmonicPrimeSource P hP hZ) (l:=l) (Equiv.refl _) mixed‖ ≤ + Real.exp ((2:ℝ)^l*(initialGap 200 k L+17*(bulkSize k L:ℝ))) := by + have he := (herror (Equiv.refl _) mixed).2 + have he' : ‖plainOriginalAverage C (harmonicPrimeSource P hP hZ) (l:=l) (Equiv.refl _) mixed - + plainFinalAverage C (harmonicPrimeSource P hP hZ) hactual hl (Equiv.refl _) mixed hV‖ ≤ 1 := by + simpa only [zero_mul,neg_zero,Real.exp_zero] using he + calc + _ ≤ ‖plainOriginalAverage C (harmonicPrimeSource P hP hZ) (l:=l) (Equiv.refl _) mixed - + plainFinalAverage C (harmonicPrimeSource P hP hZ) hactual hl (Equiv.refl _) mixed hV‖ + + ‖plainFinalAverage C (harmonicPrimeSource P hP hZ) hactual hl (Equiv.refl _) mixed hV‖ := + by simpa only [sub_add_cancel] using + (norm_add_le (plainOriginalAverage C (harmonicPrimeSource P hP hZ) (l:=l) (Equiv.refl _) mixed - + plainFinalAverage C (harmonicPrimeSource P hP hZ) hactual hl (Equiv.refl _) mixed hV) + (plainFinalAverage C (harmonicPrimeSource P hP hZ) hactual hl (Equiv.refl _) mixed hV)) + _ ≤ 1+Real.exp ((2:ℝ)^l*(initialGap 200 k L+16*(bulkSize k L:ℝ))) := + add_le_add he' (hfinal mixed) + _ ≤ _ := by simpa only [add_comm] using habsorb l 1 le_rfl + exact ⟨(singleEnergy_le_norm_plainOriginal C _).trans (horiginal true), + fun σ τ=>(covariance_le_norm_plainOriginal C _ σ τ).trans (horiginal false)⟩ + +end Ostmann.Arithmetic.HistoryBulkActualUniversalComparison + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..edd63577b0c994025f4886e9ae6172705489bee9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonBasic.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementOriginalDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageIdentities +import OAI.NumberTheory.Ostmann.Conclusion.HistorySelectedCovarianceCauchy +import OAI.NumberTheory.Ostmann.Conclusion.SelectedCovarianceComplex +import OAI.NumberTheory.Ostmann.Construction.DiagonalSingleEnergy + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalComparison +open Construction Conclusion HistoryBulkActualTotalReplacement +open HistoryBulkFibreGiantErrorAverage +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + +theorem singleEnergy_le_norm_plainOriginal : + C.selectedDiagonalSingleEnergy spectator (bulkSize k L/2) C.scale l ≤ + ‖plainOriginalAverage C spectator (l:=l) (Equiv.refl _) true‖ := by + rw [selectedDiagonalSingleEnergy_eq_originalSourceAverage] + exact (le_abs_self _).trans (Complex.abs_re_le_norm _) + +theorem covariance_le_norm_plainOriginal + (σ τ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) : + selectedCovariance C spectator (bulkSize k L/2) l σ τ ≤ + ‖plainOriginalAverage C spectator (l:=l) (Equiv.refl _) false‖ := by + apply (selectedCovariance_le_identity C spectator (bulkSize k L/2) l σ τ).trans + apply selectedCovariance_le_of_complex_norm + rw [selectedComplexCovariance_eq_originalSourceAverage,inv_one,mul_one] + change ‖originalSourceAverage C spectator (primeOriginalValue C spectator (Equiv.refl _))‖ ≤ + ‖originalSourceAverage C spectator (primeOriginalValue C spectator (Equiv.refl _))‖ + exact le_rfl + +end Ostmann.Arithmetic.HistoryBulkActualUniversalComparison + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonPrincipal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonPrincipal.lean new file mode 100644 index 0000000000000000000000000000000000000000..b8486fb219bd8423a3a32fabb139d9a89c56afe1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonPrincipal.lean @@ -0,0 +1,41 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalComparisonPrincipalStatement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalActual +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentMeanFinal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalComparison +open Construction Conclusion Filter HistoryBulkActualTotalReplacement HistoryBulkSourceDisintegration +open HistoryBulkActualUniversalPrincipal + +private theorem two_hundred_nonnegative : (0:ℝ) ≤ 200 := by norm_num +private theorem nine_nonnegative : (0:ℝ) ≤ 9 := by norm_num + +theorem actual_plainFinal_eventually (d : Decomposition) (BD Bz : ℝ) + (hBD : 0≤BD) (hBz : 9≤Bz) (k : ℕ) (hk : 2≤k) : + ActualPlainFinalEstimate d BD Bz k := + (actual_principal_eventually d 200 BD Bz two_hundred_nonnegative hBD + (le_trans nine_nonnegative hBz) hk).mono + (fun L hL P hP hZ E C hsource => + let ⟨hactual, hbound⟩ := hL E C hsource.block_lower hsource.block_upper + hsource.center_lower hsource.center_upper hsource.bulk_bin hsource.spectator_bin + (harmonicPrimeSource P hP hZ) (fun p => hsource.band p.val p.property) + ⟨hactual, fun l hl => + let ⟨hV, hmain⟩ := hbound l hl + ⟨hV, fun mixed => + (congrArg norm (replacementMean_eq_plainFinalAverage + (d:=d) (Bs:=200) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C (harmonicPrimeSource P hP hZ) hactual hl + (spectator_membership (harmonicPrimeSource P hP hZ)) mixed hV)).symm.trans_le + (hmain mixed)⟩⟩) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalComparison + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonPrincipalStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonPrincipalStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a38ab1f3d80e995bd78eab88762b646a1f25388 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalComparisonPrincipalStatement.lean @@ -0,0 +1,30 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs +import OAI.NumberTheory.Ostmann.Conclusion.ActualComparisonProviders + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalComparison +open Construction Conclusion Filter HistoryBulkActualTotalReplacement HistoryBulkSourceDisintegration + +def ActualPlainFinalEstimate (d : Decomposition) (BD Bz : ℝ) (k : ℕ) : Prop := + ∀ᶠ L : ℝ in atTop, + ∀(P : Finset ℕ)(hP : ∀p∈P,p.Prime)(hZ : 0?_)) + · exact (backgroundPrior C l).mean_const _ |>.le + · exact hbound (fun p b=>selectedFamily C outside hactual hl hout p + (restoreOuterBackground C l p bg b) mixed) mixed + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..b065046bcf843cbfd88173003a6830d83f8a477a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalActual.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalSelectedReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkPatternIntegralReplacement +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + +theorem spectator_membership (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) : + ∀q∈spectatorList spectator ds,q∈spectator.candidates := by + intro q hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + exact (ds i).property + +theorem actual_principal_eventually + (d : Decomposition) (Bs BD Bz : ℝ) (hBs : 0≤Bs) (hBD : 0≤BD) (hBz : 0≤Bz) + {k : ℕ} (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L)≤C.blockBase → + C.blockBase+favorableBlockWidth L≤Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ) + backgroundValue true (fun bg p b=>selectedReplacementBackground C + (spectatorList spectator ds) hactual hl (spectator_membership spectator ds) bg p b mixed) + false mixed (hV ds))‖ ≤ + Real.exp ((2:ℝ)^l*(initialGap Bs k L+16*(bulkSize k L:ℝ))) := by + filter_upwards [selected_aggregate_eventually d Bs BD Bz hBs hBD hBz hk] with L hL + intro E C hG hGu hcl hcu hb hd spectator hspec + obtain ⟨hactual,hbound⟩ := hL E C hG hGu hcl hcu hb hd spectator hspec + refine ⟨hactual,?_⟩ + intro l hl + have hs (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) := + hbound (spectatorList spectator ds) (spectator_membership spectator ds) + (by simp only [spectatorList,List.length_ofFn]) l hl + choose hV hmain using hs + refine ⟨hV,?_⟩ + intro mixed + apply le_trans ((spectatorPrior spectator (2*(bulkSize k L/2))).norm_cmean_le _) + apply le_trans ((spectatorPrior spectator (2*(bulkSize k L/2))).mean_mono (fun ds=>?_)) + · exact (spectatorPrior spectator (2*(bulkSize k L/2))).mean_const _ |>.le + · rw [←selectedAggregate_eq_replacementBackground] + exact hmain ds mixed + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignment.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignment.lean new file mode 100644 index 0000000000000000000000000000000000000000..f96200d7401304307357f836ab6ad8922aa79643 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignment.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalSelectedReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkActualPrincipalBlockFamily HistoryBulkFibreGiantErrorAverage +open HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +local instance universalAlignmentReplacementInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (mixed : Bool) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + selectedReplacementBackground C (spectatorList spectator ds) hactual hl hout + background pattern diagonal mixed) + false mixed hV = + HistoryBulkActualGoodPrincipal.plainPrincipal (l:=l) C spectator ds hactual hl + (Equiv.refl (Fin (2^l) × Fin (2*(bulkSize k L/2)))) mixed hV := + (selectedAggregate_eq_replacementBackground (spectator:=spectator) (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C (spectatorList spectator ds) + hactual hl hout mixed hV).symm.trans + (selectedAggregate_eq_plainPrincipal (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) C spectator ds hactual hl hout mixed hV) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentAbsent.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentAbsent.lean new file mode 100644 index 0000000000000000000000000000000000000000..712ee70d573d5a9deb1866e97bd5234375bf5c2b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentAbsent.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPattern + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator +attribute [local instance] Classical.propDecidable +local instance universalAlignmentAbsentInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (hD : outerData? C p o=none) + (outside : List ℕ) + (J : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

+ congrArg (patternComplexSum + (ι:=Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (funext fun p => funext fun b => + selectedFamily_value_eq_plainPattern_raw (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) + (L:=L) (k:=k) (l:=l) (E:=E) C spectator ds hactual hl hout p + (restoreOuterBackground C l p bg b) mixed b hV))) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..f022618394052100d60c69ff28cbf318c583dfdc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMean.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignment +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalSelectedReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion HistoryBulkSourceDisintegration +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) + (hout : ∀ ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀ q ∈ spectatorList spectator ds, q ∈ spectator.candidates) + (mixed : Bool) + (hV : ∀ ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀ q ∈ spectatorList spectator ds, ∀ j ≤ l, frequencyBound Bs BD Bz k L j < q) + +theorem replacementMean_eq_plainPrincipalMean : + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + HistoryBulkPatternIntegralReplacement.backgroundValue true + (fun background pattern diagonal => + selectedReplacementBackground C (spectatorList spectator ds) hactual hl (hout ds) + background pattern diagonal mixed) + false mixed (hV ds)) = + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + HistoryBulkActualGoodPrincipal.plainPrincipal (l:=l) C spectator ds hactual hl + (Equiv.refl (Fin (2^l) × Fin (2*(bulkSize k L/2)))) mixed (hV ds)) := + congrArg ((spectatorPrior spectator (2*(bulkSize k L/2))).cmean) + (funext fun ds => + replacementBackground_eq_plainPrincipal + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator ds hactual hl (hout ds) mixed (hV ds)) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMeanFinal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMeanFinal.lean new file mode 100644 index 0000000000000000000000000000000000000000..24e2270a430fe565417a5871c099e76cc468f117 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMeanFinal.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentMeanFinalDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalSelectedReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion HistoryBulkSourceDisintegration +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) + (hout : ∀ ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀ q ∈ spectatorList spectator ds, q ∈ spectator.candidates) + (mixed : Bool) + (hV : ∀ ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀ q ∈ spectatorList spectator ds, ∀ j ≤ l, frequencyBound Bs BD Bz k L j < q) + +theorem replacementMean_eq_plainFinalAverage : + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + HistoryBulkPatternIntegralReplacement.backgroundValue true + (fun background pattern diagonal => + selectedReplacementBackground C (spectatorList spectator ds) hactual hl (hout ds) + background pattern diagonal mixed) + false mixed (hV ds)) = + HistoryBulkActualTotalReplacement.plainFinalAverage (l:=l) C spectator hactual hl + (Equiv.refl (Fin (2^l) × Fin (2*(bulkSize k L/2)))) mixed hV := + (replacementMean_eq_plainPrincipalMean + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator hactual hl hout mixed hV).trans + (plainFinalAverage_eq_cmean + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator hactual hl + (Equiv.refl (Fin (2^l) × Fin (2*(bulkSize k L/2)))) mixed hV).symm + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMeanFinalDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMeanFinalDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7dceab878cf0f9e2939f3b9cc37ce487902e7d8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMeanFinalDefs.lean @@ -0,0 +1,35 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualTotalReplacementPlainDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion HistoryBulkSourceDisintegration +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem plainFinalAverage_eq_cmean + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l ≤ k) (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (mixed : Bool) + (hV : HistoryBulkActualTotalReplacement.SpectatorResidueBounds C spectator l) : + HistoryBulkActualTotalReplacement.plainFinalAverage + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator hactual hl σ mixed hV = + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + HistoryBulkActualGoodPrincipal.plainPrincipal + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C spectator ds hactual hl σ mixed (hV ds)) := by + unfold HistoryBulkActualTotalReplacement.plainFinalAverage + rfl + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedAbsent.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedAbsent.lean new file mode 100644 index 0000000000000000000000000000000000000000..3c10b6ec4950d14b99ad34dcb307bc811df778ac --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedAbsent.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentAbsent + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jplainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) true b hV + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedInterface.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedInterface.lean new file mode 100644 index 0000000000000000000000000000000000000000..970356df3bd4e4fb0ada87cbc5d6c1137ee4aa16 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedInterface.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSelectedMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (mixed : Bool) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jspectator.prime q (hout q hq)) hV = + @HistoryBulkPatternIntegralReplacement.familyValue d Bs BD Bz L k l E C + (spectatorList spectator ds) p true + (HistoryBulkActualGoodPrincipal.plainPatternFamily C spectator ds hactual hl + (Equiv.refl _) true p o) b false true hV := by + have he := congrArg + (fun F : SymbolicPatternFamily C (spectatorList spectator ds) l p => + @SymbolicPatternFamily.value d Bs BD Bz k L E C (spectatorList spectator ds) l p + F b true (bulkSize k L/2) (fun q hq=>spectator.prime q (hout q hq)) hV) + (selectedFamily_mixed_eq_of_some C spectator ds hactual hl hout p o D hD) + exact he.trans ((mixed_symbolic_value_eq_matched C spectator ds hactual hl hout p o b hV D hD).trans + (mixed_matched_value_eq_plainPattern C spectator ds hactual hl p o b hV)) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedPattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedPattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..cde5e9171d989fd5e9600119494a41fb33190798 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedPattern.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jplainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) true b false hV = + @HistoryBulkPatternIntegralReplacement.familyValue d Bs BD Bz L k l E C + (spectatorList spectator ds) p true + (HistoryBulkActualGoodPrincipal.plainPatternFamily C spectator ds hactual hl + (Equiv.refl _) true p o) b false true hV := by + simpa only [HistoryBulkActualGoodPrincipal.plainPatternFamily,ite_true] using + (HistoryBulkActualGoodPrincipal.pattern_after_eq_selectedValue C p o + (spectatorList spectator ds) (Equiv.refl _) + (fun i=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) true b false hV).symm + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..fb1419019300a073e708da634f6bfb370a51ce10 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedSum.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSum +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jplainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds)) true).value + b true (bulkSize k L/2) (fun q hq=>spectator.prime q (hout q hq)) hV = + HistoryBulkActualGoodPrincipal.selectedValue C p o (spectatorList spectator ds) + (Equiv.refl _) + (fun i=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) true b false hV := + symbolic_value_eq_matched_selectedValue C p o D hD (spectatorList spectator ds) + (fun i=>plainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + (fun r hr=>mixed_draw_cells C r + (lt_of_le_of_ne (mixedWeight_nonneg C.giantCenter C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) true b hV + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedZero.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..e38d64e669fb4b7e2f3977623fbe433fd59d8809 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentMixedZero.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentMixedAbsent +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jspectator.prime q (hout q hq)) hV = + @HistoryBulkPatternIntegralReplacement.familyValue d Bs BD Bz L k l E C + (spectatorList spectator ds) p true + (HistoryBulkActualGoodPrincipal.plainPatternFamily C spectator ds hactual hl + (Equiv.refl _) true p o) b false true hV := by + rw [selectedFamily_eq_empty_of_none C (spectatorList spectator ds) hactual hl hout p o true hD, + emptyFamily_value] + exact (mixed_pattern_value_eq_zero_of_none C spectator ds hactual hl p o b hV hD).symm + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentOption.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentOption.lean new file mode 100644 index 0000000000000000000000000000000000000000..96a04bccb29288cba0c2cc10030f3c88bf41c5f4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentOption.lean @@ -0,0 +1,26 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedUniversalOperatorPresent + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +theorem mapped_option_present_eq_elim {α β : Type*} (s : Option α) (f : α→β) + (F : (s.map f).isSome=true → ℂ) (G : α→ℂ) + (h : ∀hs,F hs=G (s.get (by simpa only [Option.isSome_map] using hs))) : + (if hs : (s.map f).isSome=true then F hs else 0)=s.elim 0 G := by + cases s with + | none => simp only [Option.map_none,Option.isSome_none,Bool.false_eq_true,dite_false,Option.elim_none] + | some a => + have hh := h (by simp only [Option.map_some,Option.isSome_some]) + simpa only [Option.map_some,Option.isSome_some,dite_true,Option.get_some,Option.elim_some] using hh + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPoint.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPoint.lean new file mode 100644 index 0000000000000000000000000000000000000000..2167c8ead77c9bcb4737cb4cc6bafff4aa6b9225 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPoint.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointComposeIdentity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointKernel +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointTerm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointWeight +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkReferenceFrequencyFamily HistoryBulkSelectedUniversalOperator +open HistoryBulkSelectedUniversalSymbolicFamily HistoryBulkFibreIntegralReplacementFrame +open HistoryBulkGoodPatternPrincipalFrame HistoryPairKernelReplacement +open HistoryCompensationRepresentativePatterns HistoryPairKernelReplacement +open scoped BigOperators +attribute [local instance] Classical.propDecidable +local instance actualUniversalPrincipalPointInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃v:spectator.Sample,(v:ℕ)=q) + (hw : ∀v,0≤w v) (hpos : ∀v,w v≠0 → 0

rootDensity (R.frame hcell hprime) mixed * z * + principalOperator (R.frame hcell hprime) false mixed (Equiv.refl _) hV) + (symbolic_present_weight_eq_matched C p o D outside J w P Q + hactual hl houtside hw hpos hcell hprime i b mixed)) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointCompose.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointCompose.lean new file mode 100644 index 0000000000000000000000000000000000000000..243259cce06ff8829269904d844dbc7f174aabd8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointCompose.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator HistoryBulkSelectedUniversalSymbolicFamily +open HistoryBulkFibreGiantApproximation HistoryBulkFibreIntegralReplacementFrame +open HistoryBulkGoodPatternPrincipalFrame HistoryBulkUniversalPatternAggregation +local instance actualUniversalPrincipalPointComposeInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +theorem symbolic_term_eq_frame_of_equalities + (F : SymbolicPatternFamily C outside l p) + (hp : ∀q∈outside,q.Prime) (i : RootPresent F.refs) + (hσ : F.permutation=Equiv.refl _) + (mixed : Bool) (hm : F.mask i=assignmentDensity (F.data i).assignment mixed) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jrootDensity t mixed) hf' + let ho := (congrArg (fun σ=>principalOperator (replacementReference F hp i).frame + false mixed σ hV) ((replacementReference_permutation F hp i).trans hσ)).trans + (congrArg (fun t=>principalOperator t false mixed (Equiv.refl _) hV) hf') + (replacementReference_term F hp i hσ mixed hm b hV).symm.trans + ((congrArg₂ (fun x y : ℂ=>x*y) hw + (congrArg₂ (fun x y : ℂ=>x*y) hd ho)).trans + ((mul_left_comm _ _ _).trans (mul_assoc _ _ _).symm)) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointComposeIdentity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointComposeIdentity.lean new file mode 100644 index 0000000000000000000000000000000000000000..86f1567bb91d2cf6b995c94ca6b0e21dc583797c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointComposeIdentity.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointCompose + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryBulkSourceDisintegration HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator HistoryBulkSelectedUniversalSymbolicFamily +open HistoryBulkFibreGiantApproximation HistoryBulkFibreIntegralReplacementFrame +open HistoryBulkGoodPatternPrincipalFrame HistoryBulkUniversalPatternAggregation +local instance actualUniversalPrincipalPointComposeIdentityInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +theorem symbolic_identity_term_eq_frame_of_equalities + (F : SymbolicPatternFamily C outside l p) + (hp : ∀q∈outside,q.Prime) (i : RootPresent F.refs) + (hσ : F.permutation=Equiv.refl _) + (mixed : Bool) (hm : F.mask i=assignmentDensity (F.data i).assignment mixed) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jsymbolicFamilyWeight F.refs b F.representative mixed F.mask i * + actualNestedIntegral C mixed (bulkSize k L/2) (F.data i) * + referenceRootAverage mixed d k (2*(bulkSize k L/2)) σ hp hV (rootSelected F.refs i)) hσ).symm.trans + (symbolic_term_eq_frame_of_equalities F hp i hσ mixed hm b hV f κ hf hw) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointData.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointData.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd02682d96d5599409be186f51a64353d30e319f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointData.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointFrame +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointRepresentative + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryBulkReferenceFrequencyFamily HistoryBulkSelectedUniversalOperator +attribute [local instance] Classical.propDecidable +local instance actualUniversalPrincipalPointDataInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃v:spectator.Sample,(v:ℕ)=q) + (hw : ∀v,0≤w v) (hpos : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃v:spectator.Sample,(v:ℕ)=q) + (hw : ∀v,0≤w v) (hpos : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃v:spectator.Sample,(v:ℕ)=q) + (hw : ∀v,0≤w v) (hpos : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃v:spectator.Sample,(v:ℕ)=q) + (hw : ∀v,0≤w v) (hpos : ∀v,w v≠0 → 0

alignmentReferenceKernelProduct C p o D outside i.val r b mixed) + (rootSelected_eq_presentWitness C outside σ (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + J w P Q hactual hl D.nonbulk_pos D.left_mass D.right_mass houtside hw hpos i) + let hright := matched_kernel_product_eq_reference C p o outside σ J w P Q hcell hprime i.val R b mixed + hleft.trans (hmid.trans hright) + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointRepresentative.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointRepresentative.lean new file mode 100644 index 0000000000000000000000000000000000000000..eec536732c720a3a75df3cbfab8b92fec797eb8f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentPointRepresentative.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyData +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCompensationRepresentativePatternsDecoded + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkActualPrincipalBlockFamily HistoryBulkSourceDisintegration +open HistoryCompensationRepresentativePatterns +attribute [local instance] Classical.propDecidable +local instance actualUniversalPrincipalPointRepresentativeInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + {o : OriginalOuter (fun _=>C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} {σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +theorem matched_representative_eq_decoded + (R : MatchedSelectedOuter C p o outside σ J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : MatchedSelectedOuter C p o outside (Equiv.refl _) J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃v:spectator.Sample,(v:ℕ)=q) + (hw : ∀v,0≤w v) (hpos : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p} + {outside : List ℕ} + {J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ} + {α : Type} [Fintype α] {w : α→ℝ} {P Q : α→ℤ} + {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + (R : MatchedSelectedOuter C p o outside (Equiv.refl _) J w P Q i) + (hcell : ∀v,w v≠0 → 0

C.giant) C.sources (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (outside : List ℕ) + (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃v:spectator.Sample,(v:ℕ)=q) + (hw : ∀v,0≤w v) (hpos : ∀v,w v≠0 → 0

C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (mixed : Bool) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (mixed : Bool) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jspectator.prime q (hout q hq)) hV = + @HistoryBulkPatternIntegralReplacement.familyValue d Bs BD Bz L k l E C + (spectatorList spectator ds) p true + (HistoryBulkActualGoodPrincipal.plainPatternFamily C spectator ds hactual hl + (Equiv.refl _) true p o) b false true hV := by + cases hD : outerData? C p o with + | none => exact selectedFamily_value_eq_plainPattern_mixed_of_none C spectator ds hactual hl hout p o b hV hD + | some D => exact selectedFamily_value_eq_plainPattern_mixed_of_some C spectator ds hactual hl hout p o b hV D hD + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedMixedBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedMixedBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..3b99201f32d492683f323cf670960708f3b966c2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedMixedBasic.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalSelectedProperties +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationFibreIdentities +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jplainMixedWeight C (spectatorList spectator ds) (outerNonbulk C l p o) i.1.val) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds)) true := by + simp only [selectedFamily,hD,ite_true] + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..1498dfa8bc36d3387350e713eb0a82b538de4f87 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrime.lean @@ -0,0 +1,57 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeAbsent +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimePattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeSum + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jspectator.prime q (hout q hq)) hV = + @HistoryBulkPatternIntegralReplacement.familyValue d Bs BD Bz L k l E + C (spectatorList spectator ds) p true + (HistoryBulkActualGoodPrincipal.plainPatternFamily C spectator ds hactual hl + (Equiv.refl _) false p o) b false false hV := by + cases hD : outerData? C p o with + | none => + rw [selectedFamily_eq_empty_of_none C (spectatorList spectator ds) hactual hl hout p o false hD, + emptyFamily_value] + exact (prime_plainPattern_value_eq_zero_of_none C spectator ds hactual hl p o b hV hD).symm + | some D => + rw [selectedFamily_prime_eq_of_some C (spectatorList spectator ds) hactual hl hout p o D hD] + exact (prime_symbolic_value_eq_matched C spectator ds hactual hl hout p o b hV D hD).trans + (prime_plainPattern_value_eq_matched C spectator ds hactual hl p o b hV).symm + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeAbsent.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeAbsent.lean new file mode 100644 index 0000000000000000000000000000000000000000..6392ff046528989b085b459ab401e30a3cd44304 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeAbsent.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentAbsent +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false b hV + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..e59c44516d03dc90f17f3a0bd4459b1580a04799 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeBasic.lean @@ -0,0 +1,48 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalSelectedProperties + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (hout : ∀q∈outside,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + +theorem selectedFamily_eq_empty_of_none (mixed : Bool) (hD : outerData? C p o=none) : + selectedFamily C outside hactual hl hout p o mixed = emptyFamily C outside p := by + unfold selectedFamily + rw [hD] + +theorem selectedFamily_prime_eq_of_some (D : OuterData C p o) + (hD : outerData? C p o=some D) : + selectedFamily C outside hactual hl hout p o false = + withDensity + (primePatternFamily C outside (Equiv.refl _) (outerNonbulk C l p o) + p D.blockDraw D.valid (fun _ _ _ _=>1) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (fun q hq=>⟨⟨q,hout q hq⟩,rfl⟩)) false := by + unfold selectedFamily + rw [hD] + rfl + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimePattern.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimePattern.lean new file mode 100644 index 0000000000000000000000000000000000000000..f1d6a531e77189e2389ebd62cdc3bf654fa766b9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimePattern.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false b false hV := + HistoryBulkActualGoodPrincipal.pattern_after_eq_selectedValue C p o + (spectatorList spectator ds) (Equiv.refl _) (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false b false hV + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..b3b0b5686ed23ff280d5194c1383dcfbb32028d9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSelectedPrimeSum.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSum +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j1) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (spectatorList_source spectator ds)) false).value + b false (bulkSize k L/2) (fun q hq=>spectator.prime q (hout q hq)) hV = + HistoryBulkActualGoodPrincipal.selectedValue C p o (spectatorList spectator ds) + (Equiv.refl _) + (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false b false hV := + symbolic_value_eq_matched_selectedValue C p o D hD (spectatorList spectator ds) + (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) + (fun r hr=>prime_draw_cells C r + (lt_of_le_of_ne (primeWeight_nonneg C.giant r) (Ne.symm hr))) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds) false b hV + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentStatement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentStatement.lean new file mode 100644 index 0000000000000000000000000000000000000000..a09c4caa9eda459659f21dd68559104a47f5e43a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentStatement.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalPlainDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (mixed : Bool) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jspectator.prime q (hout q hq)) hV = + @HistoryBulkPatternIntegralReplacement.familyValue d Bs BD Bz L k l E C + (spectatorList spectator ds) p true + (@HistoryBulkActualGoodPrincipal.plainPatternFamily d Bs BD Bz L k l E C spectator ds hactual hl + (Equiv.refl _) mixed p o) b false mixed hV + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSum.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSum.lean new file mode 100644 index 0000000000000000000000000000000000000000..349765c0a1eb6e5a4a4564188410bf652ddb3699 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentSum.lean @@ -0,0 +1,92 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentOption +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentPointValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkReferenceFrequencyFamily +open HistoryBulkSelectedUniversalOperator +attribute [local instance] Classical.propDecidable +local instance universalAlignmentSumInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (D : OuterData C p o) (hD : outerData? C p o=some D) + (outside : List ℕ) + (J : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → SelectedBulkSample C l → ℤ → ℤ → ℂ) + {α : Type} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (houtside : ∀q∈outside,∃r:spectator.Sample,(r:ℕ)=q) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

(⟨D,r⟩ : MatchedSelectedOuter C p o outside (Equiv.refl _) J w P Q i))).elim 0 + (fun R => matchedPrincipalValue R hcell hprime b mixed hV) + cases hs : selectWitness C outside (Equiv.refl _) (outerNonbulk C l p o) + (leftBlockDraws C p D.blockDraw D.valid) (rightBlockDraws C p D.blockDraw D.valid) + J w P Q hactual hl D.nonbulk_pos D.left_mass D.right_mass houtside hw hpos i with + | none => + have hi : ¬(F.refs i).isSome := by + dsimp only [F] + rw [alignmentDensityFamily_refs] + simp only [referenceFamily,hs,Option.map_none] + change ¬(false = true) + exact Bool.false_ne_true + simp only [presentComplexValue,dite_eq_right hi,Option.map_none,Option.elim_none] + | some r => + have hi : (F.refs i).isSome := by + dsimp only [F] + rw [alignmentDensityFamily_refs] + simp only [referenceFamily,hs,Option.map_some] + rfl + rw [presentComplexValue,dite_eq_left hi] + have ht := symbolic_present_term_eq_matchedValue C p o D outside J w P Q hactual hl + houtside hw hpos hcell hprime ⟨i,hi⟩ b mixed hV + simpa only [F,Option.map_some,Option.elim_some,alignmentMatchedOuter,presentWitness,hs,Option.get_some] + using! ht + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentValue.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentValue.lean new file mode 100644 index 0000000000000000000000000000000000000000..e9118e9b862dfd90768cc810ba6a261a2b68724a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalAlignmentValue.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalAlignmentStatement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairReferenceFlagExpectation HistoryBulkSourceDisintegration +open HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open HistoryBulkActualRootReferenceFamily HistoryBulkFibreGiantApproximation +open HistoryGiantReferenceMean HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximationReference HistoryBulkFibreGiantErrorAverage +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) + (hout : ∀q∈spectatorList spectator ds,q∈spectator.candidates) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (mixed : Bool) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jspectator.prime q (hout q hq)) hV = + @HistoryBulkPatternIntegralReplacement.familyValue d Bs BD Bz L k l E C + (spectatorList spectator ds) p true + (@HistoryBulkActualGoodPrincipal.plainPatternFamily d Bs BD Bz L k l E C spectator ds hactual hl + (Equiv.refl _) mixed p o) b false mixed hV := + selectedFamily_value_eq_plainPattern (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) + (L:=L) (k:=k) (l:=l) (E:=E) C spectator ds hactual hl hout p o mixed b hV + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..a7183976eee8eed1391eb9871db5ec2f96bcaae6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalBasic.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkUniversalPatternAggregationFamily + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkReferenceFrequencyFamily +open HistoryBulkUniversalPatternAggregation HistoryBulkSelectedUniversalOperator +open HistoryBulkFibreGiantApproximation +attribute [local instance] Classical.propDecidable +local instance universalPrincipalBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +def withDensity + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + (family : SymbolicPatternFamily C outside l p) (mixed : Bool) : + SymbolicPatternFamily C outside l p := + { family with + mask := fun i=>assignmentDensity (family.data i).assignment mixed + mask_mem := fun i=>assignmentDensity_mem (family.data i).assignment mixed } + +theorem prior_nonempty {α : Type*} [Fintype α] (μ : FinitePrior α) : Nonempty α := by + by_contra h + let : IsEmpty α := not_nonempty_iff.mp h + have ht := μ.mass_total + simp only [Finset.univ_eq_empty,Finset.sum_empty] at ht + norm_num at ht + +def emptyFamily (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) : + SymbolicPatternFamily C outside l p := by + let x := Classical.choice (prior_nonempty + (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l)) + refine { permutation := Equiv.refl _ + left := x + right := x + refs := fun _=>none + data := ?_ + representative := ?_ + mask := fun _=>0 + mask_mem := fun _=>⟨le_rfl,zero_le_one⟩ } + · intro i + exact False.elim (by simpa using i.property) + · intro i + exact False.elim (by simpa using i.property) + +@[simp] theorem emptyFamily_value (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (mixed : Bool) (s : ℕ) (hp : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (mixed : Bool) : SymbolicPatternFamily C outside l p := + match outerData? C p o with + | none => emptyFamily C outside p + | some D => + if mixed then withDensity + (mixedPatternFamily C outside (Equiv.refl _) (outerNonbulk C l p o) + p D.blockDraw D.valid + (fun i=>plainMixedWeight C outside (outerNonbulk C l p o) i.1.val) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (fun q hq=>⟨⟨q,hout q hq⟩,rfl⟩)) true + else withDensity + (primePatternFamily C outside (Equiv.refl _) (outerNonbulk C l p o) + p D.blockDraw D.valid (fun _ _ _ _=>1) + hactual hl D.nonbulk_pos D.left_mass D.right_mass + (fun q hq=>⟨⟨q,hout q hq⟩,rfl⟩)) false + +@[simp] theorem selectedFamily_permutation + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) (mixed : Bool) : + (selectedFamily C outside hactual hl hout p o mixed).permutation=Equiv.refl _ := by + unfold selectedFamily + cases outerData? C p o <;> cases mixed <;> rfl + +theorem selectedFamily_mask + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) (mixed : Bool) : + ∀i,(selectedFamily C outside hactual hl hout p o mixed).mask i= + assignmentDensity ((selectedFamily C outside hactual hl hout p o mixed).data i).assignment mixed := by + unfold selectedFamily + cases hd : outerData? C p o with + | none => + intro i + exact False.elim (by simpa only [emptyFamily,Option.isSome_none,Bool.false_eq_true] using i.property) + | some D => + cases mixed <;> intro i <;> rfl + +def selectedValue + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jspectator.prime q (hout q hq)) hV + +def selectedAggregate (mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(blockType p q,outerBlocks C l p o q)) then + selectedValue C outside hactual hl hout p o mixed hV else 0) + +theorem selectedAggregate_eq_background (mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>(selectedFamily C outside hactual hl hout p + (restoreOuterBackground C l p bg b) mixed).value b mixed (bulkSize k L/2) + (fun q hq=>spectator.prime q (hout q hq)) hV)) := by + unfold selectedAggregate + rw [outer_pattern_sum_eq_background_cmean C l] + rfl + +theorem selected_support_of_mass + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (o : OriginalOuter (fun _=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (ho : outerMass C l p o≠0) + (ht : Function.Injective (fun q=>(blockType p q,outerBlocks C l p o q))) : + (outerData? C p o).isSome := outerData?_isSome_of_mass C p o ho ht + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalDensity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..23a2b0569ffce3ce8d1d98b98715871ea372a9b6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalDensity.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestDensity + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion HistoryBulkFibreGiantApproximation +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} + +def assignmentDensity (x : SourceAssignment C.sources + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (mixed : Bool) : ℝ := + if mixed then (Frame.extractedDensity (C:=C) x).re else 1 + +theorem assignmentDensity_mem (x : SourceAssignment C.sources + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (mixed : Bool) : + 0 ≤ assignmentDensity x mixed ∧ assignmentDensity x mixed ≤ 1 := by + have hn : 0 ≤ assignmentDensity x mixed := by + cases mixed + · exact zero_le_one + · simp only [assignmentDensity,ite_true,Frame.extractedDensity,Complex.ofReal_re] + positivity + refine ⟨hn,?_⟩ + cases mixed + · exact le_rfl + · have h := Frame.norm_extractedDensity_le (C:=C) x + change (Frame.extractedDensity (C:=C) x).re ≤ 1 + exact (Complex.re_le_norm _).trans h + +@[simp] theorem assignmentDensity_cast (x : SourceAssignment C.sources + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (mixed : Bool) : + (assignmentDensity x mixed : ℂ) = + if mixed then Frame.extractedDensity (C:=C) x else 1 := by + cases mixed <;> simp only [assignmentDensity,Bool.false_eq_true,ite_false,ite_true, + Frame.extractedDensity,Complex.ofReal_re,Complex.ofReal_one] + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalFrame.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..c4e7b09b4f6c4bca1230f984af3b5cb921f37e5c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkActualUniversalPrincipalFrame.lean @@ -0,0 +1,111 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrameWeighted +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIdentityFrequencyRootTest +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedUniversalOperatorActualDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal +open Construction Conclusion HistoryBulkReferenceFrequencyFamily HistoryBulkSelectedUniversalOperator +open HistoryBulkGiantIntegerReference HistoryBulkFibreGiantApproximation HistoryBulkGoodPatternPrincipalFrame +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkSourceDisintegration +open HistoryBulkSelectedIntegralReplacement ResidueHaar +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + {σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))} + {x y : InternalSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l} + {i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l} + {r : SupportedReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l x y i.1.val i.1.val i.2} + +def frameOfData (a : ActualReferenceData C σ i r) (hp : ∀q∈outside,q.Prime) : + Frame (l:=l) C outside where + leftSource := a.assignment + rightSource := permutedAssignment C l σ a.assignment + s := i.1.val + t := i.1.val + P := a.plus + Q := a.minus + leftChoices := assembleHistoryChoices C.sources _ _ l i.2.1 x + rightChoices := assembleHistoryChoices C.sources _ _ l i.2.2 y + left_mass := a.assignment_mass + right_mass := by rw [permutedAssignment_mass]; exact a.assignment_mass + left_choices_mass := a.left_choice_mass + right_choices_mass := a.right_choice_mass + plus_pos := a.plus_pos + minus_pos := a.minus_pos + plus_cell := a.plus_cell + minus_cell := a.minus_cell + left_supported := actualReference_left_supported C a + right_supported := actualReference_right_supported C a + matching := integerMatching C _ l σ a.assignment i.1.val i.1.val a.plus a.minus _ _ + outside_primes := hp + +theorem frameOfData_left (a : ActualReferenceData C σ i r) (hp : ∀q∈outside,q.Prime) : + (frameOfData a hp).left = decodeHistory C.sources _ _ l r.left + (assembleHistoryChoices C.sources _ _ l i.2.1 x) := by + rw [a.left_eq] + rfl + +theorem frameOfData_right (a : ActualReferenceData C σ i r) (hp : ∀q∈outside,q.Prime) : + (frameOfData a hp).right = decodeHistory C.sources _ _ l r.right + (assembleHistoryChoices C.sources _ _ l i.2.2 y) := by + rw [a.right_eq] + rfl + +theorem frameOfData_integral (a : ActualReferenceData C σ i r) + (hp : ∀q∈outside,q.Prime) (mixed : Bool) : + principalIntegral (frameOfData a hp) false mixed = + actualNestedIntegral C mixed (bulkSize k L/2) a := by + cases mixed <;> rfl + +theorem frameOfData_operator (a : ActualReferenceData C (Equiv.refl _) i r) + (hp : ∀q∈outside,q.Prime) (mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jactualNestedIntegral C mixed (bulkSize k L/2) a*z) + rcases r with ⟨rl,rr,rf,sf,rm,sm,rs,ss⟩ + rcases a with ⟨ax,ap,aq,am,ac,ae,ap0,aq0,apc,aqc,al,ar⟩ + dsimp only at al ar + subst rl + subst rr + unfold referenceRootAverage + dsimp only + apply congrArg average + funext z + exact HistoryBulkIdentityFrequency.rootTest_identity mixed d _ _ _ _ hp hV k z + +theorem frameOfData_operator_of_identity (a : ActualReferenceData C σ i r) + (hσ : σ=Equiv.refl _) (hp : ∀q∈outside,q.Prime) (mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jreplacementFamily + (selectedFamily C outside hactual hl hout p (restoreOuterBackground C l p bg b) mixed) + (fun q hq=>spectator.prime q (hout q hq)) + +theorem selectedAggregate_eq_replacementBackground (mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L jselectedReplacementBackground C outside hactual hl hout bg p b mixed) + false mixed hV := by + rw [selectedAggregate_eq_background] + unfold HistoryBulkPatternIntegralReplacement.backgroundValue + apply congrArg (backgroundPrior C l).cmean + funext bg + unfold patternComplexSum + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + split_ifs + · congr 1 + symm + exact familyValue_replacementFamily _ _ + (selectedFamily_permutation C outside hactual hl hout p _ mixed) mixed + (selectedFamily_mask C outside hactual hl hout p _ mixed) b hV + · rfl + +end Ostmann.Arithmetic.HistoryBulkActualUniversalPrincipal + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedCollisionOptionProof.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedCollisionOptionProof.lean new file mode 100644 index 0000000000000000000000000000000000000000..0455477e27bbbb584535ecd9f6ed78ffcc818c82 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedCollisionOptionProof.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCollisionOptionRealBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedCollisionTerm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedValue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkActualPrincipalCollision HistoryBulkPrincipalCollisionError +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (hlen : outside.length=2*(bulkSize k L/2)) (hp : ∀ q ∈ outside, q.Prime) + (hV : ∀ q ∈ outside, ∀ j ≤ l, frequencyBound Bs BD Bz k L j < q) + +theorem correctedKernelOptionProof + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) + (o : OriginalOuter (fun _ => C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : + (selectedBulkPrior C l).cmean (fun sample => + (selectCorrectedOuterReference (l:=l) C p o outside e i).elim 0 + (fun corrected => corrected.kernelTerm (l:=l) he hlen hp hV true sample)) = + ((selectCorrectedOuterReference (l:=l) C p o outside e i).map + (fun corrected => corrected.collisionReference (l:=l) he hlen hp hV)).elim 0 + (fun reference => referenceKernel C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p o) reference (outerBlocks C l p o) true * + (selectedBulkPrior C l).cmean (fun sample => + (((selectCorrectedOuterReference (l:=l) C p o outside e i).elim 0 + (fun corrected => density (corrected.frame (l:=l) he hp) true) : ℝ) : ℂ) * + (open scoped Classical in + if true ∧ ¬fibreSmallOutsideGuard C outside (outerNonbulk C l p o) sample + then 0 else reference.value true true sample))) := + cmean_option_real_scale + (Ω := SelectedBulkSample C l) + (α := CorrectedSelectedOuter (l:=l) C p o outside e i) + (β := PrincipalCollisionReference (l:=l) C outside (outerNonbulk C l p o) p) + (selectedBulkPrior C l) + (selectCorrectedOuterReference (l:=l) C p o outside e i) + (fun R => R.collisionReference (l:=l) he hlen hp hV) + (fun R u => R.kernelTerm (l:=l) he hlen hp hV true u) + (fun r => referenceKernel C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p o) r (outerBlocks C l p o) true) + (fun R => density (R.frame (l:=l) he hp) true) + (fun r u => (open scoped Classical in + if true ∧ ¬fibreSmallOutsideGuard C outside (outerNonbulk C l p o) u then 0 else r.value true true u)) + (fun R u => R.kernelTerm_true_eq_collision (l:=l) he hlen hp hV u) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedCollisionSumProof.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedCollisionSumProof.lean new file mode 100644 index 0000000000000000000000000000000000000000..2daa480038c3f153d136e56b5fe48e67ef3726d4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedCollisionSumProof.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualGoodPrincipalDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackgroundDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionCorrectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalCollisionNormalForm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrectedValue +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedCollisionOptionProof + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryBulkActualRootReferenceFamily +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation HistoryBulkIndependentFibreReference +open HistoryBulkActualPrincipalBlockFamily HistoryBulkActualGoodPrincipal +open HistoryBulkActualCorrectedPrincipalBlockFamily +open HistoryBulkActualPrincipalCollision HistoryBulkActualPrincipalCollisionCorrected +open HistoryBulkPrincipalCollisionError +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (outside : List ℕ) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands (Template.remainder (l+1) + (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) e) + (hlen : outside.length=2*(bulkSize k L/2)) (hprime : ∀q∈outside,q.Prime) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + (selectCorrectedOuterReference (l:=l) C p outer outside e index).elim 0 + (fun corrected => corrected.kernelTerm (l:=l) he hlen hprime hV true sample))) = + ∑ index : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l), + ((selectCorrectedOuterReference (l:=l) C p outer outside e index).map + (fun corrected => corrected.collisionReference (l:=l) he hlen hprime hV)).elim 0 + (fun reference => referenceKernel C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + outside (outerNonbulk C l p outer) reference (outerBlocks C l p outer) true * + (selectedBulkPrior C l).cmean (fun sample => + (((selectCorrectedOuterReference (l:=l) C p outer outside e index).elim 0 + (fun corrected => density (corrected.frame (l:=l) he hprime) true) : ℝ) : ℂ) * + (open scoped Classical in + if true ∧ ¬fibreSmallOutsideGuard C outside (outerNonbulk C l p outer) sample + then 0 else reference.value true true sample))) := + Finset.sum_congr (M:=ℂ) + (rfl : (Finset.univ : Finset (Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l))) = Finset.univ) + (fun i _ => correctedKernelOptionProof + (d:=d) (Bs:=Bs) (BD:=BD) (Bz:=Bz) (L:=L) (k:=k) (l:=l) (E:=E) + C p outside e he hlen hprime hV i (restoreOuterBackground C l p bg b)) + +end Ostmann.Arithmetic.HistoryBulkActualPrincipalKernelStageCorrected + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBounds.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..70ea58a6d9318a7145f8c8bc99b4b8400e91caca --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBounds.lean @@ -0,0 +1,123 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBoundsActive +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBoundsRemoved +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBoundsZero + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +open Construction Conclusion Characters.RationalHistory HistoryOccurrenceVariables +open HistorySymbolicEncoding HistoryProductWindows HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryActiveCoordinates InitialCoordinatesTemplate + +theorem selected_bulk_corrected_bounds {d : Decomposition} {Bs BD Bz : ℝ} {k₀ l : ℕ} + {L : ℝ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (s : ℕ) (X Δ Err : ℝ) (hX : 0 < X) {V : ℕ → ℕ} {outside : List ℕ} + (houtside : ∀q∈outside,0 < q) (hout : outside.length = 2*s) + (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) + (hl : l < k₀) + (hl₁ : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) h) + (hl₂ : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) k) + (matchRoots : RootMatching h k) (background : PairKey h k → ℝ) + (hsrc₁ : SourceDomain (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + h (fun i => background (leftMap h k i))) + (hsrc₂ : SourceDomain (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (fun i => background (rightMap h k i))) + (hcenter : Real.log X+Δ-Err ≤ 2*(C.giantCenter:ℝ)+2*C.bulkBin+2*C.spectatorBin+ + (∑a,∑i,topCenters (bulkSize k₀ L/2) (C.cells.center (bulkSize k₀ L/2)) a i)+ + (∑a,∑j:Fin k₀,∑i,compensationCenters (bulkSize k₀ L/2) (C.cells.center (bulkSize k₀ L/2)) a j i)) + {τ : Type} (S : Finset τ) (cellCenter : τ → ℝ) (cellKey : τ → PairKey h k) + {ι : Type*} [Fintype ι] [DecidableEq ι] (e : ι ≃ bulkCoordinates h k) : + let T := (C.giantCenter:ℝ)+C.compensationLogScale l+stepGap BD Bz k₀ L l + let U := C.compensationLogScale l + let WH := nominalInheritedWidth k₀ l+1 + let Wu := nominalRemovedWidth k₀ l + let f := reindexedCorrectedRealXi (bulkSize k₀ L/2) s X C.bulkBin C.spectatorBin C.giantCenter h k hs ks + T U (pairedDiagonalHKeys h k (l+1)) (pairedDiagonalUKeys h k (l+1)) S cellCenter cellKey + (bulkCoordinates h k) background e + ContDiff ℝ ∞ (fun y : ι → ℝ => f (fun i => Real.exp (y i))) ∧ + (∀x : ι → ℝ, (∀i,0 < x i) → ∀i, + ‖deriv (fun t => f (Expr.logCurve x i t)) 0‖ ≤ + correctedPairDerivativeBound WH Wu (pairedDiagonalHKeys h k (l+1)).length + (pairedDiagonalUKeys h k (l+1)).length S.card h k V (bulkSize k₀ L/2) k₀ C.bulkBin Δ Err + (C.cells.center (bulkSize k₀ L/2))) ∧ + (∀x : ι → ℝ, (∀i,0 < x i) → + ‖f x‖ ≤ Real.exp (WH+Wu)*Real.exp (-((2^l:ℕ):ℝ)*Δ+sourceXiConstant l k₀ Err)) := by + dsimp only + let b := bulkSize k₀ L/2 + let center := C.cells.center b + let T := (C.giantCenter:ℝ)+C.compensationLogScale l+stepGap BD Bz k₀ L l + let U := C.compensationLogScale l + let WH := nominalInheritedWidth k₀ l + let Wu := nominalRemovedWidth k₀ l + let Hkeys := pairedDiagonalHKeys h k (l+1) + let Ukeys := pairedDiagonalUKeys h k (l+1) + let point (x : ι → ℝ) := insert (bulkCoordinates h k) background (fun j => x (e.symm j)) + let f := reindexedCorrectedRealXi b s X C.bulkBin C.spectatorBin C.giantCenter h k hs ks + T U Hkeys Ukeys S cellCenter cellKey (bulkCoordinates h k) background e + have hbg : ∀i,0 < background i := by + intro i + obtain ⟨j,rfl⟩ := unionMap_surjective h k i + rcases j with j | j + · exact hsrc₁.positive j + · exact hsrc₂.positive j + have hsource (x : ι → ℝ) (hx : ∀i,0 < x i) := + bulk_sourceDomains h k hs matchRoots background hsrc₁ hsrc₂ _ (fun j => hx (e.symm j)) + have hpos (x : ι → ℝ) (hx : ∀i,0 < x i) : ∀j,0 < point x j := + insert_positive _ background _ hbg (fun j => hx (e.symm j)) + have hwindow (x : ι → ℝ) (hx : ∀i,0 < x i) (hne : f x ≠ 0) : + T-WH ≤ Real.log ((Hkeys.map (point x)).prod) := by + have hn : pairedRealXi b s X C.bulkBin C.spectatorBin C.giantCenter h k hs ks (point x) ≠ 0 := by + intro hz + apply hne + change (_:ℂ)*pairedRealXi b s X C.bulkBin C.spectatorBin C.giantCenter h k hs ks (point x)=0 + rw [hz,mul_zero] + have hw := selected_paired_H_window C s hl X h k hs ks hl₂ (point x) (hsource x hx).2 hn + have hh := (abs_le.mp hw).1 + change -WH ≤ Real.log ((Hkeys.map (point x)).prod)-T at hh + linarith + have hupper (x : ι → ℝ) (hx : ∀i,0 < x i) : + Real.log ((Ukeys.map (point x)).prod) ≤ U+Wu := by + have hw := selected_paired_U_window C hl h k hl₂ (point x) (hsource x hx).2 + have hh := (abs_le.mp hw).2 + change Real.log ((Ukeys.map (point x)).prod)-U ≤ Wu at hh + linarith + refine ⟨reindexedCorrectedRealXi_log_contDiff b s X C.bulkBin C.spectatorBin C.giantCenter hX + houtside h k hs ks T U Hkeys Ukeys S cellCenter cellKey (bulkCoordinates h k) background hbg e,?_,?_⟩ + · intro x hx i + by_cases hH : T-(WH+1) ≤ Real.log ((Hkeys.map (point x)).prod) + · exact reindexedCorrectedRealXi_deriv_le b s k₀ X C.bulkBin C.spectatorBin C.giantCenter + Δ Err center hX houtside hout h k hs ks hl.le hl₁ hl₂ T U (WH+1) Wu Hkeys Ukeys + S cellCenter cellKey _ background hbg e x i hx hH (hupper x hx) + (hsource x hx).1 (hsource x hx).2 hcenter + · have hz : deriv (fun t => f (Expr.logCurve x i t)) 0 = 0 := by + apply deriv_eq_zero_below_support _ + (fun t => Real.log ((Hkeys.map (point (Expr.logCurve x i t))).prod)) (T-WH) + (log_product_insert_logCurve_continuousAt _ background hbg e x hx i Hkeys) + · intro t ht + exact hwindow _ (logCurve_positive x hx i t) ht + · simpa only [Expr.logCurve_zero] using + (show Real.log ((Hkeys.map (point x)).prod) < T-WH by linarith) + change ‖deriv (fun t => f (Expr.logCurve x i t)) 0‖ ≤ _ + rw [hz,norm_zero] + exact correctedPairDerivativeBound_nonneg (WH+1) Wu Hkeys.length Ukeys.length S.card + h k V b k₀ C.bulkBin Δ Err center + · intro x hx + by_cases hz : f x = 0 + · change ‖f x‖ ≤ _ + rw [hz,norm_zero] + positivity + · have hH : T-(WH+1) ≤ Real.log ((Hkeys.map (point x)).prod) := by + linarith [hwindow x hx hz] + exact correctedPairedRealXi_norm_le b s k₀ X C.bulkBin C.spectatorBin C.giantCenter + Δ Err center hX houtside hout h k hs ks T U (WH+1) Wu Hkeys Ukeys S cellCenter cellKey + (point x) (hpos x hx) hH (hupper x hx) (hsource x hx).1 (hsource x hx).2 hcenter + +end Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsActive.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsActive.lean new file mode 100644 index 0000000000000000000000000000000000000000..b1b0f70cc5f84c2fd1435d6484fba023aed4268d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsActive.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBoundsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkCoordinatesMatching + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +open Construction Characters.RationalHistory HistoryOccurrenceVariables +open HistorySymbolicEncoding HistoryProductWindows HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryActiveCoordinates PrimeCellFreezing +variable {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + +theorem bulk_sourceDomains {b k₀ : ℕ} {G : ℝ} {center : ℕ → ℝ} + (h k : History l) (hs : h.Supported V outside) (e : RootMatching h k) + (background : PairKey h k → ℝ) + (hh : SourceDomain b k₀ G center h (fun i => background (leftMap h k i))) + (hk : SourceDomain b k₀ G center k (fun i => background (rightMap h k i))) + (x : bulkCoordinates h k → ℝ) (hx : ∀i, 0 < x i) : + SourceDomain b k₀ G center h + (fun i => insert (bulkCoordinates h k) background x (leftMap h k i)) ∧ + SourceDomain b k₀ G center k + (fun i => insert (bulkCoordinates h k) background x (rightMap h k i)) := by + let z : bulkCoordinates h k → ℝ := fun i => Real.log (x i) + have hz : z ∈ logRectangle z z := fun i _ => ⟨le_rfl,le_rfl⟩ + have hexp : (fun i => Real.exp (z i)) = x := by + funext i + exact Real.exp_log (hx i) + constructor + · rw [←hexp] + apply sourceDomain_insert_exp b k₀ G center h (leftMap h k) _ background z z hh _ _ z hz + · intro i q hiq hq hm + rcases i with a | i | i + · cases hiq + · have he : h.root.small.get i = q := Option.some.inj hiq + exact (left_nonbulk_not_mem h k hs i (he ▸ hq) hm).elim + · exact (left_internal_not_mem h k i hm).elim + · intro a hm + exact (left_giant_not_mem h k a hm).elim + · rw [←hexp] + apply sourceDomain_insert_exp b k₀ G center k (rightMap h k) _ background z z hk _ _ z hz + · intro i q hiq hq hm + rcases i with a | i | i + · cases hiq + · have he : k.root.small.get i = q := Option.some.inj hiq + exact (right_nonbulk_not_mem h k hs e i (he ▸ hq) hm).elim + · exact (right_internal_not_mem h k i hm).elim + · intro a hm + exact (right_giant_not_mem h k a hm).elim + +theorem bulk_U_product (h k : History l) (hs : h.Supported V outside) + (e : RootMatching h k) (j : ℕ) (background : PairKey h k → ℝ) + (x : bulkCoordinates h k → ℝ) : + ((pairedDiagonalUKeys h k j).map (insert (bulkCoordinates h k) background x)).prod = + ((pairedDiagonalUKeys h k j).map background).prod := by + congr 1 + apply List.map_congr_left + intro a ha + change a ∈ (diagonalUKeys k j).map (rightMap h k) at ha + obtain ⟨key,hkey,rfl⟩ := List.mem_map.mp ha + change key ∈ ((List.finRange k.root.small.length).filter + (fun i => decide ((k.root.small.get i).role = .compensation j))).map + (fun i => Sum.inr (Sum.inl i)) at hkey + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp hkey + have hp := (List.mem_filter.mp hi).2 + have hr : (k.root.small.get i).role = .compensation j := by simpa using hp + have hn := right_nonbulk_not_mem h k hs e i (by rw [hr]; simp) + simp only [HistoryActiveCoordinates.insert,dite_eq_right hn] + +end Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4abd38981ccf0b4bade97f28bb919914a2f3517 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsActual.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkCoordinatesActual +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedXiCenter + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +open Construction Conclusion Characters.RationalHistory HistoryOccurrenceVariables +open HistorySymbolicEncoding HistoryProductWindows HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates + +theorem actual_bulk_corrected_bounds {d : Decomposition} {Bs BD Bz : ℝ} {k₀ : ℕ} + {L : ℝ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hX : 0 < C.scale) (s : ℕ) (outside : List ℕ) + (houtside : ∀q∈outside,0 < q) (hout : outside.length = 2*s) + (V : ℕ → ℕ) (l : ℕ) (hl : l < k₀) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k₀ L/2)))) + (x : OuterSample C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant) + (p q : ℤ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) V l) + (hx : (outerPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant).mass x ≠ 0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) V l c ≠ 0) + (he : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) V l e ≠ 0) : + let h := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) V l + (outerState C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant x p) c + let k := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) V l + (outerState C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant + (selectedPermutedOuter C l σ x) q) e + ∀(hs : h.Supported V outside) (ks : k.Supported V outside), + let T := (C.giantCenter:ℝ)+C.compensationLogScale l+stepGap BD Bz k₀ L l + let U := C.compensationLogScale l + let WH := nominalInheritedWidth k₀ l+1 + let Wu := nominalRemovedWidth k₀ l + ∀(τ : Type) (S : Finset τ) (cellCenter : τ → ℝ) (cellKey : τ → PairKey h k), + let f := reindexedCorrectedRealXi (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin C.giantCenter h k hs ks + T U (pairedDiagonalHKeys h k (l+1)) (pairedDiagonalUKeys h k (l+1)) S cellCenter cellKey + (bulkCoordinates h k) (pairBackground h k) (selectedOrderedEquiv C V l outside σ x p q c e hs) + ContDiff ℝ ∞ (fun y : Fin (2^l) × Fin (2*(bulkSize k₀ L/2)) → ℝ => f (fun i => Real.exp (y i))) ∧ + (∀y : Fin (2^l) × Fin (2*(bulkSize k₀ L/2)) → ℝ, (∀i,0 < y i) → ∀i, + ‖deriv (fun t => f (Expr.logCurve y i t)) 0‖ ≤ + correctedPairDerivativeBound WH Wu (pairedDiagonalHKeys h k (l+1)).length + (pairedDiagonalUKeys h k (l+1)).length S.card h k V (bulkSize k₀ L/2) k₀ C.bulkBin + (initialGap Bs k₀ L) (2+2*(k₀:ℝ)) (C.cells.center (bulkSize k₀ L/2))) ∧ + (∀y : Fin (2^l) × Fin (2*(bulkSize k₀ L/2)) → ℝ, (∀i,0 < y i) → ‖f y‖ ≤ Real.exp (WH+Wu)* + Real.exp (-((2^l:ℕ):ℝ)*initialGap Bs k₀ L+sourceXiConstant l k₀ (2+2*(k₀:ℝ)))) := by + dsimp only + intro hs ks τ S cellCenter cellKey + have hd := selected_bulk_sourceBounds C V l outside σ x p q c e hx hc he hs + apply selected_bulk_corrected_bounds C s C.scale (initialGap Bs k₀ L) (2+2*(k₀:ℝ)) + (by exact_mod_cast hX) houtside hout _ _ hs ks hl _ _ + (selectedMatching C V l σ x p q c e) _ hd.1.background_source hd.2.background_source + (selected_Xi_source_center C) S cellCenter cellKey + (selectedOrderedEquiv C V l outside σ x p q c e hs) + · exact decoded_tree_source_labels _ _ _ _ _ _ + (Template.assignedSlots_matches C.sources _ x.2.2) + · exact decoded_tree_source_labels _ _ _ _ _ _ + (Template.assignedSlots_matches C.sources _ (selectedPermutedOuter C l σ x).2.2) + +end Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c1aaa7844799404a9076707a30d3684692986fe --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsBasic.lean @@ -0,0 +1,112 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairMixedReplacementCorrectedSample +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryProductWindowsNormalize +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryProductWindowsSupport + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +open Construction Characters.RationalHistory HistoryOccurrenceVariables +open HistorySymbolicEncoding HistoryProductWindows HistoryPairSmoothXi HistoryPairPattern + +private theorem sum_filter_map {α : Type*} (xs : List α) (p : α → Bool) (f : α → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => rfl + | cons a xs ih => cases hp : p a <;> simp [hp,ih] + +theorem log_role_product {l : ℕ} (h : History l) (p : SmallSlot → Bool) + (x : Key h → ℝ) (hx : ∀i, 0 < x i) : + Real.log (((diagonalRoleKeys h p).map x).prod) = + ∑i : Fin h.root.small.length, if p (h.root.small.get i) then + Real.log (x (.inr (.inl i))) else 0 := by + rw [Real.log_list_prod (by + intro a ha + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp ha + exact (hx i).ne')] + simp only [diagonalRoleKeys,List.map_map,Function.comp_def] + rw [sum_filter_map] + rw [←List.ofFn_eq_map,List.sum_ofFn] + +theorem remaining_log_error {l : ℕ} (h : History l) (j : ℕ) + (T : List SourceSlot) (hm : Template.Matches T h.root.small) + (center : ℕ → ℝ) (x : Key h → ℝ) + (hc : ∀i, (h.root.small.get i).role ≠ .bulk → + |Real.log (x (.inr (.inl i)))-center (h.root.small.get i).origin| ≤ 1) : + |(∑i : Fin h.root.small.length, if (h.root.small.get i).role ≠ .compensation j + then Real.log (x (.inr (.inl i))) else 0) - + bulkLog h.root.small (rootExpr h).small x - + sourceSum (fixedCenter center) (Template.remainder j T)| ≤ + sourceSum fixedCount (Template.remainder j T) := by + have hC := matches_metadata_fin_sum hm (fun r o => + if r ≠ .compensation j then (if r = .bulk then 0 else center o) else 0) + have hN := matches_metadata_fin_sum hm (fun r _ => + if r ≠ .compensation j then (if r = .bulk then (0:ℝ) else 1) else 0) + have heC : sourceSum (fixedCenter center) (Template.remainder j T) = + ∑i : Fin h.root.small.length, if (h.root.small.get i).role ≠ .compensation j + then (if (h.root.small.get i).role = .bulk then 0 else center (h.root.small.get i).origin) else 0 := by + rw [hC] + simpa only [sourceSum,Template.remainder,fixedCenter,decide_eq_true_eq] using + sum_filter_map T (fun q => decide (q.role ≠ .compensation j)) (fixedCenter center) + have heN : sourceSum fixedCount (Template.remainder j T) = + ∑i : Fin h.root.small.length, if (h.root.small.get i).role ≠ .compensation j + then (if (h.root.small.get i).role = .bulk then (0:ℝ) else 1) else 0 := by + rw [hN] + simpa only [sourceSum,Template.remainder,fixedCount,decide_eq_true_eq] using + sum_filter_map T (fun q => decide (q.role ≠ .compensation j)) fixedCount + rw [heC,heN] + simp only [bulkLog,slotSum,rootExpr,Expr.realEval] + rw [←Finset.sum_sub_distrib,←Finset.sum_sub_distrib] + apply (Finset.abs_sum_le_sum_abs _ _).trans + apply Finset.sum_le_sum + intro i _ + by_cases hb : (h.root.small.get i).role = .bulk + · have hr : (h.root.small.get i).role ≠ .compensation j := by rw [hb]; simp + simp only [ite_eq_left hb,ite_eq_left hr,sub_self,abs_zero,le_refl] + · by_cases hr : (h.root.small.get i).role = .compensation j + · simp only [ite_eq_right hb,ite_eq_right (not_not.mpr hr),sub_self,abs_zero,le_refl] + · simpa only [ite_eq_right hb,ite_eq_left hr,sub_zero] using hc i hb + +theorem actual_history_H_window (b s k l : ℕ) (X tb td G : ℝ) (center : ℕ → ℝ) + {V : ℕ → ℕ} {outside : List ℕ} (h : History l) (hs : h.Supported V outside) + (hm : Template.Matches (Template.current (Template.initial (2*b) k) l) h.root.small) + (x : Key h → ℝ) (hx : SourceDomain b k G center h x) + (hne : actualRealHistoryScalar b s X tb td G outside h hs x ≠ 0) : + |Real.log (((diagonalHKeys h (l+1)).map x).prod) - + (G+(2:ℝ)^l*(2*tb+inheritedCenter b k l center))| ≤ inheritedWidth k l := by + have hb := inherited_bulkLog_of_scalar b s k X tb td G x h hs (rootExpr h) + (compensationExpr h) hx.leaves hne + have he := remaining_log_error h (l+1) _ hm center x + (fun i hi => hx.source (.inr (.inl i)) (h.root.small.get i) rfl hi) + have hC : sourceSum (fixedCenter center) (Template.remainder (l+1) + (Template.current (Template.initial (2*b) k) l)) = (2:ℝ)^l*inheritedCenter b k l center := + sourceSum_current_filter (fixedCenter center) _ _ l + have hN := fixedCount_current_filter_le + (fun q => decide (q.role ≠ .compensation (l+1))) (2*b) k l + change sourceSum fixedCount (Template.remainder (l+1) + (Template.current (Template.initial (2*b) k) l)) ≤ (2:ℝ)^l*(6+4*(k:ℝ)) at hN + rw [hC] at he + have hp : (((diagonalRoleKeys h (fun q => decide (q.role ≠ .compensation (l+1)))).map x).prod) ≠ 0 := + (List.prod_pos (by + intro a ha + obtain ⟨i,hi,rfl⟩ := List.mem_map.mp ha + exact hx.positive i)).ne' + simp only [diagonalHKeys,List.map_cons,List.prod_cons] + rw [Real.log_mul (hx.positive (.inl true)).ne' hp,log_role_product h _ x hx.positive] + simp only [decide_eq_true_eq] + have hg := hx.giant true + have ha := (abs_add_le (Real.log (x (.inl true))-G) + (bulkLog h.root.small (rootExpr h).small x-(2:ℝ)^l*(2*tb))).trans (add_le_add hg hb) + have hh := (abs_add_le _ _).trans (add_le_add ha he) + convert hh.trans (add_le_add_right hN (1+(2:ℝ)^l*2)) using 1 + · congr 1; ring + · unfold inheritedWidth; ring + +end Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsRemoved.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsRemoved.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9196cb4c4ff1e641e615b837cbe0856b609cced --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsRemoved.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBoundsSupport + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +open Construction Conclusion Characters.RationalHistory HistoryOccurrenceVariables +open HistorySymbolicEncoding HistoryProductWindows HistoryPairSmoothXi HistoryPairPattern + +private theorem sum_filter_map {α : Type*} (xs : List α) (p : α → Bool) (f : α → ℝ) : + ((xs.filter p).map f).sum = (xs.map (fun a => if p a then f a else 0)).sum := by + induction xs with + | nil => rfl + | cons a xs ih => cases hp : p a <;> simp [hp,ih] + +theorem actual_history_U_window (b k l : ℕ) (G : ℝ) (center : ℕ → ℝ) + (h : History l) + (hm : Template.Matches (Template.current (Template.initial (2*b) k) l) h.root.small) + (x : Key h → ℝ) (hx : SourceDomain b k G center h x) : + |Real.log (((diagonalUKeys h (l+1)).map x).prod) - + (2:ℝ)^l*removedCenter b k l center| ≤ removedWidth k l := by + let T := Template.current (Template.initial (2*b) k) l + have hsum (F : SlotRole → ℕ → ℝ) : + sourceSum (fun q => F q.role q.origin) (Template.extracted (l+1) T) = + ∑i : Fin h.root.small.length, if (h.root.small.get i).role = .compensation (l+1) + then F (h.root.small.get i).role (h.root.small.get i).origin else 0 := by + rw [matches_metadata_fin_sum hm (fun r o => if r = .compensation (l+1) then F r o else 0)] + simpa only [sourceSum,Template.extracted,decide_eq_true_eq] using + sum_filter_map T (fun q => decide (q.role = .compensation (l+1))) (fun q => F q.role q.origin) + have hC := hsum (fun r o => if r = .bulk then 0 else center o) + have hN := hsum (fun r _ => if r = .bulk then (0:ℝ) else 1) + have hcenter : sourceSum (fixedCenter center) (Template.extracted (l+1) T) = + (2:ℝ)^l*removedCenter b k l center := sourceSum_current_filter (fixedCenter center) _ _ l + have hcount := fixedCount_current_filter_le + (fun q => decide (q.role = .compensation (l+1))) (2*b) k l + change sourceSum fixedCount (Template.extracted (l+1) T) ≤ removedWidth k l at hcount + rw [←hcenter] + change |Real.log (((diagonalUKeys h (l+1)).map x).prod) - + sourceSum (fun q => if q.role = .bulk then 0 else center q.origin) (Template.extracted (l+1) T)| ≤ _ + rw [hC] + have he : |Real.log (((diagonalUKeys h (l+1)).map x).prod) - + ∑i : Fin h.root.small.length, if (h.root.small.get i).role = .compensation (l+1) + then (if (h.root.small.get i).role = .bulk then 0 else center (h.root.small.get i).origin) else 0| ≤ + sourceSum fixedCount (Template.extracted (l+1) T) := by + change _ ≤ sourceSum (fun q => if q.role = .bulk then (0:ℝ) else 1) _ + rw [hN] + rw [diagonalUKeys,log_role_product h _ x hx.positive] + simp only [decide_eq_true_eq] + rw [←Finset.sum_sub_distrib] + apply (Finset.abs_sum_le_sum_abs _ _).trans + apply Finset.sum_le_sum + intro i _ + by_cases hr : (h.root.small.get i).role = .compensation (l+1) + · have hb : (h.root.small.get i).role ≠ .bulk := by rw [hr]; simp + simpa only [ite_eq_left hr,ite_eq_right hb] using + hx.source (.inr (.inl i)) (h.root.small.get i) rfl hb + · simp only [ite_eq_right hr,sub_self,abs_zero,le_refl] + exact he.trans hcount + +theorem selected_paired_U_window {d : Decomposition} {Bs BD Bz : ℝ} {k₀ l : ℕ} + {L : ℝ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hl : l < k₀) (h k : History l) + (hk : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) k) + (x : PairKey h k → ℝ) + (hx : SourceDomain (bulkSize k₀ L/2) k₀ C.giantCenter + (C.cells.center (bulkSize k₀ L/2)) k (fun i => x (rightMap h k i))) : + |Real.log (((pairedDiagonalUKeys h k (l+1)).map x).prod) - + C.compensationLogScale l| ≤ nominalRemovedWidth k₀ l := by + apply removed_window_normalize (bulkSize k₀ L/2) k₀ l hl _ + (nominalWeight k₀ (nominalJ Bs BD Bz k₀ L C.blockBase C.giantCenter C.spectatorBin) + (stepGap BD Bz k₀ L)) (C.cells.center (bulkSize k₀ L/2)) _ + (C.type_frequency_center_error _) + simpa only [pairedDiagonalUKeys,List.map_map,Function.comp_def] using + actual_history_U_window (bulkSize k₀ L/2) k₀ l C.giantCenter _ k (root_matches hk) _ hx + +end Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..5024aa6b320af4585dbd5807bc9f94706dfd70ee --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsSupport.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBoundsBasic +import OAI.NumberTheory.Ostmann.Construction.SelectedCounterpartWindows + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +open Construction Conclusion Characters.RationalHistory HistoryOccurrenceVariables +open HistorySymbolicEncoding HistoryProductWindows HistoryPairSmoothXi HistoryPairPattern +variable {l : ℕ} {V : ℕ → ℕ} {outside : List ℕ} + +theorem root_matches {seed : List SourceSlot} {h : History l} + (hh : TreeSourceLabels seed h) : Template.Matches (Template.current seed l) h.root.small := by + cases h with + | leaf a => exact hh + | node a p u hp hm left right => exact hh.1 + +theorem paired_H_window (b s k₀ : ℕ) (X tb td G : ℝ) (center : ℕ → ℝ) + (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) + (hk : TreeSourceLabels (Template.initial (2*b) k₀) k) + (x : PairKey h k → ℝ) + (hx : SourceDomain b k₀ G center k (fun i => x (rightMap h k i))) + (hne : pairedRealXi b s X tb td G h k hs ks x ≠ 0) : + |Real.log (((pairedDiagonalHKeys h k (l+1)).map x).prod) - + (G+(2:ℝ)^l*(2*tb+inheritedCenter b k₀ l center))| ≤ inheritedWidth k₀ l := by + have hn : actualRealHistoryScalar b s X tb td G outside k ks + (fun i => x (rightMap h k i)) ≠ 0 := by + intro hz + exact hne (by simp only [pairedRealXi,actualRealXi,hz,star_zero,mul_zero]) + simpa only [pairedDiagonalHKeys,List.map_map,Function.comp_def] using + actual_history_H_window b s k₀ l X tb td G center k ks (root_matches hk) _ hx hn + +theorem selected_paired_H_window {d : Decomposition} {Bs BD Bz : ℝ} {k₀ : ℕ} + {L : ℝ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (s : ℕ) (hl : l < k₀) (X : ℝ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (hk : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) k) + (x : PairKey h k → ℝ) + (hx : SourceDomain (bulkSize k₀ L/2) k₀ C.giantCenter + (C.cells.center (bulkSize k₀ L/2)) k (fun i => x (rightMap h k i))) + (hne : pairedRealXi (bulkSize k₀ L/2) s X C.bulkBin C.spectatorBin C.giantCenter h k hs ks x ≠ 0) : + |Real.log (((pairedDiagonalHKeys h k (l+1)).map x).prod) - + ((C.giantCenter:ℝ)+C.compensationLogScale l+stepGap BD Bz k₀ L l)| ≤ nominalInheritedWidth k₀ l := by + apply inherited_window_normalize (bulkSize k₀ L/2) k₀ l _ C.giantCenter C.bulkBin + (nominalJ Bs BD Bz k₀ L C.blockBase C.giantCenter C.spectatorBin) + (stepGap BD Bz k₀ L l) (nominalWeight k₀ + (nominalJ Bs BD Bz k₀ L C.blockBase C.giantCenter C.spectatorBin) (stepGap BD Bz k₀ L)) + (C.cells.center (bulkSize k₀ L/2)) _ (C.top_frequency_center_error _) + (C.type_frequency_center_error _) (nominalWeight_recurrence_scaled hl _ _) + exact paired_H_window _ s k₀ X C.bulkBin C.spectatorBin C.giantCenter _ h k hs ks hk x hx hne + +end Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsZero.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsZero.lean new file mode 100644 index 0000000000000000000000000000000000000000..8be7ac56fdaa1674853e56c0fc983ca716e11e89 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCorrectedXiBoundsZero.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairMixedReplacementCorrectedReindex + +namespace OAI + +open Erdos970 + +noncomputable section +open Filter +open scoped Topology +namespace Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds +open Characters.RationalHistory HistoryActiveCoordinates + +theorem deriv_eq_zero_below_support (f : ℝ → ℂ) (g : ℝ → ℝ) (a : ℝ) + (hg : ContinuousAt g 0) (hs : ∀t, f t ≠ 0 → a ≤ g t) (h0 : g 0 < a) : + deriv f 0 = 0 := by + have he : f =ᶠ[𝓝 0] fun _ => (0:ℂ) := by + filter_upwards [hg.eventually (eventually_lt_nhds h0)] with t ht + by_contra hn + exact (not_le_of_gt ht) (hs t hn) + rw [he.deriv_eq,deriv_const] + +theorem logCurve_positive {ι : Type*} [DecidableEq ι] + (x : ι → ℝ) (hx : ∀i,0 < x i) (i : ι) (t : ℝ) : + ∀j,0 < Expr.logCurve x i t j := by + intro j + exact mul_pos (hx j) (Real.exp_pos _) + +theorem log_product_insert_logCurve_continuousAt {κ ι : Type*} + [Fintype κ] [DecidableEq κ] [DecidableEq ι] + (I : Finset κ) (background : κ → ℝ) (hbackground : ∀i,0 < background i) + (e : ι ≃ I) (x : ι → ℝ) (hx : ∀i,0 < x i) (i : ι) (keys : List κ) : + ContinuousAt (fun t => Real.log ((keys.map + (insert I background (fun j => Expr.logCurve x i t (e.symm j)))).prod)) 0 := by + apply ContinuousAt.log + · apply (continuous_list_prod keys ?_).continuousAt + intro j hj + unfold HistoryActiveCoordinates.insert + split_ifs with hj + · dsimp only [Expr.logCurve] + split_ifs <;> fun_prop + · fun_prop + · apply (List.prod_pos ?_).ne' + intro a ha + obtain ⟨j,hj,rfl⟩ := List.mem_map.mp ha + exact insert_positive I background _ hbackground + (fun j => logCurve_positive x hx i 0 (e.symm j)) j + +end Ostmann.Arithmetic.HistoryBulkCorrectedXiBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a6f682e2f107b3d16799ca4c143148bb0b640f7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportActual.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCounterpartTransportIndependent +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantOriginalMeanFactorizationDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkCounterpartTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryPairBulkTransport +open HistoryBulkReferenceScalarCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantOriginalMeanFactorization +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + (s t : ℤ) (gp gm : ℕ) + (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length)) + (hold : ∀ i, (y₀ i).val = (x₀ (π i)).val) + (hnew : ∀ i, (y i).val = (x (π i)).val) + (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l) {outside : List ℕ} + (hs : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c).Supported (frequencyBound Bs BD Bz k L) outside) + (ks : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l t gp gm y₀ e).Supported (frequencyBound Bs BD Bz k L) outside) + (hfixed : ∀ i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length, + ((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role ≠ .bulk → (x i).val = (x₀ i).val) + (Xp Xm : ℤ) +include hold hnew hfixed + +theorem independent_counterpart_mul_jointScalar (sc : ℕ) : + counterpart C y Xm * + jointScalar C sc (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l t gp gm y₀ e) hs ks (boolEquiv (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l t gp gm y₀ e)) (orderedEquiv (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l t gp gm y₀ e) hs (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c))) (fun u : Bool => if u then (Xm : ℝ) else (Xp : ℝ)) (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l x) = + jointCorrectedScalar C sc (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l t gp gm y₀ e) hs ks (boolEquiv (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l t gp gm y₀ e)) (orderedEquiv (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l t gp gm y₀ e) hs (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) (frequencyBound Bs BD Bz k L) l s gp gm x₀ c))) (fun u : Bool => if u then (Xm : ℝ) else (Xp : ℝ)) (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l x) := by + have ht := independent_new_counterpart_mul_pairedRealXi C.sources (2*(bulkSize k L/2)) k (frequencyBound Bs BD Bz k L) l + s t gp gm x₀ y₀ x y π hold hnew c e hs ks hfixed Xp Xm + (l+1) (bulkSize k L/2) sc + ((C.giantCenter : ℝ)+C.compensationLogScale l+stepGap BD Bz k L l) + (C.compensationLogScale l) C.scale C.bulkBin C.spectatorBin C.giantCenter + (C.cells.center (bulkSize k L/2)) + simp only [insertOrderedGiants_eq_bulk_over_giants] at ht + exact ht + +end Ostmann.Arithmetic.HistoryBulkCounterpartTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..fc16eb77cd50c20940f82f5934024aa490665467 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportBasic.lean @@ -0,0 +1,93 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceCounterpartValue +import OAI.NumberTheory.Ostmann.Construction.AssignmentReinsert + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkCounterpartTransport +open Construction HistoryOccurrenceVariables HistoryGiantReferenceCounterpart + +def redrawRootSmall {l : ℕ} (h : History l) (values : Fin h.root.small.length → ℕ) : List SmallSlot := + List.ofFn (fun i => {h.root.small.get i with value := values i}) + +theorem diagonalRoleKeys_redraw {l : ℕ} (h : History l) + (values : Fin h.root.small.length → ℕ) (F : Key h → ℝ) + (hF : ∀ i, F (.inr (.inl i)) = (values i : ℝ)) (pred : SlotRole → Bool) : + (diagonalRoleKeys h (fun q => pred q.role)).map F = + ((redrawRootSmall h values).filter (fun q => pred q.role)).map (fun q => (q.value : ℝ)) := by + simp only [diagonalRoleKeys, redrawRootSmall, List.ofFn_eq_map, List.filter_map, + List.map_map, Function.comp_def] + apply List.map_congr_left + intro i hi + exact hF i + +theorem diagonalRoleKeys_redraw_cells {l : ℕ} (h : History l) + (values : Fin h.root.small.length → ℕ) (F : Key h → ℝ) + (hF : ∀ i, F (.inr (.inl i)) = (values i : ℝ)) + (pred : SlotRole → Bool) (G : ℝ) (center : ℕ → ℝ) : + (diagonalRoleKeys h (fun q => pred q.role)).map + (fun i => giantCell (diagonalKeyCenter h G center i) (F i)) = + ((redrawRootSmall h values).filter (fun q => pred q.role)).map + (fun q => giantCell (center q.origin) (q.value : ℝ)) := by + simp only [diagonalRoleKeys, redrawRootSmall, List.ofFn_eq_map, List.filter_map, + List.map_map, Function.comp_def, diagonalKeyCenter] + apply List.map_congr_left + intro i hi + rw [hF i] + +theorem diagonalRootCounterpart_redraw {l : ℕ} (h : History l) + (values : Fin h.root.small.length → ℕ) (F : Key h → ℝ) + (hF : ∀ i, F (.inr (.inl i)) = (values i : ℝ)) (Q : ℝ) (hQ : F (.inl true) = Q) + (sources : SourceFamily) (T : List SourceSlot) (j : ℕ) + (u : SourceAssignment sources (Template.extracted j T)) + (y : SourceAssignment sources (Template.remainder j T)) + (hsmall : redrawRootSmall h values = Template.reinsert j T + (assignedSlots sources (Template.extracted j T) u) + (assignedSlots sources (Template.remainder j T) y)) + (A B G : ℝ) (center : ℕ → ℝ) : + diagonalRootCounterpart h j A B G center F = + remainingCounterpartAt sources T j A B G center u y Q := by + have hfilters := reinsert_role_filters j T _ _ (Template.assignedSlots_matches _ _ u) + (Template.assignedSlots_matches _ _ y) + have hH : ((diagonalHKeys h j).map F).prod = + Q * (((assignedSlots sources (Template.remainder j T) y).map SmallSlot.value).prod : ℝ) := by + simp only [diagonalHKeys, List.map_cons, List.prod_cons] + rw [diagonalRoleKeys_redraw h values F hF (fun r => decide (r ≠ .compensation j)), hQ, hsmall, hfilters.2] + simp only [Nat.cast_list_prod, List.map_map, Function.comp_def] + have hU : ((diagonalUKeys h j).map F).prod = + (((assignedSlots sources (Template.extracted j T) u).map SmallSlot.value).prod : ℝ) := by + rw [diagonalUKeys, diagonalRoleKeys_redraw h values F hF (fun r => decide (r = .compensation j)), hsmall, hfilters.1] + simp only [Nat.cast_list_prod, List.map_map, Function.comp_def] + have hcell : (∏ i : Fin (diagonalCellKeys h j).length, + giantCell (diagonalKeyCenter h G center ((diagonalCellKeys h j).get i)) + (F ((diagonalCellKeys h j).get i))) = + giantCell G Q * + (((assignedSlots sources (Template.remainder j T) y).filter + (fun q => decide (q.role ≠ .bulk))).map + (fun q => giantCell (center q.origin) (q.value : ℝ))).prod := by + have he : (∏ i : Fin (diagonalCellKeys h j).length, + giantCell (diagonalKeyCenter h G center ((diagonalCellKeys h j).get i)) + (F ((diagonalCellKeys h j).get i))) = + ((diagonalCellKeys h j).map (fun i => giantCell (diagonalKeyCenter h G center i) (F i))).prod := by + rw [← List.prod_ofFn] + congr 1 + exact List.ofFn_getElem_eq_map (diagonalCellKeys h j) + (fun i => giantCell (diagonalKeyCenter h G center i) (F i)) + rw [he] + simp only [diagonalCellKeys, List.map_cons, List.prod_cons] + rw [diagonalRoleKeys_redraw_cells h values F hF + (fun r => decide (r ≠ .compensation j ∧ r ≠ .bulk)) G center, hQ] + simp only [diagonalKeyCenter] + rw [hsmall, reinsert_counterpart_cell_filter sources T j u y] + unfold diagonalRootCounterpart rootCounterpart counterpartArchimedean + rw [hH, hU, hcell] + rfl + +end Ostmann.Arithmetic.HistoryBulkCounterpartTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportExtracted.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportExtracted.lean new file mode 100644 index 0000000000000000000000000000000000000000..3db40c88444084c955f9ae1214004b8a0e37c4fe --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportExtracted.lean @@ -0,0 +1,94 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferencePermutation +import OAI.NumberTheory.Ostmann.Construction.AssignmentReinsert +import OAI.NumberTheory.Ostmann.Construction.CanonicalEnumeration +import OAI.NumberTheory.Ostmann.Construction.DiagonalRegroupingCounterpart + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkCounterpartTransport +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference + +theorem assignedSlots_compensation_filter_eq (sources : SourceFamily) (T : List SourceSlot) + (j : ℕ) (x x₀ : SourceAssignment sources T) + (hfixed : ∀ i : Fin T.length, (T.get i).role ≠ .bulk → (x i).val = (x₀ i).val) : + (assignedSlots sources T x).filter (fun q => decide (q.role = .compensation j)) = + (assignedSlots sources T x₀).filter (fun q => decide (q.role = .compensation j)) := by + simp only [assignedSlots,Template.sample,List.ofFn_eq_map,List.filter_map,Function.comp_def] + apply List.map_congr_left + intro i hi + have hrole : (T.get i).role = .compensation j := by + simpa only [List.get_eq_getElem,Fin.getElem_fin,decide_eq_true_eq] using (List.mem_filter.mp hi).2 + have hn : (T.get i).role ≠ .bulk := by rw [hrole]; simp + have hv := hfixed i hn + congr 1 + +theorem restoringAssignment_first_slots (sources : SourceFamily) (T : List SourceSlot) + (j : ℕ) (x : SourceAssignment sources T) : + (assignedSlots sources T x).filter (fun q => decide (q.role = .compensation j)) = + assignedSlots sources (Template.extracted j T) (restoringAssignmentEquiv sources j T x).1 := by + rw [assignedSlots_split_reinsert] + exact (reinsert_role_filters j T _ _ (Template.assignedSlots_matches _ _ _) + (Template.assignedSlots_matches _ _ _)).1 + +theorem restoringAssignment_first_eq_of_nonbulk_fixed (sources : SourceFamily) (T : List SourceSlot) + (j : ℕ) (x x₀ : SourceAssignment sources T) + (hfixed : ∀ i : Fin T.length, (T.get i).role ≠ .bulk → (x i).val = (x₀ i).val) : + (restoringAssignmentEquiv sources j T x).1 = (restoringAssignmentEquiv sources j T x₀).1 := by + apply assignedSlots_injective sources (Template.extracted j T) + rw [←restoringAssignment_first_slots,←restoringAssignment_first_slots] + exact assignedSlots_compensation_filter_eq sources T j x x₀ hfixed + +theorem restoringAssignment_first_permutation (sources : SourceFamily) (T : List SourceSlot) + (j : ℕ) (σ : Equiv.Perm (Fin T.length)) + (hσ : ∀ i, sources (T.get (σ i)).origin = sources (T.get i).origin) + (hnonbulk : ∀ i : Fin T.length, (T.get i).role ≠ .bulk → σ i = i) + (x : SourceAssignment sources T) : + (restoringAssignmentEquiv sources j T (sourceAssignmentPermutation sources T σ hσ x)).1 = + (restoringAssignmentEquiv sources j T x).1 := by + apply restoringAssignment_first_eq_of_nonbulk_fixed + intro i hi + rw [sourceAssignmentPermutation_val,hnonbulk i hi] + +theorem restoringAssignment_first_permuted_redraw (sources : SourceFamily) (T : List SourceSlot) + (j : ℕ) (σ : Equiv.Perm (Fin T.length)) + (hσ : ∀ i, sources (T.get (σ i)).origin = sources (T.get i).origin) + (hnonbulk : ∀ i : Fin T.length, (T.get i).role ≠ .bulk → σ i = i) + (x x₀ : SourceAssignment sources T) + (hfixed : ∀ i : Fin T.length, (T.get i).role ≠ .bulk → (x i).val = (x₀ i).val) : + (restoringAssignmentEquiv sources j T (sourceAssignmentPermutation sources T σ hσ x)).1 = + (restoringAssignmentEquiv sources j T (sourceAssignmentPermutation sources T σ hσ x₀)).1 := + (restoringAssignment_first_permutation sources T j σ hσ hnonbulk x).trans + ((restoringAssignment_first_eq_of_nonbulk_fixed sources T j x x₀ hfixed).trans + (restoringAssignment_first_permutation sources T j σ hσ hnonbulk x₀).symm) + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +theorem restoringAssignment_first_fibreAssignment (j : ℕ) + (a : SelectedNonbulkSample C l) (y y₀ : SelectedBulkSample C l) : + (restoringAssignmentEquiv C.sources j (SelectedTemplate k L l) (fibreAssignment C a y)).1 = + (restoringAssignmentEquiv C.sources j (SelectedTemplate k L l) (fibreAssignment C a y₀)).1 := + restoringAssignment_first_eq_of_nonbulk_fixed C.sources _ j _ _ + (fibreAssignment_nonbulk_fixed C a y y₀) + +theorem restoringAssignment_first_permuted_fibreAssignment (j : ℕ) + (σ τ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) (y y₀ : SelectedBulkSample C l) : + (restoringAssignmentEquiv C.sources j (SelectedTemplate k L l) + (permuteAssignment C σ (fibreAssignment C a y))).1 = + (restoringAssignmentEquiv C.sources j (SelectedTemplate k L l) + (permuteAssignment C τ (fibreAssignment C a y₀))).1 := by + rw [permute_fibreAssignment,permute_fibreAssignment] + exact restoringAssignment_first_fibreAssignment C j a _ _ + +end Ostmann.Arithmetic.HistoryBulkCounterpartTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportIndependent.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportIndependent.lean new file mode 100644 index 0000000000000000000000000000000000000000..24a93cab0a8a4a5d38fff245393bd03dbfa0ce93 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportIndependent.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCounterpartTransportPair +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransportCoordinates + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkCounterpartTransport +open Construction Construction.CanonicalOccurrenceTransport +open HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryGiantReferenceCounterpart HistoryPairBulkTransport +open HistoryBulkReferenceScalarCoordinates HistoryBulkSupportConversePlan +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ → ℕ) (l : ℕ) + (s t : ℤ) (gp gm : ℕ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hold : ∀ i, (y₀ i).val = (x₀ (π i)).val) + (hnew : ∀ i, (y i).val = (x (π i)).val) + (c e : HistoryChoices sources (Template.initial m k₀) V l) {outside : List ℕ} + (hs : (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c).Supported V outside) + (ks : (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e).Supported V outside) + (hfixed : ∀ i : Fin (Template.current (Template.initial m k₀) l).length, + ((Template.current (Template.initial m k₀) l).get i).role ≠ .bulk → (x i).val = (x₀ i).val) + (Xp Xm : ℤ) +include hold hnew hfixed + +theorem independent_new_counterpart_mul_pairedRealXi + (j b sc : ℕ) (A B X tb td G : ℝ) (center : ℕ → ℝ) : + (remainingCounterpartAt sources (Template.current (Template.initial m k₀) l) j A B G center + (restoringAssignmentEquiv sources j _ y).1 + (restoringAssignmentEquiv sources j _ y).2 (Xm : ℝ) : ℂ) * + pairedRealXi b sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs ks (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) (orderedSourceValues sources m k₀ l x) (fun u : Bool => if u then (Xm : ℝ) else (Xp : ℝ))) = + correctedPairedRealXi b sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs ks A B + (pairedDiagonalHKeys (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) j) (pairedDiagonalUKeys (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) j) + (Finset.univ : Finset (Fin (diagonalCellKeys (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) j).length)) + (pairedDiagonalCellCenter (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) j G center) (pairedDiagonalCellKey (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) j) (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) (orderedSourceValues sources m k₀ l x) (fun u : Bool => if u then (Xm : ℝ) else (Xp : ℝ))) := by + apply new_counterpart_mul_pairedRealXi sources (Template.initial m k₀) V l t gp gm + y₀ y e (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) (orderedSourceValues sources m k₀ l x) (fun u : Bool => if u then (Xm : ℝ) else (Xp : ℝ))) (Xm : ℝ) ?_ ?_ hs ks j b sc A B X tb td G center + · simpa only [↓reduceIte] using + insertOrderedGiants_right_giant m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (Xm : ℝ) else (Xp : ℝ)) true + · intro i + simpa only [newSourceSample_assigned_root, Rat.cast_natCast] using + HistoryBulkIndependentReferenceTransport.insertOrderedGiants_right_coordinate + sources m k₀ V l s t gp gm gp gm x₀ y₀ x y π hold hnew c e hs hfixed + Xp Xm (.inr (.inl i)) + +end Ostmann.Arithmetic.HistoryBulkCounterpartTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportPair.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..762d1b58adf1585ae4286d92aba17e9bcbb22ea8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportPair.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCounterpartTransportRoot +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairMixedReplacementCorrectedSample + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkCounterpartTransport +open Construction Construction.CanonicalOccurrenceTransport +open HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryGiantReferenceCounterpart HistoryPairBulkTransport +variable (sources : SourceFamily) (seed : List SourceSlot) (V : ℕ → ℕ) (l : ℕ) +variable (s : ℤ) (gp gm : ℕ) +variable (x₀ x : SourceAssignment sources (Template.current seed l)) +variable (c : HistoryChoices sources seed V l) (h : History l) +variable (F : PairKey h (assignedHistory sources seed V l s gp gm x₀ c) → ℝ) (Q : ℝ) +variable (hQ : F (rightMap h (assignedHistory sources seed V l s gp gm x₀ c) (.inl true)) = Q) +variable (hx : ∀ i : Fin (Template.current seed l).length, + F (rightMap h (assignedHistory sources seed V l s gp gm x₀ c) (decodedCoordinateEquiv sources seed V l + (assignedRoot sources (Template.current seed l) s gp gm x₀) c + (assignedRoot_matches sources (Template.current seed l) s gp gm x₀) (.inr (.inl i)))) = + ((x i).val : ℝ)) + +include hQ hx + +theorem pairedRootCounterpart_assigned (j : ℕ) (A B G : ℝ) (center : ℕ → ℝ) : + pairedRootCounterpart h (assignedHistory sources seed V l s gp gm x₀ c) j A B G center F = + remainingCounterpartAt sources (Template.current seed l) j A B G center + (restoringAssignmentEquiv sources j (Template.current seed l) x).1 + (restoringAssignmentEquiv sources j (Template.current seed l) x).2 Q := by + rw [pairedRootCounterpart_pullback] + exact diagonalRootCounterpart_assigned sources seed V l s gp gm x₀ x c + (F ∘ rightMap h (assignedHistory sources seed V l s gp gm x₀ c)) Q hQ hx j A B G center + +theorem new_counterpart_mul_pairedRealXi {outside : List ℕ} + (hs : h.Supported V outside) (ks : (assignedHistory sources seed V l s gp gm x₀ c).Supported V outside) + (j b sc : ℕ) (A B X tb td G : ℝ) (center : ℕ → ℝ) : + (remainingCounterpartAt sources (Template.current seed l) j A B G center + (restoringAssignmentEquiv sources j (Template.current seed l) x).1 + (restoringAssignmentEquiv sources j (Template.current seed l) x).2 Q : ℂ) * + pairedRealXi b sc X tb td G h (assignedHistory sources seed V l s gp gm x₀ c) hs ks F = + correctedPairedRealXi b sc X tb td G h (assignedHistory sources seed V l s gp gm x₀ c) hs ks A B + (pairedDiagonalHKeys h (assignedHistory sources seed V l s gp gm x₀ c) j) (pairedDiagonalUKeys h (assignedHistory sources seed V l s gp gm x₀ c) j) + (Finset.univ : Finset (Fin (diagonalCellKeys (assignedHistory sources seed V l s gp gm x₀ c) j).length)) + (pairedDiagonalCellCenter (assignedHistory sources seed V l s gp gm x₀ c) j G center) (pairedDiagonalCellKey h (assignedHistory sources seed V l s gp gm x₀ c) j) F := by + change _ = (pairedRootCounterpart h (assignedHistory sources seed V l s gp gm x₀ c) j A B G center F : ℂ) * + pairedRealXi b sc X tb td G h (assignedHistory sources seed V l s gp gm x₀ c) hs ks F + rw [pairedRootCounterpart_assigned sources seed V l s gp gm x₀ x c h F Q hQ hx] + +end Ostmann.Arithmetic.HistoryBulkCounterpartTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportRoot.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportRoot.lean new file mode 100644 index 0000000000000000000000000000000000000000..d79c25fa8243e162082717b5833c3bb1fa324127 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkCounterpartTransportRoot.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCounterpartTransportBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkTransportAssigned + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkCounterpartTransport +open Construction Construction.CanonicalOccurrenceTransport HistoryOccurrenceVariables +open HistoryGiantReferenceCounterpart HistoryPairBulkTransport + +theorem redrawRootSmall_eq_assigned {l : ℕ} (h : History l) + (sources : SourceFamily) (T : List SourceSlot) + (x₀ x : SourceAssignment sources T) + (hr : h.root.small = assignedSlots sources T x₀) + (hlen : h.root.small.length = T.length) : + redrawRootSmall h (fun i => (x (Fin.cast hlen i)).val) = assignedSlots sources T x := by + unfold redrawRootSmall + rw [List.ofFn_congr hlen] + unfold assignedSlots Template.sample + apply congrArg List.ofFn + funext i + have hi : h.root.small.get (Fin.cast hlen.symm i) = + ({role := T[i].role, value := (x₀ i).val, origin := T[i].origin} : SmallSlot) := by + simp only [List.get_eq_getElem] + simp only [hr, assignedSlots, Template.sample, List.getElem_ofFn] + rfl + rw [hi] + rfl + +theorem diagonalRootCounterpart_assigned + (sources : SourceFamily) (seed : List SourceSlot) (V : ℕ → ℕ) (l : ℕ) + (s : ℤ) (gp gm : ℕ) + (x₀ x : SourceAssignment sources (Template.current seed l)) + (c : HistoryChoices sources seed V l) + (F : Key (assignedHistory sources seed V l s gp gm x₀ c) → ℝ) + (Q : ℝ) (hQ : F (.inl true) = Q) + (hx : ∀ i : Fin (Template.current seed l).length, + F (decodedCoordinateEquiv sources seed V l + (assignedRoot sources (Template.current seed l) s gp gm x₀) c + (assignedRoot_matches sources (Template.current seed l) s gp gm x₀) (.inr (.inl i))) = + ((x i).val : ℝ)) + (j : ℕ) (A B G : ℝ) (center : ℕ → ℝ) : + diagonalRootCounterpart (assignedHistory sources seed V l s gp gm x₀ c) j A B G center F = + remainingCounterpartAt sources (Template.current seed l) j A B G center + (restoringAssignmentEquiv sources j (Template.current seed l) x).1 + (restoringAssignmentEquiv sources j (Template.current seed l) x).2 Q := by + let h := assignedHistory sources seed V l s gp gm x₀ c + have hr : h.root.small = assignedSlots sources (Template.current seed l) x₀ := by + simp only [h, assignedHistory, decodeHistory_root, assignedRoot] + have hlen : h.root.small.length = (Template.current seed l).length := by + rw [hr, assignedSlots_length] + let values : Fin h.root.small.length → ℕ := fun i => (x (Fin.cast hlen i)).val + have hF : ∀ i, F (.inr (.inl i)) = (values i : ℝ) := by + intro i + have he := hx (Fin.cast hlen i) + have hkey : decodedCoordinateEquiv sources seed V l + (assignedRoot sources (Template.current seed l) s gp gm x₀) c + (assignedRoot_matches sources (Template.current seed l) s gp gm x₀) + (.inr (.inl (Fin.cast hlen i))) = .inr (.inl i) := rfl + rw [hkey] at he + exact he + apply diagonalRootCounterpart_redraw h values F hF Q hQ sources (Template.current seed l) j + (restoringAssignmentEquiv sources j (Template.current seed l) x).1 + (restoringAssignmentEquiv sources j (Template.current seed l) x).2 _ A B G center + exact (redrawRootSmall_eq_assigned h sources (Template.current seed l) x₀ x hr hlen).trans + (assignedSlots_split_reinsert sources j (Template.current seed l) x) + +end Ostmann.Arithmetic.HistoryBulkCounterpartTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagonalCorrectedSourceFibreReindex.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagonalCorrectedSourceFibreReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..ac2ed11c5a95a2ee181d13d04f027f4c81670d5d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagonalCorrectedSourceFibreReindex.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDisintegration +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalCorrectedOriginalMeanEnergySum + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkDiagonalCorrectedSourceFibreReindex +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Current Choices choicesPairSum) +open HistoryBulkIndependentFibreReference (RemainingPermutation) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +def guardedFibreMean (outside : List ℕ) (a : SelectedNonbulkSample C l) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (v : AllowedFrequency (frequencyBound Bs BD Bz k L) l) (c₁ c₂ : Choices (l:=l) C) : ℂ := + if PreservesRemainingBands (Template.remainder (l+1) (Current (k:=k) (L:=L) (l:=l))) e then + HistoryBulkIndependentFibreReference.mixedFibreMean C outside a e v.val v.val c₁ c₂ + else 0 + +theorem guardedMean_disintegration (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (v : AllowedFrequency (frequencyBound Bs BD Bz k L) l) (c₁ c₂ : Choices (l:=l) C) : + (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).cmean (fun x => + HistoryDiagonalCorrectedOriginalMean.guardedOriginalMixedMean C outside x e v c₁ c₂) = + (selectedNonbulkPrior C l).cmean (fun a => guardedFibreMean C outside a e v c₁ c₂) := by + by_cases hb : PreservesRemainingBands (Template.remainder (l+1) (Current (k:=k) (L:=L) (l:=l))) e + · simp only [HistoryDiagonalCorrectedOriginalMean.guardedOriginalMixedMean,guardedFibreMean,ite_eq_left hb] + exact HistoryBulkIndependentFibreReference.sourceMean_disintegration C outside e v.val v.val c₁ c₂ + · simp only [HistoryDiagonalCorrectedOriginalMean.guardedOriginalMixedMean,guardedFibreMean,ite_eq_right hb, + FinitePrior.cmean, mul_zero, Finset.sum_const_zero] + +def correctedFibreMeanComplex (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) : ℂ := + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + (selectedNonbulkPrior C l).cmean (fun a => + ∑ v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + choicesPairSum C (fun c₁ c₂ => guardedFibreMean C (spectatorList spectator ds) a e v c₁ c₂))) + +theorem selectedDiagonalCovariance_eq_fibres (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) : + C.selectedDiagonalCovariance spectator (bulkSize k L/2) C.scale l e = + correctedFibreMeanComplex (l:=l) C spectator e := by + rw [HistoryDiagonalCorrectedOriginalMean.selectedDiagonalCovariance_eq_originalMean] + unfold correctedFibreMeanComplex + apply congrArg (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + funext ds + simp only [choicesPairSum,FinitePrior.cmean_sum,FinitePrior.cmean_mul_left] + simp_rw [guardedMean_disintegration C] + +end Ostmann.Arithmetic.HistoryBulkDiagonalCorrectedSourceFibreReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagonalSourceFibreReindex.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagonalSourceFibreReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..4d3fa79fdd6c99e52f33213f7f9855bbcbb85545 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagonalSourceFibreReindex.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferencePermutation +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceWeightedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalSmallOriginalMeanEnergySum + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkDiagonalSourceFibreReindex +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryGiantOriginalMeanFactorization (Choices choicesPairSum) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +def diagonalWeight (outside : List ℕ) (a : SelectedNonbulkSample C l) (v : ℤ) + (u : SelectedBulkSample C l) (P Q : ℤ) : ℂ := + HistoryDiagonalSmallOriginalMean.smallMultiplier C outside (fibreAssignment C a u) v P Q + +theorem weightedMixedFibreMean_identity (outside : List ℕ) (a : SelectedNonbulkSample C l) + (v : ℤ) (c e : Choices (l:=l) C) : + weightedMixedFibreMean C outside (Equiv.refl _) a v v c e (diagonalWeight C outside a v) = + (selectedBulkPrior C l).cmean (fun u => + HistoryDiagonalSmallOriginalMean.originalMixedMean C outside + (fibreAssignment C a u) (fibreAssignment C a u) v v c e) := by + unfold weightedMixedFibreMean weightedFibreTerm + simp only [permute_fibreAssignment,Equiv.refl_apply] + rfl + +def diagonalFibreMeanComplex (spectator : PrimeSource) : ℂ := + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + (selectedNonbulkPrior C l).cmean (fun a => + ∑ v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + choicesPairSum C (fun c e => + weightedMixedFibreMean C (spectatorList spectator ds) (Equiv.refl _) a v.val v.val c e + (diagonalWeight C (spectatorList spectator ds) a v.val)))) + +private theorem cmean_root_choices {A R : Type*} [Fintype A] [Fintype R] + (μ : FinitePrior A) (F : A → R → Choices (l:=l) C → Choices (l:=l) C → ℂ) : + μ.cmean (fun a => ∑ v, choicesPairSum C (F a v)) = + ∑ v, choicesPairSum C (fun c e => μ.cmean (fun a => F a v c e)) := by + simp only [choicesPairSum,FinitePrior.cmean_sum,FinitePrior.cmean_mul_left] + +theorem selectedDiagonalSingleEnergy_eq_fibres (spectator : PrimeSource) : + C.selectedDiagonalSingleEnergy spectator (bulkSize k L/2) C.scale l = + (diagonalFibreMeanComplex (l:=l) C spectator).re := by + rw [InitialSourceChoice.selectedDiagonalSingleEnergy, + HistoryDiagonalSmallOriginalMean.diagonalSingleEnergy_eq_originalMean] + apply congrArg Complex.re + apply congrArg (spectatorPrior spectator (2*(bulkSize k L/2))).cmean + funext ds + rw [selected_source_cmean_disintegration C l] + apply congrArg (selectedNonbulkPrior C l).cmean + funext a + rw [cmean_root_choices C] + apply Finset.sum_congr rfl + intro v hv + apply congrArg (choicesPairSum C) + funext c e + exact (weightedMixedFibreMean_identity C (spectatorList spectator ds) a v.val c e).symm + +end Ostmann.Arithmetic.HistoryBulkDiagonalSourceFibreReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverage.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverage.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ecbd32db46fd8a529a5a593eefa49789f2c1af4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverage.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverageCRT +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSpectatorProductMixed + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage +open Construction ResidueHaar HistoryBulkSpectatorProduct HistoryCRTIntegration +open HistoryBulkResidueNormSum HistoryFrequencyResidues HistoryPairedFrequencyAverage +open HistorySignedSpectatorDiagramAverage +open scoped BigOperators +variable (d : Decomposition) {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} +variable (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) +variable (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V jcanonicalRTest (m:=m) K h k (z.1,z.2))‖ ≤ + (((3:ℝ)^(2^l))^outside.length)*canonicalUnitBulkAverage K h k hs ks m := by + apply norm_coupledAverage_le hc + · exact actual_unit_average_universal d h k hs ks hp hV σ hm hthree + · exact canonical_unit_average_le K h k hs ks + +theorem independent_unit_good + (hc : outside.prod.Coprime ((pairedFrequencyProduct h k)^(K+2))) + (hm : 0 < m) (hthree : ∀q∈outside,3 ≤ q) (hgood : ¬Conclusion.TransferBadArrangement σ) : + letI := primeAtNeZero hp + ‖coupledAverage outside.prod ((pairedFrequencyProduct h k)^(K+2)) + (unitTest h k hs ks hp hV σ (residueTransform d)) (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=>independentRTest K h k σ (z.1,z.2))‖ ≤ + ∏i : Fin outside.length, Tree.treeComparisonConstant (l-2)* + ((FiniteField.correlationBound (residueTransform d (primeAt outside i)):ℝ)+ + (primeAt outside i:ℝ)^(-(1/4:ℝ))) := by + let := primeAtNeZero hp + have hr : ‖average (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=> + average (independentRTest K h k σ (z.1,z.2)))‖≤1 := by + apply HistoryBulkSpectatorProduct.norm_average_le + intro z + apply HistoryBulkSpectatorProduct.norm_average_le + intro x + exact independentRTest_norm_le K h k σ _ x + have hh := norm_coupledAverage_le hc (unitTest h k hs ks hp hV σ (residueTransform d)) (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=>independentRTest K h k σ (z.1,z.2)) + (actual_unit_average_good d h k hs ks hp hV σ hm hthree hgood) hr + simpa only [mul_one] using hh + +theorem canonical_mixed_universal + (hc : outside.prod.Coprime ((pairedFrequencyProduct h k)^(K+2))) + (hm : 0 < m) (hthree : ∀q∈outside,3 ≤ q) : + ‖coupledAverage outside.prod ((pairedFrequencyProduct h k)^(K+2)) + (mixedTest h k hs ks hp hV σ (residueTransform d)) (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=>canonicalRTest (m:=m) K h k (z.1,z.2))‖ ≤ + (((3:ℝ)^(2^l))^outside.length)*canonicalRingUnitBulkAverage K h k hs ks m := by + apply norm_coupledAverage_le hc + · exact actual_mixed_average_universal d h k hs ks hp hV σ hm hthree + · exact canonical_mixed_average_le K h k hs ks + +theorem independent_mixed_good + (hc : outside.prod.Coprime ((pairedFrequencyProduct h k)^(K+2))) + (hm : 0 < m) (hthree : ∀q∈outside,3 ≤ q) (hgood : ¬Conclusion.TransferBadArrangement σ) : + letI := primeAtNeZero hp + ‖coupledAverage outside.prod ((pairedFrequencyProduct h k)^(K+2)) + (mixedTest h k hs ks hp hV σ (residueTransform d)) (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=>independentRTest K h k σ (z.1,z.2))‖ ≤ + ∏i : Fin outside.length, Tree.treeComparisonConstant (l-2)* + ((FiniteField.correlationBound (residueTransform d (primeAt outside i)):ℝ)+ + (primeAt outside i:ℝ)^(-(1/4:ℝ))) := by + let := primeAtNeZero hp + have hr : ‖average (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=> + average (independentRTest K h k σ (z.1,z.2)))‖≤1 := by + apply HistoryBulkSpectatorProduct.norm_average_le + intro z + apply HistoryBulkSpectatorProduct.norm_average_le + intro x + exact independentRTest_norm_le K h k σ _ x + have hh := norm_coupledAverage_le hc (mixedTest h k hs ks hp hV σ (residueTransform d)) (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=>independentRTest K h k σ (z.1,z.2)) + (actual_mixed_average_good d h k hs ks hp hV σ hm hthree hgood) hr + simpa only [mul_one] using hh + +end Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..f77a0f4f2d4dcd4168895af8c0f48d8e2a78b762 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageActual.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage +open Construction ResidueHaar HistoryBulkSpectatorProduct HistoryCRTIntegration +open HistoryBulkResidueNormSum HistoryFrequencyResidues HistoryPairedFrequencyAverage +open HistorySignedSpectatorDiagramAverage +open scoped BigOperators +variable (d : Decomposition) {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} +variable (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) +variable (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V jcanonicalRTest (m:=m) K h k (z.1,z.2))‖ ≤ + (((3:ℝ)^(2^l))^outside.length)*canonicalUnitBulkAverage K h k hs ks m := by + let : NeZero outside.prod := ⟨(outsideModulus_pos hp).ne'⟩ + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + exact canonical_unit_universal d h k hs ks hp hV σ K (had.2.2.2 (K+2)).2.2.2.1 hm hthree + +theorem actual_independent_unit_good + (had : PairAdmissible h k outside) + (hm : 0 < m) (hthree : ∀q∈outside,3 ≤ q) (hgood : ¬Conclusion.TransferBadArrangement σ) : + letI : NeZero outside.prod := ⟨(outsideModulus_pos hp).ne'⟩ + letI : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + letI := primeAtNeZero hp + ‖coupledAverage outside.prod ((pairedFrequencyProduct h k)^(K+2)) + (unitTest h k hs ks hp hV σ (residueTransform d)) (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=>independentRTest K h k σ (z.1,z.2))‖ ≤ + ∏i : Fin outside.length, Tree.treeComparisonConstant (l-2)* + ((FiniteField.correlationBound (residueTransform d (primeAt outside i)):ℝ)+ + (primeAt outside i:ℝ)^(-(1/4:ℝ))) := by + let : NeZero outside.prod := ⟨(outsideModulus_pos hp).ne'⟩ + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + let := primeAtNeZero hp + exact independent_unit_good d h k hs ks hp hV σ K (had.2.2.2 (K+2)).2.2.2.1 hm hthree hgood + +theorem actual_canonical_mixed_universal + (had : PairAdmissible h k outside) + (hm : 0 < m) (hthree : ∀q∈outside,3 ≤ q) : + letI : NeZero outside.prod := ⟨(outsideModulus_pos hp).ne'⟩ + letI : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + ‖coupledAverage outside.prod ((pairedFrequencyProduct h k)^(K+2)) + (mixedTest h k hs ks hp hV σ (residueTransform d)) (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=>canonicalRTest (m:=m) K h k (z.1,z.2))‖ ≤ + (((3:ℝ)^(2^l))^outside.length)*canonicalRingUnitBulkAverage K h k hs ks m := by + let : NeZero outside.prod := ⟨(outsideModulus_pos hp).ne'⟩ + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + exact canonical_mixed_universal d h k hs ks hp hV σ K (had.2.2.2 (K+2)).2.2.2.1 hm hthree + +theorem actual_independent_mixed_good + (had : PairAdmissible h k outside) + (hm : 0 < m) (hthree : ∀q∈outside,3 ≤ q) (hgood : ¬Conclusion.TransferBadArrangement σ) : + letI : NeZero outside.prod := ⟨(outsideModulus_pos hp).ne'⟩ + letI : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + letI := primeAtNeZero hp + ‖coupledAverage outside.prod ((pairedFrequencyProduct h k)^(K+2)) + (mixedTest h k hs ks hp hV σ (residueTransform d)) (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=>independentRTest K h k σ (z.1,z.2))‖ ≤ + ∏i : Fin outside.length, Tree.treeComparisonConstant (l-2)* + ((FiniteField.correlationBound (residueTransform d (primeAt outside i)):ℝ)+ + (primeAt outside i:ℝ)^(-(1/4:ℝ))) := by + let : NeZero outside.prod := ⟨(outsideModulus_pos hp).ne'⟩ + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + let := primeAtNeZero hp + exact independent_mixed_good d h k hs ks hp hV σ K (had.2.2.2 (K+2)).2.2.2.1 hm hthree hgood + +end Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..099e991f09288ee9fc0d69aa5b17e7a231531d70 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageBasic.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkResidueJointAverage +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkResidueNormSumTests +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairedFrequencyAverageRingUnit + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage +open Construction Characters HistoryFrequencyResidues HistoryCRTIntegration +open HistoryBulkResidueNormSum HistoryPairedFrequencyAverage ResidueHaar + +theorem norm_average_le_avg_norm {α : Type*} [Fintype α] (f : α→ℂ) : + ‖average f‖ ≤ BinaryExposure.avg (fun a=>‖f a‖) := by + rw [average,norm_mul] + simp only [norm_inv,norm_natCast] + exact mul_le_mul_of_nonneg_left (norm_sum_le _ _) (inv_nonneg.mpr (Nat.cast_nonneg _)) + +theorem norm_average_average_le {α β : Type*} [Fintype α] [Fintype β] (f : α→β→ℂ) : + ‖average (fun a=>average (f a))‖ ≤ + BinaryExposure.avg (fun b=>BinaryExposure.avg (fun a=>‖f a b‖)) := by + rw [HistoryBulkResidueCRT.average_swap f] + apply (norm_average_le_avg_norm _).trans + unfold BinaryExposure.avg + apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (Nat.cast_nonneg _)) + apply Finset.sum_le_sum + intro b hb + exact norm_average_le_avg_norm (fun a=>f a b) + +theorem canonical_unit_average_le (K : ℕ) {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) : + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + ‖average (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=> + average (canonicalRTest (m:=m) K h k (z.1,z.2)))‖ ≤ + canonicalUnitBulkAverage K h k hs ks m := by + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + exact norm_average_average_le _ + +theorem canonical_mixed_average_le (K : ℕ) {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) : + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + ‖average (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=> + average (canonicalRTest (m:=m) K h k (z.1,z.2)))‖ ≤ + canonicalRingUnitBulkAverage K h k hs ks m := by + let : NeZero (pairedFrequencyProduct h k) := ⟨pairedFrequencyProduct_ne_zero hs ks⟩ + exact norm_average_average_le _ + +theorem arrayEquiv_projections {ι : Type*} [Fintype ι] [DecidableEq ι] + {D R : ℕ} (hc : D.Coprime R) (x : ι→(ZMod (D*R))ˣ) : + (HistoryBulkResidueCRT.arrayEquiv hc x).1=(fun i=>ZMod.unitsMap (Nat.dvd_mul_right D R) (x i)) ∧ + (HistoryBulkResidueCRT.arrayEquiv hc x).2=(fun i=>ZMod.unitsMap (Nat.dvd_mul_left R D) (x i)) := by + constructor + · funext i + apply Units.ext + exact HistoryBulkResidueCRT.arrayEquiv_left_coe hc x i + · funext i + apply Units.ext + exact HistoryBulkResidueCRT.arrayEquiv_right_coe hc x i + +end Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageCRT.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageCRT.lean new file mode 100644 index 0000000000000000000000000000000000000000..19f7dab6f1565de72ae53ad9d23a30db6c010c1e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramFrequencyAverageCRT.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverageBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage +open ResidueHaar HistoryBulkResidueCRT +variable {ι α β : Type*} [Fintype ι] [DecidableEq ι] [Fintype α] [Fintype β] + +def coupledAverage (D R : ℕ) [NeZero D] [NeZero R] + (F : α→(ι→(ZMod D)ˣ)→ℂ) (G : β→(ι→(ZMod R)ˣ)→ℂ) : ℂ := + average (fun x : ι→(ZMod (D*R))ˣ=> + average (fun a=>F a (fun i=>ZMod.unitsMap (Nat.dvd_mul_right D R) (x i)))* + average (fun b=>G b (fun i=>ZMod.unitsMap (Nat.dvd_mul_left R D) (x i)))) + +theorem coupledAverage_eq {D R : ℕ} [NeZero D] [NeZero R] (hc : D.Coprime R) + (F : α→(ι→(ZMod D)ˣ)→ℂ) (G : β→(ι→(ZMod R)ˣ)→ℂ) : + coupledAverage D R F G=average (fun a=>average (F a))*average (fun b=>average (G b)) := by + unfold coupledAverage + have he : (fun x : ι→(ZMod (D*R))ˣ=> + average (fun a=>F a (fun i=>ZMod.unitsMap (Nat.dvd_mul_right D R) (x i)))* + average (fun b=>G b (fun i=>ZMod.unitsMap (Nat.dvd_mul_left R D) (x i))))= + (fun x : ι→(ZMod (D*R))ˣ=>average (fun a=>F a ((arrayEquiv hc x).1))* + average (fun b=>G b ((arrayEquiv hc x).2))) := by + funext x + rw [(arrayEquiv_projections hc x).1,(arrayEquiv_projections hc x).2] + rw [he] + exact giant_array_product_average hc F G + +theorem coupledAverage_eq_nested {D R : ℕ} [NeZero D] [NeZero R] + (F : α→(ι→(ZMod D)ˣ)→ℂ) (G : β→(ι→(ZMod R)ˣ)→ℂ) : + coupledAverage D R F G= + average (fun x : ι→(ZMod (D*R))ˣ=>average (fun a=>average (fun b=> + F a (fun i=>ZMod.unitsMap (Nat.dvd_mul_right D R) (x i))* + G b (fun i=>ZMod.unitsMap (Nat.dvd_mul_left R D) (x i))))) := by + unfold coupledAverage + congr 1 + funext x + simp only [average,Finset.mul_sum,Finset.sum_mul] + rw [Finset.sum_comm] + apply Finset.sum_congr rfl + intro a ha + apply Finset.sum_congr rfl + intro b hb + ring + +theorem norm_coupledAverage_le {D R : ℕ} [NeZero D] [NeZero R] (hc : D.Coprime R) + (F : α→(ι→(ZMod D)ˣ)→ℂ) (G : β→(ι→(ZMod R)ˣ)→ℂ) + {A B : ℝ} (hF : ‖average (fun a=>average (F a))‖≤A) + (hG : ‖average (fun b=>average (G b))‖≤B) : ‖coupledAverage D R F G‖≤A*B := by + rw [coupledAverage_eq hc,norm_mul] + exact mul_le_mul hF hG (norm_nonneg _) ((norm_nonneg _).trans hF) + +end Ostmann.Arithmetic.HistoryBulkDiagramFrequencyAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParameters.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParameters.lean new file mode 100644 index 0000000000000000000000000000000000000000..691a4edd816fda61a1f0639fb64ecc9aa9ad6903 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParameters.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagramParametersDecode +import OAI.NumberTheory.Ostmann.Conclusion.BulkPositionPermutation +import OAI.NumberTheory.Ostmann.Construction.ActualAmplitude + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkDiagramParameters +open Construction Conclusion HistoryTreeParameters HistoryResidueRegular + HistorySignedSpectatorDiagram +variable {q : ℕ} [Fact q.Prime] + +theorem parameters_outer_eq (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (giant : PrimeSource) + (x y : OuterSample sources (Template.current seed l) giant) (s : ℤ) + (c : HistoryChoices sources seed V l) + (hxy : ∀i : Fin (Template.current seed l).length, + (Template.current seed l)[i].role≠.bulk → (x.2.2 i:ℕ)=(y.2.2 i:ℕ)) + (hx : (decodeHistory sources seed V l + (outerState sources (Template.current seed l) giant x s) c).Supported V outside) + (hy : (decodeHistory sources seed V l + (outerState sources (Template.current seed l) giant y s) c).Supported V outside) + (hrx : Regular q (decodeHistory sources seed V l + (outerState sources (Template.current seed l) giant x s) c)) + (hry : Regular q (decodeHistory sources seed V l + (outerState sources (Template.current seed l) giant y s) c)) (sign : Bool) : + parameters V outside (decodeHistory sources seed V l + (outerState sources (Template.current seed l) giant x s) c) hx hrx sign= + parameters V outside (decodeHistory sources seed V l + (outerState sources (Template.current seed l) giant y s) c) hy hry sign := by + apply parameters_decode_eq + · rfl + · exact assignedSlots_erase_eq sources (Template.current seed l) x.2.2 y.2.2 hxy + +theorem assignedSlots_leafBulkPermutation_erase_eq (b k l : ℕ) (bulk : PrimeSource) + (top : Fin 3→PrimeSource) (comp : Fin k→Fin 2→PrimeSource) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*b))) + (x : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) : + (assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + (leafBulkAssignmentPermutation b k l bulk top comp σ x)).map eraseBulkValue= + (assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x).map eraseBulkValue := by + apply assignedSlots_erase_eq + intro i hi + rw [leafBulkAssignmentPermutation_val,leafBulkPermutation_apply_nonbulk _ _ _ _ _ hi] + +theorem parameters_leafBulkPermutation (b k l : ℕ) (bulk : PrimeSource) + (top : Fin 3→PrimeSource) (comp : Fin k→Fin 2→PrimeSource) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*b))) + (V : ℕ→ℕ) (outside : List ℕ) + (x : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (s : ℤ) (Gp Gm Gp' Gm' : ℕ) + (c : HistoryChoices (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l) : + let sources := initialSourceFamily b k bulk top comp + let seed := Template.initial (2*b) k + let T := Template.current seed l + let a : State := ⟨s,Gp,Gm,assignedSlots sources T x⟩ + let a' : State := ⟨s,Gp',Gm',assignedSlots sources T + (leafBulkAssignmentPermutation b k l bulk top comp σ x)⟩ + ∀(ha : (decodeHistory sources seed V l a c).Supported V outside) + (ha' : (decodeHistory sources seed V l a' c).Supported V outside) + (hr : Regular q (decodeHistory sources seed V l a c)) + (hr' : Regular q (decodeHistory sources seed V l a' c)) (sign : Bool), + parameters V outside (decodeHistory sources seed V l a' c) ha' hr' sign= + parameters V outside (decodeHistory sources seed V l a c) ha hr sign := by + dsimp only + intro ha ha' hr hr' sign + apply parameters_decode_eq + · rfl + · exact assignedSlots_leafBulkPermutation_erase_eq b k l bulk top comp σ x + +end Ostmann.Arithmetic.HistoryBulkDiagramParameters + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..a1dd93b4eda7acd4020be9bce341df559b91d8ee --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersBasic.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryTreeParameters +import OAI.NumberTheory.Ostmann.Construction.CanonicalHistory + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkDiagramParameters +open Construction HistoryBulkProducts + +def eraseBulkValue (a : SmallSlot) : SmallSlot := + if a.role=.bulk then ⟨a.role,0,a.origin⟩ else a + +@[simp] theorem eraseBulkValue_role (a : SmallSlot) : + (eraseBulkValue a).role=a.role := by + simp only [eraseBulkValue]; split_ifs <;> rfl + +@[simp] theorem eraseBulkValue_origin (a : SmallSlot) : + (eraseBulkValue a).origin=a.origin := by + simp only [eraseBulkValue]; split_ifs <;> rfl + +@[simp] theorem eraseBulkValue_zero (r : SlotRole) (o : ℕ) : + eraseBulkValue ⟨r,0,o⟩=⟨r,0,o⟩ := by + simp only [eraseBulkValue]; split_ifs <;> rfl + +theorem fixedProduct_erase (xs : List SmallSlot) : + fixedProduct (xs.map eraseBulkValue)=fixedProduct xs := by + induction xs with + | nil => rfl + | cons a xs ih => + by_cases ha : a.role=.bulk + · simpa [fixedProduct,eraseBulkValue,ha] using ih + · simpa [fixedProduct,eraseBulkValue,ha] using congrArg (fun n => a.value*n) ih + +theorem fixedProduct_eq_of_erase_eq {xs ys : List SmallSlot} + (h : xs.map eraseBulkValue=ys.map eraseBulkValue) : fixedProduct xs=fixedProduct ys := by + rw [←fixedProduct_erase xs,←fixedProduct_erase ys,h] + +theorem erase_reinsert (j : ℕ) (T : List SourceSlot) (u h : List SmallSlot) : + (Template.reinsert j T u h).map eraseBulkValue= + Template.reinsert j T (u.map eraseBulkValue) (h.map eraseBulkValue) := by + induction T generalizing u h with + | nil => rfl + | cons q T ih => + by_cases hq : q.role=.compensation j + · cases u <;> simp [Template.reinsert,hq,ih] + · cases h <;> simp [Template.reinsert,hq,ih] + +theorem erase_reinsert_eq (j : ℕ) (T : List SourceSlot) (u : List SmallSlot) + {h h' : List SmallSlot} (hh : h.map eraseBulkValue=h'.map eraseBulkValue) : + (Template.reinsert j T u h).map eraseBulkValue= + (Template.reinsert j T u h').map eraseBulkValue := by + rw [erase_reinsert,erase_reinsert,hh] + +theorem erase_take_eq {xs ys : List SmallSlot} + (h : xs.map eraseBulkValue=ys.map eraseBulkValue) (n : ℕ) : + (xs.take n).map eraseBulkValue=(ys.take n).map eraseBulkValue := by + simpa only [List.map_take] using congrArg (List.take n) h + +theorem erase_drop_eq {xs ys : List SmallSlot} + (h : xs.map eraseBulkValue=ys.map eraseBulkValue) (n : ℕ) : + (xs.drop n).map eraseBulkValue=(ys.drop n).map eraseBulkValue := by + simpa only [List.map_drop] using congrArg (List.drop n) h + +theorem assignedSlots_erase_eq (sources : SourceFamily) (T : List SourceSlot) + (x y : SourceAssignment sources T) + (h : ∀i : Fin T.length, T[i].role≠.bulk → (x i:ℕ)=(y i:ℕ)) : + (assignedSlots sources T x).map eraseBulkValue= + (assignedSlots sources T y).map eraseBulkValue := by + simp only [assignedSlots,Template.sample,List.map_ofFn] + congr 1 + funext i + by_cases hi : T[i].role=.bulk + · change T[i.val].role=.bulk at hi + simp [eraseBulkValue,hi] + · have hv := h i hi + change T[i.val].role≠.bulk at hi + simp [eraseBulkValue,hi,hv] + +end Ostmann.Arithmetic.HistoryBulkDiagramParameters + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersDecode.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersDecode.lean new file mode 100644 index 0000000000000000000000000000000000000000..a145370f89e876c8c95c38ff76df5b140b2afba5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersDecode.lean @@ -0,0 +1,71 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagramParametersBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedSpectatorDiagramEvaluation + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkDiagramParameters +open Construction HistoryBulkProducts HistoryResidueRegular HistoryTreeParameters + HistorySignedSpectatorDiagram +variable {q : ℕ} [Fact q.Prime] + +theorem parameters_decode_eq (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (a b : State) + (c : HistoryChoices sources seed V l) + (hf : a.frequency=b.frequency) + (hab : a.small.map eraseBulkValue=b.small.map eraseBulkValue) + (ha : (decodeHistory sources seed V l a c).Supported V outside) + (hb : (decodeHistory sources seed V l b c).Supported V outside) + (hra : Regular q (decodeHistory sources seed V l a c)) + (hrb : Regular q (decodeHistory sources seed V l b c)) (sign : Bool) : + parameters V outside (decodeHistory sources seed V l a c) ha hra sign= + parameters V outside (decodeHistory sources seed V l b c) hb hrb sign := by + induction l generalizing a b sign with + | zero => + apply congrArg (fun u => Tree.Parameters.leaf u sign) + apply Units.ext + change (a.frequency:ZMod q)=(b.frequency:ZMod q) + rw [hf] + | succ l ih => + let T := Template.current seed l + let n := (Template.remainder (l+1) T).length + let u := assignedSlots sources (Template.extracted (l+1) T) c.2.2.1 + simp only [decodeHistory,parameters] + congr 1 + · apply Units.ext + change (a.frequency:ZMod q)=(b.frequency:ZMod q) + rw [hf] + · apply Units.ext + change (fixedProduct (a.small.take n):ZMod q)=(fixedProduct (b.small.take n):ZMod q) + rw [fixedProduct_eq_of_erase_eq (erase_take_eq hab n)] + · apply Units.ext + change (fixedProduct (a.small.drop n):ZMod q)=(fixedProduct (b.small.drop n):ZMod q) + rw [fixedProduct_eq_of_erase_eq (erase_drop_eq hab n)] + · apply ih + · rfl + · exact erase_reinsert_eq (l+1) T u (erase_take_eq hab n) + · apply ih + · rfl + · exact erase_reinsert_eq (l+1) T u (erase_drop_eq hab n) + +theorem variableDiagram_decode_eq (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (a b : State) + (c : HistoryChoices sources seed V (l+1)) + (hf : a.frequency=b.frequency) + (hab : a.small.map eraseBulkValue=b.small.map eraseBulkValue) + (ha : (decodeHistory sources seed V (l+1) a c).Supported V outside) + (hb : (decodeHistory sources seed V (l+1) b c).Supported V outside) + (hra : Regular q (decodeHistory sources seed V (l+1) a c)) + (hrb : Regular q (decodeHistory sources seed V (l+1) b c)) + (D Xp Xm : (ZMod q)ˣ) : + variableDiagram (decodeHistory sources seed V (l+1) a c) ha hra D Xp Xm= + variableDiagram (decodeHistory sources seed V (l+1) b c) hb hrb D Xp Xm := by + have hp := parameters_decode_eq sources seed V outside (l+1) a b c hf hab ha hb hra hrb false + unfold variableDiagram + congr 1 + +end Ostmann.Arithmetic.HistoryBulkDiagramParameters + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersEvaluation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersEvaluation.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f54afd1b68911220cd1f2ed3c5e334b3357fe04 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkDiagramParametersEvaluation.lean @@ -0,0 +1,33 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagramParameters + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkDiagramParameters +open Construction HistoryResidueRegular HistoryTreeParameters + HistorySignedSpectatorDiagram HistorySignedSpectatorCRT +variable {q : ℕ} [Fact q.Prime] + +theorem primeSpectator_decode_eq_referenceDiagram (sources : SourceFamily) + (seed : List SourceSlot) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (a b : State) + (c : HistoryChoices sources seed V (l+1)) + (hf : a.frequency=b.frequency) + (hab : a.small.map eraseBulkValue=b.small.map eraseBulkValue) + (ha : (decodeHistory sources seed V (l+1) a c).Supported V outside) + (hb : (decodeHistory sources seed V (l+1) b c).Supported V outside) + (hq : q∈outside) (hV : ∀j≤l+1,V j norm_num + +theorem masked_cmean_approximation {α : Type*} [Fintype α] + (μ : FinitePrior α) {l : ℕ} (h k : History l) + (good : α→Prop) (periodic main : α→ℂ) (error : ℝ) + (herror : 0≤error) + (hpoint : ∀x, μ.mass x≠0 → good x → ‖periodic x-main x‖≤error) : + ‖μ.cmean (fun x=>guardIndicator (good x)*oldCompensation h k*periodic x)- + oldCompensation h k*μ.cmean (fun x=>guardIndicator (good x)*main x)‖ ≤ + ((h.compensationProduct:ℝ)*(k.compensationProduct:ℝ))*error := by + classical + rw [←FinitePrior.cmean_mul_left, GiantCollisionError.cmean_sub_eq] + apply GiantCollisionError.norm_cmean_le_of_mass_ne_zero + intro x hx + by_cases hg : good x + · simp only [guardIndicator,hg,ite_true,one_mul] + rw [←mul_sub,norm_mul,norm_oldCompensation] + exact mul_le_mul_of_nonneg_left (hpoint x hx hg) (by positivity) + · simp only [guardIndicator,hg,ite_false,zero_mul,mul_zero,sub_self,norm_zero] + positivity + +theorem cmean_approximation_of_source_identity {α : Type*} [Fintype α] + (μ : FinitePrior α) {l : ℕ} (h k : History l) + (good : α→Prop) (source periodic main : α→ℂ) (error : ℝ) + (herror : 0≤error) + (hsource : ∀x,μ.mass x≠0 → + source x=guardIndicator (good x)*oldCompensation h k*periodic x) + (hpoint : ∀x,μ.mass x≠0 → good x → ‖periodic x-main x‖≤error) : + ‖μ.cmean source- + oldCompensation h k*μ.cmean (fun x=>guardIndicator (good x)*main x)‖ ≤ + ((h.compensationProduct:ℝ)*(k.compensationProduct:ℝ))*error := by + have heq : μ.cmean source = μ.cmean + (fun x=>guardIndicator (good x)*oldCompensation h k*periodic x) := by + apply Finset.sum_congr rfl + intro x _ + by_cases hx : μ.mass x=0 + · simp only [hx,Complex.ofReal_zero,zero_mul] + · rw [hsource x hx] + rw [heq] + exact masked_cmean_approximation μ h k good periodic main error herror hpoint + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationCollisionGuard.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationCollisionGuard.lean new file mode 100644 index 0000000000000000000000000000000000000000..aec1d211475458b2ae79af8e9bd0897e8b0869d6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationCollisionGuard.lean @@ -0,0 +1,85 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorGuard +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryPairBulkTransport HistorySignedResidueFactorization +open HistoryBulkReferencePeriodicMeanSource HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryBulkPrincipalCollisionError +open HistoryBulkIndependentFibreReference HistoryDiagonalRemainingRootMatching + +theorem assignedSlots_values_perm (sources : SourceFamily) (T : List SourceSlot) + (x y : SourceAssignment sources T) (π : Equiv.Perm (Fin T.length)) + (hnew : ∀ i, (y i).val = (x (π i)).val) : + ((assignedSlots sources T y).map SmallSlot.value).Perm + ((assignedSlots sources T x).map SmallSlot.value) := by + simpa only [assignedSlots, Template.sample, List.map_ofFn, Function.comp_def, hnew] using + π.ofFn_comp_perm (fun i => (x i).val) + +theorem assignedSlots_pairwise_iff (sources : SourceFamily) (T : List SourceSlot) + (outside : List ℕ) (x y : SourceAssignment sources T) + (π : Equiv.Perm (Fin T.length)) (hnew : ∀ i, (y i).val = (x (π i)).val) : + ((assignedSlots sources T y).map SmallSlot.value ++ outside).Pairwise Nat.Coprime ↔ + ((assignedSlots sources T x).map SmallSlot.value ++ outside).Pairwise Nat.Coprime := + ((assignedSlots_values_perm sources T x y π hnew).append_right outside).pairwise_iff + Nat.Coprime.symm + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} + +theorem Frame.staticPairMask_eq_leftGuard (r : Frame (l:=l) C outside) + (x y : Frame.Source (C:=C) (l:=l)) + (π : Equiv.Perm (Fin (SelectedTemplate depth L l).length)) + (hnew : ∀ i, (y i).val = (x (π i)).val) : + staticPairMask (r.newLeft x) (r.newRight y) outside = + guardIndicator (((assignedSlots C.sources (SelectedTemplate depth L l) x).map + SmallSlot.value ++ outside).Pairwise Nat.Coprime) := by + have hp := assignedSlots_pairwise_iff C.sources (SelectedTemplate depth L l) + outside x y π hnew + simp only [staticPairMask, Frame.newLeft, Frame.newRight, assignedHistory, + decodeHistory_root, assignedRoot, hp, and_self] + +theorem Frame.staticPairMask_eq_fibreSmallOutsideGuard (r : Frame (l:=l) C outside) + (a : SelectedNonbulkSample C l) (u : SelectedBulkSample C l) + (y : Frame.Source (C:=C) (l:=l)) + (π : Equiv.Perm (Fin (SelectedTemplate depth L l).length)) + (hnew : ∀ i, (y i).val = (fibreAssignment C a u (π i)).val) : + staticPairMask (r.newLeft (fibreAssignment C a u)) (r.newRight y) outside = + guardIndicator (fibreSmallOutsideGuard C outside a u) := + r.staticPairMask_eq_leftGuard (fibreAssignment C a u) y π hnew + +theorem Frame.plain_staticPairMask_eq_fibreSmallOutsideGuard + (r : Frame (l:=l) C outside) + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (a : SelectedNonbulkSample C l) (u : SelectedBulkSample C l) : + staticPairMask (r.newLeft (fibreAssignment C a u)) + (r.newRight (permuteAssignment C σ (fibreAssignment C a u))) outside = + guardIndicator (fibreSmallOutsideGuard C outside a u) := by + apply r.staticPairMask_eq_fibreSmallOutsideGuard a u _ (selectedLeafPermutation C l σ) + intro i + exact sourceAssignmentPermutation_val C.sources _ _ _ _ i + +theorem Frame.corrected_staticPairMask_eq_fibreSmallOutsideGuard + (r : Frame (l:=l) C outside) (a : SelectedNonbulkSample C l) + (e : RemainingPermutation (k:=depth) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (u : SelectedBulkSample C l) + (hc : Compatible C a e u) : + staticPairMask (r.newLeft (fibreAssignment C a u)) + (r.newRight (rightAssignment C a e u hc)) outside = + guardIndicator (fibreSmallOutsideGuard C outside a u) := by + apply r.staticPairMask_eq_fibreSmallOutsideGuard a u _ (fullPermutation (l+1) _ e he) + exact counterpartCurrentAssignment_value C (fibreAssignment C a u) e he hc + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..eca552f446771c1353f9cf0904c3d5ad8c1ce37a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationDefs.lean @@ -0,0 +1,137 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportActualPrincipalPlainPrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceNewModuliSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferencePeriodicMeanSourcePrime + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryGiantReferenceMean HistoryPairBulkTransport +open HistoryBulkReferenceNewModuli HistoryBulkGiantPrincipalTransport +open HistoryCRTIntegration HistoryPairBulkCoordinates HistoryPairGiantCoordinates +open HistoryBulkReferenceScalarCoordinates HistoryBulkSpectatorReferenceRaw +open HistoryBulkReferenceTests HistoryBulkReferencePeriodicMeanSource +open HistoryGiantWeightedPriorReplacement HistoryGiantPriorGrid ResidueHaar +open HistorySignedSpectatorCRT HistorySignedXiTransport HistoryPairPattern +open HistoryBulkGiantCorrectedBounds HistoryBulkCorrectedXiBounds +open HistorySymbolicEncoding HistorySignedResidueFactorization HistoryBulkResidueNormSum +open HistoryPrincipalIntegralAverage +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz depth L E) (outside : List ℕ) + +structure Frame where + leftSource : SourceAssignment C.sources (Template.current + (Template.initial (2*(bulkSize depth L/2)) depth) l) + rightSource : SourceAssignment C.sources (Template.current + (Template.initial (2*(bulkSize depth L/2)) depth) l) + s : ℤ + t : ℤ + P : ℤ + Q : ℤ + leftChoices : HistoryChoices C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l + rightChoices : HistoryChoices C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l + left_mass : (assignmentPrior C.sources _).mass leftSource≠0 + right_mass : (assignmentPrior C.sources _).mass rightSource≠0 + left_choices_mass : choicesMass C.sources _ _ l leftChoices≠0 + right_choices_mass : choicesMass C.sources _ _ l rightChoices≠0 + plus_pos : 0

jointScalar C (bulkSize depth L/2) r.left r.right r.left_supported r.right_supported + (boolEquiv r.left r.right) + (orderedEquiv (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices))) + u (orderedSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) + +def fixedB (x : Source (C:=C) (l:=l)) : PairKey r.left r.right→ℤ := + integerInsertOrderedGiants (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices)) + (orderedIntegerSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) (fun _=>0) + +def residueTest (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) := + newReferenceResidueTest d depth r.left r.right r.left_supported r.right_supported + (r.newLeft x) (r.newRight y) σ + (sourceBulkUnits (frequencyModulus r.left r.right (depth+2)) C.sources + (2*(bulkSize depth L/2)) depth l x) (r.fixedB x) (rootResidueIndicator (r.newLeft x)) + +def periodic (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := + guardedPeriodicSourcePrimeMean C.giantCenter ∅ C.giantPositive + (newComparisonModulus (r.newLeft x) r.left r.right outside depth) + (r.residueTest σ x y) (r.scalar x) + +def giantIntegral (x : Source (C:=C) (l:=l)) : ℂ := + primeIntegral (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter ∅) (primeCutoff C.giantCenter (r.scalar x)) + +def principal (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := by + letI : NeZero outside.prod := ⟨(outsideModulus_pos r.outside_primes).ne'⟩ + letI : NeZero (frequencyModulus r.left r.right (depth+2)) := + ⟨(frequencyModulus_pos r.left r.right r.left_supported r.right_supported (depth+2)).ne'⟩ + letI : NeZero (representativeModulus r.left r.right) := + ⟨(representativeModulus_pos r.left r.right r.left_supported r.right_supported).ne'⟩ + exact r.giantIntegral x * + (average (fun z : UnitPair outside.prod=>residuePairSpectator (residueTransform d) + outside outside.prod (r.newLeft x) (r.newRight y) (z.1,z.2)) * + average (fun z : UnitPair (frequencyModulus r.left r.right (depth+2))=> + independentRTest depth r.left r.right σ + ((z.1:ZMod (frequencyModulus r.left r.right (depth+2))), + (z.2:ZMod (frequencyModulus r.left r.right (depth+2)))) + (sourceBulkUnits (frequencyModulus r.left r.right (depth+2)) C.sources + (2*(bulkSize depth L/2)) depth l x)) * + average (fun z : UnitPair (representativeModulus r.left r.right)=> + primeResidueIndicatorAt r.left r.right r.left_supported r.right_supported (r.fixedB x) (z.1,z.2))) + +def sourceMean (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := + primeMean C.giant (HistoryBulkIndependentReferenceTerm.orderedReferenceTerm C + (frequencyBound Bs BD Bz depth L) outside l depth σ r.leftSource r.rightSource x y + r.s r.t r.P.toNat r.Q.toNat r.leftChoices r.rightChoices r.left_supported r.right_supported + (bulkSize depth L/2) (bulkSize depth L/2) C.scale C.bulkBin C.spectatorBin C.giantCenter + (fun _ _=>1)) + +end Frame +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationFibreIdentities.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationFibreIdentities.lean new file mode 100644 index 0000000000000000000000000000000000000000..4f3897a20279ad367b8ae2f12ec82b27ffcbb25c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationFibreIdentities.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceFrameCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceFramePlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceWeighted +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryGiantReferenceMean HistoryGiantOriginalMeanFactorization +open HistoryDiagonalSmallOriginalMean +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz depth L E) (outside : List ℕ) + +def plainMixedWeight (a : SelectedNonbulkSample C l) (s : ℤ) + (u : SelectedBulkSample C l) (P Q : ℤ) : ℂ := + (smallMultiplier C outside (fibreAssignment C a u) s P Q:ℂ) + +def plainMixedFibreMean + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) : ℂ := + weightedMixedFibreMean C outside σ a s t c e (plainMixedWeight C outside a s) + +theorem plain_mixed_reference_mean + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) + (y₀ : SelectedBulkSample C l) (draw : MixedDraw C.giantCenter C.giant) + (ha : 0<(selectedNonbulkPrior C l).mass a) + (hy₀ : 0<(selectedBulkPrior C l).mass y₀) + (hr : 0 < mixedWeight C.giantCenter C.giant draw) + (hc : choicesMass C.sources _ _ l c≠0) (he : choicesMass C.sources _ _ l e≠0) + (hs : FibreSupported C outside σ a s t c e y₀ + (mixedP C.giantCenter C.giant draw) (mixedQ C.giantCenter C.giant draw)) + (hp : ∀q∈outside,q.Prime) : + let r := plainMixedFrame C outside σ a s t c e y₀ draw ha hy₀ hr hc he hs hp + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass + (mixedWeight C.giantCenter C.giant) (fun u z=> + weightedFibreReferenceTerm C outside σ a s t c e (plainMixedWeight C outside a s) + depth y₀ (mixedP C.giantCenter C.giant draw) (mixedQ C.giantCenter C.giant draw) + hs u (mixedP C.giantCenter C.giant z) (mixedQ C.giantCenter C.giant z)) = + (selectedBulkPrior C l).cmean (fun u=>r.sourceMeanMixed σ + (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u))) := by + dsimp only + change HistoryBulkFibreReference.originalMean _ _ _ = + (selectedBulkPrior C l).cmean (fun u=>mixedMean C.giantCenter C.giant + (weightedFibreReferenceTerm C outside σ a s t c e (plainMixedWeight C outside a s) + depth y₀ (mixedP C.giantCenter C.giant draw) (mixedQ C.giantCenter C.giant draw) hs u)) + simp only [HistoryBulkFibreReference.originalMean,FinitePrior.cmean,mixedMean_eq_weighted, + Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + +theorem corrected_mixed_reference_mean + (a : SelectedNonbulkSample C l) + (e : HistoryBulkIndependentFibreReference.RemainingPermutation (k:=depth) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) + (old : HistoryBulkIndependentFibreReference.Reference C outside a e s t c₁ c₂) + (ha : 0<(selectedNonbulkPrior C l).mass a) + (hc₁ : choicesMass C.sources _ _ l c₁≠0) (hc₂ : choicesMass C.sources _ _ l c₂≠0) + (hp : ∀q∈outside,q.Prime) : + let r := correctedFrame C outside a e s t c₁ c₂ old ha he hc₁ hc₂ hp + HistoryBulkIndependentFibreReference.referenceMean C outside a e he s t c₁ c₂ depth old = + (selectedBulkPrior C l).cmean (fun u=>r.sourceMeanCorrectedMixed + (HistoryBulkIndependentFibreReference.bulkPermutation e he) + (fibreAssignment C a u) + (HistoryBulkIndependentFibreReference.rightAssignment C a e u + (HistoryBulkIndependentFibreReference.reference_compatible_all C outside a e he s t c₁ c₂ old u))) := by + rfl + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..bbf2ce63488981c689382757e17f961c3c6e9e08 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMean.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationPrime + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion Filter HistoryBulkReferencePeriodicMeanSource +open HistorySignedResidueFactorization ScaleBudget + +theorem frame_prime_mean_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0r.sourceMean σ (x u) (y u))- + oldCompensation r.left r.right * μ.cmean (fun u=> + staticPairMask (r.newLeft (x u)) (r.newRight (y u)) (spectatorList spectator ds)* + r.principal σ (x u) (y u))‖ ≤ + ((r.left.compensationProduct:ℝ)*(r.right.compensationProduct:ℝ))* + (30*Real.exp (-Real.exp (giant.target*L))) := by + filter_upwards [frame_prime_error_eventually d Bs BD Bz hBs hdepth] with L hL + intro E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl r σ α _ μ x y π hnew hx hfixed + apply cmean_approximation_of_source_identity μ r.left r.right + (fun u=>((r.newLeft (x u)).root.small.map SmallSlot.value++spectatorList spectator ds).Pairwise Nat.Coprime ∧ + ((r.newRight (y u)).root.small.map SmallSlot.value++spectatorList spectator ds).Pairwise Nat.Coprime) + (fun u=>r.sourceMean σ (x u) (y u)) (fun u=>r.periodic σ (x u) (y u)) + (fun u=>r.principal σ (x u) (y u)) (30*Real.exp (-Real.exp (giant.target*L))) (by positivity) + · intro u _ + exact r.sourceMean_eq σ (x u) (y u) (π u) (hnew u) + · intro u hu _ + exact hL E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl r σ + (x u) (y u) (hx u hu) (hfixed u hu) + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMeanBounds.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMeanBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c693211047cc8c94409e695c69d662b9288cc89 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMeanBounds.lean @@ -0,0 +1,24 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction + +theorem cmean_error_of_fixed_factor {α : Type*} [Fintype α] + (μ : FinitePrior α) (factor : ℂ) (source principal : α→ℂ) (error : ℝ) + (h : ∀u,μ.mass u≠0 → ‖source u-factor*principal u‖≤error) : + ‖μ.cmean source-factor*μ.cmean principal‖≤error := by + rw [←FinitePrior.cmean_mul_left,GiantCollisionError.cmean_sub_eq] + exact GiantCollisionError.norm_cmean_le_of_mass_ne_zero μ _ error h + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef5eb3382cd4e350c672679d5df7dec8a92b7a0a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedCorrected.lean @@ -0,0 +1,73 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedCorrectedPeriodic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceSmallMultiplierSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion Filter HistoryPairBulkTransport HistorySymbolicEncoding +open HistoryBulkReferencePeriodicMeanSource HistoryBulkReferenceSmallMultiplier +open HistorySignedResidueFactorization ScaleBudget + +theorem frame_corrected_mixed_source_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0(hspec p).2) ds l hl + x r.leftSource r.rightSource r.s r.s r.t r.P r.Q 1 1 + r.leftChoices r.leftChoices r.rightChoices hx r.left_mass r.right_mass + r.left_choices_mass r.right_choices_mass r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching + (Frame.Slots (depth:=depth) (L:=L) (l:=l)) + (orderedEquiv (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices))) + (orderedSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) + (by + intro u + unfold orderedSourceValues + exact_mod_cast ((C.sources _).prime (x ((currentBulkPositionEquiv + (2*(bulkSize depth L/2)) depth l).symm u).val).val + (x ((currentBulkPositionEquiv (2*(bulkSize depth L/2)) depth l).symm u).val).property).pos) + (r.newRight y) (2*(bulkSize depth L/2)) σ + (sourceBulkUnits (frequencyModulus r.left r.right (depth+2)) C.sources + (2*(bulkSize depth L/2)) depth l x) (r.fixedB x) + (currentOuterSlots C x) (currentRemainingSlots C x) + (currentSmallHistory_split C x r.s r.leftChoices) + (spectatorList spectator ds).prod 1 1 r.s hu hcrt ∅ (by simp) C.giantPositive + exact ha + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..aacfa427fabf4a75923368071da2c2f131d2b123 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedDefs.lean @@ -0,0 +1,128 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferencePeriodicMeanSourceCorrectedMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferencePeriodicMeanSourceMixedActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryGiantReferenceMean HistoryPairBulkTransport +open HistoryBulkReferenceNewModuli HistoryBulkGiantPrincipalTransport +open HistoryCRTIntegration HistoryPairBulkCoordinates HistoryPairGiantCoordinates +open HistoryBulkReferenceScalarCoordinates HistoryBulkSpectatorReferenceRaw +open HistoryBulkReferenceTests HistoryBulkReferencePeriodicMeanSource +open HistoryGiantWeightedPriorReplacement HistoryGiantPriorGrid ResidueHaar +open HistorySignedSpectatorCRT HistorySignedXiTransport HistoryPairPattern +open HistoryBulkGiantCorrectedBounds HistoryBulkCorrectedXiBounds +open HistorySymbolicEncoding HistorySignedResidueFactorization HistoryBulkResidueNormSum +open HistoryPrincipalIntegralAverage HistoryBulkReferenceSmallMultiplier +open HistoryDiagonalSmallOriginalMean DiagonalSmallResidueNorm +open HistorySignedResidueWeightedAverages +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} +namespace Frame +variable (r : Frame (l:=l) C outside) + +def mixedScalar (x : Source (C:=C) (l:=l)) : (Option Unit→ℝ)→ℂ := + fun u=>jointScalar C (bulkSize depth L/2) r.left r.right r.left_supported r.right_supported + (optionEquiv r.left r.right) + (orderedEquiv (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices))) + u (orderedSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) + +def correctedMixedScalar (x : Source (C:=C) (l:=l)) : (Option Unit→ℝ)→ℂ := + fun u=>jointCorrectedScalar C (bulkSize depth L/2) r.left r.right r.left_supported r.right_supported + (optionEquiv r.left r.right) + (orderedEquiv (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices))) + u (orderedSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) + +def mixedResidueTest (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) + (hu : SmallUnitData outside.prod 1 1 (currentOuterSlots C x) (currentRemainingSlots C x) r.s) := + newReferenceResidueTest d depth r.left r.right r.left_supported r.right_supported + (r.newLeft x) (r.newRight y) σ + (sourceBulkUnits (frequencyModulus r.left r.right (depth+2)) C.sources + (2*(bulkSize depth L/2)) depth l x) (r.fixedB x) + (fun z=>rootResidueIndicator (r.newLeft x) z * + mixedExtension (currentRootSmallTest C outside x r.s r.leftChoices hu) z) + +def extractedDensity (x : Source (C:=C) (l:=l)) : ℂ := + ((∏i : Fin (currentOuterSlots C x).length, + ((((currentOuterSlots C x)[i].value-1:ℕ):ℝ)/(currentOuterSlots C x)[i].value):ℝ):ℂ) + +def mixedBlockAverage (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := by + letI : NeZero outside.prod := ⟨(outsideModulus_pos r.outside_primes).ne'⟩ + letI : NeZero (frequencyModulus r.left r.right (depth+2)) := + ⟨(frequencyModulus_pos r.left r.right r.left_supported r.right_supported (depth+2)).ne'⟩ + letI : NeZero (representativeModulus r.left r.right) := + ⟨(representativeModulus_pos r.left r.right r.left_supported r.right_supported).ne'⟩ + exact extractedDensity x * + average (fun z : MixedPair outside.prod=>residuePairSpectator (residueTransform d) + outside outside.prod (r.newLeft x) (r.newRight y) (z.1,z.2)) * + average (fun z : MixedPair (frequencyModulus r.left r.right (depth+2))=> + independentRTest depth r.left r.right σ + ((z.1:ZMod (frequencyModulus r.left r.right (depth+2))), + (z.2:ZMod (frequencyModulus r.left r.right (depth+2)))) + (sourceBulkUnits (frequencyModulus r.left r.right (depth+2)) C.sources + (2*(bulkSize depth L/2)) depth l x)) * + average (fun z : MixedPair (representativeModulus r.left r.right)=> + primeResidueIndicatorAt r.left r.right r.left_supported r.right_supported (r.fixedB x) (z.1,z.2)) + +def periodicMixed (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) + (hu : SmallUnitData outside.prod 1 1 (currentOuterSlots C x) (currentRemainingSlots C x) r.s) : ℂ := + guardedPeriodicSourceMixedMean C.giantCenter ∅ C.giantPositive + (newComparisonModulus (r.newLeft x) r.left r.right outside depth) + (r.mixedResidueTest σ x y hu) (r.mixedScalar x) + +def principalMixed (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter ∅) + (mixedGiantPrimeTest C.giantCenter (r.mixedScalar x)) * r.mixedBlockAverage σ x y + +def sourceMeanMixed (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := + mixedMean C.giantCenter C.giant + (HistoryBulkIndependentReferenceTerm.orderedReferenceTerm C + (frequencyBound Bs BD Bz depth L) outside l depth σ r.leftSource r.rightSource x y + r.s r.t r.P.toNat r.Q.toNat r.leftChoices r.rightChoices r.left_supported r.right_supported + (bulkSize depth L/2) (bulkSize depth L/2) C.scale C.bulkBin C.spectatorBin C.giantCenter + (fun P Q=>(smallMultiplier C outside x r.s P Q:ℂ))) + +def periodicCorrectedMixed (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) + (hu : SmallUnitData outside.prod 1 1 (currentOuterSlots C x) (currentRemainingSlots C x) r.s) : ℂ := + guardedPeriodicSourceMixedMean C.giantCenter ∅ C.giantPositive + (newComparisonModulus (r.newLeft x) r.left r.right outside depth) + (r.mixedResidueTest σ x y hu) (r.correctedMixedScalar x) + +def principalCorrectedMixed (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter ∅) + (mixedGiantPrimeTest C.giantCenter (r.correctedMixedScalar x)) * r.mixedBlockAverage σ x y + +def sourceMeanCorrectedMixed (σ : Equiv.Perm (Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Source (C:=C) (l:=l)) : ℂ := + mixedMean C.giantCenter C.giant + (HistoryBulkIndependentReferenceTerm.orderedReferenceTerm C + (frequencyBound Bs BD Bz depth L) outside l depth σ r.leftSource r.rightSource x y + r.s r.t r.P.toNat r.Q.toNat r.leftChoices r.rightChoices r.left_supported r.right_supported + (bulkSize depth L/2) (bulkSize depth L/2) C.scale C.bulkBin C.spectatorBin C.giantCenter + (fun P Q=>(smallMultiplier C outside x r.s P Q:ℂ) * HistoryGiantOriginalMeanFactorization.counterpart C y Q)) + +end Frame +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedPlain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedPlain.lean new file mode 100644 index 0000000000000000000000000000000000000000..e06fa451a985ad73dc62706bf58460ced9dfd031 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedPlain.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedPlainPeriodic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceSmallMultiplierSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion Filter HistoryPairBulkTransport HistorySymbolicEncoding +open HistoryBulkReferencePeriodicMeanSource HistoryBulkReferenceSmallMultiplier +open HistorySignedResidueFactorization ScaleBudget + +theorem frame_mixed_source_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0(hspec p).2) ds l hl + x r.leftSource r.rightSource r.s r.s r.t r.P r.Q 1 1 + r.leftChoices r.leftChoices r.rightChoices hx r.left_mass r.right_mass + r.left_choices_mass r.right_choices_mass r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching + (Frame.Slots (depth:=depth) (L:=L) (l:=l)) + (orderedEquiv (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices))) + (orderedSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) + (by + intro u + unfold orderedSourceValues + exact_mod_cast ((C.sources _).prime (x ((currentBulkPositionEquiv + (2*(bulkSize depth L/2)) depth l).symm u).val).val + (x ((currentBulkPositionEquiv (2*(bulkSize depth L/2)) depth l).symm u).val).property).pos) + (r.newRight y) (2*(bulkSize depth L/2)) σ + (sourceBulkUnits (frequencyModulus r.left r.right (depth+2)) C.sources + (2*(bulkSize depth L/2)) depth l x) (r.fixedB x) + (currentOuterSlots C x) (currentRemainingSlots C x) + (currentSmallHistory_split C x r.s r.leftChoices) + (spectatorList spectator ds).prod 1 1 r.s hu hcrt ∅ (by simp) C.giantPositive + exact ha + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..2c108e2d01ffc130d30172482c3646a0ce455f7b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationMixedSource.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferencePeriodicMeanSourceZero + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryPairBulkTransport HistorySymbolicEncoding +open HistoryBulkReferencePeriodicMeanSource HistoryBulkReferenceSmallMultiplier +open HistorySignedResidueFactorization DiagonalSmallResidueNorm +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} + +theorem Frame.sourceMeanMixed_eq (r : Frame (l:=l) C outside) + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Frame.Source (C:=C) (l:=l)) + (hu : SmallUnitData outside.prod 1 1 (currentOuterSlots C x) (currentRemainingSlots C x) r.s) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length)) + (hnew : ∀i,(y i).val=(x (π i)).val) + : r.sourceMeanMixed σ x y = staticPairMask (r.newLeft x) (r.newRight y) outside * + oldCompensation r.left r.right*r.periodicMixed σ x y hu := by + exact orderedReference_mixedMean_jointScalar C outside l depth σ r.leftSource r.rightSource + x y r.s r.t r.P.toNat r.Q.toNat r.leftChoices r.rightChoices r.left_supported + r.right_supported (bulkSize depth L/2) hu π hnew r.outside_primes + +theorem Frame.sourceMeanMixed_eq_zero (r : Frame (l:=l) C outside) + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Frame.Source (C:=C) (l:=l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length)) + (hnew : ∀i,(y i).val=(x (π i)).val) + (hz : staticPairMask (r.newLeft x) (r.newRight y) outside=0) : + r.sourceMeanMixed σ x y=0 := by + exact (orderedReference_means_eq_zero_of_static C (frequencyBound Bs BD Bz depth L) + outside l depth σ r.leftSource r.rightSource x y r.s r.t r.P.toNat r.Q.toNat + r.leftChoices r.rightChoices r.left_supported r.right_supported + (bulkSize depth L/2) (bulkSize depth L/2) C.scale C.bulkBin C.spectatorBin C.giantCenter + π hnew r.outside_primes _ hz).2 + +theorem Frame.sourceMeanCorrectedMixed_eq (r : Frame (l:=l) C outside) + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Frame.Source (C:=C) (l:=l)) + (hu : SmallUnitData outside.prod 1 1 (currentOuterSlots C x) (currentRemainingSlots C x) r.s) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length)) + (hold : ∀i,(r.rightSource i).val=(r.leftSource (π i)).val) + (hnew : ∀i,(y i).val=(x (π i)).val) + (hfixed : ∀i:Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length, + ((Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).get i).role≠.bulk → + (x i).val=(r.leftSource i).val) + : r.sourceMeanCorrectedMixed σ x y = staticPairMask (r.newLeft x) (r.newRight y) outside * + oldCompensation r.left r.right*r.periodicCorrectedMixed σ x y hu := by + exact orderedReference_corrected_mixedMean_jointScalar C outside l depth σ r.leftSource r.rightSource + x y r.s r.t r.P.toNat r.Q.toNat r.leftChoices r.rightChoices r.left_supported + r.right_supported (bulkSize depth L/2) hu π hold hnew hfixed r.outside_primes + +theorem Frame.sourceMeanCorrectedMixed_eq_zero (r : Frame (l:=l) C outside) + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Frame.Source (C:=C) (l:=l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length)) + (hnew : ∀i,(y i).val=(x (π i)).val) + (hz : staticPairMask (r.newLeft x) (r.newRight y) outside=0) : + r.sourceMeanCorrectedMixed σ x y=0 := by + exact (orderedReference_means_eq_zero_of_static C (frequencyBound Bs BD Bz depth L) + outside l depth σ r.leftSource r.rightSource x y r.s r.t r.P.toNat r.Q.toNat + r.leftChoices r.rightChoices r.left_supported r.right_supported + (bulkSize depth L/2) (bulkSize depth L/2) C.scale C.bulkBin C.spectatorBin C.giantCenter + π hnew r.outside_primes _ hz).2 + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..ec8df7ec654cc640a6b69b5fcdaf32bdf558d65b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationPrime.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferencePeriodicMeanSourcePrimeActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion Filter HistoryPairBulkTransport HistorySymbolicEncoding +open HistoryBulkReferencePeriodicMeanSource HistoryBulkGiantPrincipalTransport +open HistoryBulkReferenceNewModuli HistoryBulkSpectatorReferenceRaw +open HistoryBulkReferenceScalarCoordinates HistoryPairBulkCoordinates HistoryPairGiantCoordinates +open HistoryCRTIntegration HistoryBulkCorrectedXiBounds HistoryGiantXiReplacementActual +open ScaleBudget + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} + +theorem Frame.sourceMean_eq (r : Frame (l:=l) C outside) + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (x y : Frame.Source (C:=C) (l:=l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length)) + (hnew : ∀i,(y i).val=(x (π i)).val) : + r.sourceMean σ x y = staticPairMask (r.newLeft x) (r.newRight y) outside * + oldCompensation r.left r.right*r.periodic σ x y := by + exact orderedReference_primeMean_jointScalar C outside l depth σ r.leftSource r.rightSource + x y r.s r.t r.P.toNat r.Q.toNat r.leftChoices r.rightChoices r.left_supported + r.right_supported (bulkSize depth L/2) π hnew r.outside_primes + +theorem frame_prime_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0(hspec p).2) ds l hl + x r.leftSource r.rightSource r.s r.s r.t r.P r.Q 1 1 + r.leftChoices r.leftChoices r.rightChoices hx r.left_mass r.right_mass + r.left_choices_mass r.right_choices_mass r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching + (Frame.Slots (depth:=depth) (L:=L) (l:=l)) + (orderedEquiv (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices))) + (orderedSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) + (by + intro u + unfold orderedSourceValues + exact_mod_cast ((C.sources _).prime (x ((currentBulkPositionEquiv + (2*(bulkSize depth L/2)) depth l).symm u).val).val + (x ((currentBulkPositionEquiv (2*(bulkSize depth L/2)) depth l).symm u).val).property).pos) + (r.newRight y) (2*(bulkSize depth L/2)) σ + (sourceBulkUnits (frequencyModulus r.left r.right (depth+2)) C.sources + (2*(bulkSize depth L/2)) depth l x) (r.fixedB x) hcrt ∅ (by simp) C.giantPositive + exact ha + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..5ba6c0b3b525e7d97d25fd7d7e3e7b1e98cc0bf9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReference.lean @@ -0,0 +1,12 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferencePlain + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..de19ae8988e3ea8de2c25fc4524aa238c1b07d31 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceBasic.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceMeanMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +structure IntegerReferenceData + (x y : SourceAssignment C.sources (SelectedTemplate k L l)) (P Q : ℤ) : Prop where + left_mass : (assignmentPrior C.sources (SelectedTemplate k L l)).mass x ≠ 0 + right_mass : (assignmentPrior C.sources (SelectedTemplate k L l)).mass y ≠ 0 + plus_pos : 0 < P + minus_pos : 0 < Q + plus_cell : |Real.log (P:ℝ)-(C.giantCenter:ℝ)| ≤ 1 + minus_cell : |Real.log (Q:ℝ)-(C.giantCenter:ℝ)| ≤ 1 + +theorem prime_draw_cells (r : PrimeDraw C.giant) (hr : 0 < primeWeight C.giant r) : + 0 < primeP C.giant r ∧ 0 < primeQ C.giant r ∧ + |Real.log ((primeP C.giant r):ℝ)-(C.giantCenter:ℝ)|≤1 ∧ + |Real.log ((primeQ C.giant r):ℝ)-(C.giantCenter:ℝ)|≤1 := by + have hp := primeDraw_positive C.giant r + have hcell := prime_reference_cells C r hr + refine ⟨hp.1,hp.2,?_,?_⟩ + · simpa only [primeP,Int.cast_natCast] using hcell.1.le + · simpa only [primeQ,Int.cast_natCast] using hcell.2.le + +theorem mixed_draw_cells (r : MixedDraw C.giantCenter C.giant) + (hr : 0 < mixedWeight C.giantCenter C.giant r) : + 0 < mixedP C.giantCenter C.giant r ∧ 0 < mixedQ C.giantCenter C.giant r ∧ + |Real.log ((mixedP C.giantCenter C.giant r):ℝ)-(C.giantCenter:ℝ)|≤1 ∧ + |Real.log ((mixedQ C.giantCenter C.giant r):ℝ)-(C.giantCenter:ℝ)|≤1 := by + have hp := mixedDraw_positive C.giantCenter C.giant r + have hcell := mixed_reference_cells C r hr + refine ⟨hp.1,hp.2,?_,?_⟩ + · simpa only [mixedP,Int.cast_natCast] using hcell.1.le + · simpa only [mixedQ,Int.cast_natCast] using hcell.2.le + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..ab6aa18de4891e6e900bfd827517ed8b35d87667 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceCorrected.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceSelection +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryBulkIndependentFibreReference +open HistoryGiantOriginalMeanFactorization (Current Choices history) +open HistoryDiagonalRemainingRootMatching HistoryPairBulkCoordinates HistoryPairBulkTransport +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (a : SelectedNonbulkSample C l) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) +variable (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) + +theorem corrected_reference_masses (r : Reference C outside a e s t c₁ c₂) + (ha : 0 < (selectedNonbulkPrior C l).mass a) : + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (fibreAssignment C a r.bulk) ≠ 0 ∧ + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (rightAssignment C a e r.bulk r.compatible) ≠ 0 := + ⟨ne_of_gt (fibreAssignment_mass_pos C a r.bulk ha r.bulk_pos),r.right_mass⟩ + +theorem corrected_reference_data (r : Reference C outside a e s t c₁ c₂) + (ha : 0 < (selectedNonbulkPrior C l).mass a) : + IntegerReferenceData C (fibreAssignment C a r.bulk) + (rightAssignment C a e r.bulk r.compatible) + (mixedP C.giantCenter C.giant r.draw) (mixedQ C.giantCenter C.giant r.draw) := by + have hm := corrected_reference_masses C outside a e s t c₁ c₂ r ha + have hg := mixed_draw_cells C r.draw r.draw_pos + exact ⟨hm.1,hm.2,hg.1,hg.2.1,hg.2.2.1,hg.2.2.2⟩ + +def corrected_reference_matching (r : Reference C outside a e s t c₁ c₂) + (he : PreservesRemainingBands _ e) (P Q : ℤ) : + RootMatching (history C (fibreAssignment C a r.bulk) s P Q c₁) + (history C (rightAssignment C a e r.bulk r.compatible) t P Q c₂) := + counterpartRootMatching C (frequencyBound Bs BD Bz k L) + (fibreAssignment C a r.bulk) e he r.compatible s t P.toNat Q.toNat P.toNat Q.toNat c₁ c₂ + +def corrected_reference_draw_matching (r : Reference C outside a e s t c₁ c₂) + (he : PreservesRemainingBands _ e) : + RootMatching + (history C (fibreAssignment C a r.bulk) s + (mixedP C.giantCenter C.giant r.draw) (mixedQ C.giantCenter C.giant r.draw) c₁) + (history C (rightAssignment C a e r.bulk r.compatible) t + (mixedP C.giantCenter C.giant r.draw) (mixedQ C.giantCenter C.giant r.draw) c₂) := + corrected_reference_matching C outside a e s t c₁ c₂ r he _ _ + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceFrameCorrected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceFrameCorrected.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf8e2a638bdc74ae45fdb666ab0307ce683fc211 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceFrameCorrected.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryGiantOriginalMeanFactorization +open HistoryBulkFibreGiantApproximationReference HistoryPairBulkCoordinates +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +open HistoryBulkIndependentFibreReference HistoryDiagonalRemainingRootMatching +variable (a : SelectedNonbulkSample C l) +variable (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) +variable (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) + +def correctedFrame (r : Reference C outside a e s t c₁ c₂) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (he : PreservesRemainingBands _ e) + (hc₁ : choicesMass C.sources _ _ l c₁ ≠ 0) + (hc₂ : choicesMass C.sources _ _ l c₂ ≠ 0) + (hp : ∀q∈outside,q.Prime) : Frame (l:=l) C outside := + let hd := corrected_reference_data C outside a e s t c₁ c₂ r ha + { leftSource := fibreAssignment C a r.bulk + rightSource := rightAssignment C a e r.bulk r.compatible + s := s + t := t + P := mixedP C.giantCenter C.giant r.draw + Q := mixedQ C.giantCenter C.giant r.draw + leftChoices := c₁ + rightChoices := c₂ + left_mass := hd.left_mass + right_mass := hd.right_mass + left_choices_mass := hc₁ + right_choices_mass := hc₂ + plus_pos := hd.plus_pos + minus_pos := hd.minus_pos + plus_cell := hd.plus_cell + minus_cell := hd.minus_cell + left_supported := r.supported.1 + right_supported := r.supported.2 + matching := corrected_reference_draw_matching C outside a e s t c₁ c₂ r he + outside_primes := hp } + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceFramePlain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceFramePlain.lean new file mode 100644 index 0000000000000000000000000000000000000000..21ddfd8b3d540043abd88080d0688fbbe53396fb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferenceFramePlain.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryGiantOriginalMeanFactorization +open HistoryBulkFibreGiantApproximationReference HistoryPairBulkCoordinates +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) + +def plainPrimeFrame (y₀ : SelectedBulkSample C l) (draw : PrimeDraw C.giant) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hy₀ : 0 < (selectedBulkPrior C l).mass y₀) + (hr : 0 < primeWeight C.giant draw) + (hc : choicesMass C.sources _ _ l c ≠ 0) + (he : choicesMass C.sources _ _ l e ≠ 0) + (hs : FibreSupported C outside σ a s t c e y₀ + (primeP C.giant draw) (primeQ C.giant draw)) + (hp : ∀q∈outside,q.Prime) : Frame (l:=l) C outside := + let hd := plain_prime_reference_data C σ a y₀ draw ha hy₀ hr + { leftSource := fibreAssignment C a y₀ + rightSource := permuteAssignment C σ (fibreAssignment C a y₀) + s := s + t := t + P := primeP C.giant draw + Q := primeQ C.giant draw + leftChoices := c + rightChoices := e + left_mass := hd.left_mass + right_mass := hd.right_mass + left_choices_mass := hc + right_choices_mass := he + plus_pos := hd.plus_pos + minus_pos := hd.minus_pos + plus_cell := hd.plus_cell + minus_cell := hd.minus_cell + left_supported := hs.1 + right_supported := hs.2 + matching := plain_reference_matching C σ a s t c e y₀ _ _ + outside_primes := hp } + +def plainMixedFrame (y₀ : SelectedBulkSample C l) + (draw : MixedDraw C.giantCenter C.giant) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hy₀ : 0 < (selectedBulkPrior C l).mass y₀) + (hr : 0 < mixedWeight C.giantCenter C.giant draw) + (hc : choicesMass C.sources _ _ l c ≠ 0) + (he : choicesMass C.sources _ _ l e ≠ 0) + (hs : FibreSupported C outside σ a s t c e y₀ + (mixedP C.giantCenter C.giant draw) (mixedQ C.giantCenter C.giant draw)) + (hp : ∀q∈outside,q.Prime) : Frame (l:=l) C outside := + let hd := plain_mixed_reference_data C σ a y₀ draw ha hy₀ hr + { leftSource := fibreAssignment C a y₀ + rightSource := permuteAssignment C σ (fibreAssignment C a y₀) + s := s + t := t + P := mixedP C.giantCenter C.giant draw + Q := mixedQ C.giantCenter C.giant draw + leftChoices := c + rightChoices := e + left_mass := hd.left_mass + right_mass := hd.right_mass + left_choices_mass := hc + right_choices_mass := he + plus_pos := hd.plus_pos + minus_pos := hd.minus_pos + plus_cell := hd.plus_cell + minus_cell := hd.minus_cell + left_supported := hs.1 + right_supported := hs.2 + matching := plain_reference_matching C σ a s t c e y₀ _ _ + outside_primes := hp } + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferencePlain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferencePlain.lean new file mode 100644 index 0000000000000000000000000000000000000000..b483332aba0f22c1a81e835f9635ba57a8fe25ba --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationReferencePlain.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingAssigned +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkCoordinatesPermutation + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryGiantOriginalMeanFactorization +open HistoryPairBulkCoordinates HistoryPairBulkTransport HistoryDiagonalRemainingRootMatching +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) +variable (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) + +theorem plain_reference_masses (y : SelectedBulkSample C l) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hy : 0 < (selectedBulkPrior C l).mass y) : + (assignmentPrior C.sources (SelectedTemplate k L l)).mass (fibreAssignment C a y) ≠ 0 ∧ + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (permuteAssignment C σ (fibreAssignment C a y)) ≠ 0 := by + have hx := ne_of_gt (fibreAssignment_mass_pos C a y ha hy) + refine ⟨hx,?_⟩ + simpa only [permuteAssignment,sourceAssignmentPermutation_mass] using hx + +theorem plain_prime_reference_data (y : SelectedBulkSample C l) (r : PrimeDraw C.giant) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hy : 0 < (selectedBulkPrior C l).mass y) (hr : 0 < primeWeight C.giant r) : + IntegerReferenceData C (fibreAssignment C a y) + (permuteAssignment C σ (fibreAssignment C a y)) (primeP C.giant r) (primeQ C.giant r) := by + have hm := plain_reference_masses C σ a y ha hy + have hp := prime_draw_cells C r hr + exact ⟨hm.1,hm.2,hp.1,hp.2.1,hp.2.2.1,hp.2.2.2⟩ + +theorem plain_mixed_reference_data (y : SelectedBulkSample C l) + (r : MixedDraw C.giantCenter C.giant) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hy : 0 < (selectedBulkPrior C l).mass y) + (hr : 0 < mixedWeight C.giantCenter C.giant r) : + IntegerReferenceData C (fibreAssignment C a y) + (permuteAssignment C σ (fibreAssignment C a y)) + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r) := by + have hm := plain_reference_masses C σ a y ha hy + have hp := mixed_draw_cells C r hr + exact ⟨hm.1,hm.2,hp.1,hp.2.1,hp.2.2.1,hp.2.2.2⟩ + +def plain_reference_matching (s t : ℤ) (c e : Choices (l:=l) C) + (y : SelectedBulkSample C l) (P Q : ℤ) : + RootMatching (history C (fibreAssignment C a y) s P Q c) + (history C (permuteAssignment C σ (fibreAssignment C a y)) t P Q e) := by + exact assignedRootMatching C.sources (Seed (k:=k) (L:=L)) + (frequencyBound Bs BD Bz k L) l s t P.toNat Q.toNat P.toNat Q.toNat + (fibreAssignment C a y) (permuteAssignment C σ (fibreAssignment C a y)) c e + (selectedLeafPermutation C l σ) + (sourceAssignmentPermutation_val C.sources _ _ _ _) + (leafBulkPermutation_bulk_iff (2*(bulkSize k L/2)) k l σ) + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootPrincipals.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootPrincipals.lean new file mode 100644 index 0000000000000000000000000000000000000000..60905f7ba86f6c6d21a7423a30315bbd657d1cb2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootPrincipals.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryBulkReferencePeriodicMeanSource +open HistoryPrincipalIntegralAverage HistoryGiantPriorGrid +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} +namespace Frame +variable (r : Frame (l:=l) C outside) +variable (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L jC.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter ∅) + (mixedGiantPrimeTest C.giantCenter (if corrected then r.correctedMixedScalar x else r.mixedScalar x)) + +def mixedRootPrincipal (corrected : Bool) : ℂ := + extractedDensity (C:=C) r.leftSource * + (r.mixedIntegralValue x corrected*r.rootValue true hV σ x*r.mixedBMean x) + +theorem masked_mixed_principal_from_block + (hblock : staticPairMask (r.newLeft x) (r.newRight y) outside*r.mixedBlockAverage σ x y = + staticPairMask (r.newLeft x) (r.newRight y) outside* + (extractedDensity (C:=C) x*r.rootValue true hV σ x*r.mixedBMean x)) + (hfixed : ∀i:Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length, + ((Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).get i).role≠.bulk → + (x i).val=(r.leftSource i).val) (corrected : Bool) : + staticPairMask (r.newLeft x) (r.newRight y) outside* + (if corrected then r.principalCorrectedMixed σ x y else r.principalMixed σ x y) = + staticPairMask (r.newLeft x) (r.newRight y) outside*r.mixedRootPrincipal hV σ x corrected := by + have hd := extractedDensity_eq_of_nonbulk_fixed x r.leftSource hfixed + have hm : (if corrected then r.principalCorrectedMixed σ x y else r.principalMixed σ x y)= + r.mixedIntegralValue x corrected*r.mixedBlockAverage σ x y := by + cases corrected <;> rfl + rw [hm] + calc + _ = r.mixedIntegralValue x corrected* + (staticPairMask (r.newLeft x) (r.newRight y) outside*r.mixedBlockAverage σ x y) := by ring + _ = r.mixedIntegralValue x corrected* + (staticPairMask (r.newLeft x) (r.newRight y) outside* + (extractedDensity (C:=C) x*r.rootValue true hV σ x*r.mixedBMean x)) := + congrArg (fun z:ℂ=>r.mixedIntegralValue x corrected*z) hblock + _ = _ := by rw [hd]; unfold mixedRootPrincipal; ring + +end Frame +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d5a548dbac0340eee2477375f4bdf3a8022abcca --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestBasic.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTest + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryPairBulkTransport HistoryBulkProducts +open HistoryBulkDiagramParameters HistoryBulkSpectatorReferenceRaw +open HistoryBulkSelectedIntegralReplacement HistoryBulkReplacementGeometry +open HistoryCRTIntegration HistoryBulkResidueNormSum HistoryPrincipalIntegralAverage +open HistoryBulkReferenceTests +open HistorySignedSpectatorCRT HistorySignedResidueFactorization ResidueHaar + +theorem bulkProduct_coprime_of_static {xs : List SmallSlot} {outside : List ℕ} + (h : (xs.map SmallSlot.value ++ outside).Pairwise Nat.Coprime) : + Nat.Coprime (bulkProduct xs) outside.prod := by + apply Nat.coprime_list_prod_left_iff.mpr + intro a ha + obtain ⟨q,hq,rfl⟩ := List.mem_map.mp ha + apply Nat.coprime_list_prod_right_iff.mpr + intro p hp + exact (List.pairwise_append.mp h).2.2 q.value + (List.mem_map.mpr ⟨q,(List.mem_filter.mp hq).1,rfl⟩) p hp + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} +namespace Frame +variable (r : Frame (l:=l) C outside) + +def rootValue (mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L j + primeResidueIndicatorAt r.left r.right r.left_supported r.right_supported + (r.fixedB x) (z.1,z.2)) + +end Frame +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestDensity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ac41e0f157e3791e7d91d80a59ca712029e9785 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestDensity.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCounterpartTransportExtracted +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestMixed + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion HistoryBulkReferenceSmallMultiplier +open HistoryDiagonalSmallOriginalMean HistoryBulkCounterpartTransport +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} +namespace Frame + +def slotDensity (xs : List SmallSlot) : ℂ := + ((∏i : Fin xs.length, ((((xs.get i).value-1:ℕ):ℝ)/(xs.get i).value):ℝ):ℂ) + +theorem extractedDensity_eq_of_nonbulk_fixed + (x x₀ : Source (C:=C) (l:=l)) + (hfixed : ∀i:Fin (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).length, + ((Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l).get i).role≠.bulk → + (x i).val=(x₀ i).val) : + extractedDensity (C:=C) x = extractedDensity (C:=C) x₀ := by + have hu := restoringAssignment_first_eq_of_nonbulk_fixed C.sources _ (l+1) x x₀ hfixed + have hs : currentOuterSlots C x = currentOuterSlots C x₀ := + congrArg (assignedSlots C.sources _) hu + change slotDensity (currentOuterSlots C x)=slotDensity (currentOuterSlots C x₀) + exact congrArg slotDensity hs + +theorem norm_extractedDensity_le (x : Source (C:=C) (l:=l)) : + ‖extractedDensity (C:=C) x‖≤1 := by + unfold extractedDensity + rw [Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg (by positivity)] + apply Finset.prod_le_one₀ (fun _ _=>by positivity) + intro i _ + let p := ((currentOuterSlots C x).get i).value + change ((p-1:ℕ):ℝ)/(p:ℝ)≤1 + by_cases hp : p=0 + · simp [hp] + · have hpos : (0:ℝ)

+ primeResidueIndicatorAt r.left r.right r.left_supported r.right_supported + (r.fixedB x) (z.1,z.2)) + +theorem mixedBlockAverage_eq_rootValue (r : Frame (l:=l) C outside) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L jextractedDensity (C:=C) x*(z*r.mixedBMean x)) heq.symm + simp only [mixedBlockAverage,rootValue,bulkModulus,frequencyModulus,left,right, + newLeft,newRight,assignedHistory,mixedBMean,mul_assoc, + HistoryFrequencyResidues.pairedFrequencyProduct,InitialSourceChoice.sources, + NominalCenterArray.sources] at hmul ⊢ + exact hmul + +theorem masked_mixedBlockAverage_eq_rootValue (r : Frame (l:=l) C outside) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L jhfreq j (hj.trans hl) + exact ⟨r.masked_principal_eq_rootValue hV σ x y hx hf hbulk hfixed hfixed', + r.masked_mixedBlockAverage_eq_rootValue hV σ x y hx hf hbulk hfixed hfixed'⟩ + +end Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestUnit.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestUnit.lean new file mode 100644 index 0000000000000000000000000000000000000000..06fea4853a0b45ae0f9b6df7c4ddc7cf5545889a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantApproximationRootTestUnit.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantApproximation +open Construction Conclusion CanonicalHistoryLeafBulk HistoryPairBulkTransport HistoryBulkProducts +open HistoryBulkDiagramParameters HistoryBulkSpectatorReferenceRaw +open HistoryBulkSelectedIntegralReplacement HistoryBulkReplacementGeometry +open HistoryCRTIntegration HistoryBulkResidueNormSum HistoryPrincipalIntegralAverage +open HistoryBulkReferenceTests HistorySignedSpectatorCRT ResidueHaar +open HistorySignedResidueFactorization HistoryBulkReferencePeriodicMeanSource +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} +namespace Frame + +theorem principal_eq_rootValue (r : Frame (l:=l) C outside) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L jr.giantIntegral x*(z*r.unitBMean x)) heq.symm + simp only [principal,rootValue,bulkModulus,frequencyModulus,left,right, + newLeft,newRight,assignedHistory,unitBMean,mul_assoc, + HistoryFrequencyResidues.pairedFrequencyProduct,InitialSourceChoice.sources, + NominalCenterArray.sources] at hmul ⊢ + exact hmul + +theorem masked_principal_eq_rootValue (r : Frame (l:=l) C outside) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L jselectedNonbulkPrior C l) + (mixedOriginalValue C spectator σ) (mixedSelectedPrincipal C spectator hactual hl σ) (by + intro ds hds a ha x y hx hy i + exact hpoint E C hG hGu hcl hcu hb hd spectator hspec ds + (spectator_mass_ne_zero spectator ds hds) l hl σ hactual a x y i + (lt_of_le_of_ne ((selectedNonbulkPrior C l).mass_nonneg a) (Ne.symm ha)) hx hy) + simpa only [originalSourceAverage] using h + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageActualPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageActualPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..8166226ecd0cfe24d3500933b9a6e0bb6cbac384 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageActualPrime.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageBudgetSymbolic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedPrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximation HistoryBulkActualRootReferenceFamily + +theorem actual_prime_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + (hBs : 0≤Bs) (hH : 0≤H) {depth : ℕ} (hdepth : 0selectedNonbulkPrior C l) + (primeOriginalValue C spectator σ) (primeSelectedPrincipal C spectator hactual hl σ) (by + intro ds hds a ha x y hx hy i + exact hpoint E C hG hGu hcl hcu hb hd spectator hspec ds + (spectator_mass_ne_zero spectator ds hds) l hl σ hactual a x y i + (lt_of_le_of_ne ((selectedNonbulkPrior C l).mass_nonneg a) (Ne.symm ha)) hx hy) + simpa only [originalSourceAverage] using h + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudget.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..e3bc43382996da577fa9370b1cd08ef59cca8c22 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudget.lean @@ -0,0 +1,40 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCompensation +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantOriginalMeanChoicesDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter HistoryGiantOriginalMeanFactorization + +theorem selected_choices_error_eventually + (d : Decomposition) (Bs BD Bz : ℝ) {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20 : ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter : ℝ) → + (C.giantCenter : ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin : ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin : ℝ)| ≤ favorableBlockWidth L/16 → + ∀ l ≤ k, ∀ (F G : Choices (l:=l) C → Choices (l:=l) C → ℂ), + (∀ c e, choicesMass C.sources _ _ l c ≠ 0 → choicesMass C.sources _ _ l e ≠ 0 → + ‖F c e-G c e‖ ≤ pairedChoiceCompensation C c e * + (30*Real.exp (-Real.exp (ScaleBudget.giant.target*L)))) → + ‖choicesPairSum C F-choicesPairSum C G‖ ≤ + Real.exp (-Real.exp ((21/2000 : ℝ)*L)) := by + filter_upwards [selected_pairedChoiceCompensation_error_eventually d Bs BD Bz hk] with L hL + intro E C hG hcl hcu hb hd l hl F G hFG + exact (choicesPairSum_error_le C F G + (fun c e => pairedChoiceCompensation C c e * + (30*Real.exp (-Real.exp (ScaleBudget.giant.target*L)))) hFG).trans + (hL E C hG hcl hcu hb hd l hl) + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetDraws.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetDraws.lean new file mode 100644 index 0000000000000000000000000000000000000000..2f54306ed70011d29c2ec859d9ecff76eb44a629 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetDraws.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageBudgetNested +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceFrequencyFamilyRoots + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter HistoryGiantOriginalMeanFactorization +open HistoryBulkReferenceFrequencyFamily + +theorem choices_sum_eq_source_cmean (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ → ℕ) (l : ℕ) (F : HistoryChoices sources seed V l → ℂ) : + (∑ c, (choicesMass sources seed V l c : ℂ)*F c) = + (internalSourcePrior sources seed l).cmean (fun x => + ∑ f, F (assembleHistoryChoices sources seed V l f x)) := by + rw [sum_choicesMass_eq_source_prior] + simp only [FinitePrior.cmean, Finset.mul_sum] + exact Finset.sum_comm + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +theorem choicesPairSum_eq_source_cmean + (F : Choices (l:=l) C → Choices (l:=l) C → ℂ) : + choicesPairSum C F = + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun x => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun y => + ∑ f, ∑ g, F + (assembleHistoryChoices C.sources (Seed (k:=k) (L:=L)) + (frequencyBound Bs BD Bz k L) l f x) + (assembleHistoryChoices C.sources (Seed (k:=k) (L:=L)) + (frequencyBound Bs BD Bz k L) l g y))) := by + unfold choicesPairSum + simp only [Complex.ofReal_mul, mul_assoc, ← Finset.mul_sum] + simp_rw [choices_sum_eq_source_cmean] + simp only [FinitePrior.cmean_sum] + +theorem root_choices_sum_eq_source_cmean + (F : AllowedFrequency (frequencyBound Bs BD Bz k L) l → + Choices (l:=l) C → Choices (l:=l) C → ℂ) : + (∑ r, choicesPairSum C (F r)) = + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun x => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun y => + ∑ i : RootFrequencyIndex (frequencyBound Bs BD Bz k L) l, + F i.1 + (assembleHistoryChoices C.sources (Seed (k:=k) (L:=L)) + (frequencyBound Bs BD Bz k L) l i.2.1 x) + (assembleHistoryChoices C.sources (Seed (k:=k) (L:=L)) + (frequencyBound Bs BD Bz k L) l i.2.2 y))) := by + simp only [RootFrequencyIndex, Fintype.sum_prod_type, choicesPairSum_eq_source_cmean, + FinitePrior.cmean_sum] + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetNested.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetNested.lean new file mode 100644 index 0000000000000000000000000000000000000000..a9d182ddf3fb35996058cd3762a3d929506f19a0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetNested.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GiantCollisionError +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedRootErrorBudget + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter HistoryGiantOriginalMeanFactorization + +theorem selected_nested_choices_error_eventually + (d : Decomposition) (Bs BD Bz H : ℝ) (hH : 0 ≤ H) {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20 : ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter : ℝ) → + (C.giantCenter : ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin : ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin : ℝ)| ≤ favorableBlockWidth L/16 → + ∀ l ≤ k, ∀ (α β : Type*) [Fintype α] [Fintype β] + (μ : FinitePrior α) (ν : α → FinitePrior β) + (F G : α → β → AllowedFrequency (frequencyBound Bs BD Bz k L) l → + Choices (l:=l) C → Choices (l:=l) C → ℂ), + (∀ a, μ.mass a ≠ 0 → ∀ b, (ν a).mass b ≠ 0 → ∀ r c e, + choicesMass C.sources _ _ l c ≠ 0 → choicesMass C.sources _ _ l e ≠ 0 → + ‖F a b r c e-G a b r c e‖ ≤ pairedChoiceCompensation C c e * + (30*Real.exp (-Real.exp (ScaleBudget.giant.target*L)))) → + ‖μ.cmean (fun a => (ν a).cmean (fun b => ∑ r, choicesPairSum C (F a b r))) - + μ.cmean (fun a => (ν a).cmean (fun b => ∑ r, choicesPairSum C (G a b r)))‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L : ℝ)) ∧ + ‖μ.cmean (fun a => (ν a).cmean (fun b => ∑ r, choicesPairSum C (F a b r))) - + μ.cmean (fun a => (ν a).cmean (fun b => ∑ r, choicesPairSum C (G a b r)))‖ ≤ + Real.exp (-H*(bulkSize k L : ℝ)) := by + filter_upwards [selected_choices_error_eventually d Bs BD Bz hk, + HistorySelectedRootErrorBudget.selected_nested_root_error_eventually Bs BD Bz H hH hk] + with L hchoices hroot + intro E C hG hcl hcu hb hd l hl α β _ _ μ ν F G hFG + have h := hroot l hl α β μ ν + (fun a b r => choicesPairSum C (F a b r)-choicesPairSum C (G a b r)) (by + intro a ha b hb' r + exact hchoices E C hG hcl hcu hb hd l hl (F a b r) (G a b r) + (hFG a ha b hb' r)) + simpa only [Finset.sum_sub_distrib, GiantCollisionError.cmean_sub_eq] using h + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetSymbolic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetSymbolic.lean new file mode 100644 index 0000000000000000000000000000000000000000..2af53c98a582eef0ead3b4fcfc167e5cefcd16b6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageBudgetSymbolic.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamilyWitness +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageBudgetDraws + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter HistoryGiantOriginalMeanFactorization +open HistoryBulkReferenceFrequencyFamily HistoryBulkActualRootReferenceFamily + +theorem selected_nested_symbolic_error_eventually + (d : Decomposition) (Bs BD Bz H : ℝ) (hH : 0 ≤ H) {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20 : ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter : ℝ) → + (C.giantCenter : ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin : ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin : ℝ)| ≤ favorableBlockWidth L/16 → + ∀ l ≤ k, ∀ (α β : Type*) [Fintype α] [Fintype β] + (μ : FinitePrior α) (ν : α → FinitePrior β) + (F G : α → β → Draws (l:=l) C → Draws (l:=l) C → + RootFrequencyIndex (frequencyBound Bs BD Bz k L) l → ℂ), + (∀ a, μ.mass a ≠ 0 → ∀ b, (ν a).mass b ≠ 0 → ∀ x y, + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).mass x ≠ 0 → + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).mass y ≠ 0 → ∀ i, + ‖F a b x y i-G a b x y i‖ ≤ + pairedChoiceCompensation C (leftChoices C x i) (rightChoices C y i) * + (30*Real.exp (-Real.exp (ScaleBudget.giant.target*L)))) → + ‖μ.cmean (fun a => (ν a).cmean (fun b => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun x => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun y => + ∑ i, F a b x y i)))) - + μ.cmean (fun a => (ν a).cmean (fun b => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun x => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun y => + ∑ i, G a b x y i))))‖ ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L : ℝ)) ∧ + ‖μ.cmean (fun a => (ν a).cmean (fun b => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun x => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun y => + ∑ i, F a b x y i)))) - + μ.cmean (fun a => (ν a).cmean (fun b => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun x => + (internalSourcePrior C.sources (Seed (k:=k) (L:=L)) l).cmean (fun y => + ∑ i, G a b x y i))))‖ ≤ + Real.exp (-H*(bulkSize k L : ℝ)) := by + filter_upwards [selected_nested_choices_error_eventually d Bs BD Bz H hH hk] with L hL + intro E C hG hcl hcu hb hd l hl α β _ _ μ ν F G hFG + let F' := fun a b r (c e : Choices (l:=l) C) => + F a b (historyDraws C.sources _ _ l c) (historyDraws C.sources _ _ l e) + (r, historyFrequencies C.sources _ _ l c, historyFrequencies C.sources _ _ l e) + let G' := fun a b r (c e : Choices (l:=l) C) => + G a b (historyDraws C.sources _ _ l c) (historyDraws C.sources _ _ l e) + (r, historyFrequencies C.sources _ _ l c, historyFrequencies C.sources _ _ l e) + have h := hL E C hG hcl hcu hb hd l hl α β μ ν F' G' (by + intro a ha b hb' r c e hc he + have hc' := hc + have he' := he + rw [choicesMass_eq_internalSourcePrior] at hc' he' + simpa only [F', G', leftChoices, rightChoices, assembleHistoryChoices_projections] using + hFG a ha b hb' (historyDraws C.sources _ _ l c) (historyDraws C.sources _ _ l e) + hc' he' (r, historyFrequencies C.sources _ _ l c, historyFrequencies C.sources _ _ l e)) + simpa only [root_choices_sum_eq_source_cmean, F', G', + historyDraws_assemble, historyFrequencies_assemble] using h + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCompensation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCompensation.lean new file mode 100644 index 0000000000000000000000000000000000000000..bc6785381aed1e6a170eb7d1d9497101a52af0cd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCompensation.lean @@ -0,0 +1,110 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantCompensationErrorAverage + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryGiantCompensationProduct +open HistoryBulkFibreGiantApproximation HistoryBulkReferencePeriodicMeanSource +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz depth L E) + +def choiceCompensation + (c : HistoryChoices C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l) : ℝ := + ((∏ i : Internal (Template.initial (2*(bulkSize depth L/2)) depth) l, + (historyDraws C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l c i).val : ℕ) : ℝ) + +def pairedChoiceCompensation + (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l) : ℝ := + choiceCompensation C c * choiceCompensation C e + +theorem choiceCompensation_nonneg + (c : HistoryChoices C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l) : 0 ≤ choiceCompensation C c := + Nat.cast_nonneg _ + +theorem pairedChoiceCompensation_nonneg + (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l) : 0 ≤ pairedChoiceCompensation C c e := + mul_nonneg (choiceCompensation_nonneg C c) (choiceCompensation_nonneg C e) + +theorem assigned_compensationProduct (s : ℤ) (gp gm : ℕ) + (x : SourceAssignment C.sources + (Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l)) + (c : HistoryChoices C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l) : + ((assignedHistory C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) l s gp gm x c).compensationProduct : ℝ) = + choiceCompensation C c := by + exact congrArg (fun n : ℕ => (n : ℝ)) + (decoded_compensationProduct_eq_draws C.sources _ _ l + (assignedRoot C.sources _ s gp gm x) c (assignedRoot_matches C.sources _ s gp gm x)) + +theorem frame_left_compensation {outside : List ℕ} (r : Frame (l:=l) C outside) : + (r.left.compensationProduct : ℝ) = choiceCompensation C r.leftChoices := + assigned_compensationProduct C r.s r.P.toNat r.Q.toNat r.leftSource r.leftChoices + +theorem frame_right_compensation {outside : List ℕ} (r : Frame (l:=l) C outside) : + (r.right.compensationProduct : ℝ) = choiceCompensation C r.rightChoices := + assigned_compensationProduct C r.t r.P.toNat r.Q.toNat r.rightSource r.rightChoices + +theorem frame_oldCompensation {outside : List ℕ} (r : Frame (l:=l) C outside) : + oldCompensation r.left r.right = + (pairedChoiceCompensation C r.leftChoices r.rightChoices : ℂ) := by + have hl := congrArg (fun x : ℝ => (x : ℂ)) (frame_left_compensation C r) + have hr := congrArg (fun x : ℝ => (x : ℂ)) (frame_right_compensation C r) + simpa only [oldCompensation, pairedChoiceCompensation, Complex.ofReal_mul, + Complex.ofReal_natCast] using congrArg₂ (fun x y : ℂ => x*y) hl hr + +theorem frame_norm_oldCompensation {outside : List ℕ} (r : Frame (l:=l) C outside) : + ‖oldCompensation r.left r.right‖ = + pairedChoiceCompensation C r.leftChoices r.rightChoices := by + rw [frame_oldCompensation, Complex.norm_real, Real.norm_eq_abs, + abs_of_nonneg (pairedChoiceCompensation_nonneg C _ _)] + +theorem selected_pairedChoiceCompensation_error_eventually + (d : Decomposition) (Bs BD Bz : ℝ) {depth : ℕ} (hk : 0 < depth) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz depth L E), + Real.exp ((1/20 : ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter : ℝ) → + (C.giantCenter : ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin : ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin : ℝ)| ≤ favorableBlockWidth L/16 → + ∀ l ≤ depth, + let seed := Template.initial (2*(bulkSize depth L/2)) depth + let V := frequencyBound Bs BD Bz depth L + (∑ c : HistoryChoices C.sources seed V l, ∑ e : HistoryChoices C.sources seed V l, + choicesMass C.sources seed V l c * choicesMass C.sources seed V l e * + (pairedChoiceCompensation C c e * + (30*Real.exp (-Real.exp (ScaleBudget.giant.target*L))))) ≤ + Real.exp (-Real.exp ((21/2000 : ℝ)*L)) := by + classical + filter_upwards [HistoryGiantCompensationError.selected_choices_average_error_eventually + d Bs BD Bz hk] with L hL + intro E C hG hcl hcu hb hd l hl + let T := Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l + let μ := assignmentPrior C.sources T + have hm : 0 < ∑ x, μ.mass x := by rw [μ.mass_total]; norm_num + obtain ⟨x, _, _hx⟩ := (Finset.sum_pos_iff_of_nonneg + (fun x _ => μ.mass_nonneg x)).mp hm + let a := assignedRoot C.sources T 0 1 1 x + have ha := assignedRoot_matches C.sources T 0 1 1 x + have herr := hL E C hG hcl hcu hb hd (2*(bulkSize depth L/2)) l hl a a ha ha + simpa only [pairedChoiceCompensation, choiceCompensation, + decoded_compensationProduct_eq_draws C.sources _ _ l a _ ha] using herr + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..7cbdbdf99c72001867f95e3a744b919e94fc5ef3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedActual.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageBudgetSymbolic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily (Draws Index leftChoices rightChoices) +open HistoryBulkIndependentFibreReference + +theorem actual_corrected_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + (hBs : 0≤Bs) (hH : 0≤H) {depth : ℕ} (hdepth : 0selectedNonbulkPrior C l) + (correctedOriginalValue C spectator e) (correctedSelectedPrincipal C spectator e he) (by + intro ds hds a ha x y hx hy i + exact hpoint E C hG hGu hcl hcu hb hd spectator hspec ds + (spectator_mass_ne_zero spectator ds hds) l hl e he a x y i + (lt_of_le_of_ne ((selectedNonbulkPrior C l).mass_nonneg a) (Ne.symm ha)) hx hy) + simpa only [originalSourceAverage] using h + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedCovariance.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedCovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..f87995975bf7f19348bff1a2255935fb3c9fd198 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedCovariance.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedIdentities +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedScalarDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily (Draws Index leftChoices rightChoices) +open HistoryBulkIndependentFibreReference + +theorem selectedDiagonalCovariance_corrected_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + (hBs : 0≤Bs) (hH : 0≤H) {depth : ℕ} (hdepth : 0 + let y := rightAssignment C a e u + (reference_compatible_all C outside a e he s t c₁ c₂ r u) + staticPairMask (f.newLeft (fibreAssignment C a u)) (f.newRight y) outside * + f.principalCorrectedMixed (bulkPermutation e he) (fibreAssignment C a u) y) + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedIdentities.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedIdentities.lean new file mode 100644 index 0000000000000000000000000000000000000000..36406eaf4bcbcd53f1941a6fa9805bdd842b8787 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedIdentities.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagonalCorrectedSourceFibreReindex +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageBudgetDraws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily (leftChoices rightChoices) +open HistoryBulkIndependentFibreReference +open HistoryBulkDiagonalCorrectedSourceFibreReindex +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + +theorem selectedDiagonalCovariance_eq_originalSourceAverage + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) : + C.selectedDiagonalCovariance spectator (bulkSize k L/2) C.scale l e = + originalSourceAverage C spectator (correctedOriginalValue C spectator e) := by + rw [selectedDiagonalCovariance_eq_fibres] + unfold correctedFibreMeanComplex + simp only [guardedFibreMean,ite_eq_left he] + simp_rw [root_choices_sum_eq_source_cmean] + rfl + +theorem selectedDiagonalCovariance_eq_guardedOriginalSourceAverage + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) : + C.selectedDiagonalCovariance spectator (bulkSize k L/2) C.scale l e = + if PreservesRemainingBands _ e then + originalSourceAverage C spectator (correctedOriginalValue C spectator e) else 0 := by + classical + by_cases he : PreservesRemainingBands _ e + · rw [ite_eq_left he] + exact selectedDiagonalCovariance_eq_originalSourceAverage C spectator e he + · rw [ite_eq_right he,selectedDiagonalCovariance_eq_fibres] + simp only [correctedFibreMeanComplex,guardedFibreMean,ite_eq_right he, + HistoryGiantOriginalMeanFactorization.choicesPairSum,FinitePrior.cmean, + mul_zero,Finset.sum_const_zero] + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedScalarDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedScalarDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..0c0c61877ad0f90356e92e96045086f55e1372dd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedScalarDefs.lean @@ -0,0 +1,29 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDefs +import OAI.NumberTheory.Ostmann.Construction.SelectedDiagonalEnvironment + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable + +def correctedGuardedPrincipalAverage {d : Decomposition} {Bs BD Bz L : ℝ} + {k l : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k L E) + (spectator : PrimeSource) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) : ℂ := + if he : PreservesRemainingBands _ e then + originalSourceAverage C spectator (correctedSelectedPrincipal C spectator e he) + else 0 + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..e4f7e12465559064c94bfa94aa36793426962b41 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedSelected.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMeanBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedSelectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkReferencePeriodicMeanSource HistoryGiantOriginalMeanFactorization +open HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily (Draws Index leftChoices rightChoices) +open HistoryBulkIndependentFibreReference + +theorem corrected_selected_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0 + have hz := (HistoryBulkActualCorrectedReferenceFamily.selectWitness_none_iff C + (spectatorList spectator ds) a e i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) ha).mp hR + simp only [correctedOriginalValue,hz,Option.elim_none,sub_self,norm_zero] + exact mul_nonneg (pairedChoiceCompensation_nonneg C _ _) (by positivity) + | some r => + have h := hAP E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl a e he + i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) ha + (leftChoices_mass_of_draws C x hx i) (rightChoices_mass_of_draws C y hy i) r + have h' := h.trans + (mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right (by norm_num : (9:ℝ)≤30) (Real.exp_nonneg _)) + (pairedChoiceCompensation_nonneg C _ _)) + simpa only [correctedOriginalValue,Option.elim_some] using h' + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedSelectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedSelectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..505e8403f2e55bcd4be457e0617e818db14d5dfe --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedSelectedDefs.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily (Draws Index leftChoices rightChoices) +open HistoryBulkIndependentFibreReference +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +def correctedOriginalValue (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : ℂ := + mixedFibreMean C (spectatorList spectator ds) a e i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) + +def correctedSelectedPrincipal (spectator : PrimeSource) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : ℂ := + if ha : 0<(selectedNonbulkPrior C l).mass a then + if hx : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass x≠0 then + if hy : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass y≠0 then + (HistoryBulkActualCorrectedReferenceFamily.selectWitness C (spectatorList spectator ds) + a e i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) ha).elim 0 + (fun r=>correctedWitnessPrincipal C (spectatorList spectator ds) a e he + i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) r ha + (leftChoices_mass_of_draws C x hx i) (rightChoices_mass_of_draws C y hy i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) + else 0 + else 0 + else 0 + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedWitness.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..7913b9f553f8d254a4280654a4bdbc25d16a6204 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageCorrectedWitness.lean @@ -0,0 +1,100 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualCorrectedReferenceFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationFibreIdentities +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMeanBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedCorrected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCorrectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkReferencePeriodicMeanSource HistoryGiantOriginalMeanFactorization +open HistoryBulkIndependentFibreReference HistoryDiagonalRemainingRootMatching + +open HistoryBulkFibreGiantApproximation + +theorem corrected_witness_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0r.sourceMeanCorrectedMixed + (bulkPermutation e he) (fibreAssignment C a u) + (rightAssignment C a e u (reference_compatible_all C (spectatorList spectator ds) + a e he s t c₁ c₂ old u))) := + hmean.trans (corrected_mixed_reference_mean C (spectatorList spectator ds) a e he s t c₁ c₂ + old ha hc₁ hc₂ r.outside_primes) + have hbnd : ‖(selectedBulkPrior C l).cmean (fun u=>r.sourceMeanCorrectedMixed + (bulkPermutation e he) (fibreAssignment C a u) + (rightAssignment C a e u (reference_compatible_all C (spectatorList spectator ds) + a e he s t c₁ c₂ old u))) - + oldCompensation r.left r.right*(selectedBulkPrior C l).cmean (fun u=> + let y := rightAssignment C a e u (reference_compatible_all C (spectatorList spectator ds) + a e he s t c₁ c₂ old u) + staticPairMask (r.newLeft (fibreAssignment C a u)) (r.newRight y) (spectatorList spectator ds) * + r.principalCorrectedMixed (bulkPermutation e he) (fibreAssignment C a u) y)‖ ≤ + ((r.left.compensationProduct:ℝ)*(r.right.compensationProduct:ℝ))* + (9*Real.exp (-Real.exp (giant.target*L))) := by + apply cmean_error_of_fixed_factor + intro u hu + exact hAP E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl r (bulkPermutation e he) + (fibreAssignment C a u) + (rightAssignment C a e u (reference_compatible_all C (spectatorList spectator ds) + a e he s t c₁ c₂ old u)) + (fullPermutation (l+1) _ e he) + (counterpartCurrentAssignment_value C _ e he old.compatible) + (counterpartCurrentAssignment_value C _ e he _) + (ne_of_gt (fibreAssignment_mass_pos C a u ha + (lt_of_le_of_ne ((selectedBulkPrior C l).mass_nonneg u) (Ne.symm hu)))) + (fibreAssignment_nonbulk_fixed C a u old.bulk) + rw [←heq] at hbnd + simpa only [correctedWitnessPrincipal, HistoryBulkActualCorrectedReferenceFamily.witnessFrame, + frame_left_compensation, frame_right_compensation, pairedChoiceCompensation, + r, hp, correctedFrame] using hbnd + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageIdentities.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageIdentities.lean new file mode 100644 index 0000000000000000000000000000000000000000..05372fa6c09a63978949c55f4dc9abd1ac45ac12 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageIdentities.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagonalSourceFibreReindex +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageBudgetDraws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceCovariance + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily HistoryBulkDiagonalSourceFibreReindex +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) + +theorem selectedComplexCovariance_eq_originalSourceAverage + (σ τ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) : + selectedComplexCovariance C spectator (bulkSize k L/2) l σ τ = + originalSourceAverage C spectator (primeOriginalValue C spectator (σ⁻¹*τ)) := by + rw [selectedComplexCovariance_eq_fibres] + simp_rw [root_choices_sum_eq_source_cmean] + simp only [originalSourceAverage,primeOriginalValue,wholeMean, + primeFibreMean_eq_weighted,weightedFibreTerm_eq_mul,one_mul,leftChoices,rightChoices] + +theorem selectedDiagonalSingleEnergy_eq_originalSourceAverage : + C.selectedDiagonalSingleEnergy spectator (bulkSize k L/2) C.scale l = + (originalSourceAverage C spectator (mixedOriginalValue (l:=l) C spectator (Equiv.refl _))).re := by + rw [selectedDiagonalSingleEnergy_eq_fibres] + unfold diagonalFibreMeanComplex + simp_rw [root_choices_sum_eq_source_cmean] + simp only [originalSourceAverage,mixedOriginalValue,wholeMean, + weightedMixedFibreMean_eq_weighted,leftChoices,rightChoices] + rfl + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..0cf1267e21102525be00a297420b4da98e612780 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageMixed.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMeanBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAveragePrincipal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkReferencePeriodicMeanSource HistoryGiantOriginalMeanFactorization +open HistoryBulkFibreGiantApproximation HistoryBulkActualRootReferenceFamily + +theorem mixed_witness_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0 plainMixedWeight C (spectatorList spectator ds) a i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i)≠0) + (he : choicesMass C.sources _ _ l (rightChoices C y i)≠0), + ‖wholeMean C (spectatorList spectator ds) σ a x y + (fun i => plainMixedWeight C (spectatorList spectator ds) a i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i - + mixedWitnessPrincipal C (spectatorList spectator ds) σ a x y r ha hc he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)‖ ≤ + pairedChoiceCompensation C (leftChoices C x i) (rightChoices C y i) * + (9*Real.exp (-Real.exp (giant.target*L))) := by + filter_upwards [frame_mixed_source_error_eventually + d Bs BD Bz hBs hdepth] with L hAP + intro E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl σ a x y i r ha hc he + let hp := HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds + let f := mixedWitnessFrame C (spectatorList spectator ds) σ a x y + (fun i => plainMixedWeight C (spectatorList spectator ds) a i.1.val) r ha hc he hp + have heq := mixedWitnessMean_eq_source C (spectatorList spectator ds) σ a x y r ha hc he hp + have hbnd : ‖(selectedBulkPrior C l).cmean (fun u=>f.sourceMeanMixed σ + (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u))) - + oldCompensation f.left f.right * (selectedBulkPrior C l).cmean (fun u=> + staticPairMask (f.newLeft (fibreAssignment C a u)) + (f.newRight (permuteAssignment C σ (fibreAssignment C a u))) (spectatorList spectator ds)* + f.principalMixed σ (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u)))‖ ≤ + ((f.left.compensationProduct:ℝ)*(f.right.compensationProduct:ℝ))* + (9*Real.exp (-Real.exp (giant.target*L))) := by + apply cmean_error_of_fixed_factor + intro u hu + exact hAP E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl f σ + (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u)) + (selectedLeafPermutation C l σ) + (sourceAssignmentPermutation_val C.sources _ _ _ _) + (ne_of_gt (fibreAssignment_mass_pos C a u ha + (lt_of_le_of_ne ((selectedBulkPrior C l).mass_nonneg u) (Ne.symm hu)))) + (fibreAssignment_nonbulk_fixed C a u r.bulk) + rw [←heq] at hbnd + simpa only [mixedWitnessPrincipal,frame_left_compensation,frame_right_compensation, + pairedChoiceCompensation, f, hp, mixedWitnessFrame, plainMixedFrame] using hbnd + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAveragePrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAveragePrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..11e494580266f6c5f12be9a64a99e7fafdf0f4a4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAveragePrime.lean @@ -0,0 +1,70 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMeanBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAveragePrincipal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkReferencePeriodicMeanSource HistoryGiantOriginalMeanFactorization +open HistoryBulkFibreGiantApproximation HistoryBulkActualRootReferenceFamily + +theorem prime_witness_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0 1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i)≠0) + (he : choicesMass C.sources _ _ l (rightChoices C y i)≠0), + ‖wholeMean C (spectatorList spectator ds) σ a x y + (fun _ _ _ _ => 1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i - + primeWitnessPrincipal C (spectatorList spectator ds) σ a x y r ha hc he + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)‖ ≤ + pairedChoiceCompensation C (leftChoices C x i) (rightChoices C y i) * + (30*Real.exp (-Real.exp (giant.target*L))) := by + filter_upwards [frame_prime_mean_error_eventually + d Bs BD Bz hBs hdepth] with L hAP + intro E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl σ a x y i r ha hc he + let hp := HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds + let f := primeWitnessFrame C (spectatorList spectator ds) σ a x y + (fun _ _ _ _ => 1) r ha hc he hp + have heq := primeWitnessMean_eq_source C (spectatorList spectator ds) σ a x y r ha hc he hp + have hbnd := hAP E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl f σ + (SelectedBulkSample C l) (selectedBulkPrior C l) + (fibreAssignment C a) (fun u=>permuteAssignment C σ (fibreAssignment C a u)) + (fun _=>selectedLeafPermutation C l σ) + (fun u=>sourceAssignmentPermutation_val C.sources _ _ _ _) + (fun u hu=>ne_of_gt (fibreAssignment_mass_pos C a u ha + (lt_of_le_of_ne ((selectedBulkPrior C l).mass_nonneg u) (Ne.symm hu)))) + (fun u _=>fibreAssignment_nonbulk_fixed C a u r.bulk) + rw [←heq] at hbnd + simpa only [primeWitnessPrincipal,frame_left_compensation,frame_right_compensation, + pairedChoiceCompensation, f, hp, primeWitnessFrame, plainPrimeFrame] using hbnd + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAveragePrincipal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAveragePrincipal.lean new file mode 100644 index 0000000000000000000000000000000000000000..53305e7dc11a5b30eb562a337bb0dea63bfc6717 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAveragePrincipal.lean @@ -0,0 +1,53 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageWitness + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily HistoryBulkReferencePeriodicMeanSource +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) +variable {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +def primeWitnessPrincipal + (r : Witness C outside σ a x y (fun _ _ _ _ => 1) (primeWeight C.giant) + (primeP C.giant) (primeQ C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C y i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : ℂ := + let f := primeWitnessFrame C outside σ a x y (fun _ _ _ _ => 1) r ha hc he hp + oldCompensation f.left f.right * (selectedBulkPrior C l).cmean (fun u => + staticPairMask (f.newLeft (fibreAssignment C a u)) + (f.newRight (permuteAssignment C σ (fibreAssignment C a u))) outside * + f.principal σ (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u))) + +def mixedWitnessPrincipal + (r : Witness C outside σ a x y + (fun i => plainMixedWeight C outside a i.1.val) + (mixedWeight C.giantCenter C.giant) + (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C y i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : ℂ := + let f := mixedWitnessFrame C outside σ a x y + (fun i => plainMixedWeight C outside a i.1.val) r ha hc he hp + oldCompensation f.left f.right * (selectedBulkPrior C l).cmean (fun u => + staticPairMask (f.newLeft (fibreAssignment C a u)) + (f.newRight (permuteAssignment C σ (fibreAssignment C a u))) outside * + f.principalMixed σ (fibreAssignment C a u) (permuteAssignment C σ (fibreAssignment C a u))) + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..287a0548cc18b0f78dcfd0de63c3b9ca6f00cb77 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedDefs.lean @@ -0,0 +1,103 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAveragePrincipal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily +attribute [local instance] Classical.propDecidable +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +theorem leftChoices_mass_of_draws (x : Draws C (l:=l)) + (hx : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass x ≠ 0) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + choicesMass C.sources _ _ l (leftChoices C x i) ≠ 0 := by + simpa only [leftChoices,choicesMass_assemble] using hx + +theorem rightChoices_mass_of_draws (y : Draws C (l:=l)) + (hy : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass y ≠ 0) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : + choicesMass C.sources _ _ l (rightChoices C y i) ≠ 0 := by + simpa only [rightChoices,choicesMass_assemble] using hy + +theorem spectatorList_source (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) : + ∀q∈spectatorList spectator ds,∃p:spectator.Sample,(p:ℕ)=q := by + intro q hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + exact ⟨ds i,rfl⟩ + +def primeOriginalValue (spectator : PrimeSource) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : ℂ := + wholeMean C (spectatorList spectator ds) σ a x y (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) i + +def mixedOriginalValue (spectator : PrimeSource) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : ℂ := + wholeMean C (spectatorList spectator ds) σ a x y + (fun i=>plainMixedWeight C (spectatorList spectator ds) a i.1.val) + (mixedWeight C.giantCenter C.giant) + (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i + +def primeSelectedPrincipal (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : ℂ := + if ha : 0<(selectedNonbulkPrior C l).mass a then + if hx : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass x≠0 then + if hy : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass y≠0 then + (selectWitness C (spectatorList spectator ds) σ a x y (fun _ _ _ _=>1) + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl ha (leftChoices_mass_of_draws C x hx) (rightChoices_mass_of_draws C y hy) + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) + (fun r _=>primeDraw_positive C.giant r) i).elim 0 + (fun r=>primeWitnessPrincipal C (spectatorList spectator ds) σ a x y r ha + (leftChoices_mass_of_draws C x hx i) (rightChoices_mass_of_draws C y hy i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) + else 0 + else 0 + else 0 + +def mixedSelectedPrincipal (spectator : PrimeSource) + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (hl : l≤k) (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) + (i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)) : ℂ := + if ha : 0<(selectedNonbulkPrior C l).mass a then + if hx : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass x≠0 then + if hy : (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).mass y≠0 then + (selectWitness C (spectatorList spectator ds) σ a x y + (fun i=>plainMixedWeight C (spectatorList spectator ds) a i.1.val) + (mixedWeight C.giantCenter C.giant) + (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl ha (leftChoices_mass_of_draws C x hx) (rightChoices_mass_of_draws C y hy) + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) i).elim 0 + (fun r=>mixedWitnessPrincipal C (spectatorList spectator ds) σ a x y r ha + (leftChoices_mass_of_draws C x hx i) (rightChoices_mass_of_draws C y hy i) + (HistoryBulkGiantPrincipalTransport.selected_spectator_primes spectator ds)) + else 0 + else 0 + else 0 + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..adad12ca91cae891564e8536218c2ba53caf43a6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedMixed.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMeanBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkReferencePeriodicMeanSource HistoryGiantOriginalMeanFactorization +open HistoryBulkFibreGiantApproximation HistoryBulkActualRootReferenceFamily + +theorem mixed_selected_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0 plainMixedWeight C (spectatorList spectator ds) a i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) + hactual hl ha (leftChoices_mass_of_draws C x hx) (rightChoices_mass_of_draws C y hy) + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) (fun r _=>mixedDraw_positive C.giantCenter C.giant r) i = R + cases R with + | none => + have hz := (selectWitness_none_iff C (spectatorList spectator ds) σ a x y + (fun i => plainMixedWeight C (spectatorList spectator ds) a i.1.val) (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) hactual hl ha + (leftChoices_mass_of_draws C x hx) (rightChoices_mass_of_draws C y hy) + (spectatorList_source spectator ds) (mixedWeight_nonneg C.giantCenter C.giant) (fun r _=>mixedDraw_positive C.giantCenter C.giant r) i).mp hR + simp only [mixedOriginalValue,hz,Option.elim_none,sub_self,norm_zero] + exact mul_nonneg (pairedChoiceCompensation_nonneg C _ _) (by positivity) + | some r => + have h := hAP E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl σ a x y i r ha + (leftChoices_mass_of_draws C x hx i) (rightChoices_mass_of_draws C y hy i) + have h' := h.trans + (mul_le_mul_of_nonneg_left + (mul_le_mul_of_nonneg_right (by norm_num : (9:ℝ)≤30) (Real.exp_nonneg _)) + (pairedChoiceCompensation_nonneg C _ _)) + simpa only [mixedOriginalValue,Option.elim_some] using h' + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..e5827e0711348385b2c5b95c61ead49a763d13ee --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSelectedPrime.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMeanBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationMixedPlain +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAveragePrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion Filter ScaleBudget +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference HistoryGiantReferenceMean +open HistoryBulkReferencePeriodicMeanSource HistoryGiantOriginalMeanFactorization +open HistoryBulkFibreGiantApproximation HistoryBulkActualRootReferenceFamily + +theorem prime_selected_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {depth : ℕ} (hdepth : 0 1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + hactual hl ha (leftChoices_mass_of_draws C x hx) (rightChoices_mass_of_draws C y hy) + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) (fun r _=>primeDraw_positive C.giant r) i = R + cases R with + | none => + have hz := (selectWitness_none_iff C (spectatorList spectator ds) σ a x y + (fun _ _ _ _ => 1) (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) hactual hl ha + (leftChoices_mass_of_draws C x hx) (rightChoices_mass_of_draws C y hy) + (spectatorList_source spectator ds) (primeWeight_nonneg C.giant) (fun r _=>primeDraw_positive C.giant r) i).mp hR + simp only [primeOriginalValue,hz,Option.elim_none,sub_self,norm_zero] + exact mul_nonneg (pairedChoiceCompensation_nonneg C _ _) (by positivity) + | some r => + have h := hAP E C hG hGu hcl hcu hb hd spectator hspec ds hds l hl σ a x y i r ha + (leftChoices_mass_of_draws C x hx i) (rightChoices_mass_of_draws C y hy i) + simpa only [primeOriginalValue,Option.elim_some] using h + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSourceMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSourceMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..367761b3e5ad58ef3c5af7d2dcffa75e8a53e2b8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageSourceMean.lean @@ -0,0 +1,37 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageSelectedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkActualRootReferenceFamily +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +def originalSourceAverage (spectator : PrimeSource) + (F : (Fin (2*(bulkSize k L/2))→spectator.Sample) → SelectedNonbulkSample C l → + Draws C (l:=l) → Draws C (l:=l) → + Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → ℂ) : ℂ := + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + (selectedNonbulkPrior C l).cmean (fun a => + (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).cmean (fun x => + (internalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).cmean (fun y => + ∑ i, F ds a x y i)))) + +theorem spectator_mass_ne_zero (spectator : PrimeSource) + (ds : Fin (2*(bulkSize k L/2))→spectator.Sample) + (h : (spectatorPrior spectator (2*(bulkSize k L/2))).mass ds≠0) : + ∀i,spectator.law.mass (ds i)≠0 := by + change (∏i,spectator.law.mass (ds i))≠0 at h + exact fun i=>Finset.prod_ne_zero_iff.mp h i (Finset.mem_univ i) + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageWitness.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageWitness.lean new file mode 100644 index 0000000000000000000000000000000000000000..4c6b83e5752903ff844b9fe9e51a3eb4869fe3f0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreGiantErrorAverageWitness.lean @@ -0,0 +1,94 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualRootReferenceFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationFibreIdentities +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverageCompensation + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage +open Construction Conclusion HistoryBulkSourceDisintegration HistoryGiantReferenceMean +open HistoryBulkFibreOriginalReference HistoryBulkFibreGiantApproximation +open HistoryBulkActualRootReferenceFamily +open HistoryGiantOriginalMeanFactorization (Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (x y : Draws C (l:=l)) +variable (J : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l) → + SelectedBulkSample C l → ℤ → ℤ → ℂ) +variable {i : Index (Bs:=Bs) (BD:=BD) (Bz:=Bz) (k:=k) (L:=L) (l:=l)} + +def primeWitnessFrame + (r : Witness C outside σ a x y J (primeWeight C.giant) + (primeP C.giant) (primeQ C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C y i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : Frame (l:=l) C outside := + plainPrimeFrame C outside σ a i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) + r.bulk r.giant ha r.bulk_pos r.giant_pos hc he r.supported hp + +def mixedWitnessFrame + (r : Witness C outside σ a x y J (mixedWeight C.giantCenter C.giant) + (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C y i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : Frame (l:=l) C outside := + plainMixedFrame C outside σ a i.1.val i.1.val (leftChoices C x i) (rightChoices C y i) + r.bulk r.giant ha r.bulk_pos r.giant_pos hc he r.supported hp + +theorem primeWitnessMean_eq_source + (r : Witness C outside σ a x y (fun _ _ _ _ => 1) (primeWeight C.giant) + (primeP C.giant) (primeQ C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C y i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : + let f := primeWitnessFrame C outside σ a x y (fun _ _ _ _ => 1) r ha hc he hp + wholeMean C outside σ a x y (fun _ _ _ _ => 1) (primeWeight C.giant) + (primeP C.giant) (primeQ C.giant) i = + (selectedBulkPrior C l).cmean (fun u => + f.sourceMean σ (fibreAssignment C a u) + (permuteAssignment C σ (fibreAssignment C a u))) := by + dsimp only + rw [r.mean_eq] + change HistoryBulkFibreReference.originalMean _ _ _ = + (selectedBulkPrior C l).cmean (fun u => primeMean C.giant + (weightedFibreReferenceTerm C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) (fun _ _ _ => 1) + k r.bulk (primeP C.giant r.giant) (primeQ C.giant r.giant) r.supported u)) + simp only [HistoryBulkFibreReference.originalMean,FinitePrior.cmean,primeMean_eq_weighted, + Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + +theorem mixedWitnessMean_eq_source + (r : Witness C outside σ a x y + (fun i => plainMixedWeight C outside a i.1.val) + (mixedWeight C.giantCenter C.giant) + (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ _ l (leftChoices C x i) ≠ 0) + (he : choicesMass C.sources _ _ l (rightChoices C y i) ≠ 0) + (hp : ∀q∈outside,q.Prime) : + let f := mixedWitnessFrame C outside σ a x y + (fun i => plainMixedWeight C outside a i.1.val) r ha hc he hp + wholeMean C outside σ a x y (fun i => plainMixedWeight C outside a i.1.val) + (mixedWeight C.giantCenter C.giant) + (mixedP C.giantCenter C.giant) (mixedQ C.giantCenter C.giant) i = + (selectedBulkPrior C l).cmean (fun u => + f.sourceMeanMixed σ (fibreAssignment C a u) + (permuteAssignment C σ (fibreAssignment C a u))) := by + dsimp only + exact r.mean_eq.trans (plain_mixed_reference_mean C outside σ a i.1.val i.1.val + (leftChoices C x i) (rightChoices C y i) r.bulk r.giant ha r.bulk_pos r.giant_pos + hc he r.supported hp) + +end Ostmann.Arithmetic.HistoryBulkFibreGiantErrorAverage + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ee42109b2dd366e726053492654ca62b1ad52e4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacement.lean @@ -0,0 +1,14 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementCorrectedMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementCorrectedPrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementPlainMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementPlainPrime + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementCorrectedMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementCorrectedMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..c498682b4ca75026332f9ddc1efc6a0101e86513 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementCorrectedMixed.lean @@ -0,0 +1,103 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedIntegralReplacementCorrectedMixedReferenceError + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistoryBulkGiantCorrectedBounds HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds +open HistoryGiantReferenceMean HistorySignedXiTransport HistorySelectedPairDerivativeBounds PrimeCellFreezing +open HistoryBulkPriorGrid HistoryPrincipalIntegralAverage HistoryBulkReplacementGeometry +open HistoryBulkGiantIntegerReference HistoryBulkResidueNormSum ScaleBudget Filter +open HistoryBulkSelectedIntegralReplacement +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkSpectatorReferenceRaw HistoryBulkReferenceScalarCoordinates HistoryBulkFibreSourceMean + +theorem reference_corrected_mixed_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k₀ : ℕ} (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter:ℝ) → + ∀ (l : ℕ) (_hl : l < k₀) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k₀ L/2)))) + (x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (p q P Q : ℤ) + (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x ≠ 0) + (_hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y ≠ 0) + (_hc : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_he : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_hP : 0 + F (sourceBulkUnits N C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)) * + mixedIntegral + (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>Construction.logCellMass C.giantCenter ∅) + (fun y=>mixedJointCutoff C.giantCenter f y + (orderedSourceValues C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)))) - + HistorySelectedJointIntegralBounds.nestedMixedIntegral L C.giantCenter E f* + ResidueHaar.average F‖ ≤ + 192*Real.exp (-Real.exp (bulk.target*L)) := by + filter_upwards [HistoryBulkSelectedIntegralReplacement.reference_corrected_mixed_error_eventually + d Bs BD Bz hBs hk₀] with L hAP + intro spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e hx hy hc he hP hQ hPc hQc + dsimp only + intro hs gs hmatch eB hV independent a + obtain ⟨hsize,herr⟩ := hAP spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e + hx hy hc he hP hQ hPc hQc hs gs hmatch eB hV independent + let h := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) x p) P Q) c + let g := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) y q) P Q) e + have : NeZero (bulkModulus h g (spectatorList spectator ds) k₀) := + ⟨actual_bulk_modulus_ne_zero h g hs gs (spectatorPrimes spectator ds) k₀⟩ + let F := rootTest independent true d h g hs gs (spectatorPrimes spectator ds) hV σ k₀ + let f := jointCorrectedScalar C (bulkSize k₀ L/2) h g hs gs (optionEquiv h g) eB + have hmean := fibre_cmean_eq_sourceBulkMean C a + (bulkModulus h g (spectatorList spectator ds) k₀) hsize F (fun x => mixedIntegral + (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit => C.giantCenter-1) (fun _ => C.giantCenter+1) + (fun _ => Construction.logCellMass C.giantCenter ∅) + (fun y => mixedJointCutoff C.giantCenter f y x)) + refine ⟨hsize,?_⟩ + exact (congrArg (fun z : ℂ => ‖z - + HistorySelectedJointIntegralBounds.nestedMixedIntegral L C.giantCenter E f * + ResidueHaar.average F‖) hmean).le.trans herr + +end Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementCorrectedPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementCorrectedPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..13a15649ab788dcdd79c85f52451a828b9bf15b9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementCorrectedPrime.lean @@ -0,0 +1,101 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedIntegralReplacementCorrectedPrimeReferenceError + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistoryBulkGiantCorrectedBounds HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds +open HistoryGiantReferenceMean HistorySignedXiTransport HistorySelectedPairDerivativeBounds PrimeCellFreezing +open HistoryBulkPriorGrid HistoryPrincipalIntegralAverage HistoryBulkReplacementGeometry +open HistoryBulkGiantIntegerReference HistoryBulkResidueNormSum ScaleBudget Filter +open HistoryBulkSelectedIntegralReplacement +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkSpectatorReferenceRaw HistoryBulkReferenceScalarCoordinates HistoryBulkFibreSourceMean + +theorem reference_corrected_prime_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k₀ : ℕ} (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter:ℝ) → + ∀ (l : ℕ) (_hl : l < k₀) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k₀ L/2)))) + (x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (p q P Q : ℤ) + (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x ≠ 0) + (_hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y ≠ 0) + (_hc : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_he : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_hP : 0 + F (sourceBulkUnits N C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)) * + primeIntegral + (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>Construction.logCellMass C.giantCenter ∅) + (fun y=>primeJointCutoff C.giantCenter f y + (orderedSourceValues C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)))) - + HistorySelectedJointIntegralBounds.nestedPrimeIntegral L C.giantCenter E f* + ResidueHaar.average F‖ ≤ + 192*Real.exp (-Real.exp (bulk.target*L)) := by + filter_upwards [HistoryBulkSelectedIntegralReplacement.reference_corrected_prime_error_eventually + d Bs BD Bz hBs hk₀] with L hAP + intro spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e hx hy hc he hP hQ hPc hQc + dsimp only + intro hs gs hmatch eB hV independent a + obtain ⟨hsize,herr⟩ := hAP spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e + hx hy hc he hP hQ hPc hQc hs gs hmatch eB hV independent + let h := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) x p) P Q) c + let g := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) y q) P Q) e + have : NeZero (bulkModulus h g (spectatorList spectator ds) k₀) := + ⟨actual_bulk_modulus_ne_zero h g hs gs (spectatorPrimes spectator ds) k₀⟩ + let F := rootTest independent false d h g hs gs (spectatorPrimes spectator ds) hV σ k₀ + let f := jointCorrectedScalar C (bulkSize k₀ L/2) h g hs gs (boolEquiv h g) eB + have hmean := fibre_cmean_eq_sourceBulkMean C a + (bulkModulus h g (spectatorList spectator ds) k₀) hsize F (fun x => primeIntegral + (fun _ : Bool => C.giantCenter-1) (fun _ => C.giantCenter+1) + (fun _ => Construction.logCellMass C.giantCenter ∅) + (fun y => primeJointCutoff C.giantCenter f y x)) + refine ⟨hsize,?_⟩ + exact (congrArg (fun z : ℂ => ‖z - + HistorySelectedJointIntegralBounds.nestedPrimeIntegral L C.giantCenter E f * + ResidueHaar.average F‖) hmean).le.trans herr + +end Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrame.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..3d26c3dcfde86ef7a7f55c59338a51c30d8ffdd8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrame.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrameDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrame +open Construction Conclusion Filter ScaleBudget HistoryPairBulkTransport +open HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkGoodPatternPrincipalFrame HistoryBulkGiantCorrectedBounds +open HistoryBulkFibreIntegralReplacement HistoryBulkIntegralReplacement +open HistoryBulkReferenceScalarCoordinates HistoryPrincipalIntegralAverage + +theorem selected_bulkMean_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k : ℕ} (hBs : 0≤Bs) (hk : 0 cases mixed + · obtain ⟨_,hb⟩ := hpp spectator hspec ds E C hblock hcenter l hl + σ r.leftSource r.rightSource r.s r.t r.P r.Q r.leftChoices r.rightChoices + r.left_mass r.right_mass r.left_choices_mass r.right_choices_mass + r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching (orderedBulkEquiv r) hV true a + exact hb + · obtain ⟨_,hb⟩ := hpm spectator hspec ds E C hblock hcenter l hl + σ r.leftSource r.rightSource r.s r.t r.P r.Q r.leftChoices r.rightChoices + r.left_mass r.right_mass r.left_choices_mass r.right_choices_mass + r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching (orderedBulkEquiv r) hV true a + exact hb + · obtain ⟨_,hb⟩ := hcp spectator hspec ds E C hblock hcenter l (hstage rfl) + σ r.leftSource r.rightSource r.s r.t r.P r.Q r.leftChoices r.rightChoices + r.left_mass r.right_mass r.left_choices_mass r.right_choices_mass + r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching (orderedBulkEquiv r) hV true a + exact hb + · obtain ⟨_,hb⟩ := hcm spectator hspec ds E C hblock hcenter l (hstage rfl) + σ r.leftSource r.rightSource r.s r.t r.P r.Q r.leftChoices r.rightChoices + r.left_mass r.right_mass r.left_choices_mass r.right_choices_mass + r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching (orderedBulkEquiv r) hV true a + exact hb + +end Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrame + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrameDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrameDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f1c09a66e49685affa8935d1f798ffa241c1261 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrameDefs.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootPrincipals +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternPrincipalFrameDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrame +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryBulkFibreGiantApproximation HistoryBulkGoodPatternPrincipalFrame +open HistoryBulkGiantCorrectedBounds HistoryBulkCorrectedXiBounds +open HistoryPairGiantCoordinates HistoryBulkReferenceScalarCoordinates +open HistoryPrincipalIntegralAverage HistoryGiantPriorGrid HistoryBulkIntegralReplacement +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +def giantValue (r : Frame (l:=l) C outside) (corrected mixed : Bool) + (x : Frame.Source (C:=C) (l:=l)) : ℂ := + if mixed then r.mixedIntegralValue x corrected else + primeIntegral (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter ∅) + (primeCutoff C.giantCenter (fun u=> + (if corrected then + jointCorrectedScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (boolEquiv r.left r.right) (orderedBulkEquiv r) + else + jointScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (boolEquiv r.left r.right) (orderedBulkEquiv r)) + u (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l x))) + +def bulkMean (r : Frame (l:=l) C outside) (corrected mixed : Bool) + (a : SelectedNonbulkSample C l) + (σ : Equiv.Perm (Frame.Slots (depth:=k) (L:=L) (l:=l))) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j + r.rootValue mixed hV σ (fibreAssignment C a u)* + giantValue r corrected mixed (fibreAssignment C a u)) + +end Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrame + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrameWeighted.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrameWeighted.lean new file mode 100644 index 0000000000000000000000000000000000000000..59df227bdb6450860dd4ed2ad3398f99d0928724 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementFrameWeighted.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrame + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacementFrame +open Construction Conclusion Filter ScaleBudget HistoryBulkSourceDisintegration +open HistoryBulkFibreGiantApproximation HistoryBulkGoodPatternPrincipalFrame +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +def rootDensity (r : Frame (l:=l) C outside) (mixed : Bool) : ℂ := + if mixed then Frame.extractedDensity (C:=C) r.leftSource else 1 + +theorem norm_rootDensity_le (r : Frame (l:=l) C outside) (mixed : Bool) : + ‖rootDensity r mixed‖≤1 := by + cases mixed + · simp only [rootDensity,Bool.false_eq_true,ite_false,norm_one,le_refl] + · exact Frame.norm_extractedDensity_le r.leftSource + +theorem selected_weighted_bulkMean_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k : ℕ} (hBs : 0≤Bs) (hk : 0 F (sourceBulkUnits N C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)) * mixedIntegral + (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>Construction.logCellMass C.giantCenter ∅) + (fun y=>mixedJointCutoff C.giantCenter f y (orderedSourceValues C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)))) - + HistorySelectedJointIntegralBounds.nestedMixedIntegral L C.giantCenter E f* + ResidueHaar.average F‖ ≤ + 192*Real.exp (-Real.exp (bulk.target*L)) := by + filter_upwards [HistoryBulkSelectedIntegralReplacement.reference_plain_mixed_error_eventually d Bs BD Bz hBs hk₀] + with L hAP + intro spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e hx hy hc he hP hQ hPc hQc + dsimp only + intro hs gs hmatch eB hV independent a + let h := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources _ x p) P Q) c + let g := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources _ y q) P Q) e + have : NeZero (bulkModulus h g (spectatorList spectator ds) k₀) := + ⟨actual_bulk_modulus_ne_zero h g hs gs (spectatorPrimes spectator ds) k₀⟩ + obtain ⟨hsize,herr⟩ := hAP spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e + hx hy hc he hP hQ hPc hQc hs gs hmatch eB hV independent + refine ⟨hsize,?_⟩ + let F := rootTest independent true d h g hs gs (spectatorPrimes spectator ds) hV σ k₀ + let f := jointScalar C (bulkSize k₀ L/2) h g hs gs (optionEquiv h g) eB + have hmean := fibre_cmean_eq_sourceBulkMean C a + (bulkModulus h g (spectatorList spectator ds) k₀) hsize F (fun z => mixedIntegral + (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit => C.giantCenter-1) (fun _ => C.giantCenter+1) + (fun _ => Construction.logCellMass C.giantCenter ∅) + (fun y => mixedJointCutoff C.giantCenter f y z)) + exact (congrArg (fun z : ℂ => ‖z - + HistorySelectedJointIntegralBounds.nestedMixedIntegral L C.giantCenter E f * + ResidueHaar.average F‖) hmean).le.trans herr + +end Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementPlainPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementPlainPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..df0700c4edca963e32fa9e74a6648cdd58cc04c0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreIntegralReplacementPlainPrime.lean @@ -0,0 +1,97 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreSourceMean +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedIntegralReplacementPlainPrimeReferenceError + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryBulkSelectedIntegralReplacement +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistoryBulkGiantCorrectedBounds HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds +open HistoryGiantReferenceMean HistorySignedXiTransport HistorySelectedPairDerivativeBounds PrimeCellFreezing +open HistoryBulkPriorGrid HistoryPrincipalIntegralAverage HistoryBulkReplacementGeometry +open HistoryBulkFibreSourceMean HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryBulkSpectatorReferenceRaw HistoryBulkReferenceScalarCoordinates +open HistoryBulkGiantIntegerReference HistoryBulkResidueNormSum ScaleBudget Filter + +theorem reference_plain_prime_error_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {k₀ : ℕ} (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter:ℝ) → + ∀ (l : ℕ) (_hl : l ≤ k₀) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k₀ L/2)))) + (x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (p q P Q : ℤ) + (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x ≠ 0) + (_hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y ≠ 0) + (_hc : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_he : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_hP : 0 F (sourceBulkUnits N C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)) * primeIntegral + (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>Construction.logCellMass C.giantCenter ∅) + (fun y=>primeJointCutoff C.giantCenter f y (orderedSourceValues C.sources (2*(bulkSize k₀ L/2)) k₀ l (fibreAssignment C a u)))) - + HistorySelectedJointIntegralBounds.nestedPrimeIntegral L C.giantCenter E f* + ResidueHaar.average F‖ ≤ + 192*Real.exp (-Real.exp (bulk.target*L)) := by + filter_upwards [HistoryBulkSelectedIntegralReplacement.reference_plain_prime_error_eventually d Bs BD Bz hBs hk₀] + with L hAP + intro spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e hx hy hc he hP hQ hPc hQc + dsimp only + intro hs gs hmatch eB hV independent a + let h := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources _ x p) P Q) c + let g := decodeHistory C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l + (giantState (sourceState C.sources _ y q) P Q) e + have : NeZero (bulkModulus h g (spectatorList spectator ds) k₀) := + ⟨actual_bulk_modulus_ne_zero h g hs gs (spectatorPrimes spectator ds) k₀⟩ + obtain ⟨hsize,herr⟩ := hAP spectator hspec ds E C hblock hcenter l hl σ x y p q P Q c e + hx hy hc he hP hQ hPc hQc hs gs hmatch eB hV independent + refine ⟨hsize,?_⟩ + let F := rootTest independent false d h g hs gs (spectatorPrimes spectator ds) hV σ k₀ + let f := jointScalar C (bulkSize k₀ L/2) h g hs gs (boolEquiv h g) eB + have hmean := fibre_cmean_eq_sourceBulkMean C a + (bulkModulus h g (spectatorList spectator ds) k₀) hsize F (fun z => primeIntegral + (fun _ : Bool => C.giantCenter-1) (fun _ => C.giantCenter+1) + (fun _ => Construction.logCellMass C.giantCenter ∅) + (fun y => primeJointCutoff C.giantCenter f y z)) + exact (congrArg (fun z : ℂ => ‖z - + HistorySelectedJointIntegralBounds.nestedPrimeIntegral L C.giantCenter E f * + ResidueHaar.average F‖) hmean).le.trans herr + +end Ostmann.Arithmetic.HistoryBulkFibreIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..b54cd7e55e11b16081631478760955ed86e6a92a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReference.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceSelection + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) + +theorem primeFibreMean_eq_zero_or_reference : + primeFibreMean C outside σ a s t c e = 0 ∨ + ∃y,∃r : PrimeDraw C.giant, + 0 < (selectedBulkPrior C l).mass y ∧ 0 < primeWeight C.giant r ∧ + fibreTerm C outside σ a s t c e y (primeP C.giant r) (primeQ C.giant r) ≠ 0 ∧ + FibreSupported C outside σ a s t c e y (primeP C.giant r) (primeQ C.giant r) := by + rw [primeFibreMean_eq_weighted] + exact weightedFibreMean_eq_zero_or_reference C outside σ a s t c e + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) (primeWeight_nonneg C.giant) + +theorem mixedFibreMean_eq_zero_or_reference : + mixedFibreMean C outside σ a s t c e = 0 ∨ + ∃y,∃r : MixedDraw C.giantCenter C.giant, + 0 < (selectedBulkPrior C l).mass y ∧ 0 < mixedWeight C.giantCenter C.giant r ∧ + fibreTerm C outside σ a s t c e y + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r) ≠ 0 ∧ + FibreSupported C outside σ a s t c e y + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r) := by + rw [mixedFibreMean_eq_weighted] + exact weightedFibreMean_eq_zero_or_reference C outside σ a s t c e + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) (mixedWeight_nonneg C.giantCenter C.giant) + +theorem fibreAssignment_mass_pos (y : SelectedBulkSample C l) + (ha : 0 < (selectedNonbulkPrior C l).mass a) (hy : 0 < (selectedBulkPrior C l).mass y) : + 0 < (assignmentPrior C.sources (SelectedTemplate k L l)).mass (fibreAssignment C a y) := by + rw [fibreAssignment_mass] + exact mul_pos ha hy + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceCovariance.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceCovariance.lean new file mode 100644 index 0000000000000000000000000000000000000000..41605bbfb1b24940c3bb0caf61acbab8e5174ad5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceCovariance.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferencePermutation + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Choices choicesPairSum) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +theorem bulk_primeMean_relative (outside : List ℕ) + (σ τ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) : + (selectedBulkPrior C l).cmean (fun y => + HistoryGiantUncorrectedOriginalMean.originalPrimeMean C outside + (permuteAssignment C σ (fibreAssignment C a y)) + (permuteAssignment C τ (fibreAssignment C a y)) s t c e) = + primeFibreMean C outside (σ⁻¹*τ) a s t c e := by + change _ = (selectedBulkPrior C l).cmean (fun y => + HistoryGiantUncorrectedOriginalMean.originalPrimeMean C outside (fibreAssignment C a y) + (permuteAssignment C (σ⁻¹*τ) (fibreAssignment C a y)) s t c e) + simp_rw [permute_fibreAssignment] + exact bulk_cmean_relative_permutation C σ τ + (fun y z => HistoryGiantUncorrectedOriginalMean.originalPrimeMean C outside + (fibreAssignment C a y) (fibreAssignment C a z) s t c e) + +theorem selectedComplexCovariance_eq_fibres (spectator : PrimeSource) + (σ τ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) : + selectedComplexCovariance C spectator (bulkSize k L/2) l σ τ = + (spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + (selectedNonbulkPrior C l).cmean (fun a => + ∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + choicesPairSum C (fun c e => + primeFibreMean C (spectatorList spectator ds) (σ⁻¹*τ) a v.val v.val c e))) := by + rw [HistoryGiantUncorrectedOriginalMean.selectedComplexCovariance_eq_originalMean] + apply congrArg (FinitePrior.cmean (spectatorPrior spectator (2*(bulkSize k L/2)))) + funext ds + rw [selected_source_cmean_disintegration] + apply congrArg (FinitePrior.cmean (selectedNonbulkPrior C l)) + funext a + simp only [choicesPairSum] + rw [cmean_frequency_choices] + apply Finset.sum_congr rfl + intro v _ + apply Finset.sum_congr rfl + intro c _ + apply Finset.sum_congr rfl + intro e _ + exact congrArg (fun z : ℂ => + ((choicesMass C.sources _ _ l c * choicesMass C.sources _ _ l e : ℝ):ℂ) * z) + (bulk_primeMean_relative C (spectatorList spectator ds) σ τ a v.val v.val c e) + +theorem selectedCovariance_eq_fibres (spectator : PrimeSource) + (σ τ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) : + selectedCovariance C spectator (bulkSize k L/2) l σ τ = + ((spectatorPrior spectator (2*(bulkSize k L/2))).cmean (fun ds => + (selectedNonbulkPrior C l).cmean (fun a => + ∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + choicesPairSum C (fun c e => + primeFibreMean C (spectatorList spectator ds) (σ⁻¹*τ) a v.val v.val c e)))).re := by + rw [←selectedComplexCovariance_re,selectedComplexCovariance_eq_fibres] + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..635a4fc1a2425ba978ddc660f256a26351375a4c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceDefs.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceDisintegration +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantUncorrectedOriginalMeanCovariance + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistorySignedXiTransport +open HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Seed Current Choices history) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +def fibreAssignment (a : SelectedNonbulkSample C l) (y : SelectedBulkSample C l) : + SourceAssignment C.sources (SelectedTemplate k L l) := + (selectedSourceEquiv C l).symm (a,y) + +def permuteAssignment + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (x : SourceAssignment C.sources (SelectedTemplate k L l)) := + sourceAssignmentPermutation C.sources (SelectedTemplate k L l) + (selectedLeafPermutation C l σ) (selectedLeafPermutation_source C l σ) x + +variable (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) + +def fibreTerm (y : SelectedBulkSample C l) (P Q : ℤ) : ℂ := + sourceIntegrand d C.sources (Seed (k:=k) (L:=L)) (frequencyBound Bs BD Bz k L) outside l + (sourceState C.sources _ (fibreAssignment C a y) s) + (sourceState C.sources _ (permuteAssignment C σ (fibreAssignment C a y)) t) + c e (fun _ _ => 1) (bulkSize k L/2) (bulkSize k L/2) + C.scale C.bulkBin C.spectatorBin C.giantCenter + P Q + +def FibreSupported (y : SelectedBulkSample C l) (P Q : ℤ) : Prop := + (history C (fibreAssignment C a y) s P Q c).Supported (frequencyBound Bs BD Bz k L) outside ∧ + (history C (permuteAssignment C σ (fibreAssignment C a y)) t P Q e).Supported + (frequencyBound Bs BD Bz k L) outside + +theorem fibreTerm_ne_zero_supported (y : SelectedBulkSample C l) (P Q : ℤ) + (h : fibreTerm C outside σ a s t c e y P Q ≠ 0) : + FibreSupported C outside σ a s t c e y P Q := by + have hh : supportedHistoryPairXi d (frequencyBound Bs BD Bz k L) outside + (bulkSize k L/2) (bulkSize k L/2) C.scale C.bulkBin C.spectatorBin C.giantCenter + (history C (fibreAssignment C a y) s P Q c) + (history C (permuteAssignment C σ (fibreAssignment C a y)) t P Q e) ≠ 0 := by + simpa only [fibreTerm,sourceIntegrand,one_mul,history] using h + constructor + · by_contra hn + apply hh + simp only [supportedHistoryPairXi,hn,dite_false] + · by_contra hn + apply hh + simp only [supportedHistoryPairXi,hn,dite_false] + split <;> rfl + +def primeFibreMean : ℂ := + (selectedBulkPrior C l).cmean (fun y => + primeMean C.giant (fibreTerm C outside σ a s t c e y)) + +def mixedFibreMean : ℂ := + (selectedBulkPrior C l).cmean (fun y => + mixedMean C.giantCenter C.giant (fibreTerm C outside σ a s t c e y)) + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..1f991c08002f56a80c1c1ad3a43b63279d773596 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceFinite.lean @@ -0,0 +1,25 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction + +theorem cmean_frequency_choices {A V I J : Type*} + [Fintype A] [Fintype V] [Fintype I] [Fintype J] + (μ : FinitePrior A) (w : I → J → ℂ) (F : A → V → I → J → ℂ) : + μ.cmean (fun x => ∑v,∑c,∑e,w c e*F x v c e) = + ∑v,∑c,∑e,w c e*μ.cmean (fun x => F x v c e) := by + simp_rw [FinitePrior.cmean_sum,FinitePrior.cmean_mul_left] + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceLaws.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ace0036fd00acadc831f49eb1c013ac99a4f3a7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceLaws.lean @@ -0,0 +1,73 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean +open HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Seed Current Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +@[simp] theorem fibreAssignment_mass (a : SelectedNonbulkSample C l) (y : SelectedBulkSample C l) : + (assignmentPrior C.sources (SelectedTemplate k L l)).mass (fibreAssignment C a y) = + (selectedNonbulkPrior C l).mass a * (selectedBulkPrior C l).mass y := by + simpa only [fibreAssignment,Equiv.apply_symm_apply] using + selectedSourceEquiv_mass C l ((selectedSourceEquiv C l).symm (a,y)) + +@[simp] theorem fibreAssignment_nonbulk (a : SelectedNonbulkSample C l) (y : SelectedBulkSample C l) + (i : NonbulkPosition (SelectedTemplate k L l)) : fibreAssignment C a y i.val = a i := by + simpa only [fibreAssignment,Equiv.apply_symm_apply] using + (selectedSourceEquiv_nonbulk C l ((selectedSourceEquiv C l).symm (a,y)) i).symm + +theorem fibreAssignment_nonbulk_fixed (a : SelectedNonbulkSample C l) + (y z : SelectedBulkSample C l) (i : Fin (SelectedTemplate k L l).length) + (hi : ((SelectedTemplate k L l).get i).role ≠ .bulk) : + (fibreAssignment C a y i).val = (fibreAssignment C a z i).val := by + have hy := fibreAssignment_nonbulk C a y ⟨i,hi⟩ + have hz := fibreAssignment_nonbulk C a z ⟨i,hi⟩ + exact congrArg Subtype.val (hy.trans hz.symm) + +variable (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) + +theorem primeFibreMean_eq_weighted : + primeFibreMean C outside σ a s t c e = + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass (primeWeight C.giant) + (fun y r => fibreTerm C outside σ a s t c e y (primeP C.giant r) (primeQ C.giant r)) := by + simp only [primeFibreMean,primeMean_eq_weighted,FinitePrior.cmean, + HistoryBulkFibreReference.originalMean,Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + +theorem mixedFibreMean_eq_weighted : + mixedFibreMean C outside σ a s t c e = + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass + (mixedWeight C.giantCenter C.giant) + (fun y r => fibreTerm C outside σ a s t c e y + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r)) := by + simp only [mixedFibreMean,mixedMean_eq_weighted,FinitePrior.cmean, + HistoryBulkFibreReference.originalMean,Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + +theorem originalPrimeMean_disintegration : + (assignmentPrior C.sources (SelectedTemplate k L l)).cmean (fun x => + HistoryGiantUncorrectedOriginalMean.originalPrimeMean C outside x (permuteAssignment C σ x) s t c e) = + (selectedNonbulkPrior C l).cmean (fun a => primeFibreMean C outside σ a s t c e) := by + exact selected_source_cmean_disintegration C l _ + +theorem originalMixedMean_disintegration : + (assignmentPrior C.sources (SelectedTemplate k L l)).cmean (fun x => + HistoryGiantUncorrectedOriginalMean.originalMixedMean C outside x (permuteAssignment C σ x) s t c e) = + (selectedNonbulkPrior C l).cmean (fun a => mixedFibreMean C outside σ a s t c e) := by + exact selected_source_cmean_disintegration C l _ + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferencePermutation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferencePermutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..63c0ea42306cdf9d2c7c4b68745a65e4b1662c9e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferencePermutation.lean @@ -0,0 +1,57 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryBulkSourceDisintegration +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +def bulkDrawPermutation (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) : + SelectedBulkSample C l ≃ SelectedBulkSample C l := + Equiv.arrowCongr σ.symm (Equiv.refl C.bulk.Sample) + +@[simp] theorem bulkDrawPermutation_apply + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (y : SelectedBulkSample C l) + (u : Fin (2^l) × Fin (2*(bulkSize k L/2))) : + bulkDrawPermutation C σ y u = y (σ u) := rfl + +theorem bulkDrawPermutation_mass + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (y : SelectedBulkSample C l) : + (selectedBulkPrior C l).mass (bulkDrawPermutation C σ y) = (selectedBulkPrior C l).mass y := + Equiv.prod_comp σ (fun u => C.bulk.law.mass (y u)) + +theorem bulk_cmean_permutation + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) (F : SelectedBulkSample C l → ℂ) : + (selectedBulkPrior C l).cmean (fun y => F (fun u => y (σ u))) = + (selectedBulkPrior C l).cmean F := by + let W : WeightEquiv (selectedBulkPrior C l).mass (selectedBulkPrior C l).mass := + ⟨bulkDrawPermutation C σ,fun y => (bulkDrawPermutation_mass C σ y).symm⟩ + exact W.csum_comp F + +theorem bulk_cmean_relative_permutation + (σ τ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (F : SelectedBulkSample C l → SelectedBulkSample C l → ℂ) : + (selectedBulkPrior C l).cmean (fun y => F (fun u => y (σ u)) (fun u => y (τ u))) = + (selectedBulkPrior C l).cmean (fun y => F y (fun u => y ((σ⁻¹*τ) u))) := by + have h := bulk_cmean_permutation C σ (fun y => F y (fun u => y ((σ⁻¹*τ) u))) + simpa only [Equiv.Perm.mul_apply,Equiv.Perm.inv_def,Equiv.apply_symm_apply] using h + +theorem permute_fibreAssignment + (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) (y : SelectedBulkSample C l) : + permuteAssignment C σ (fibreAssignment C a y) = + fibreAssignment C a (fun u => y (σ u)) := + selectedSourceEquiv_symm_permutation C l σ a y + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceSelection.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..c95509c2e97760613a42a7415c42ca61ee1c7262 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceSelection.lean @@ -0,0 +1,60 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) + +theorem weightedFibreMean_eq_zero_or_reference + {α : Type*} [Fintype α] (w : α → ℝ) (P Q : α → ℤ) (hw : ∀r,0≤w r) : + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass w + (fun y r => fibreTerm C outside σ a s t c e y (P r) (Q r)) = 0 ∨ + ∃y r,0<(selectedBulkPrior C l).mass y ∧ 0 FibreSupported C outside σ a s t c e y (P r) (Q r)) + (fun y r _ _ h => fibreTerm_ne_zero_supported C outside σ a s t c e y (P r) (Q r) h) + +theorem weightedFibreMean_eq_zero_or_fixed_reference + {α : Type*} [Fintype α] (w : α → ℝ) (P Q : α → ℤ) (hw : ∀r,0≤w r) + (T : SelectedBulkSample C l → α → SelectedBulkSample C l → α → ℂ) + (hconverse : ∀y₀ r₀,FibreSupported C outside σ a s t c e y₀ (P r₀) (Q r₀) → + ∀y r,(selectedBulkPrior C l).mass y ≠ 0 → w r ≠ 0 → T y₀ r₀ y r ≠ 0 → + FibreSupported C outside σ a s t c e y (P r) (Q r)) + (htransport : ∀y₀ r₀,FibreSupported C outside σ a s t c e y₀ (P r₀) (Q r₀) → + ∀y r,(selectedBulkPrior C l).mass y ≠ 0 → w r ≠ 0 → + FibreSupported C outside σ a s t c e y (P r) (Q r) → + fibreTerm C outside σ a s t c e y (P r) (Q r) = T y₀ r₀ y r) : + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass w + (fun y r => fibreTerm C outside σ a s t c e y (P r) (Q r)) = 0 ∨ + ∃y₀ r₀,0<(selectedBulkPrior C l).mass y₀ ∧ 0 fibreTerm C outside σ a s t c e y (P r) (Q r)) = + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass w (T y₀ r₀) := + HistoryBulkFibreReference.originalMean_eq_zero_or_fixed_reference _ _ _ + (selectedBulkPrior C l).mass_nonneg hw + (fun y r => FibreSupported C outside σ a s t c e y (P r) (Q r)) T + (fun y r _ _ h => fibreTerm_ne_zero_supported C outside σ a s t c e y (P r) (Q r) h) + hconverse htransport + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceTermDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceTermDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..9a4fb522acbe3a025947d13c7897899442f0eb20 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceTermDefs.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Choices) +open HistoryPairBulkTransport +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) + +def fibreReferenceTerm (K : ℕ) (y₀ : SelectedBulkSample C l) (P₀ Q₀ : ℤ) + (hs : FibreSupported C outside σ a s t c e y₀ P₀ Q₀) + (y : SelectedBulkSample C l) (P Q : ℤ) : ℂ := + HistoryBulkFixedReferenceTerm.referenceTerm C (frequencyBound Bs BD Bz k L) outside l K σ + (fibreAssignment C a y₀) (fibreAssignment C a y) s t P₀.toNat Q₀.toNat c e + hs.1 hs.2 (bulkSize k L/2) (bulkSize k L/2) + C.scale C.bulkBin C.spectatorBin C.giantCenter (fun _ _ => 1) P Q + +theorem fibreTerm_eq_fibreReferenceTerm + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (K : ℕ) (hle : l≤K) (hl : l≤k) + (y₀ : SelectedBulkSample C l) (P₀ Q₀ : ℤ) + (hs : FibreSupported C outside σ a s t c e y₀ P₀ Q₀) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hy₀ : 0 < (selectedBulkPrior C l).mass y₀) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c≠0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l e≠0) + (houtside : ∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) + (y : SelectedBulkSample C l) (P Q : ℤ) + (hy : (selectedBulkPrior C l).mass y≠0) (hp : 0 1) P Q + (fibreAssignment_nonbulk_fixed C a y y₀) + (ne_of_gt (fibreAssignment_mass_pos C a y₀ ha hy₀)) + (ne_of_gt (fibreAssignment_mass_pos C a y ha + (lt_of_le_of_ne ((selectedBulkPrior C l).mass_nonneg y) (Ne.symm hy)))) + hc he hp hq houtside + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeighted.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeighted.lean new file mode 100644 index 0000000000000000000000000000000000000000..7fa10dd2cd967482475a951f277ccc942a62ae65 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeighted.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceWeightedMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration Filter +open HistoryGiantOriginalMeanFactorization (Choices) + +theorem weighted_fibre_reference_eventually + (d : Decomposition) (Bs BD Bz : ℝ) {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (outside : List ℕ), (∀ q∈outside, ∃ p : spectator.Sample, (p:ℕ)=q) → + ∀ (l K : ℕ), l ≤ K → l ≤ k → + ∀ (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) + (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C), + 0 < (selectedNonbulkPrior C l).mass a → + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c ≠ 0 → + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l e ≠ 0 → + ∀ J : SelectedBulkSample C l → ℤ → ℤ → ℂ, + WeightedFixedFibreReference C outside σ a s t c e J K + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + (weightedPrimeFibreMean C outside σ a s t c e J) ∧ + WeightedFixedFibreReference C outside σ a s t c e J K + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) (weightedMixedFibreMean C outside σ a s t c e J) := by + filter_upwards [HistoryBulkFixedReferenceTerm.selected_reference_equality_eventually d Bs BD Bz hk] + with L hL + intro E C hG hcl hcu hb hd spectator hspec outside houtside l K hle hl σ a s t c e ha hc he J + have hactual := hL E C hG hcl hcu hb hd spectator hspec + exact ⟨weightedPrimeFibreMean_fixed_reference C outside σ a s t c e J + hactual K hle hl ha hc he houtside, + weightedMixedFibreMean_fixed_reference C outside σ a s t c e J + hactual K hle hl ha hc he houtside⟩ + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..72240cdb024d3f075a8d72683111c0a401e04af7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedDefs.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceTermDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Seed Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) +variable (J : SelectedBulkSample C l → ℤ → ℤ → ℂ) + +def weightedFibreTerm (y : SelectedBulkSample C l) (P Q : ℤ) : ℂ := + sourceIntegrand d C.sources (Seed (k:=k) (L:=L)) (frequencyBound Bs BD Bz k L) outside l + (sourceState C.sources _ (fibreAssignment C a y) s) + (sourceState C.sources _ (permuteAssignment C σ (fibreAssignment C a y)) t) + c e (J y) (bulkSize k L/2) (bulkSize k L/2) + C.scale C.bulkBin C.spectatorBin C.giantCenter P Q + +theorem weightedFibreTerm_eq_mul (y : SelectedBulkSample C l) (P Q : ℤ) : + weightedFibreTerm C outside σ a s t c e J y P Q = + J y P Q * fibreTerm C outside σ a s t c e y P Q := by + simp only [weightedFibreTerm,fibreTerm,sourceIntegrand,one_mul] + +theorem weightedFibreTerm_ne_zero_supported (y : SelectedBulkSample C l) (P Q : ℤ) + (h : weightedFibreTerm C outside σ a s t c e J y P Q ≠ 0) : + FibreSupported C outside σ a s t c e y P Q := by + rw [weightedFibreTerm_eq_mul] at h + exact fibreTerm_ne_zero_supported C outside σ a s t c e y P Q (mul_ne_zero_iff.mp h).2 + +def weightedPrimeFibreMean : ℂ := + (selectedBulkPrior C l).cmean (fun y => + primeMean C.giant (weightedFibreTerm C outside σ a s t c e J y)) + +def weightedMixedFibreMean : ℂ := + (selectedBulkPrior C l).cmean (fun y => + mixedMean C.giantCenter C.giant (weightedFibreTerm C outside σ a s t c e J y)) + +theorem weightedPrimeFibreMean_eq_weighted : + weightedPrimeFibreMean C outside σ a s t c e J = + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass (primeWeight C.giant) + (fun y r => weightedFibreTerm C outside σ a s t c e J y + (primeP C.giant r) (primeQ C.giant r)) := by + simp only [weightedPrimeFibreMean,primeMean_eq_weighted,FinitePrior.cmean, + HistoryBulkFibreReference.originalMean,Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + +theorem weightedMixedFibreMean_eq_weighted : + weightedMixedFibreMean C outside σ a s t c e J = + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass + (mixedWeight C.giantCenter C.giant) + (fun y r => weightedFibreTerm C outside σ a s t c e J y + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r)) := by + simp only [weightedMixedFibreMean,mixedMean_eq_weighted,FinitePrior.cmean, + HistoryBulkFibreReference.originalMean,Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..55f8867d0898537f15a81cca9338cb230d95a95e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedMean.lean @@ -0,0 +1,100 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceWeightedTerm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Choices) +open HistoryBulkFibreReference (originalMean) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) +variable (J : SelectedBulkSample C l → ℤ → ℤ → ℂ) + +def WeightedFixedFibreReference {α : Type*} [Fintype α] + (K : ℕ) (w : α→ℝ) (P Q : α→ℤ) (mean : ℂ) : Prop := + mean=0 ∨ ∃y₀ r₀, + 0 < (selectedBulkPrior C l).mass y₀ ∧ 0 < w r₀ ∧ + weightedFibreTerm C outside σ a s t c e J y₀ (P r₀) (Q r₀)≠0 ∧ + ∃hs : FibreSupported C outside σ a s t c e y₀ (P r₀) (Q r₀), + (∀y r,(selectedBulkPrior C l).mass y≠0 → w r≠0 → + weightedFibreTerm C outside σ a s t c e J y (P r) (Q r)= + weightedFibreReferenceTerm C outside σ a s t c e J K y₀ (P r₀) (Q r₀) hs y (P r) (Q r)) ∧ + mean=originalMean (selectedBulkPrior C l).mass w + (fun y r=>weightedFibreReferenceTerm C outside σ a s t c e J K y₀ (P r₀) (Q r₀) hs y (P r) (Q r)) + +theorem weightedWholeFibreMean_fixed_reference + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (K : ℕ) (hle : l≤K) (hl : l≤k) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c≠0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l e≠0) + (houtside : ∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) + {α : Type*} [Fintype α] (w : α→ℝ) (P Q : α→ℤ) + (hw : ∀r,0≤w r) (hpos : ∀r,w r≠0 → 0

weightedFibreTerm C outside σ a s t c e J y (P r) (Q r))) := by + rcases HistoryBulkFibreReference.originalMean_eq_zero_or_reference + (selectedBulkPrior C l).mass w + (fun y r => weightedFibreTerm C outside σ a s t c e J y (P r) (Q r)) + (selectedBulkPrior C l).mass_nonneg hw + (fun y r => FibreSupported C outside σ a s t c e y (P r) (Q r)) + (fun y r _ _ h => weightedFibreTerm_ne_zero_supported C outside σ a s t c e J y (P r) (Q r) h) with + hz | ⟨y₀,r₀,hy₀,hr₀,hne,hs⟩ + · exact Or.inl hz + · have hfixed : ∀y r,(selectedBulkPrior C l).mass y≠0 → w r≠0 → + weightedFibreTerm C outside σ a s t c e J y (P r) (Q r)= + weightedFibreReferenceTerm C outside σ a s t c e J K y₀ (P r₀) (Q r₀) hs y (P r) (Q r) := by + intro y r hy hr + exact weightedFibreTerm_eq_weightedFibreReferenceTerm C outside σ a s t c e J hactual K hle hl + y₀ (P r₀) (Q r₀) hs ha hy₀ hc he houtside y (P r) (Q r) hy + (hpos r hr).1 (hpos r hr).2 + exact Or.inr ⟨y₀,r₀,hy₀,hr₀,hne,hs,hfixed, + HistoryBulkFibreReference.originalMean_congr _ _ _ _ hfixed⟩ + +theorem weightedPrimeFibreMean_fixed_reference + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (K : ℕ) (hle : l≤K) (hl : l≤k) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c≠0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l e≠0) + (houtside : ∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) : + WeightedFixedFibreReference C outside σ a s t c e J K + (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + (weightedPrimeFibreMean C outside σ a s t c e J) := by + rw [weightedPrimeFibreMean_eq_weighted] + exact weightedWholeFibreMean_fixed_reference C outside σ a s t c e J hactual K hle hl ha hc he + houtside (primeWeight C.giant) (primeP C.giant) (primeQ C.giant) + (primeWeight_nonneg C.giant) (fun r _=>primeDraw_positive C.giant r) + +theorem weightedMixedFibreMean_fixed_reference + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (K : ℕ) (hle : l≤K) (hl : l≤k) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c≠0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l e≠0) + (houtside : ∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) : + WeightedFixedFibreReference C outside σ a s t c e J K + (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) (weightedMixedFibreMean C outside σ a s t c e J) := by + rw [weightedMixedFibreMean_eq_weighted] + exact weightedWholeFibreMean_fixed_reference C outside σ a s t c e J hactual K hle hl ha hc he + houtside (mixedWeight C.giantCenter C.giant) (mixedP C.giantCenter C.giant) + (mixedQ C.giantCenter C.giant) (mixedWeight_nonneg C.giantCenter C.giant) + (fun r _=>mixedDraw_positive C.giantCenter C.giant r) + +end Ostmann.Arithmetic.HistoryBulkFibreOriginalReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedTerm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedTerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..2ee69698b8328e18aa2496e7b925a7c6a693ebce --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreOriginalReferenceWeightedTerm.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceWeightedDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreOriginalReference +open Construction Conclusion HistoryGiantReferenceMean HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Choices) +open HistoryPairBulkTransport +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (σ : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2)))) +variable (a : SelectedNonbulkSample C l) (s t : ℤ) (c e : Choices (l:=l) C) +variable (J : SelectedBulkSample C l → ℤ → ℤ → ℂ) + +def weightedFibreReferenceTerm (K : ℕ) (y₀ : SelectedBulkSample C l) (P₀ Q₀ : ℤ) + (hs : FibreSupported C outside σ a s t c e y₀ P₀ Q₀) + (y : SelectedBulkSample C l) (P Q : ℤ) : ℂ := + HistoryBulkFixedReferenceTerm.referenceTerm C (frequencyBound Bs BD Bz k L) outside l K σ + (fibreAssignment C a y₀) (fibreAssignment C a y) s t P₀.toNat Q₀.toNat c e + hs.1 hs.2 (bulkSize k L/2) (bulkSize k L/2) + C.scale C.bulkBin C.spectatorBin C.giantCenter (J y) P Q + +theorem weightedFibreTerm_eq_weightedFibreReferenceTerm + {spectator : PrimeSource} + (hactual : HistoryBulkFixedReferenceTerm.SelectedReferenceEquality C spectator) + (K : ℕ) (hle : l≤K) (hl : l≤k) + (y₀ : SelectedBulkSample C l) (P₀ Q₀ : ℤ) + (hs : FibreSupported C outside σ a s t c e y₀ P₀ Q₀) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hy₀ : 0 < (selectedBulkPrior C l).mass y₀) + (hc : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c≠0) + (he : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l e≠0) + (houtside : ∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) + (y : SelectedBulkSample C l) (P Q : ℤ) + (hy : (selectedBulkPrior C l).mass y≠0) (hp : 0 Characters.Template.unitConvention ((u i).val : ZMod N) := by + funext i + simp only [sourceBulkUnits, bulkSamples_fibreAssignment] + +theorem sourceBulkUnits_fibreAssignment_eq_bulkTupleUnits + (a : SelectedNonbulkSample C l) (u : SelectedBulkSample C l) + (N : ℕ) [NeZero N] (hsize : (N : ℝ) < Real.exp (bulkLogLower L)) : + sourceBulkUnits N C.sources (2*(bulkSize k L/2)) k l (fibreAssignment C a u) = + bulkTupleUnits L N hsize + (fun i => ⟨(u i).val, bulkPrimeBand_subset_closed L E (u i).property⟩) := by + rw [sourceBulkUnits_fibreAssignment] + funext i + exact unitConvention_bulk_sample C N hsize (u i) + +theorem fibre_cmean_eq_sourceBulkMean (a : SelectedNonbulkSample C l) + (N : ℕ) [NeZero N] (hsize : (N : ℝ) < Real.exp (bulkLogLower L)) + (F : ((Fin (2^l) × Fin (2*(bulkSize k L/2))) → (ZMod N)ˣ) → ℂ) + (f : ((Fin (2^l) × Fin (2*(bulkSize k L/2))) → ℝ) → ℂ) : + (selectedBulkPrior C l).cmean (fun u => + F (sourceBulkUnits N C.sources (2*(bulkSize k L/2)) k l (fibreAssignment C a u)) * + f (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l (fibreAssignment C a u))) = + sourceBulkMean L E C.bulkPositive N hsize F f := by + simp only [sourceBulkUnits_fibreAssignment, orderedSourceValues_fibreAssignment] + exact selectedBulkPrior_cmean_eq_sourceBulkMean C N hsize F f + +theorem fibre_cmean_integrated_eq_sourceBulkMean (a : SelectedNonbulkSample C l) + (N : ℕ) [NeZero N] (hsize : (N : ℝ) < Real.exp (bulkLogLower L)) + (F : ((Fin (2^l) × Fin (2*(bulkSize k L/2))) → (ZMod N)ˣ) → ℂ) + {Θ : Type*} (I : (Θ → ℂ) → ℂ) + (f : Θ → ((Fin (2^l) × Fin (2*(bulkSize k L/2))) → ℝ) → ℂ) : + (selectedBulkPrior C l).cmean (fun u => + F (sourceBulkUnits N C.sources (2*(bulkSize k L/2)) k l (fibreAssignment C a u)) * + I (fun q => f q + (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l (fibreAssignment C a u)))) = + sourceBulkMean L E C.bulkPositive N hsize F (fun x => I (fun q => f q x)) := + fibre_cmean_eq_sourceBulkMean C a N hsize F (fun x => I (fun q => f q x)) + +end Ostmann.Arithmetic.HistoryBulkFibreSourceMean + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreSourceMeanBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreSourceMeanBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..833613cd1824802a7e6048922720e6ca1f95bf97 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreSourceMeanBasic.lean @@ -0,0 +1,43 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPriorReplacementSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceDisintegrationSelectedDefs +import OAI.NumberTheory.Ostmann.Characters.TemplateFrequencyConstraint + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreSourceMean +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkPriorGrid +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +theorem unitConvention_bulk_sample (N : ℕ) [NeZero N] + (hsize : (N : ℝ) < Real.exp (bulkLogLower L)) (p : C.bulk.Sample) : + Characters.Template.unitConvention (p.val : ZMod N) = + bulkPrimeUnit L N hsize p.val (bulkPrimeBand_subset_closed L E p.property) := by + apply Units.ext + rw [Characters.Template.unitConvention_coe _ + ((ZMod.isUnit_iff_coprime _ _).mpr + (bulkClosedSupport_coprime L N hsize (bulkPrimeBand_subset_closed L E p.property))), + bulkPrimeUnit_coe] + +theorem selectedBulkPrior_cmean_eq_sourceBulkMean + (N : ℕ) [NeZero N] (hsize : (N : ℝ) < Real.exp (bulkLogLower L)) + (F : ((Fin (2^l) × Fin (2*(bulkSize k L/2))) → (ZMod N)ˣ) → ℂ) + (f : ((Fin (2^l) × Fin (2*(bulkSize k L/2))) → ℝ) → ℂ) : + (selectedBulkPrior C l).cmean (fun u => + F (fun i => Characters.Template.unitConvention ((u i).val : ZMod N)) * + f (fun i => ((u i).val : ℝ))) = + sourceBulkMean L E C.bulkPositive N hsize F f := by + rw [sourceBulkMean_selected_eq] + simp only [unitConvention_bulk_sample C N hsize] + rfl + +end Ostmann.Arithmetic.HistoryBulkFibreSourceMean + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreSourceMeanValues.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreSourceMeanValues.lean new file mode 100644 index 0000000000000000000000000000000000000000..dc77686eb821bb58261fd0851a4f05078d028e2b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFibreSourceMeanValues.lean @@ -0,0 +1,39 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.CanonicalHistoryLeafBulkSamples +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceScalarCoordinatesBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFibreSourceMean +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference CanonicalHistoryLeafBulk +open HistoryBulkReferenceScalarCoordinates +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) + +@[simp] theorem bulkSamples_fibreAssignment (a : SelectedNonbulkSample C l) + (u : SelectedBulkSample C l) (b : Fin (2^l)) (i : Fin (2*(bulkSize k L/2))) : + bulkSamples C.sources (2*(bulkSize k L/2)) k l (fibreAssignment C a u) b i = + (u (b,i)).val := by + have hv := selectedSourceEquiv_bulk_val C l (fibreAssignment C a u) (b,i) + simpa only [fibreAssignment, Equiv.apply_symm_apply, bulkSamples] using hv.symm + +@[simp] theorem orderedSourceValues_fibreAssignment (a : SelectedNonbulkSample C l) + (u : SelectedBulkSample C l) : + orderedSourceValues C.sources (2*(bulkSize k L/2)) k l (fibreAssignment C a u) = + fun j => ((u j).val : ℝ) := by + funext j + change (bulkSamples C.sources (2*(bulkSize k L/2)) k l + (fibreAssignment C a u) j.1 j.2 : ℝ) = ((u j).val : ℝ) + rw [bulkSamples_fibreAssignment] + +end Ostmann.Arithmetic.HistoryBulkFibreSourceMean + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTerm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..bd0c33323d106795ce6bd4229ce4b13024002ccc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTerm.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermConverse +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermSupported + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryPairSmoothXi HistoryGiantReferenceMean +open HistoryRepresentativeSourceSeparation + +theorem sourceIntegrand_eq_referenceTerm + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (x₀ x : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) (hle : l≤K) + (hfixed : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l c≠0) (he : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) + (hp : 0 ⟨hprime q hq,houtfreq q hq⟩) + (by simpa only [giantState,sourceState,Int.toNat_natCast,assignedHistory,assignedRoot] using hs) + (by simpa only [giantState,sourceState,Int.toNat_natCast,assignedHistory,assignedRoot] using ks) + apply sourceIntegrand_eq_referenceTerm C V outside l K σ x₀ x s t gp gm c e hs ks + b sw X tb td G Jmul P Q hsep hle hfixed hx hc he hfreq hp hq ?_ hprime houtfreq + simpa only [giantState,sourceState,Int.toNat_natCast,assignedHistory,assignedRoot] using had + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..10e82f47c892396875a935aadded83e08d42831b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermBasic.lean @@ -0,0 +1,47 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsActualSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceMeanLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedSpectatorDiagramActual + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryPairSmoothXi +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates HistorySignedSpectatorCRT +open HistoryBulkResidueNormSum HistoryBulkSpectatorReferenceRaw HistoryFrequencyResidues +open HistoryGiantReferenceMean HistorySignedXiTransport + +def referenceTerm + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (x₀ x : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) : ℂ := + if (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) s P.toNat Q.toNat x).Coprime outside ∧ + (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) t P.toNat Q.toNat ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x)).Coprime outside then + Jmul P Q * (((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c).compensationProduct:ℂ)*((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e).compensationProduct:ℂ)) * + orderedSourceIndicatorB C.sources (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e) hs ks + (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)) x P Q * + independentRTest K (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e) σ (P,Q) + (sourceBulkUnits ((pairedFrequencyProduct (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e))^(K+2)) C.sources (2*(bulkSize k L/2)) k l x) * + residuePairSpectator (residueTransform d) outside outside.prod (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s P.toNat Q.toNat x c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t P.toNat Q.toNat ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x) e) (P,Q) * + pairedRealXi b sw X tb td G (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e) hs ks + (insertOrderedGiants (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e) hs + (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)) + (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l x) + (fun a => if a then (Q:ℝ) else (P:ℝ))) + else 0 + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermConverse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermConverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..1d50c7d80118c9b88f9c0aad5f2bb3c315996d74 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermConverse.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermBasic + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryPairSmoothXi +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates HistorySignedSpectatorCRT +open HistoryBulkResidueNormSum HistoryBulkSpectatorReferenceRaw HistoryFrequencyResidues +open HistoryBulkReferenceTestsActual HistorySignedSpectatorDiagram + +theorem supported_of_referenceTerm_ne_zero + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (x₀ x : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) (hle : l≤K) + (hfixed : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l c≠0) (he : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) + (hp : 0 (z:ZMod N)) hpI + have hqc (N : ℕ) : (Q.toNat:ZMod N)=(Q:ZMod N) := by + simpa only [Int.cast_natCast] using congrArg (fun z:ℤ => (z:ZMod N)) hqI + apply inserted_pair_supported_of_actual_finite_tests C V outside l K σ x₀ x s t gp gm + P.toNat Q.toNat c e hs ks b sw X tb td G hsep hle hfixed hx hc he hfreq + (by omega) (by omega) hroot.1 hroot.2 + ?_ ?_ ?_ (residueTransform d) hprime (fun q _ => actual_residueTransform_zero d q) houtfreq ?_ + · simpa only [hpI,hqI] using hB + · simpa only [hpR,hqR] using hXi + · simpa only [hpc,hqc] using hR + · simpa only [hpc,hqc] using hD + · exact False.elim (hz rfl) + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3623eb23ff2bc495ecdb7323939332c63bb9e57 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermSelected.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermActual + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm +open Construction Conclusion Filter Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryGiantReferenceMean + +def SelectedReferenceEquality {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) : Prop := + let m := 2*(bulkSize k L/2) + let seed := Template.initial m k + let V := frequencyBound Bs BD Bz k L + ∀ (outside : List ℕ) (l K : ℕ), l≤K → l≤k → + ∀ (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x₀ x : SourceAssignment C.sources (Template.current seed l)) + (s t : ℤ) (gp gm : ℕ) (c e : HistoryChoices C.sources seed V l), + let perm := leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk + (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ + let H := assignedHistory C.sources seed V l s gp gm x₀ c + let J := assignedHistory C.sources seed V l t gp gm (perm x₀) e + ∀ (hs : H.Supported V outside) (ks : J.Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ), + (∀i : Fin (Template.current seed l).length, + ((Template.current seed l).get i).role≠.bulk → (x i).val=(x₀ i).val) → + (assignmentPrior C.sources (Template.current seed l)).mass x₀≠0 → + (assignmentPrior C.sources (Template.current seed l)).mass x≠0 → + choicesMass C.sources seed V l c≠0 → choicesMass C.sources seed V l e≠0 → + 0

hfreq j (hj.trans hl)) hp hq hprime + intro q hq j hj + obtain ⟨p,rfl⟩ := houtside q hq + exact houtfreq p j (hj.trans hl) + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermSupported.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermSupported.lean new file mode 100644 index 0000000000000000000000000000000000000000..ecdfa398988d9c4657e6017464a2fe4deace68d6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTermSupported.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTermBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceForwardBActual +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceForwardRSource + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryPairSmoothXi HistoryBulkReferenceTests +open HistoryBulkReferenceScalarCoordinates HistorySignedSpectatorCRT HistoryGiantReferenceMean +open HistoryBulkResidueNormSum HistoryBulkSpectatorReferenceRaw HistoryFrequencyResidues +open HistoryRepresentativeSourceSeparation HistoryBulkReferenceForwardB HistoryBulkReferenceForwardR + +theorem sourceIntegrand_eq_referenceTerm_of_supported + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (x₀ x : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) (hle : l≤K) + (hfixed : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l c≠0) (he : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) + (hp : 0≤P) (hq : 0≤Q) (had : PairAdmissible (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x₀) e) outside) + (hn : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s P.toNat Q.toNat x c).Supported V outside) (kn : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t P.toNat Q.toNat ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x) e).Supported V outside) : + sourceIntegrand d C.sources (Template.initial (2*(bulkSize k L/2)) k) V outside l + (sourceState C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) x s) (sourceState C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x) t) + c e Jmul b sw X tb td G P Q = + referenceTerm C V outside l K σ x₀ x s t gp gm c e hs ks b sw X tb td G Jmul P Q := by + have hroot : (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) s P.toNat Q.toNat x).Coprime outside ∧ + (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) t P.toNat Q.toNat ((leafBulkAssignmentPermutation (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) x)).Coprime outside := by + simpa only [assignedHistory,decodeHistory_root] using + And.intro (History.supported_root_coprime hn) (History.supported_root_coprime kn) + have hB := actual_orderedSourceIndicatorB_eq_one_of_supported C hsep V l s t gp gm P.toNat Q.toNat + x₀ x (leafBulkPermutation (2*(bulkSize k L/2)) k l σ) (leafBulkPermutation_source (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) c e hs ks hn kn hfixed hx hc he hfreq + have hR := source_independentRTest_eq_one_of_supported K (bulkSize k L/2) k l C.bulk + (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) V outside + σ x₀ x s t gp gm P.toNat Q.toNat c e hfixed hs ks hn kn hx hc he hfreq hle + simp only [Int.toNat_of_nonneg hp,Int.toNat_of_nonneg hq] at hB + have hpc (N : ℕ) : (P.toNat:ZMod N)=(P:ZMod N) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hp] + have hqc (N : ℕ) : (Q.toNat:ZMod N)=(Q:ZMod N) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hq] + simp only [hpc,hqc] at hR + unfold referenceTerm + simp only [leafBulkAssignmentPermutation] at hroot + erw [ite_eq_left hroot,hB,hR,mul_one,mul_one] + exact HistoryBulkFixedReferenceTransport.integer_sourceIntegrand_residue_transport + C.sources (2*(bulkSize k L/2)) k V outside l s t gp gm P Q x₀ x (leafBulkPermutation (2*(bulkSize k L/2)) k l σ) (leafBulkPermutation_source (bulkSize k L/2) k l C.bulk (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) σ) c e + d hp hq had hs ks hn kn hfixed Jmul b sw X tb td G + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..8491f4b0455d00bdd4ba020505e98c809739e01d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransport.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportFactors +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportInteger + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates +open HistorySignedXiTransport HistoryGiantReferenceMean HistorySignedSpectatorCRT +open HistoryRepresentativeSourceSeparation + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm : ℕ) (P Q : ℤ) + (x₀ x : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hπ : ∀i, sources ((Template.current (Template.initial m k₀) l).get (π i)).origin = + sources ((Template.current (Template.initial m k₀) l).get i).origin) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +local notation "T" => Template.current (Template.initial m k₀) l +local notation "H₀" => assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c +local notation "K₀" => assignedHistory sources (Template.initial m k₀) V l t gp gm + (sourceAssignmentPermutation sources T π hπ x₀) e +local notation "H₁" => assignedHistory sources (Template.initial m k₀) V l s P.toNat Q.toNat x c +local notation "K₁" => assignedHistory sources (Template.initial m k₀) V l t P.toNat Q.toNat + (sourceAssignmentPermutation sources T π hπ x) e + +theorem integer_sourceIntegrand_residue_transport (d : Decomposition) (hP : 0≤P) (hQ : 0≤Q) + (had : PairAdmissible H₀ K₀ outside) + (hs : (H₀).Supported V outside) (ks : (K₀).Supported V outside) + (hs' : (H₁).Supported V outside) (ks' : (K₁).Supported V outside) + (hfixed : ∀i : Fin (T).length, ((T).get i).role≠.bulk → (x i).val=(x₀ i).val) + (J : ℤ→ℤ→ℂ) (bc sc : ℕ) (X tb td G : ℝ) : + sourceIntegrand d sources (Template.initial m k₀) V outside l + (sourceState sources T x s) + (sourceState sources T (sourceAssignmentPermutation sources T π hπ x) t) + c e J bc sc X tb td G P Q = + J P Q * (((H₀).compensationProduct:ℂ)*((K₀).compensationProduct:ℂ))* + residuePairSpectator (residueTransform d) outside outside.prod H₁ K₁ (P,Q)* + pairedRealXi bc sc X tb td G H₀ K₀ hs ks + (insertOrderedGiants m k₀ H₀ K₀ hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (Q:ℝ) else (P:ℝ))) := by + rw [integer_sourceIntegrand_transport sources m k₀ V outside l s t gp gm P Q + x₀ x π hπ c e d hP hQ hs ks hs' ks' hfixed J bc sc X tb td G] + have hd := assigned_pair_leafProduct_eq_residue_of_reference sources + (Template.initial m k₀) V outside l s t gp gm P.toNat Q.toNat + x₀ (sourceAssignmentPermutation sources T π hπ x₀) + x (sourceAssignmentPermutation sources T π hπ x) c e had hs' ks' (residueTransform d) + have hPD : (P.toNat:ZMod outside.prod)=(P:ZMod outside.prod) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hP] + have hQD : (Q.toNat:ZMod outside.prod)=(Q:ZMod outside.prod) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hQ] + rw [hPD,hQD] at hd + rw [hd] + exact mul_right_comm _ _ _ + +end Pair +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportFactors.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportFactors.lean new file mode 100644 index 0000000000000000000000000000000000000000..501cc75316cb2c69ffbd4ecca5c0ade289f83c32 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportFactors.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportFactorsBasic + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped ComplexConjugate +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +open Construction HistoryPairBulkTransport HistorySignedDecode HistorySignedResidues +open HistorySignedSpectatorCRT HistoryRepresentativeSourceSeparation + +theorem assigned_frequencies_eq (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (l : ℕ) (s : ℤ) (gp gm gp' gm' : ℕ) + (x₀ x : SourceAssignment sources (Template.current seed l)) + (c : HistoryChoices sources seed V l) : + (assignedHistory sources seed V l s gp gm x₀ c).frequencies= + (assignedHistory sources seed V l s gp' gm' x c).frequencies := + decoded_frequencies_eq sources seed V l _ _ c rfl + +theorem assigned_pair_leafProduct_eq_residue_of_reference + (sources : SourceFamily) (seed : List SourceSlot) (V : ℕ→ℕ) + (outside : List ℕ) (l : ℕ) (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ y₀ x y : SourceAssignment sources (Template.current seed l)) + (c e : HistoryChoices sources seed V l) + (had : PairAdmissible (assignedHistory sources seed V l s gp gm x₀ c) + (assignedHistory sources seed V l t gp gm y₀ e) outside) + (hs : (assignedHistory sources seed V l s gp' gm' x c).Supported V outside) + (ks : (assignedHistory sources seed V l t gp' gm' y e).Supported V outside) + (g : (q:ℕ)→ZMod q→ℂ) : + (assignedHistory sources seed V l s gp' gm' x c).leafProduct (Construction.spectatorFactor g outside)* + conj ((assignedHistory sources seed V l t gp' gm' y e).leafProduct (Construction.spectatorFactor g outside))= + residuePairSpectator g outside outside.prod + (assignedHistory sources seed V l s gp' gm' x c) + (assignedHistory sources seed V l t gp' gm' y e) (gp',gm') := by + apply assigned_pair_leafProduct_eq_residue sources seed V outside l s t gp' gm' x y c e hs ks _ g + intro u hu + rw [←assigned_frequencies_eq sources seed V l s gp gm gp' gm' x₀ x c, + ←assigned_frequencies_eq sources seed V l t gp gm gp' gm' y₀ y e] at hu + have hc : Nat.Coprime + (FrequencyPrecision.product ((assignedHistory sources seed V l s gp gm x₀ c).frequencies++ + (assignedHistory sources seed V l t gp gm y₀ e).frequencies)) outside.prod := by + simpa only [pow_one] using (had.2.2.2 1).2.2.2.1.symm + exact hc.of_dvd_left (FrequencyPrecision.frequency_dvd_product hu) + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportFactorsBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportFactorsBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d381f05e50a77740147a6f4cd688f5c43144550a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportFactorsBasic.lean @@ -0,0 +1,96 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkTransportAssigned +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedDecodeSupportedIntegral +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedSpectatorCRT +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedXiTransportBasic + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped ComplexConjugate +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +open Construction HistoryPairBulkTransport HistorySignedDecode HistorySignedResidues +open HistorySignedSpectatorCRT HistorySignedXiTransport + +theorem assigned_compensationProduct_eq (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (l : ℕ) (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ x : SourceAssignment sources (Template.current seed l)) + (c : HistoryChoices sources seed V l) : + (assignedHistory sources seed V l s gp gm x₀ c).compensationProduct= + (assignedHistory sources seed V l t gp' gm' x c).compensationProduct := + decoded_compensationProduct_eq sources seed V l _ _ c + +theorem decoded_frequencies_eq (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (l : ℕ) (a b : State) (c : HistoryChoices sources seed V l) + (hf : a.frequency=b.frequency) : + (decodeHistory sources seed V l a c).frequencies= + (decodeHistory sources seed V l b c).frequencies := by + induction l generalizing a b with + | zero => simpa only [decodeHistory,History.frequencies] using congrArg (fun s=>[s]) hf + | succ l ih => + simp only [decodeHistory,History.frequencies] + apply congrArg₂ List.cons hf + exact congrArg₂ List.append (ih _ _ c.2.2.2.1 rfl) (ih _ _ c.2.2.2.2 rfl) + +theorem decoded_rebuild_positiveIntegral (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (a : State) + (c : HistoryChoices sources seed V l) + (hs : (decodeHistory sources seed V l a c).Supported V outside) : + (rebuild (decodeHistory sources seed V l a c) a.giantPlus a.giantMinus).PositiveIntegral := by + simpa only [rebuild_decodeHistory,SignedState.ofState] using + signedDecode_ofState_positiveIntegral_of_supported sources seed V l a c outside hs + +theorem decoded_rebuild_toHistory (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (a : State) + (c : HistoryChoices sources seed V l) + (hs : (decodeHistory sources seed V l a c).Supported V outside) : + (rebuild (decodeHistory sources seed V l a c) a.giantPlus a.giantMinus).toHistory= + decodeHistory sources seed V l a c := by + simpa only [rebuild_decodeHistory,SignedState.ofState] using + signedDecode_ofState_toHistory_of_supported sources seed V l a c outside hs + +theorem decoded_leafProduct_eq_residue (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (a : State) + (c : HistoryChoices sources seed V l) + (hs : (decodeHistory sources seed V l a c).Supported V outside) + (hf : ∀s∈(decodeHistory sources seed V l a c).frequencies,Nat.Coprime s.natAbs outside.prod) + (g : (q:ℕ)→ZMod q→ℂ) : + (decodeHistory sources seed V l a c).leafProduct (Construction.spectatorFactor g outside)= + residueSpectator g outside outside.prod (decodeHistory sources seed V l a c) + a.giantPlus a.giantMinus := by + let h := decodeHistory sources seed V l a c + have hi := decoded_rebuild_positiveIntegral sources seed V outside l a c hs + have he := residueSpectator_intCast h g outside (divisorProduct h) outside.prod + (fun q hq=>List.dvd_prod hq) (divisorData_actual h hs) + (divisorProduct_coprime_outside h hs hf) a.giantPlus a.giantMinus hi.integralGuard + rw [HistorySignedSpectator.spectatorProduct_eq_projection g outside _ hi.nonnegative, + decoded_rebuild_toHistory sources seed V outside l a c hs] at he + simpa only [Int.cast_natCast] using he.symm + +theorem assigned_pair_leafProduct_eq_residue (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (s t : ℤ) (gp gm : ℕ) + (x y : SourceAssignment sources (Template.current seed l)) + (c e : HistoryChoices sources seed V l) + (hs : (assignedHistory sources seed V l s gp gm x c).Supported V outside) + (ks : (assignedHistory sources seed V l t gp gm y e).Supported V outside) + (hf : ∀u∈(assignedHistory sources seed V l s gp gm x c).frequencies++ + (assignedHistory sources seed V l t gp gm y e).frequencies,Nat.Coprime u.natAbs outside.prod) + (g : (q:ℕ)→ZMod q→ℂ) : + (assignedHistory sources seed V l s gp gm x c).leafProduct (Construction.spectatorFactor g outside)* + conj ((assignedHistory sources seed V l t gp gm y e).leafProduct (Construction.spectatorFactor g outside))= + residuePairSpectator g outside outside.prod + (assignedHistory sources seed V l s gp gm x c) + (assignedHistory sources seed V l t gp gm y e) (gp,gm) := by + rw [residuePairSpectator] + exact congrArg₂ (fun a b : ℂ=>a*conj b) + (decoded_leafProduct_eq_residue sources seed V outside l _ c hs + (fun u hu=>hf u (List.mem_append_left _ hu)) g) + (decoded_leafProduct_eq_residue sources seed V outside l _ e ks + (fun u hu=>hf u (List.mem_append_right _ hu)) g) + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportInteger.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportInteger.lean new file mode 100644 index 0000000000000000000000000000000000000000..0a6e85551ddd12d22968c988fd8cb02bf3f383b5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportInteger.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportPair + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped ComplexConjugate +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates +open HistorySignedXiTransport HistoryGiantReferenceMean + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm : ℕ) (P Q : ℤ) + (x₀ x : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hπ : ∀i, sources ((Template.current (Template.initial m k₀) l).get (π i)).origin = + sources ((Template.current (Template.initial m k₀) l).get i).origin) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +local notation "T" => Template.current (Template.initial m k₀) l +local notation "H₀" => assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c +local notation "K₀" => assignedHistory sources (Template.initial m k₀) V l t gp gm + (sourceAssignmentPermutation sources T π hπ x₀) e +local notation "H₁" => assignedHistory sources (Template.initial m k₀) V l s P.toNat Q.toNat x c +local notation "K₁" => assignedHistory sources (Template.initial m k₀) V l t P.toNat Q.toNat + (sourceAssignmentPermutation sources T π hπ x) e + +theorem integer_sourceIntegrand_transport (d : Decomposition) (hP : 0≤P) (hQ : 0≤Q) + (hs : (H₀).Supported V outside) (ks : (K₀).Supported V outside) + (hs' : (H₁).Supported V outside) (ks' : (K₁).Supported V outside) + (hfixed : ∀i : Fin (T).length, ((T).get i).role≠.bulk → (x i).val=(x₀ i).val) + (J : ℤ→ℤ→ℂ) (bc sc : ℕ) (X tb td G : ℝ) : + sourceIntegrand d sources (Template.initial m k₀) V outside l + (sourceState sources T x s) + (sourceState sources T (sourceAssignmentPermutation sources T π hπ x) t) + c e J bc sc X tb td G P Q = + J P Q * (((H₀).compensationProduct:ℂ)*((K₀).compensationProduct:ℂ))* + pairedRealXi bc sc X tb td G H₀ K₀ hs ks + (insertOrderedGiants m k₀ H₀ K₀ hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (Q:ℝ) else (P:ℝ)))* + ((H₁).leafProduct (spectatorFactor (residueTransform d) outside)* + conj ((K₁).leafProduct (spectatorFactor (residueTransform d) outside))) := by + have h := assigned_sourceIntegrand_transport sources m k₀ V outside l s t + gp gm P.toNat Q.toNat x₀ x π hπ c e d hs ks hs' ks' hfixed J bc sc X tb td G + have hPr : (P.toNat:ℝ)=(P:ℝ) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hP] + have hQr : (Q.toNat:ℝ)=(Q:ℝ) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hQ] + simpa only [Int.toNat_of_nonneg hP,Int.toNat_of_nonneg hQ,hPr,hQr] using h + +end Pair +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportPair.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..7130a3519c5d383eb314ffe66faf741585e6cd21 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportPair.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportScalar +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceMeanLaws + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped ComplexConjugate +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates +open HistorySignedXiTransport HistoryGiantReferenceMean + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ x : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hπ : ∀i, sources ((Template.current (Template.initial m k₀) l).get (π i)).origin = + sources ((Template.current (Template.initial m k₀) l).get i).origin) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +local notation "T" => Template.current (Template.initial m k₀) l +local notation "H₀" => assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c +local notation "K₀" => assignedHistory sources (Template.initial m k₀) V l t gp gm + (sourceAssignmentPermutation sources T π hπ x₀) e +local notation "H₁" => assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c +local notation "K₁" => assignedHistory sources (Template.initial m k₀) V l t gp' gm' + (sourceAssignmentPermutation sources T π hπ x) e + +theorem assigned_supportedPair_transport (d : Decomposition) + (hs : (H₀).Supported V outside) (ks : (K₀).Supported V outside) + (hs' : (H₁).Supported V outside) (ks' : (K₁).Supported V outside) + (hfixed : ∀i : Fin (T).length, ((T).get i).role≠.bulk → (x i).val=(x₀ i).val) + (bc sc : ℕ) (X tb td G : ℝ) : + supportedHistoryPairXi d V outside bc sc X tb td G H₁ K₁ = + (((H₀).compensationProduct:ℂ)*((K₀).compensationProduct:ℂ))* + pairedRealXi bc sc X tb td G H₀ K₀ hs ks + (insertOrderedGiants m k₀ H₀ K₀ hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (gm':ℝ) else (gp':ℝ)))* + ((H₁).leafProduct (spectatorFactor (residueTransform d) outside)* + conj ((K₁).leafProduct (spectatorFactor (residueTransform d) outside))) := by + rw [supportedHistoryPairXi,dite_eq_left hs',dite_eq_left ks', + ←assigned_pairedRealXi_insertOrderedGiants sources m k₀ V outside l s t + gp gm gp' gm' x₀ x π hπ c e hs ks hs' ks' hfixed bc sc X tb td G] + have hh : (H₁).compensationProduct=(H₀).compensationProduct := + decoded_compensationProduct_eq sources (Template.initial m k₀) V l _ _ c + have hk : (K₁).compensationProduct=(K₀).compensationProduct := + decoded_compensationProduct_eq sources (Template.initial m k₀) V l _ _ e + rw [hh,hk] + +theorem assigned_sourceIntegrand_transport (d : Decomposition) + (hs : (H₀).Supported V outside) (ks : (K₀).Supported V outside) + (hs' : (H₁).Supported V outside) (ks' : (K₁).Supported V outside) + (hfixed : ∀i : Fin (T).length, ((T).get i).role≠.bulk → (x i).val=(x₀ i).val) + (J : ℤ→ℤ→ℂ) (bc sc : ℕ) (X tb td G : ℝ) : + sourceIntegrand d sources (Template.initial m k₀) V outside l + (sourceState sources T x s) + (sourceState sources T (sourceAssignmentPermutation sources T π hπ x) t) + c e J bc sc X tb td G gp' gm' = + J gp' gm' * (((H₀).compensationProduct:ℂ)*((K₀).compensationProduct:ℂ))* + pairedRealXi bc sc X tb td G H₀ K₀ hs ks + (insertOrderedGiants m k₀ H₀ K₀ hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (gm':ℝ) else (gp':ℝ)))* + ((H₁).leafProduct (spectatorFactor (residueTransform d) outside)* + conj ((K₁).leafProduct (spectatorFactor (residueTransform d) outside))) := by + change J gp' gm' * supportedHistoryPairXi d V outside bc sc X tb td G H₁ K₁ = _ + rw [assigned_supportedPair_transport sources m k₀ V outside l s t + gp gm gp' gm' x₀ x π hπ c e d hs ks hs' ks' hfixed bc sc X tb td G] + simp only [mul_assoc] + +end Pair +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportScalar.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..a0d12ae1b23cae5fe6da0e2aea3890d229ddb4cd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportScalar.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportScalarBasic + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ x : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hπ : ∀i, sources ((Template.current (Template.initial m k₀) l).get (π i)).origin = + sources ((Template.current (Template.initial m k₀) l).get i).origin) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +local notation "T" => Template.current (Template.initial m k₀) l +local notation "H₀" => assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c +local notation "K₀" => assignedHistory sources (Template.initial m k₀) V l t gp gm + (sourceAssignmentPermutation sources T π hπ x₀) e +local notation "H₁" => assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c +local notation "K₁" => assignedHistory sources (Template.initial m k₀) V l t gp' gm' + (sourceAssignmentPermutation sources T π hπ x) e + +theorem assigned_pairedRealXi_insertOrderedGiants + (hs : (H₀).Supported V outside) (ks : (K₀).Supported V outside) + (hs' : (H₁).Supported V outside) (ks' : (K₁).Supported V outside) + (hfixed : ∀i : Fin (T).length, ((T).get i).role≠.bulk → (x i).val=(x₀ i).val) + (bc sc : ℕ) (X tb td G : ℝ) : + pairedRealXi bc sc X tb td G H₀ K₀ hs ks + (insertOrderedGiants m k₀ H₀ K₀ hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (gm':ℝ) else (gp':ℝ))) = + pairedRealXi bc sc X tb td G H₁ K₁ hs' ks' + (fun i => (pairSample H₁ K₁ i:ℝ)) := by + have hr : RootGiantsAgree H₁ K₁ := by + simp [RootGiantsAgree,assignedHistory,decodeHistory_root,assignedRoot] + simp only [pairedRealXi,actualRealXi,leftMap_sample,rightMap_sample H₁ K₁ hr] + apply congrArg₂ (fun a b : ℂ => a * star b) + · apply assigned_scalar_transport sources (Template.initial m k₀) V outside l s gp gm gp' gm' + x₀ x c hs hs' bc sc X tb td G + intro i + simpa only [Int.cast_natCast] using + insertOrderedGiants_left_coordinate sources m k₀ V l s gp gm gp' gm' + x₀ x c K₀ hs hfixed gp' gm' i + · apply assigned_scalar_transport sources (Template.initial m k₀) V outside l t gp gm gp' gm' + (sourceAssignmentPermutation sources T π hπ x₀) + (sourceAssignmentPermutation sources T π hπ x) e ks ks' bc sc X tb td G + intro i + simpa only [Int.cast_natCast] using + insertOrderedGiants_right_coordinate sources m k₀ V l s t gp gm gp' gm' + x₀ x π hπ c e hs hfixed gp' gm' i + +end Pair +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportScalarBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportScalarBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..53fae2dcb0ecb35f528656d6262ef8be3e2e95d7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFixedReferenceTransportScalarBasic.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceScalarCoordinatesRight +import OAI.NumberTheory.Ostmann.Construction.CanonicalOccurrenceTransportScalar + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates + +theorem newSourceSample_assigned_actual (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (l : ℕ) (s : ℤ) (gp gm : ℕ) + (x : SourceAssignment sources (Template.current seed l)) + (c : HistoryChoices sources seed V l) (i : Coordinate seed l) : + (newSourceSample sources seed V l (assignedRoot sources _ s gp gm x) c + (assignedRoot_matches sources _ s gp gm x) gp gm i : ℝ) = + (coordinateSample seed (assignedHistory sources seed V l s gp gm x c) + (assignedLabels sources seed V l s gp gm x c) i : ℝ) := by + rcases i with t | i | i + · cases t <;> simp only [newSourceSample_plus,newSourceSample_minus, + coordinateSample_giant,assignedHistory,decodeHistory_root,assignedRoot, + Bool.false_eq_true,↓reduceIte,Rat.cast_natCast,Int.cast_natCast] + · rw [newSourceSample_assigned_root,assigned_root_sample] + simp only [Rat.cast_natCast,Int.cast_natCast] + · rw [newSourceSample_internal] + change ((historyDraws sources seed V l c i).val:ℝ) = + (coordinateSample seed (decodeHistory sources seed V l + (assignedRoot sources _ s gp gm x) c) + (decoded_tree_source_labels sources seed V l + (assignedRoot sources _ s gp gm x) c + (assignedRoot_matches sources _ s gp gm x)) (.inr (.inr i)) : ℝ) + rw [decoded_coordinateSample_internal sources seed V l + (assignedRoot sources _ s gp gm x) c + (assignedRoot_matches sources _ s gp gm x) i,Int.cast_natCast] + +theorem assigned_scalar_transport (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) (s : ℤ) (gp gm gp' gm' : ℕ) + (x₀ x : SourceAssignment sources (Template.current seed l)) + (c : HistoryChoices sources seed V l) + (hs : (assignedHistory sources seed V l s gp gm x₀ c).Supported V outside) + (hs' : (assignedHistory sources seed V l s gp' gm' x c).Supported V outside) + (bc sc : ℕ) (X tb td G : ℝ) + (y : Key (assignedHistory sources seed V l s gp gm x₀ c) → ℝ) + (hy : ∀i, y (decodedCoordinateEquiv sources seed V l + (assignedRoot sources _ s gp gm x₀) c (assignedRoot_matches sources _ s gp gm x₀) i) = + (newSourceSample sources seed V l (assignedRoot sources _ s gp' gm' x) c + (assignedRoot_matches sources _ s gp' gm' x) gp' gm' i:ℝ)) : + actualRealHistoryScalar bc sc X tb td G outside + (assignedHistory sources seed V l s gp gm x₀ c) hs y = + actualRealHistoryScalar bc sc X tb td G outside + (assignedHistory sources seed V l s gp' gm' x c) hs' + (fun i => (integerSample (assignedHistory sources seed V l s gp' gm' x c) i:ℝ)) := by + apply actualRealHistoryScalar_eq_of_coordinates seed _ _ hs hs' + (assignedLabels sources seed V l s gp gm x₀ c) + (assignedLabels sources seed V l s gp' gm' x c) + (decoded_plan_eq sources seed V outside l _ _ c c + (assignedRoot_matches sources _ s gp gm x₀) + (assignedRoot_matches sources _ s gp' gm' x) rfl rfl hs hs') + intro i + exact (hy i).trans (newSourceSample_assigned_actual sources seed V l s gp' gm' x c i) + +end Ostmann.Arithmetic.HistoryBulkFixedReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..da42ac2d6fa229e5303e74dd9d4544f8c7fa275a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransport.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFrequencyTransportIndicator + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFrequencyTransport +open Construction HistoryBulkDiagramParameters HistoryFrequencyResidues +open HistorySignedResidueFactorization HistoryPairedFrequencyAverage + +theorem pairedIndicator_decode_eq_reference (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ → ℕ) (l : ℕ) (a b a' b' : State) + (c c' : HistoryChoices sources seed V l) + (hf : a.frequency=b.frequency) (hf' : a'.frequency=b'.frequency) + (hab : a.small.map eraseBulkValue=b.small.map eraseBulkValue) + (hab' : a'.small.map eraseBulkValue=b'.small.map eraseBulkValue) (K : ℕ) : + let h := decodeHistory sources seed V l a c + let g := decodeHistory sources seed V l b c + let h' := decodeHistory sources seed V l a' c' + let g' := decodeHistory sources seed V l b' c' + ∃ hR : pairedFrequencyProduct h h'=pairedFrequencyProduct g g', + ∀ z : ZMod ((pairedFrequencyProduct g g')^(K+2)) × + ZMod ((pairedFrequencyProduct g g')^(K+2)), + pairedFrequencyResidueIndicator K h h' (residuePairTransport K hR z)= + leafIndicator K (pairedFrequencyProduct g g') (frequencySchedule g g') + (fixedFactorSchedule g g') g g' [] + (l,initialResidueGiants K (pairedFrequencyProduct g g') z, + initialResidueGiants K (pairedFrequencyProduct g g') z) + (frequencyLeaves ((pairedFrequencyProduct g g')^(K+2)) h) := by + dsimp only + have ha := sameFrequencyData_decode sources seed V l a b c hf hab + have hb := sameFrequencyData_decode sources seed V l a' b' c' hf' hab' + refine ⟨pairedFrequencyProduct_eq ha hb, ?_⟩ + intro z + exact pairedIndicator_eq_reference ha hb K z + +theorem pairedIndicator_assigned_eq_reference (sources : SourceFamily) + (seed : List SourceSlot) (V : ℕ → ℕ) (l : ℕ) + (x y : SourceAssignment sources (Template.current seed l)) + (hxy : ∀i : Fin (Template.current seed l).length, + (Template.current seed l)[i].role≠.bulk → (x i : ℕ)=(y i : ℕ)) + (s t : ℤ) (Gp Gm Gp' Gm' : ℕ) (c c' : HistoryChoices sources seed V l) (K : ℕ) : + let a : State := ⟨s,Gp,Gm,assignedSlots sources (Template.current seed l) x⟩ + let b : State := ⟨s,Gp',Gm',assignedSlots sources (Template.current seed l) y⟩ + let a' : State := ⟨t,Gp,Gm,assignedSlots sources (Template.current seed l) x⟩ + let b' : State := ⟨t,Gp',Gm',assignedSlots sources (Template.current seed l) y⟩ + let h := decodeHistory sources seed V l a c + let g := decodeHistory sources seed V l b c + let h' := decodeHistory sources seed V l a' c' + let g' := decodeHistory sources seed V l b' c' + ∃ hR : pairedFrequencyProduct h h'=pairedFrequencyProduct g g', + ∀ z : ZMod ((pairedFrequencyProduct g g')^(K+2)) × + ZMod ((pairedFrequencyProduct g g')^(K+2)), + pairedFrequencyResidueIndicator K h h' (residuePairTransport K hR z)= + leafIndicator K (pairedFrequencyProduct g g') (frequencySchedule g g') + (fixedFactorSchedule g g') g g' [] + (l,initialResidueGiants K (pairedFrequencyProduct g g') z, + initialResidueGiants K (pairedFrequencyProduct g g') z) + (frequencyLeaves ((pairedFrequencyProduct g g')^(K+2)) h) := by + dsimp only + exact pairedIndicator_decode_eq_reference sources seed V l + ⟨s,Gp,Gm,assignedSlots sources (Template.current seed l) x⟩ + ⟨s,Gp',Gm',assignedSlots sources (Template.current seed l) y⟩ + ⟨t,Gp,Gm,assignedSlots sources (Template.current seed l) x⟩ + ⟨t,Gp',Gm',assignedSlots sources (Template.current seed l) y⟩ c c' rfl rfl + (assignedSlots_erase_eq sources (Template.current seed l) x y hxy) + (assignedSlots_erase_eq sources (Template.current seed l) x y hxy) K + +end Ostmann.Arithmetic.HistoryBulkFrequencyTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e8dab178c0d778e3d8bfa953e8a17ca74113e84 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportBasic.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkDiagramParametersBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryFrequencyRealizationMetadata + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFrequencyTransport +open Construction HistoryBulkProducts HistoryBulkDiagramParameters HistoryFrequencyResidues + +def SameFrequencyData : {l : ℕ} → History l → History l → Prop + | _, .leaf a, .leaf b => a.frequency=b.frequency + | _, .node a _ u hp hm left right, .node b _ u' hp' hm' left' right' => + a.frequency=b.frequency ∧ fixedProduct hp=fixedProduct hp' ∧ + fixedProduct hm=fixedProduct hm' ∧ (u.map SmallSlot.value).prod=(u'.map SmallSlot.value).prod ∧ + SameFrequencyData left left' ∧ SameFrequencyData right right' + +theorem SameFrequencyData.root_frequency_eq {l : ℕ} {h g : History l} + (hfg : SameFrequencyData h g) : h.root.frequency=g.root.frequency := by + cases h <;> cases g + · exact hfg + · exact hfg.1 + +theorem SameFrequencyData.frequencies_eq {l : ℕ} {h g : History l} + (hfg : SameFrequencyData h g) : h.frequencies=g.frequencies := by + induction h with + | leaf a => cases g with | leaf b => simpa [History.frequencies,SameFrequencyData] using hfg + | node a p u hp hm left right il ir => + cases g with + | node b p' u' hp' hm' left' right' => + simp only [History.frequencies, hfg.1, il hfg.2.2.2.2.1, ir hfg.2.2.2.2.2] + +theorem sameFrequencyData_decode (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ → ℕ) (l : ℕ) (a b : State) (c : HistoryChoices sources seed V l) + (hf : a.frequency=b.frequency) + (hab : a.small.map eraseBulkValue=b.small.map eraseBulkValue) : + SameFrequencyData (decodeHistory sources seed V l a c) + (decodeHistory sources seed V l b c) := by + induction l generalizing a b with + | zero => exact hf + | succ l ih => + let T := Template.current seed l + let n := (Template.remainder (l+1) T).length + let u := assignedSlots sources (Template.extracted (l+1) T) c.2.2.1 + simp only [decodeHistory, SameFrequencyData] + refine ⟨hf, fixedProduct_eq_of_erase_eq (erase_take_eq hab n), + fixedProduct_eq_of_erase_eq (erase_drop_eq hab n), by trivial, ?_, ?_⟩ + · exact ih _ _ _ rfl (erase_reinsert_eq (l+1) T u (erase_take_eq hab n)) + · exact ih _ _ _ rfl (erase_reinsert_eq (l+1) T u (erase_drop_eq hab n)) + +theorem pairedFrequencyProduct_eq {l : ℕ} {h g h' g' : History l} + (ha : SameFrequencyData h g) (hb : SameFrequencyData h' g') : + pairedFrequencyProduct h h'=pairedFrequencyProduct g g' := by + simp only [pairedFrequencyProduct, ha.frequencies_eq, hb.frequencies_eq] + +end Ostmann.Arithmetic.HistoryBulkFrequencyTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportIndicator.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportIndicator.lean new file mode 100644 index 0000000000000000000000000000000000000000..8980c1630b84d7b0e3114555850efeda74d25d6d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportIndicator.lean @@ -0,0 +1,67 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFrequencyTransportSchedules +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairedFrequencyAverageBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFrequencyTransport +open Construction HistoryFrequencyResidues HistorySignedResidueFactorization +open HistoryPairedFrequencyAverage Characters.FrequencyExposure + +def residuePairTransport (K : ℕ) {R S : ℕ} (h : R=S) + (z : ZMod (S^(K+2)) × ZMod (S^(K+2))) : + ZMod (R^(K+2)) × ZMod (R^(K+2)) := h.symm ▸ z + +theorem leafIndicator_eq (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) {l : ℕ} {h g h' g' : History l} + (ha : SameFrequencyData h g) (hb : SameFrequencyData h' g') + (p : List Bool) (c : PairedContext R) + (z : Characters.BinaryHaar.Leaves (ZMod (R^(K+2)))ˣ l) : + leafIndicator K R d f h h' p c z=leafIndicator K R d f g g' p c z := by + unfold leafIndicator + apply congrArg guardIndicator + exact propext (and_congr (knownPairFrequencyUnits_iff K R d f ha hb p c z) Iff.rfl) + +theorem pairedIndicator_eq_aux (K R : ℕ) {l : ℕ} (h h' : History l) + (hR : pairedFrequencyProduct h h'=R) + (hF : ∀s∈h.frequencies,s.natAbs∣R) (hF' : ∀s∈h'.frequencies,s.natAbs∣R) + (z : ZMod (R^(K+2)) × ZMod (R^(K+2))) : + pairedFrequencyResidueIndicator K h h' (residuePairTransport K hR z)= + leafIndicator K R (frequencyScheduleAux R h h' hF hF') (fixedFactorSchedule h h') h h' [] + (l,initialResidueGiants K R z,initialResidueGiants K R z) + (frequencyLeaves (R^(K+2)) h) := by + subst R + rfl + +theorem pairedIndicator_eq_reference {l : ℕ} {h g h' g' : History l} + (ha : SameFrequencyData h g) (hb : SameFrequencyData h' g') (K : ℕ) + (z : ZMod ((pairedFrequencyProduct g g')^(K+2)) × + ZMod ((pairedFrequencyProduct g g')^(K+2))) : + pairedFrequencyResidueIndicator K h h' (residuePairTransport K (pairedFrequencyProduct_eq ha hb) z)= + leafIndicator K (pairedFrequencyProduct g g') (frequencySchedule g g') + (fixedFactorSchedule g g') g g' [] + (l,initialResidueGiants K (pairedFrequencyProduct g g') z, + initialResidueGiants K (pairedFrequencyProduct g g') z) + (frequencyLeaves ((pairedFrequencyProduct g g')^(K+2)) h) := by + have hF : ∀s∈h.frequencies,s.natAbs∣pairedFrequencyProduct g g' := by + intro s hs + rw [ha.frequencies_eq] at hs + exact FrequencyPrecision.frequency_dvd_product (List.mem_append_left _ hs) + have hF' : ∀s∈h'.frequencies,s.natAbs∣pairedFrequencyProduct g g' := by + intro s hs + rw [hb.frequencies_eq] at hs + exact FrequencyPrecision.frequency_dvd_product (List.mem_append_right _ hs) + rw [pairedIndicator_eq_aux K _ h h' (pairedFrequencyProduct_eq ha hb) hF hF' z] + have hd := frequencyScheduleAux_eq (pairedFrequencyProduct g g') ha hb hF + (fun _ hs => FrequencyPrecision.frequency_dvd_product (List.mem_append_left _ hs)) hF' + (fun _ hs => FrequencyPrecision.frequency_dvd_product (List.mem_append_right _ hs)) + rw [hd, fixedFactorSchedule_eq ha hb] + exact leafIndicator_eq K _ _ _ ha hb _ _ _ + +end Ostmann.Arithmetic.HistoryBulkFrequencyTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportSchedules.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportSchedules.lean new file mode 100644 index 0000000000000000000000000000000000000000..a6f448eddf7bcd93a91757cd8752a22684709ff9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkFrequencyTransportSchedules.lean @@ -0,0 +1,85 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFrequencyTransportBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedFrequencyGuardContextDefs + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkFrequencyTransport +open Construction HistoryBulkProducts HistoryFrequencyResidues Characters.FrequencyExposure + +theorem fixedFactorSchedule_eq {l : ℕ} {h g h' g' : History l} + (ha : SameFrequencyData h g) (hb : SameFrequencyData h' g') : + fixedFactorSchedule h h'=fixedFactorSchedule g g' := by + induction h with + | leaf a => cases g; cases h'; cases g'; rfl + | node a p u hp hm left right il ir => + cases g with + | node b q v bp bm leftg rightg => + cases h' with + | node a' p' u' hp' hm' left' right' => + cases g' with + | node b' q' v' bp' bm' leftg' rightg' => + simp only [SameFrequencyData] at ha hb + simp only [fixedFactorSchedule, ha.2.1, ha.2.2.1, ha.2.2.2.1, + hb.2.1, hb.2.2.1, hb.2.2.2.1, + il ha.2.2.2.2.1 hb.2.2.2.2.1, ir ha.2.2.2.2.2 hb.2.2.2.2.2] + +theorem frequencyScheduleAux_eq (R : ℕ) {l : ℕ} {h g h' g' : History l} + (ha : SameFrequencyData h g) (hb : SameFrequencyData h' g') + (hF : ∀s∈h.frequencies,s.natAbs∣R) (gF : ∀s∈g.frequencies,s.natAbs∣R) + (hF' : ∀s∈h'.frequencies,s.natAbs∣R) (gF' : ∀s∈g'.frequencies,s.natAbs∣R) : + frequencyScheduleAux R h h' hF hF'=frequencyScheduleAux R g g' gF gF' := by + induction h with + | leaf a => + cases g with + | leaf b => + cases h' with + | leaf a' => + cases g' with + | leaf b' => + simp only [SameFrequencyData] at ha hb + simp only [frequencyScheduleAux,actualNodeData,ha,hb] + | node a p u hp hm left right il ir => + cases g with + | node b q v bp bm leftg rightg => + cases h' with + | node a' p' u' hp' hm' left' right' => + cases g' with + | node b' q' v' bp' bm' leftg' rightg' => + have hl := ha.2.2.2.2.1.root_frequency_eq + have hr := ha.2.2.2.2.2.root_frequency_eq + have hl' := hb.2.2.2.2.1.root_frequency_eq + have hr' := hb.2.2.2.2.2.root_frequency_eq + simp only [SameFrequencyData] at ha hb + simp only [frequencyScheduleAux] + congr 1 + · simp only [actualNodeData,ha.1,hb.1,hl,hr,hl',hr'] + · exact il ha.2.2.2.2.1 hb.2.2.2.2.1 _ _ _ _ + · exact ir ha.2.2.2.2.2 hb.2.2.2.2.2 _ _ _ _ + +theorem knownPairFrequencyUnits_iff (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) {l : ℕ} {h g h' g' : History l} + (ha : SameFrequencyData h g) (hb : SameFrequencyData h' g') + (p : List Bool) (c : PairedContext R) + (z : Characters.BinaryHaar.Leaves (ZMod (R^(K+2)))ˣ l) : + knownPairFrequencyUnits K R d f h h' p c z ↔ + knownPairFrequencyUnits K R d f g g' p c z := by + induction h generalizing p c with + | leaf a => + cases g; cases h'; cases g' + simp only [knownPairFrequencyUnits,ha.frequencies_eq,hb.frequencies_eq] + | node a q u hp hm left right il ir => + cases g with + | node b q' v bp bm leftg rightg => + cases h' with + | node a' r u' hp' hm' left' right' => + cases g' with + | node b' r' v' bp' bm' leftg' rightg' => + simp only [knownPairFrequencyUnits,ha.frequencies_eq,hb.frequencies_eq, + il ha.2.2.2.2.1 hb.2.2.2.2.1,ir ha.2.2.2.2.2 hb.2.2.2.2.2] + +end Ostmann.Arithmetic.HistoryBulkFrequencyTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBounds.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..906bc2bde16f79a3224ccf2adf4ee594f6c5fea5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBounds.lean @@ -0,0 +1,13 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsCutoff +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsOrder +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..203c158c5a7cf10e677d8595f328dc189e7c9d4d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsBasic.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkCoordinatesBasic + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open Construction HistoryPairPattern HistoryActiveCoordinates +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates +attribute [local instance] Classical.propDecidable +variable {l : ℕ} + +theorem giant_bulk_disjoint (h k : History l) : + Disjoint (giantCoordinates h k) (bulkCoordinates h k) := by + apply Finset.disjoint_left.mpr + intro i hi hb + obtain ⟨b,_,rfl⟩ := Finset.mem_image.mp hi + exact left_giant_not_mem h k b hb + +def jointInsert (h k : History l) {κ ι : Type*} + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (u : κ → ℝ) (x : ι → ℝ) : PairKey h k → ℝ := + HistoryActiveCoordinates.insert (bulkCoordinates h k) + (HistoryActiveCoordinates.insert (giantCoordinates h k) background (u ∘ eG.symm)) (x ∘ eB.symm) + +theorem jointInsert_commute (h k : History l) {κ ι : Type*} + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (u : κ → ℝ) (x : ι → ℝ) : + jointInsert h k eG eB background u x= + HistoryActiveCoordinates.insert (giantCoordinates h k) + (HistoryActiveCoordinates.insert (bulkCoordinates h k) background (x ∘ eB.symm)) (u ∘ eG.symm) := by + funext i + by_cases hg : i∈giantCoordinates h k + · have hb : i∉bulkCoordinates h k := fun hb => Finset.disjoint_left.mp (giant_bulk_disjoint h k) hg hb + simp only [jointInsert,HistoryActiveCoordinates.insert,dite_eq_left hg,dite_eq_right hb] + · by_cases hb : i∈bulkCoordinates h k <;> + simp only [jointInsert,HistoryActiveCoordinates.insert,dite_eq_right hg,hb,↓reduceDIte] + +@[simp] theorem jointInsert_giant (h k : History l) {κ ι : Type*} + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (u : κ → ℝ) (x : ι → ℝ) (j : κ) : + jointInsert h k eG eB background u x (eG j).val=u j := by + rw [jointInsert_commute] + simp only [HistoryActiveCoordinates.insert,dite_eq_left (eG j).property,Function.comp_apply] + change u (eG.symm (eG j))=u j + rw [Equiv.symm_apply_apply] + +@[simp] theorem jointInsert_bulk (h k : History l) {κ ι : Type*} + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (u : κ → ℝ) (x : ι → ℝ) (j : ι) : + jointInsert h k eG eB background u x (eB j).val=x j := by + simp only [jointInsert,HistoryActiveCoordinates.insert,dite_eq_left (eB j).property,Function.comp_apply] + change x (eB.symm (eB j))=x j + rw [Equiv.symm_apply_apply] + +theorem jointInsert_frozen (h k : History l) {κ ι : Type*} + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (u : κ → ℝ) (x : ι → ℝ) (j : PairKey h k) + (hg : j∉giantCoordinates h k) (hb : j∉bulkCoordinates h k) : + jointInsert h k eG eB background u x j=background j := by + simp only [jointInsert,HistoryActiveCoordinates.insert,dite_eq_right hg,dite_eq_right hb] + +theorem jointInsert_positive (h k : History l) {κ ι : Type*} + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (u : κ → ℝ) (x : ι → ℝ) + (hbackground : ∀i,0hu (eG.symm i))) + (fun i=>hx (eB.symm i)) + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsContinuity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsContinuity.lean new file mode 100644 index 0000000000000000000000000000000000000000..5148b05ac522c0d952e1b1fa48fe8b65984523a5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsContinuity.lean @@ -0,0 +1,106 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairMixedReplacementCorrectedBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open Construction HistoryPairPattern HistoryActiveCoordinates HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates +open scoped ContDiff +attribute [local instance] Classical.propDecidable +variable {l : ℕ} + +theorem jointInsert_exp (h k : History l) {κ ι : Type*} + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (hbackground : ∀i,0Real.exp (u j)) (fun j=>Real.exp (x j))= + fun i=>Real.exp (jointInsert h k eG eB (fun j=>Real.log (background j)) u x i) := by + funext i + by_cases hb : i∈bulkCoordinates h k <;> by_cases hg : i∈giantCoordinates h k <;> + simp only [jointInsert,HistoryActiveCoordinates.insert,hb,hg,↓reduceDIte,Function.comp_apply,Real.exp_log (hbackground i)] + +theorem jointInsert_contDiff (h k : History l) {κ ι : Type*} [Fintype κ] [Fintype ι] + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) : + ContDiff ℝ ∞ (fun z : (κ→ℝ)×(ι→ℝ)=>jointInsert h k eG eB background z.1 z.2) := by + apply contDiff_pi.mpr + intro i + by_cases hb : i∈bulkCoordinates h k <;> by_cases hg : i∈giantCoordinates h k <;> + simp only [jointInsert,HistoryActiveCoordinates.insert,hb,hg,↓reduceDIte,Function.comp_apply] <;> fun_prop + +theorem log_contDiff_jointInsert (h k : History l) {κ ι : Type*} [Fintype κ] [Fintype ι] + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (background : PairKey h k → ℝ) (hbackground : ∀i,0f (fun i=>Real.exp (y i)))) : + ContDiff ℝ ∞ (fun z : (κ→ℝ)×(ι→ℝ)=> + f (jointInsert h k eG eB background (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i)))) := by + simpa only [Function.comp_def,←jointInsert_exp h k eG eB background hbackground] using + hf.comp (jointInsert_contDiff h k eG eB (fun i=>Real.log (background i))) + +theorem correctedPairedRealXi_joint_log_contDiff + {V : ℕ→ℕ} {outside : List ℕ} (b s : ℕ) (X tb td G : ℝ) (hX : 0 + correctedPairedRealXi b s X tb td G h k hs ks T U Hkeys Ukeys S cellCenter cellKey + (jointInsert h k eG eB background (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i)))) := + log_contDiff_jointInsert h k eG eB background hbackground _ + (correctedPairedRealXi_log_contDiff b s X tb td G hX houtside h k hs ks + T U Hkeys Ukeys S cellCenter cellKey) + +theorem correctedPairedRealXi_joint_log_continuous + {V : ℕ→ℕ} {outside : List ℕ} (b s : ℕ) (X tb td G : ℝ) (hX : 0 + correctedPairedRealXi b s X tb td G h k hs ks T U Hkeys Ukeys S cellCenter cellKey + (jointInsert h k eG eB background (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i)))) := + (correctedPairedRealXi_joint_log_contDiff b s X tb td G hX houtside h k hs ks + T U Hkeys Ukeys S cellCenter cellKey eG eB background hbackground).continuous + +theorem pairedRealXi_joint_log_contDiff + {V : ℕ→ℕ} {outside : List ℕ} (b s : ℕ) (X tb td G : ℝ) (hX : 0 + pairedRealXi b s X tb td G h k hs ks + (jointInsert h k eG eB background (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i)))) := + log_contDiff_jointInsert h k eG eB background hbackground _ + (pairedRealXi_log_contDiff b s X tb td G hX houtside h k hs ks) + +theorem pairedRealXi_joint_log_continuous + {V : ℕ→ℕ} {outside : List ℕ} (b s : ℕ) (X tb td G : ℝ) (hX : 0 + pairedRealXi b s X tb td G h k hs ks + (jointInsert h k eG eB background (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i)))) := + (pairedRealXi_joint_log_contDiff b s X tb td G hX houtside h k hs ks + eG eB background hbackground).continuous + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsCutoff.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..7b4523380beeb57be6732a6f0047e0c8365752b7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsCutoff.lean @@ -0,0 +1,106 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantPriorGridMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantPriorGridPrime + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open HistoryBulkIntegralReplacement HistoryGiantPriorGrid PrimeCellFreezing +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +theorem bulkBounds_const_mul {k : ℕ} {L C : ℝ} {f : (ι→ℝ)→ℂ} + (hf : BulkBounds k L C f) (c : ℂ) (hc : ‖c‖ ≤ 1) : + BulkBounds k L C (fun x=>c*f x) := by + refine ⟨fun z hz=>(hf.differentiable z hz).const_mul c,?_,?_⟩ + · intro z hz i + rw [deriv_const_mul_field, norm_mul] + exact (mul_le_of_le_one_left (norm_nonneg _) hc).trans (hf.derivative z hz i) + · intro z hz + rw [norm_mul] + exact (mul_le_of_le_one_left (norm_nonneg _) hc).trans (hf.norm z hz) + +def primeJointCutoff (G : ℝ) (f : (Bool→ℝ)→(ι→ℝ)→ℂ) + (u : Bool→ℝ) (x : ι→ℝ) : ℂ := primeCutoff G (fun v=>f v x) u + +def mixedJointCutoff (G : ℝ) (f : (Option Unit→ℝ)→(ι→ℝ)→ℂ) + (u : Option Unit→ℝ) (x : ι→ℝ) : ℂ := mixedGiantPrimeTest G (fun v=>f v x) u + +theorem primeJointCutoff_bulkBounds {k : ℕ} {L C : ℝ} (G : ℝ) + (f : (Bool→ℝ)→(ι→ℝ)→ℂ) (u : Bool→ℝ) (hf : BulkBounds k L C (f u)) : + BulkBounds k L C (primeJointCutoff G f u) := by + apply bulkBounds_const_mul hf + rw [norm_mul, Complex.norm_real, Complex.norm_real, + Real.norm_eq_abs, Real.norm_eq_abs, abs_of_nonneg (giantCell_bounds G (u false)).1, + abs_of_nonneg (giantCell_bounds G (u true)).1] + exact (mul_le_mul_of_nonneg_right (giantCell_bounds G (u false)).2 + (giantCell_bounds G (u true)).1).trans (by simpa using (giantCell_bounds G (u true)).2) + +theorem mixedJointCutoff_bulkBounds {k : ℕ} {L C : ℝ} (G : ℝ) + (f : (Option Unit→ℝ)→(ι→ℝ)→ℂ) (u : Option Unit→ℝ) (hf : BulkBounds k L C (f u)) : + BulkBounds k L C (mixedJointCutoff G f u) := by + apply bulkBounds_const_mul hf + rw [Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (smoothPartition_nonneg _)] + exact smoothPartition_le_one _ + +omit [DecidableEq ι] in +theorem primeJointCutoff_log_contDiff (G : ℝ) (f : (Bool→ℝ)→(ι→ℝ)→ℂ) + (hf : ContDiff ℝ ∞ (fun z : (Bool→ℝ)×(ι→ℝ)=> + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i)))) : + ContDiff ℝ ∞ (fun z : (Bool→ℝ)×(ι→ℝ)=> + primeJointCutoff G f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) := by + have ha : ContDiff ℝ ∞ (fun z : (Bool→ℝ)×(ι→ℝ)=> + (giantCell G (Real.exp (z.1 false)):ℂ)) := by + exact Complex.ofRealCLM.contDiff.comp ((giantCell_contDiff G).comp (by fun_prop)) + have hb : ContDiff ℝ ∞ (fun z : (Bool→ℝ)×(ι→ℝ)=> + (giantCell G (Real.exp (z.1 true)):ℂ)) := by + exact Complex.ofRealCLM.contDiff.comp ((giantCell_contDiff G).comp (by fun_prop)) + exact (ha.mul hb).mul hf + +omit [DecidableEq ι] in +theorem mixedJointCutoff_log_contDiff (G : ℝ) (f : (Option Unit→ℝ)→(ι→ℝ)→ℂ) + (hf : ContDiff ℝ ∞ (fun z : (Option Unit→ℝ)×(ι→ℝ)=> + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i)))) : + ContDiff ℝ ∞ (fun z : (Option Unit→ℝ)×(ι→ℝ)=> + mixedJointCutoff G f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) := by + have ha : ContDiff ℝ ∞ (fun z : (Option Unit→ℝ)×(ι→ℝ)=> + (smoothPartition (z.1 (some ())-G):ℂ)) := by + exact Complex.ofRealCLM.contDiff.comp (smoothPartition_contDiff.comp (by fun_prop)) + simpa only [mixedJointCutoff,mixedGiantPrimeTest,Real.log_exp] using ha.mul hf + +theorem primeJointCutoff_joint_bounds {k : ℕ} {L C : ℝ} (G : ℝ) + (f : (Bool→ℝ)→(ι→ℝ)→ℂ) + (hf : ContDiff ℝ ∞ (fun z : (Bool→ℝ)×(ι→ℝ)=> + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀z∈logRectangle (fun _=>G-1) (fun _=>G+1), + BulkBounds k L C (f (fun i=>Real.exp (z i)))) : + ContDiff ℝ ∞ (fun z : (Bool→ℝ)×(ι→ℝ)=> + primeJointCutoff G f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀z∈logRectangle (fun _=>G-1) (fun _=>G+1), + BulkBounds k L C (primeJointCutoff G f (fun i=>Real.exp (z i))) := + ⟨primeJointCutoff_log_contDiff G f hf.1, + fun z hz=>primeJointCutoff_bulkBounds G f _ (hf.2 z hz)⟩ + +theorem mixedJointCutoff_joint_bounds {k : ℕ} {L C : ℝ} (G : ℝ) + (f : (Option Unit→ℝ)→(ι→ℝ)→ℂ) + (hf : ContDiff ℝ ∞ (fun z : (Option Unit→ℝ)×(ι→ℝ)=> + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀z∈logRectangle (fun _=>G-1) (fun _=>G+1), + BulkBounds k L C (f (fun i=>Real.exp (z i)))) : + ContDiff ℝ ∞ (fun z : (Option Unit→ℝ)×(ι→ℝ)=> + mixedJointCutoff G f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀z∈logRectangle (fun _=>G-1) (fun _=>G+1), + BulkBounds k L C (mixedJointCutoff G f (fun i=>Real.exp (z i))) := + ⟨mixedJointCutoff_log_contDiff G f hf.1, + fun z hz=>mixedJointCutoff_bulkBounds G f _ (hf.2 z hz)⟩ + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..7c05fd63e8d1b7c2aa2a2801471e12066578d7c2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsDefs.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkCorrectedXiBoundsActual +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIntegralReplacementBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k₀ l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k₀ L E) +variable {outside : List ℕ} + +def jointCorrectedScalar (s : ℕ) (h k : History l) + (hs : h.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (ks : k.Supported (frequencyBound Bs BD Bz k₀ L) outside) + {κ ι : Type*} (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (u : κ → ℝ) (x : ι → ℝ) : ℂ := + reindexedCorrectedRealXi (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin C.giantCenter h k hs ks + ((C.giantCenter:ℝ)+C.compensationLogScale l+stepGap BD Bz k₀ L l) (C.compensationLogScale l) + (pairedDiagonalHKeys h k (l+1)) (pairedDiagonalUKeys h k (l+1)) + (Finset.univ : Finset (Fin (diagonalCellKeys k (l+1)).length)) + (pairedDiagonalCellCenter k (l+1) C.giantCenter (C.cells.center (bulkSize k₀ L/2))) + (pairedDiagonalCellKey h k (l+1)) (bulkCoordinates h k) + (insert (giantCoordinates h k) (pairBackground h k) (fun j => u (eG.symm j))) eB x + +def jointScalar (s : ℕ) (h k : History l) + (hs : h.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (ks : k.Supported (frequencyBound Bs BD Bz k₀ L) outside) + {κ ι : Type*} (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (u : κ → ℝ) (x : ι → ℝ) : ℂ := + reindexedRealXi (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin C.giantCenter h k hs ks + (bulkCoordinates h k) + (insert (giantCoordinates h k) (pairBackground h k) (fun j => u (eG.symm j))) eB x + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsOrder.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsOrder.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e3a7e5195579ce7f17f2d0bd0eaad47d6579236 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsOrder.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIntegralReplacementBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k₀ l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k₀ L E) +variable {outside : List ℕ} + +theorem jointCorrectedScalar_giant_first (s : ℕ) (h k : History l) + (hs : h.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (ks : k.Supported (frequencyBound Bs BD Bz k₀ L) outside) + {κ ι : Type*} (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (u : κ → ℝ) (x : ι → ℝ) : + jointCorrectedScalar C s h k hs ks eG eB u x = + reindexedCorrectedRealXi (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin C.giantCenter h k hs ks + ((C.giantCenter:ℝ)+C.compensationLogScale l+stepGap BD Bz k₀ L l) (C.compensationLogScale l) + (pairedDiagonalHKeys h k (l+1)) (pairedDiagonalUKeys h k (l+1)) + (Finset.univ : Finset (Fin (diagonalCellKeys k (l+1)).length)) + (pairedDiagonalCellCenter k (l+1) C.giantCenter (C.cells.center (bulkSize k₀ L/2))) + (pairedDiagonalCellKey h k (l+1)) + (giantCoordinates h k) + (insert (bulkCoordinates h k) (pairBackground h k) (fun j => x (eB.symm j))) eG u := by + unfold jointCorrectedScalar reindexedCorrectedRealXi + exact congrArg (correctedPairedRealXi (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin + C.giantCenter h k hs ks + ((C.giantCenter:ℝ)+C.compensationLogScale l+stepGap BD Bz k₀ L l) (C.compensationLogScale l) + (pairedDiagonalHKeys h k (l+1)) (pairedDiagonalUKeys h k (l+1)) + (Finset.univ : Finset (Fin (diagonalCellKeys k (l+1)).length)) + (pairedDiagonalCellCenter k (l+1) C.giantCenter (C.cells.center (bulkSize k₀ L/2))) + (pairedDiagonalCellKey h k (l+1))) + (jointInsert_commute h k eG eB (pairBackground h k) u x) + +theorem jointScalar_giant_first (s : ℕ) (h k : History l) + (hs : h.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (ks : k.Supported (frequencyBound Bs BD Bz k₀ L) outside) + {κ ι : Type*} (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (u : κ → ℝ) (x : ι → ℝ) : + jointScalar C s h k hs ks eG eB u x = + reindexedRealXi (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin C.giantCenter h k hs ks + (giantCoordinates h k) + (insert (bulkCoordinates h k) (pairBackground h k) (fun j => x (eB.symm j))) eG u := by + unfold jointScalar reindexedRealXi activeRealXi + exact congrArg (pairedRealXi (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin + C.giantCenter h k hs ks) (jointInsert_commute h k eG eB (pairBackground h k) u x) + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsPlain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsPlain.lean new file mode 100644 index 0000000000000000000000000000000000000000..9e3b08638ae064c54055fca2e06343f2dbf02645 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsPlain.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedPairDerivativeBoundsAmplitude + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistorySelectedPairDerivativeBounds HistorySelectedPairDerivativeCounts +open HistoryBulkCorrectedXiBounds PrimeCellFreezing +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k₀ l : ℕ} {E : Finset ℕ} + +theorem plain_bulkBounds + (C : InitialSourceChoice d Bs BD Bz k₀ L E) (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) + (hm : 1 ≤ bulkSize k₀ L) (s : ℕ) {outside : List ℕ} + (houtside : ∀ q ∈ outside, 0 < q) (hout : outside.length = 2*s) + (h k : History l) (hs : h.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (ks : k.Supported (frequencyBound Bs BD Bz k₀ L) outside) (hl : l ≤ k₀) + (hh : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) h) + (hk : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) k) + (matchRoots : RootMatching h k) + (hsrc₁ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + h (leftMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + (hsrc₂ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + {κ ι : Type*} [Fintype κ] [DecidableEq κ] [Fintype ι] [DecidableEq ι] + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (z : κ → ℝ) + (hz : z ∈ logRectangle (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) : + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointScalar C s h k hs ks eG eB (fun i => Real.exp (z i))) := by + have hX : 0 < (C.scale:ℝ) := by exact_mod_cast InitialEta.initial_scale_pos C + let background := insert (giantCoordinates h k) (pairBackground h k) + (fun j => Real.exp (z (eG.symm j))) + have hsource := giant_sourceDomains C h k hsrc₁ hsrc₂ eG z hz + have hbg : ∀ i, 0 < background i := by + intro i + obtain ⟨j,rfl⟩ := unionMap_surjective h k i + rcases j with j | j + · exact hsource.1.positive j + · exact hsource.2.positive j + have hbulk (x : ι → ℝ) (hx : ∀ i, 0 < x i) := + bulk_sourceDomains h k hs matchRoots background hsource.1 hsource.2 + (fun j => x (eB.symm j)) (fun j => hx (eB.symm j)) + have hD := selected_pair_bound C hBs hk₀ hm hl h k hh hk + have hA := selected_amplitude_bound Bs BD Bz L hBs hk₀ hl + have hA' : Real.exp (-((2^l:ℕ):ℝ)*initialGap Bs k₀ L+sourceXiConstant l k₀ (2+2*(k₀:ℝ))) ≤ + Real.exp (selectedExponent Bs BD Bz k₀*((bulkSize k₀ L:ℝ)+1)) := by + apply le_trans _ hA + exact le_mul_of_one_le_left (Real.exp_nonneg _) (Real.one_le_exp (by + unfold nominalInheritedWidth nominalRemovedWidth + positivity)) + refine ⟨?_,?_,?_⟩ + · intro y hy + exact (reindexedRealXi_log_contDiff (bulkSize k₀ L/2) s C.scale C.bulkBin C.spectatorBin + C.giantCenter hX houtside h k hs ks (bulkCoordinates h k) background hbg eB).differentiable (by simp) y + · intro y hy i + have hb := hbulk (fun j => Real.exp (y j)) (fun j => Real.exp_pos _) + exact (reindexedRealXi_deriv_le (bulkSize k₀ L/2) s k₀ C.scale C.bulkBin C.spectatorBin + C.giantCenter (initialGap Bs k₀ L) (2+2*(k₀:ℝ)) (C.cells.center (bulkSize k₀ L/2)) + hX houtside hout h k hs ks hl hh hk (bulkCoordinates h k) background hbg eB + (fun j => Real.exp (y j)) i (fun j => Real.exp_pos _) hb.1 hb.2 + (selected_Xi_source_center C)).trans hD + · intro y hy + have hb := hbulk (fun j => Real.exp (y j)) (fun j => Real.exp_pos _) + exact (pairedRealXi_norm_le (bulkSize k₀ L/2) s k₀ C.scale C.bulkBin C.spectatorBin + C.giantCenter (initialGap Bs k₀ L) (2+2*(k₀:ℝ)) (C.cells.center (bulkSize k₀ L/2)) + hX houtside hout h k hs ks _ hb.1 hb.2 (selected_Xi_source_center C)).trans hA' + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsRegularity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsRegularity.lean new file mode 100644 index 0000000000000000000000000000000000000000..48d65a51bf6f8937a61f504de421ba0754414520 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsRegularity.lean @@ -0,0 +1,77 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsContinuity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsSource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k₀ l : ℕ} {E : Finset ℕ} + +theorem jointCorrectedScalar_log_contDiff + (C : InitialSourceChoice d Bs BD Bz k₀ L E) (s : ℕ) {outside : List ℕ} + (houtside : ∀ q ∈ outside, 0 < q) + (h k : History l) (hs : h.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (ks : k.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (hsrc₁ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + h (leftMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + (hsrc₂ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + {κ ι : Type*} [Fintype κ] [Fintype ι] + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) : + ContDiff ℝ ∞ (fun z : (κ→ℝ)×(ι→ℝ)=> + jointCorrectedScalar C s h k hs ks eG eB (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) := by + have hX : 0 < (C.scale:ℝ) := by exact_mod_cast InitialEta.initial_scale_pos C + have hbg : ∀i,0 C.giantCenter-1) (fun _ => C.giantCenter+1)) + (hsrc₂ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + {κ ι : Type*} [Fintype κ] [Fintype ι] + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) : + ContDiff ℝ ∞ (fun z : (κ→ℝ)×(ι→ℝ)=> + jointScalar C s h k hs ks eG eB (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) := by + have hX : 0 < (C.scale:ℝ) := by exact_mod_cast InitialEta.initial_scale_pos C + have hbg : ∀i,0C.giantCenter-1) (fun _=>C.giantCenter+1) → + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointCorrectedScalar C s h k hs ks eG + (selectedOrderedEquiv C V l outside σ x p q c e hs) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs ks eG z hz + have hy : (outerPrior C.sources + (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant).mass + (selectedPermutedOuter C l σ x)≠0 := by + rwa [selectedPermutedOuter_mass] + have hsrc := HistoryGiantSourceBounds.selected_decoded_pair_giant_sourceBounds C + (frequencyBound Bs BD Bz k₀ L) l x (selectedPermutedOuter C l σ x) p q c e hx hy hc he + apply corrected_bulkBounds C hBs hk₀ hm s houtside hout _ _ hs ks hl _ _ + (selectedMatching C (frequencyBound Bs BD Bz k₀ L) l σ x p q c e) hsrc.1 hsrc.2 eG + (selectedOrderedEquiv C (frequencyBound Bs BD Bz k₀ L) l outside σ x p q c e hs) z hz + · exact decoded_tree_source_labels _ _ _ _ _ _ + (Template.assignedSlots_matches C.sources _ x.2.2) + · exact decoded_tree_source_labels _ _ _ _ _ _ + (Template.assignedSlots_matches C.sources _ (selectedPermutedOuter C l σ x).2.2) + +theorem selected_plain_bulkBounds {d : Decomposition} {Bs BD Bz : ℝ} {k₀ : ℕ} + {L : ℝ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0≤Bs) (hk₀ : 0C.giantCenter-1) (fun _=>C.giantCenter+1) → + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointScalar C s h k hs ks eG + (selectedOrderedEquiv C V l outside σ x p q c e hs) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs ks eG z hz + have hy : (outerPrior C.sources + (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant).mass + (selectedPermutedOuter C l σ x)≠0 := by + rwa [selectedPermutedOuter_mass] + have hsrc := HistoryGiantSourceBounds.selected_decoded_pair_giant_sourceBounds C + (frequencyBound Bs BD Bz k₀ L) l x (selectedPermutedOuter C l σ x) p q c e hx hy hc he + apply plain_bulkBounds C hBs hk₀ hm s houtside hout _ _ hs ks hl _ _ + (selectedMatching C (frequencyBound Bs BD Bz k₀ L) l σ x p q c e) hsrc.1 hsrc.2 eG + (selectedOrderedEquiv C (frequencyBound Bs BD Bz k₀ L) l outside σ x p q c e hs) z hz + · exact decoded_tree_source_labels _ _ _ _ _ _ + (Template.assignedSlots_matches C.sources _ x.2.2) + · exact decoded_tree_source_labels _ _ _ _ _ _ + (Template.assignedSlots_matches C.sources _ (selectedPermutedOuter C l σ x).2.2) + +theorem selected_corrected_joint_bounds {d : Decomposition} {Bs BD Bz : ℝ} {k₀ : ℕ} + {L : ℝ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0≤Bs) (hk₀ : 0 + jointCorrectedScalar C s h k hs ks eG + (selectedOrderedEquiv C V l outside σ x p q c e hs) + (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀z : κ→ℝ, z ∈ logRectangle (fun _=>C.giantCenter-1) (fun _=>C.giantCenter+1) → + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointCorrectedScalar C s h k hs ks eG + (selectedOrderedEquiv C V l outside σ x p q c e hs) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs ks eG + have hy : (outerPrior C.sources + (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant).mass + (selectedPermutedOuter C l σ x)≠0 := by + rwa [selectedPermutedOuter_mass] + have hsrc := HistoryGiantSourceBounds.selected_decoded_pair_giant_sourceBounds C + (frequencyBound Bs BD Bz k₀ L) l x (selectedPermutedOuter C l σ x) p q c e hx hy hc he + exact ⟨jointCorrectedScalar_log_contDiff C s houtside _ _ hs ks hsrc.1 hsrc.2 eG + (selectedOrderedEquiv C (frequencyBound Bs BD Bz k₀ L) l outside σ x p q c e hs), + selected_corrected_bulkBounds C hBs hk₀ hm s outside houtside hout l hl σ x p q c e hx hc he hs ks eG⟩ + +theorem selected_plain_joint_bounds {d : Decomposition} {Bs BD Bz : ℝ} {k₀ : ℕ} + {L : ℝ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0≤Bs) (hk₀ : 0 + jointScalar C s h k hs ks eG + (selectedOrderedEquiv C V l outside σ x p q c e hs) + (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀z : κ→ℝ, z ∈ logRectangle (fun _=>C.giantCenter-1) (fun _=>C.giantCenter+1) → + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointScalar C s h k hs ks eG + (selectedOrderedEquiv C V l outside σ x p q c e hs) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs ks eG + have hy : (outerPrior C.sources + (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l) C.giant).mass + (selectedPermutedOuter C l σ x)≠0 := by + rwa [selectedPermutedOuter_mass] + have hsrc := HistoryGiantSourceBounds.selected_decoded_pair_giant_sourceBounds C + (frequencyBound Bs BD Bz k₀ L) l x (selectedPermutedOuter C l σ x) p q c e hx hy hc he + exact ⟨jointScalar_log_contDiff C s houtside _ _ hs ks hsrc.1 hsrc.2 eG + (selectedOrderedEquiv C (frequencyBound Bs BD Bz k₀ L) l outside σ x p q c e hs), + selected_plain_bulkBounds C hBs hk₀ hm s outside houtside hout l hl σ x p q c e hx hc he hs ks eG⟩ + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..029825a1d291828d011c3a10da5cf33b461a3d3b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantCorrectedBoundsSource.lean @@ -0,0 +1,93 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBoundsDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedPairDerivativeBoundsAmplitude +import OAI.NumberTheory.Ostmann.Construction.LevelZeroFrequencySupport + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistorySelectedPairDerivativeBounds HistorySelectedPairDerivativeCounts +open HistoryBulkCorrectedXiBounds PrimeCellFreezing +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k₀ l : ℕ} {E : Finset ℕ} + +theorem giant_sourceDomains + (C : InitialSourceChoice d Bs BD Bz k₀ L E) (h k : History l) + (hsrc₁ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + h (leftMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + (hsrc₂ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + {κ : Type*} (eG : κ ≃ giantCoordinates h k) (z : κ → ℝ) + (hz : z ∈ logRectangle (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) : + let background := insert (giantCoordinates h k) (pairBackground h k) + (fun j => Real.exp (z (eG.symm j))) + SourceDomain (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + h (fun i => background (leftMap h k i)) ∧ + SourceDomain (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (fun i => background (rightMap h k i)) := by + have hm : (fun j => z (eG.symm j)) ∈ + logRectangle (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1) := + fun j _ => hz (eG.symm j) (Set.mem_univ _) + exact ⟨hsrc₁.sourceDomain _ hm,hsrc₂.sourceDomain _ hm⟩ + +theorem corrected_bulkBounds + (C : InitialSourceChoice d Bs BD Bz k₀ L E) (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) + (hm : 1 ≤ bulkSize k₀ L) (s : ℕ) {outside : List ℕ} + (houtside : ∀ q ∈ outside, 0 < q) (hout : outside.length = 2*s) + (h k : History l) (hs : h.Supported (frequencyBound Bs BD Bz k₀ L) outside) + (ks : k.Supported (frequencyBound Bs BD Bz k₀ L) outside) (hl : l < k₀) + (hh : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) h) + (hk : TreeSourceLabels (Template.initial (2*(bulkSize k₀ L/2)) k₀) k) + (matchRoots : RootMatching h k) + (hsrc₁ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + h (leftMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + (hsrc₂ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) + {κ ι : Type*} [Fintype κ] [DecidableEq κ] [Fintype ι] [DecidableEq ι] + (eG : κ ≃ giantCoordinates h k) (eB : ι ≃ bulkCoordinates h k) + (z : κ → ℝ) + (hz : z ∈ logRectangle (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)) : + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointCorrectedScalar C s h k hs ks eG eB (fun i => Real.exp (z i))) := by + have hX : 0 < (C.scale:ℝ) := by exact_mod_cast InitialEta.initial_scale_pos C + have hsource := giant_sourceDomains C h k hsrc₁ hsrc₂ eG z hz + have hr := selected_bulk_corrected_bounds C s C.scale (initialGap Bs k₀ L) (2+2*(k₀:ℝ)) + hX houtside hout h k hs ks hl hh hk matchRoots _ hsource.1 hsource.2 + (selected_Xi_source_center C) + (Finset.univ : Finset (Fin (diagonalCellKeys k (l+1)).length)) + (pairedDiagonalCellCenter k (l+1) C.giantCenter (C.cells.center (bulkSize k₀ L/2))) + (pairedDiagonalCellKey h k (l+1)) eB + have hcount := diagonal_cells_card_le hk hl.le (l+1) + have hc : (Finset.univ : Finset (Fin (diagonalCellKeys k (l+1)).length)).card ≤ + (k₀+1)*countCoefficient k₀*(bulkSize k₀ L/2+1) := by + nlinarith [Nat.zero_le (countCoefficient k₀*(bulkSize k₀ L/2+1))] + have hD := selected_bulk_corrected_bound C hBs hk₀ hm hl.le h k hh hk (l+1) hc + have hA := selected_amplitude_bound Bs BD Bz L hBs hk₀ hl.le + have hA' : Real.exp ((nominalInheritedWidth k₀ l+1)+nominalRemovedWidth k₀ l)* + Real.exp (-((2^l:ℕ):ℝ)*initialGap Bs k₀ L+sourceXiConstant l k₀ (2+2*(k₀:ℝ))) ≤ + Real.exp (selectedExponent Bs BD Bz k₀*((bulkSize k₀ L:ℝ)+1)) := by + apply le_trans _ hA + exact mul_le_mul_of_nonneg_right (Real.exp_le_exp.mpr (by linarith)) (Real.exp_nonneg _) + refine ⟨?_,?_,?_⟩ + · intro y hy + exact hr.1.differentiable (by simp) y + · intro y hy i + exact (hr.2.1 _ (fun i => Real.exp_pos _) i).trans hD + · intro y hy + exact (hr.2.2 _ (fun i => Real.exp_pos _)).trans hA' + +end Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..7baa13bebc37aef0b88a112b7ed570cac8879d86 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReference.lean @@ -0,0 +1,11 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantIntegerReferenceCutoff + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..60d85cf57de681fb37abcb91c8e26408ecf2bc1b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceBasic.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkCoordinatesPermutation + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantIntegerReference +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern +open HistoryPairBulkCoordinates HistoryGiantReferenceMean HistorySignedXiTransport + +variable {d : Decomposition} {Bs BD Bz : ℝ} {k₀ : ℕ} {L : ℝ} {E : Finset ℕ} +local notation "b₀" => (bulkSize k₀ L/2) + +def permutedAssignment (C : InitialSourceChoice d Bs BD Bz k₀ L E) (l : ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b₀))) + (x : SourceAssignment C.sources (Template.current (Template.initial (2*b₀) k₀) l)) : + SourceAssignment C.sources (Template.current (Template.initial (2*b₀) k₀) l) := + leafBulkAssignmentPermutation b₀ k₀ l C.bulk (C.cells.topSource E C.deleted_card) + (C.cells.compSource E C.deleted_card) σ x + +theorem permutedAssignment_mass (C : InitialSourceChoice d Bs BD Bz k₀ L E) (l : ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b₀))) + (x : SourceAssignment C.sources (Template.current (Template.initial (2*b₀) k₀) l)) : + (assignmentPrior C.sources (Template.current (Template.initial (2*b₀) k₀) l)).mass + (permutedAssignment C l σ x)= + (assignmentPrior C.sources (Template.current (Template.initial (2*b₀) k₀) l)).mass x := + leafBulkAssignmentPermutation_mass b₀ k₀ l C.bulk (C.cells.topSource E C.deleted_card) + (C.cells.compSource E C.deleted_card) σ x + +def integerMatching (C : InitialSourceChoice d Bs BD Bz k₀ L E) (V : ℕ → ℕ) (l : ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b₀))) + (x : SourceAssignment C.sources (Template.current (Template.initial (2*b₀) k₀) l)) + (s t P Q : ℤ) (c e : HistoryChoices C.sources (Template.initial (2*b₀) k₀) V l) : + RootMatching + (decodeHistory C.sources (Template.initial (2*b₀) k₀) V l + (giantState (sourceState C.sources (Template.current (Template.initial (2*b₀) k₀) l) x s) P Q) c) + (decodeHistory C.sources (Template.initial (2*b₀) k₀) V l + (giantState (sourceState C.sources (Template.current (Template.initial (2*b₀) k₀) l) + (permutedAssignment C l σ x) t) P Q) e) := by + apply permutationMatching b₀ k₀ C.bulk (C.cells.topSource E C.deleted_card) + (C.cells.compSource E C.deleted_card) σ x + · simpa only [decodeHistory_root,giantState,sourceState] using + Template.assignedSlots_matches C.sources (Template.current (Template.initial (2*b₀) k₀) l) x + · simpa only [decodeHistory_root,giantState,sourceState] using + Template.assignedSlots_matches C.sources (Template.current (Template.initial (2*b₀) k₀) l) + (permutedAssignment C l σ x) + · simp only [decodeHistory_root,giantState,sourceState] + rfl + · simp only [decodeHistory_root,giantState,sourceState,permutedAssignment] + rfl + +def integerOrderedEquiv (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (V : ℕ → ℕ) (l : ℕ) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b₀))) + (x : SourceAssignment C.sources (Template.current (Template.initial (2*b₀) k₀) l)) + (s t P Q : ℤ) (c e : HistoryChoices C.sources (Template.initial (2*b₀) k₀) V l) + (hs : (decodeHistory C.sources (Template.initial (2*b₀) k₀) V l + (giantState (sourceState C.sources (Template.current (Template.initial (2*b₀) k₀) l) x s) P Q) c).Supported V outside) : + (Fin (2^l) × Fin (2*b₀)) ≃ bulkCoordinates + (decodeHistory C.sources (Template.initial (2*b₀) k₀) V l + (giantState (sourceState C.sources (Template.current (Template.initial (2*b₀) k₀) l) x s) P Q) c) + (decodeHistory C.sources (Template.initial (2*b₀) k₀) V l + (giantState (sourceState C.sources (Template.current (Template.initial (2*b₀) k₀) l) + (permutedAssignment C l σ x) t) P Q) e) := + orderedEquiv (2*b₀) k₀ _ _ hs (by + simpa only [decodeHistory_root,giantState,sourceState] using + Template.assignedSlots_matches C.sources (Template.current (Template.initial (2*b₀) k₀) l) x) + +theorem integer_rootGiantsAgree (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (V : ℕ → ℕ) (l : ℕ) + (σ : Equiv.Perm (Fin (2^l) × Fin (2*b₀))) + (x : SourceAssignment C.sources (Template.current (Template.initial (2*b₀) k₀) l)) + (s t P Q : ℤ) (c e : HistoryChoices C.sources (Template.initial (2*b₀) k₀) V l) : + RootGiantsAgree + (decodeHistory C.sources (Template.initial (2*b₀) k₀) V l + (giantState (sourceState C.sources (Template.current (Template.initial (2*b₀) k₀) l) x s) P Q) c) + (decodeHistory C.sources (Template.initial (2*b₀) k₀) V l + (giantState (sourceState C.sources (Template.current (Template.initial (2*b₀) k₀) l) + (permutedAssignment C l σ x) t) P Q) e) := + HistoryGiantXiReplacementActual.decoded_shared_giants _ _ _ _ _ _ _ _ _ _ + +end Ostmann.Arithmetic.HistoryBulkGiantIntegerReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceCutoff.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceCutoff.lean new file mode 100644 index 0000000000000000000000000000000000000000..4a675ce56c9d21751092e849ce6d8e9ed0422ff3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceCutoff.lean @@ -0,0 +1,161 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantIntegerReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantIntegerReferenceSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantIntegerReference +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistoryBulkGiantCorrectedBounds HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds +open HistoryGiantReferenceMean HistorySignedXiTransport HistorySelectedPairDerivativeBounds PrimeCellFreezing + +theorem selected_corrected_prime_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + primeJointCutoff C.giantCenter (jointCorrectedScalar C s h g hs gs eG eB) (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (primeJointCutoff C.giantCenter (jointCorrectedScalar C s h g hs gs eG eB) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs + exact primeJointCutoff_joint_bounds C.giantCenter _ + (selected_corrected_joint_bounds C hBs hk₀ hm s outside houtside hout l hl σ x p q P Q c e + hx hc he hP hQ hPc hQc hs gs (Bool) (boolEquiv _ _)) + +theorem selected_corrected_mixed_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + mixedJointCutoff C.giantCenter (jointCorrectedScalar C s h g hs gs eG eB) (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : Option Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (mixedJointCutoff C.giantCenter (jointCorrectedScalar C s h g hs gs eG eB) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs + exact mixedJointCutoff_joint_bounds C.giantCenter _ + (selected_corrected_joint_bounds C hBs hk₀ hm s outside houtside hout l hl σ x p q P Q c e + hx hc he hP hQ hPc hQc hs gs (Option Unit) (optionEquiv _ _)) + +theorem selected_plain_prime_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + primeJointCutoff C.giantCenter (jointScalar C s h g hs gs eG eB) (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (primeJointCutoff C.giantCenter (jointScalar C s h g hs gs eG eB) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs + exact primeJointCutoff_joint_bounds C.giantCenter _ + (selected_plain_joint_bounds C hBs hk₀ hm s outside houtside hout l hl σ x p q P Q c e + hx hc he hP hQ hPc hQc hs gs (Bool) (boolEquiv _ _)) + +theorem selected_plain_mixed_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + mixedJointCutoff C.giantCenter (jointScalar C s h g hs gs eG eB) (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : Option Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (mixedJointCutoff C.giantCenter (jointScalar C s h g hs gs eG eB) (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs + exact mixedJointCutoff_joint_bounds C.giantCenter _ + (selected_plain_joint_bounds C hBs hk₀ hm s outside houtside hout l hl σ x p q P Q c e + hx hc he hP hQ hPc hQc hs gs (Option Unit) (optionEquiv _ _)) + +end Ostmann.Arithmetic.HistoryBulkGiantIntegerReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..63244e36c9755f99f71bc07bce19778843a830f8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceSelected.lean @@ -0,0 +1,107 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantIntegerReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantIntegerReferenceSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantIntegerReference +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistoryBulkGiantCorrectedBounds HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds +open HistoryGiantReferenceMean HistorySignedXiTransport HistorySelectedPairDerivativeBounds PrimeCellFreezing + +theorem selected_corrected_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + jointCorrectedScalar C s h g hs gs eG eB (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : κ=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointCorrectedScalar C s h g hs gs eG eB (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs κ _ _ eG + have hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass + (permutedAssignment C l σ x) ≠ 0 := by + rw [permutedAssignment_mass] + exact hx + exact reference_corrected_joint_bounds C hBs hk₀ hm s outside houtside hout l hl + x (permutedAssignment C l σ x) p q P Q c e hx hy hc he hP hQ hPc hQc + hs gs (integerMatching C (frequencyBound Bs BD Bz k₀ L) l σ x p q P Q c e) + κ (Fin (2^l)×Fin (2*(bulkSize k₀ L/2))) eG + (integerOrderedEquiv C (frequencyBound Bs BD Bz k₀ L) l outside σ x p q P Q c e hs) + +theorem selected_plain_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + jointScalar C s h g hs gs eG eB (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : κ=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointScalar C s h g hs gs eG eB (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs κ _ _ eG + have hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass + (permutedAssignment C l σ x) ≠ 0 := by + rw [permutedAssignment_mass] + exact hx + exact reference_plain_joint_bounds C hBs hk₀ hm s outside houtside hout l hl + x (permutedAssignment C l σ x) p q P Q c e hx hy hc he hP hQ hPc hQc + hs gs (integerMatching C (frequencyBound Bs BD Bz k₀ L) l σ x p q P Q c e) + κ (Fin (2^l)×Fin (2*(bulkSize k₀ L/2))) eG + (integerOrderedEquiv C (frequencyBound Bs BD Bz k₀ L) l outside σ x p q P Q c e hs) + +end Ostmann.Arithmetic.HistoryBulkGiantIntegerReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..abad4cad016b535239af785df04dcefc4ba0569b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantIntegerReferenceSource.lean @@ -0,0 +1,106 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantCorrectedBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantIntegerReference +open Construction Conclusion HistoryOccurrenceVariables HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkIntegralReplacement +open HistoryBulkGiantCorrectedBounds HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds +open HistoryGiantReferenceMean HistorySignedXiTransport HistorySelectedPairDerivativeBounds PrimeCellFreezing + +theorem reference_corrected_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + jointCorrectedScalar C s h g hs gs eG eB (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : κ=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointCorrectedScalar C s h g hs gs eG eB (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs hmatch κ ι _ _ _ _ eG eB + have hsource := selected_reference_sourceBounds C (frequencyBound Bs BD Bz k₀ L) l + x y p q c e P Q hx hy hc he hP hQ hPc hQc + have hh := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l x p P Q c + have hg := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l y q P Q e + refine ⟨jointCorrectedScalar_log_contDiff C s houtside _ _ hs gs hsource.1 hsource.2 eG eB,?_⟩ + intro z hz + exact corrected_bulkBounds C hBs hk₀ hm s houtside hout _ _ hs gs hl hh hg + hmatch hsource.1 hsource.2 eG eB z hz + +theorem reference_plain_joint_bounds {d : Decomposition} {Bs BD Bz L : ℝ} + {k₀ : ℕ} {E : Finset ℕ} (C : InitialSourceChoice d Bs BD Bz k₀ L E) + (hBs : 0 ≤ Bs) (hk₀ : 0 < k₀) (hm : 1 ≤ bulkSize k₀ L) + (s : ℕ) (outside : List ℕ) (houtside : ∀q∈outside,0 + jointScalar C s h g hs gs eG eB (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) ∧ + ∀ z∈logRectangle (fun _ : κ=>C.giantCenter-1) (fun _=>C.giantCenter+1), + BulkBounds k₀ L (selectedExponent Bs BD Bz k₀) + (jointScalar C s h g hs gs eG eB (fun i=>Real.exp (z i))) := by + dsimp only + intro hs gs hmatch κ ι _ _ _ _ eG eB + have hsource := selected_reference_sourceBounds C (frequencyBound Bs BD Bz k₀ L) l + x y p q c e P Q hx hy hc he hP hQ hPc hQc + have hh := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l x p P Q c + have hg := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l y q P Q e + refine ⟨jointScalar_log_contDiff C s houtside _ _ hs gs hsource.1 hsource.2 eG eB,?_⟩ + intro z hz + exact plain_bulkBounds C hBs hk₀ hm s houtside hout _ _ hs gs hl hh hg + hmatch hsource.1 hsource.2 eG eB z hz + +end Ostmann.Arithmetic.HistoryBulkGiantIntegerReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportA.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportA.lean new file mode 100644 index 0000000000000000000000000000000000000000..094b4cc5229eb6dc82f23ba10491c04044f830fa --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportA.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedResidueWeightedAverages + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistoryPrincipalIntegralAverage ResidueHaar HistorySignedResidueFactorization +open HistorySignedResidueWeightedAverages HistoryDiagonalSmallAverage DiagonalSmallResidueNorm +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + +section Average +variable (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (newh newk : History l) (g : (q:ℕ)→ZMod q→ℂ) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) (M : ℕ) + (hA : rootModulus newh∣M) (hD : outside.prod∣M) + (hR : frequencyModulus h k (K+2)∣M) (hB : representativeModulus h k∣M) + [NeZero (rootModulus newh)] [NeZero outside.prod] + [NeZero (frequencyModulus h k (K+2))] [NeZero (representativeModulus h k)] [NeZero M] + (hc : (rootModulus newh).Coprime outside.prod ∧ + (rootModulus newh).Coprime (frequencyModulus h k (K+2)) ∧ + (rootModulus newh).Coprime (representativeModulus h k) ∧ + outside.prod.Coprime (frequencyModulus h k (K+2)) ∧ + outside.prod.Coprime (representativeModulus h k) ∧ + (frequencyModulus h k (K+2)).Coprime (representativeModulus h k)) + (hd : rootModulus newh*outside.prod*frequencyModulus h k (K+2)*representativeModulus h k∣M) +include hc hd + +theorem reference_mixed_small_average + (d : Decomposition) (outerU xs : List SmallSlot) + (hslots : newh.root.small.Perm (outerU++xs)) (D₀ P₀ q₀ : ℕ) (v₀ : ℤ) + [∀i,Fact (smallPrime xs outerU i).Prime] (huA : SmallUnitData D₀ P₀ q₀ outerU xs v₀) : + average (fun z : MixedPair M => + referenceResidueTest K h k hs ks newh newk g σ x v M hA hD hR hB + (fun a => rootResidueIndicator newh a * mixedExtension + (fun u => (rootSmallTest d newh outerU xs hslots D₀ P₀ q₀ v₀ huA u:ℂ)) a) + (z.1,z.2)) = + ((∏i : Fin outerU.length, (((outerU[i].value-1:ℕ):ℝ)/outerU[i].value):ℝ):ℂ)* + average (fun z : MixedPair outside.prod=>residuePairSpectator g outside outside.prod newh newk (z.1,z.2))* + average (fun z : MixedPair (frequencyModulus h k (K+2))=>independentRTest K h k σ + ((z.1:ZMod (frequencyModulus h k (K+2))),(z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : MixedPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := by + rw [reference_mixed_average K h k hs ks newh newk g σ x v M hA hD hR hB _ hc hd] + simp only [mixedExtension_coe] + rw [rootSmallTest_mixed_average] + +end Average +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d7cb99cbf60c64331b97282c81a5ddc6d8ff8af6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalBasic.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportModulusCRT + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistoryPrincipalIntegralAverage ResidueHaar HistorySignedResidueFactorization +open HistorySignedResidueWeightedAverages HistoryDiagonalSmallAverage DiagonalSmallResidueNorm +open HistoryBulkReferenceNewModuli +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} +lemma neZero_of_dvd_modulus {a M : ℕ} [NeZero M] (ha : a ∣ M) : NeZero a := by + refine ⟨fun hz => ?_⟩ + have hM : M = 0 := by simpa only [hz, zero_dvd_iff] using ha + exact NeZero.ne M hM + +section Average +variable (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (newh newk : History l) (d : Decomposition) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) + [NeZero (newComparisonModulus newh h k outside K)] + (hc : NewCRTCompatible newh h k outside K) +include hc + +theorem new_reference_unit_root_average_of_modulus : + letI : NeZero (rootModulus newh) := neZero_of_dvd_modulus (new_A_dvd newh h k outside K) + letI : NeZero outside.prod := neZero_of_dvd_modulus (new_D_dvd newh h k outside K) + letI : NeZero (frequencyModulus h k (K+2)) := neZero_of_dvd_modulus (new_R_dvd newh h k outside K) + letI : NeZero (representativeModulus h k) := neZero_of_dvd_modulus (new_B_dvd newh h k outside K) + average (fun z : UnitPair (newComparisonModulus newh h k outside K) => + newReferenceResidueTest d K h k hs ks newh newk σ x v (rootResidueIndicator newh) (z.1,z.2)) = + average (fun z : UnitPair outside.prod=>residuePairSpectator (residueTransform d) outside outside.prod newh newk (z.1,z.2))* + average (fun z : UnitPair (frequencyModulus h k (K+2))=>independentRTest K h k σ + ((z.1:ZMod (frequencyModulus h k (K+2))),(z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : UnitPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := by + let : NeZero (rootModulus newh) := neZero_of_dvd_modulus (new_A_dvd newh h k outside K) + let : NeZero outside.prod := neZero_of_dvd_modulus (new_D_dvd newh h k outside K) + let : NeZero (frequencyModulus h k (K+2)) := neZero_of_dvd_modulus (new_R_dvd newh h k outside K) + let : NeZero (representativeModulus h k) := neZero_of_dvd_modulus (new_B_dvd newh h k outside K) + exact new_reference_unit_root_average K h k hs ks newh newk d σ x v hc + +theorem new_reference_mixed_small_average_of_modulus + (outerU xs : List SmallSlot) (hslots : newh.root.small.Perm (outerU++xs)) + (D₀ P₀ q₀ : ℕ) (v₀ : ℤ) [∀i,Fact (smallPrime xs outerU i).Prime] + (huA : SmallUnitData D₀ P₀ q₀ outerU xs v₀) : + letI : NeZero (rootModulus newh) := neZero_of_dvd_modulus (new_A_dvd newh h k outside K) + letI : NeZero outside.prod := neZero_of_dvd_modulus (new_D_dvd newh h k outside K) + letI : NeZero (frequencyModulus h k (K+2)) := neZero_of_dvd_modulus (new_R_dvd newh h k outside K) + letI : NeZero (representativeModulus h k) := neZero_of_dvd_modulus (new_B_dvd newh h k outside K) + average (fun z : MixedPair (newComparisonModulus newh h k outside K) => + newReferenceResidueTest d K h k hs ks newh newk σ x v + (fun a => rootResidueIndicator newh a * mixedExtension + (fun u => (rootSmallTest d newh outerU xs hslots D₀ P₀ q₀ v₀ huA u:ℂ)) a) (z.1,z.2)) = + ((∏i : Fin outerU.length, (((outerU[i].value-1:ℕ):ℝ)/outerU[i].value):ℝ):ℂ)* + average (fun z : MixedPair outside.prod=>residuePairSpectator (residueTransform d) outside outside.prod newh newk (z.1,z.2))* + average (fun z : MixedPair (frequencyModulus h k (K+2))=>independentRTest K h k σ + ((z.1:ZMod (frequencyModulus h k (K+2))),(z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : MixedPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := by + let : NeZero (rootModulus newh) := neZero_of_dvd_modulus (new_A_dvd newh h k outside K) + let : NeZero outside.prod := neZero_of_dvd_modulus (new_D_dvd newh h k outside K) + let : NeZero (frequencyModulus h k (K+2)) := neZero_of_dvd_modulus (new_R_dvd newh h k outside K) + let : NeZero (representativeModulus h k) := neZero_of_dvd_modulus (new_B_dvd newh h k outside K) + exact new_reference_mixed_small_average K h k hs ks newh newk d σ x v hc + outerU xs hslots D₀ P₀ q₀ v₀ huA + +end Average +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalCorrectedMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalCorrectedMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..22b7613017c8cc80e725ed74e01692787c117eb1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalCorrectedMixed.lean @@ -0,0 +1,129 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportActualPrincipalBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedCorrectedMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding +open HistoryBulkReferenceNewModuli HistoryPairBulkTransport + +open HistorySignedSpectatorCRT HistoryBulkReferenceTests HistoryFrequencyResidues HistoryBulkResidueNormSum +open HistorySignedResidueFactorization HistorySignedResidueWeightedAverages +open HistoryDiagonalSmallAverage DiagonalSmallResidueNorm + +theorem corrected_mixed_actual_principal_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ (ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample) + (l : ℕ) (_ : l < k₀) + (xn x₀ y₀ : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (snew s₀ t₀ P₀ Q₀ : ℤ) (gp gm : ℕ) + (cnew c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass xn ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x₀ ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y₀ ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_ : 0 rootResidueIndicator newh a * mixedExtension + (fun z => (rootSmallTest d newh outerU xs hslots D₀ P₁ q₁ v₁ huA z:ℂ)) a + let R := newReferenceResidueTest d k₀ h k hs ks newh newk σ xUnits v fA + ∀ (deleted : Finset ℕ), deleted.card≤2 → ∀hZ : 0jointCorrectedScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u)- + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (mixedGiantPrimeTest C.giantCenter (fun v=>jointCorrectedScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u))* + (((∏i : Fin outerU.length, (((outerU[i].value-1:ℕ):ℝ)/outerU[i].value):ℝ):ℂ)* + average (fun z : MixedPair outside.prod=>residuePairSpectator (residueTransform d) + outside outside.prod newh newk (z.1,z.2))* + average (fun z : MixedPair (frequencyModulus h k (k₀+2))=>independentRTest k₀ h k σ + ((z.1:ZMod (frequencyModulus h k (k₀+2))),(z.2:ZMod (frequencyModulus h k (k₀+2)))) xUnits)* + average (fun z : MixedPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [corrected_mixed_selected_eventually d Bs BD Bz hBs hk₀] with L hselected + intro E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ snew s₀ t₀ P₀ Q₀ gp gm + cnew c e hxn hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu newk m σ xUnits v outerU xs hslots D₀ P₁ q₁ v₁ _ huA hcrt + deleted hdeleted hZ + let h := decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ x₀ s₀) P₀ Q₀) c + let k := decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ y₀ t₀) P₀ Q₀) e + let newh := assignedHistory C.sources _ _ l snew gp gm xn cnew + let outside := spectatorList spectator ds + let M := newComparisonModulus newh h k outside k₀ + let : NeZero M := ⟨(assigned_newComparisonModulus_pos C.sources _ _ l snew gp gm + xn cnew h k hs ks (selected_spectator_primes spectator ds) k₀).ne'⟩ + let : NeZero (rootModulus newh) := neZero_of_dvd_modulus (new_A_dvd newh h k outside k₀) + let : NeZero outside.prod := neZero_of_dvd_modulus (new_D_dvd newh h k outside k₀) + let : NeZero (frequencyModulus h k (k₀+2)) := neZero_of_dvd_modulus (new_R_dvd newh h k outside k₀) + let : NeZero (representativeModulus h k) := neZero_of_dvd_modulus (new_B_dvd newh h k outside k₀) + have hbound := hselected E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ + snew s₀ t₀ P₀ Q₀ gp gm cnew c e hxn hx hy hc he hP hQ hPc hQc hs ks hmatch + ι eB u hu newk m σ xUnits v + (fun a => rootResidueIndicator newh a * mixedExtension + (fun z => (rootSmallTest d newh outerU xs hslots D₀ P₁ q₁ v₁ huA z:ℂ)) a) + (norm_mixed_rootSmallTest_le d newh outerU xs hslots D₀ P₁ q₁ v₁ huA) + deleted hdeleted hZ + have havg := new_reference_mixed_small_average_of_modulus k₀ h k hs ks newh newk d σ xUnits v + hcrt outerU xs hslots D₀ P₁ q₁ v₁ huA + rw [havg] at hbound + exact hbound + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalPlainMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalPlainMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..37e2773b2830e4abf8f157ad393883688f883f7c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalPlainMixed.lean @@ -0,0 +1,129 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportActualPrincipalBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedPlainMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding +open HistoryBulkReferenceNewModuli HistoryPairBulkTransport + +open HistorySignedSpectatorCRT HistoryBulkReferenceTests HistoryFrequencyResidues HistoryBulkResidueNormSum +open HistorySignedResidueFactorization HistorySignedResidueWeightedAverages +open HistoryDiagonalSmallAverage DiagonalSmallResidueNorm + +theorem plain_mixed_actual_principal_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ (ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample) + (l : ℕ) (_hl : l ≤ k₀) + (xn x₀ y₀ : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (snew s₀ t₀ P₀ Q₀ : ℤ) (gp gm : ℕ) + (cnew c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_hxn : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass xn ≠ 0) + (_hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x₀ ≠ 0) + (_hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y₀ ≠ 0) + (_hc : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_he : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_hP : 0 rootResidueIndicator newh a * mixedExtension + (fun z => (rootSmallTest d newh outerU xs hslots D₀ P₁ q₁ v₁ huA z:ℂ)) a + let R := newReferenceResidueTest d k₀ h k hs ks newh newk σ xUnits v fA + ∀ (deleted : Finset ℕ), deleted.card≤2 → ∀hZ : 0jointScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u)- + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (mixedGiantPrimeTest C.giantCenter (fun v=>jointScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u))* + (((∏i : Fin outerU.length, (((outerU[i].value-1:ℕ):ℝ)/outerU[i].value):ℝ):ℂ)* + average (fun z : MixedPair outside.prod=>residuePairSpectator (residueTransform d) + outside outside.prod newh newk (z.1,z.2))* + average (fun z : MixedPair (frequencyModulus h k (k₀+2))=>independentRTest k₀ h k σ + ((z.1:ZMod (frequencyModulus h k (k₀+2))),(z.2:ZMod (frequencyModulus h k (k₀+2)))) xUnits)* + average (fun z : MixedPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [plain_mixed_selected_eventually d Bs BD Bz hBs hk₀] with L hselected + intro E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ snew s₀ t₀ P₀ Q₀ gp gm + cnew c e hxn hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu newk m σ xUnits v outerU xs hslots D₀ P₁ q₁ v₁ _ huA hcrt + deleted hdeleted hZ + let h := decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ x₀ s₀) P₀ Q₀) c + let k := decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ y₀ t₀) P₀ Q₀) e + let newh := assignedHistory C.sources _ _ l snew gp gm xn cnew + let outside := spectatorList spectator ds + let M := newComparisonModulus newh h k outside k₀ + let : NeZero M := ⟨(assigned_newComparisonModulus_pos C.sources _ _ l snew gp gm + xn cnew h k hs ks (selected_spectator_primes spectator ds) k₀).ne'⟩ + let : NeZero (rootModulus newh) := neZero_of_dvd_modulus (new_A_dvd newh h k outside k₀) + let : NeZero outside.prod := neZero_of_dvd_modulus (new_D_dvd newh h k outside k₀) + let : NeZero (frequencyModulus h k (k₀+2)) := neZero_of_dvd_modulus (new_R_dvd newh h k outside k₀) + let : NeZero (representativeModulus h k) := neZero_of_dvd_modulus (new_B_dvd newh h k outside k₀) + have hbound := hselected E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ + snew s₀ t₀ P₀ Q₀ gp gm cnew c e hxn hx hy hc he hP hQ hPc hQc hs ks hmatch + ι eB u hu newk m σ xUnits v + (fun a => rootResidueIndicator newh a * mixedExtension + (fun z => (rootSmallTest d newh outerU xs hslots D₀ P₁ q₁ v₁ huA z:ℂ)) a) + (norm_mixed_rootSmallTest_le d newh outerU xs hslots D₀ P₁ q₁ v₁ huA) + deleted hdeleted hZ + have havg := new_reference_mixed_small_average_of_modulus k₀ h k hs ks newh newk d σ xUnits v + hcrt outerU xs hslots D₀ P₁ q₁ v₁ huA + rw [havg] at hbound + exact hbound + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalPlainPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalPlainPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..525e6895655fa2e24ddb1548c454922e37cea1ef --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportActualPrincipalPlainPrime.lean @@ -0,0 +1,111 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportActualPrincipalBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedPlainPrime + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding +open HistoryBulkReferenceNewModuli HistoryPairBulkTransport +open HistorySignedResidueFactorization HistorySignedSpectatorCRT HistoryBulkResidueNormSum HistoryBulkReferenceTests + +theorem plain_prime_actual_principal_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ (ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample) + (l : ℕ) (_ : l ≤ k₀) + (xn x₀ y₀ : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (snew s₀ t₀ P₀ Q₀ : ℤ) (gp gm : ℕ) + (cnew c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass xn ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x₀ ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y₀ ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_ : 0jointScalar C (bulkSize k₀ L/2) h k hs ks (boolEquiv h k) eB v u)- + primeIntegral (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (primeCutoff C.giantCenter (fun v=>jointScalar C (bulkSize k₀ L/2) h k hs ks (boolEquiv h k) eB v u))* + (average (fun z : UnitPair outside.prod=>residuePairSpectator (residueTransform d) outside outside.prod newh newk (z.1,z.2))* + average (fun z : UnitPair (frequencyModulus h k (k₀+2))=>independentRTest k₀ h k σ + ((z.1:ZMod (frequencyModulus h k (k₀+2))),(z.2:ZMod (frequencyModulus h k (k₀+2)))) xUnits)* + average (fun z : UnitPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)))‖≤ + 30*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [plain_prime_selected_eventually d Bs BD Bz hBs hk₀] with L hsource + intro E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ snew s₀ t₀ P₀ Q₀ gp gm + cnew c e hxn hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu newk m σ xUnits v hCRT deleted hdeleted hZ + let h := decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ x₀ s₀) P₀ Q₀) c + let k := decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ y₀ t₀) P₀ Q₀) e + let newh := assignedHistory C.sources _ _ l snew gp gm xn cnew + let outside := spectatorList spectator ds + let M := newComparisonModulus newh h k outside k₀ + let : NeZero M := ⟨(assigned_newComparisonModulus_pos C.sources _ _ l snew gp gm + xn cnew h k hs ks (selected_spectator_primes spectator ds) k₀).ne'⟩ + let : NeZero (rootModulus newh) := neZero_of_dvd_modulus (new_A_dvd newh h k outside k₀) + let : NeZero outside.prod := neZero_of_dvd_modulus (new_D_dvd newh h k outside k₀) + let : NeZero (frequencyModulus h k (k₀+2)) := neZero_of_dvd_modulus (new_R_dvd newh h k outside k₀) + let : NeZero (representativeModulus h k) := neZero_of_dvd_modulus (new_B_dvd newh h k outside k₀) + have hbound := hsource E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ + snew s₀ t₀ P₀ Q₀ gp gm cnew c e hxn hx hy hc he hP hQ hPc hQc + hs ks hmatch ι eB u hu newk m σ xUnits v + (rootResidueIndicator newh) + (root_test_norm_le_modulus newh (rootModulus newh)) deleted hdeleted hZ + have havg := new_reference_unit_root_average_of_modulus k₀ h k hs ks newh newk d σ xUnits v hCRT + rw [havg] at hbound + exact hbound + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..8ff061ca740e02eb96f3c655d75924e226351e3b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportBasic.lean @@ -0,0 +1,103 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportFlags +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkResidueNormSumFrequency +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCRTFourProducts +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPrincipalIntegralAverage +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedResidueMainFactors +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedSpectatorCRTResidue + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistoryPrincipalIntegralAverage ResidueHaar HistorySignedResidueFactorization + +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + +def referenceResidueTest (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (newh newk : History l) (g : (q:ℕ)→ZMod q→ℂ) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) (M : ℕ) + (hA : rootModulus newh∣M) (hD : outside.prod∣M) + (hR : frequencyModulus h k (K+2)∣M) (hB : representativeModulus h k∣M) + (fA : ZMod (rootModulus newh)×ZMod (rootModulus newh)→ℂ) + (z : ZMod M×ZMod M) : ℂ := + fA (projectedRingPair hA z)* + residuePairSpectator g outside outside.prod newh newk (projectedRingPair hD z)* + independentRTest K h k σ (projectedRingPair hR z) x* + primeResidueIndicatorAt h k hs ks v (projectedRingPair hB z) + +section Average +variable (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (newh newk : History l) (g : (q:ℕ)→ZMod q→ℂ) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) (M : ℕ) + (hA : rootModulus newh∣M) (hD : outside.prod∣M) + (hR : frequencyModulus h k (K+2)∣M) (hB : representativeModulus h k∣M) + (fA : ZMod (rootModulus newh)×ZMod (rootModulus newh)→ℂ) + [NeZero (rootModulus newh)] [NeZero outside.prod] + [NeZero (frequencyModulus h k (K+2))] [NeZero (representativeModulus h k)] [NeZero M] + (hc : (rootModulus newh).Coprime outside.prod ∧ + (rootModulus newh).Coprime (frequencyModulus h k (K+2)) ∧ + (rootModulus newh).Coprime (representativeModulus h k) ∧ + outside.prod.Coprime (frequencyModulus h k (K+2)) ∧ + outside.prod.Coprime (representativeModulus h k) ∧ + (frequencyModulus h k (K+2)).Coprime (representativeModulus h k)) + (hd : rootModulus newh*outside.prod*frequencyModulus h k (K+2)*representativeModulus h k∣M) +include hc hd + +theorem reference_unit_average : + average (fun z : UnitPair M => + referenceResidueTest K h k hs ks newh newk g σ x v M hA hD hR hB fA (z.1,z.2)) = + average (fun z : UnitPair (rootModulus newh)=>fA (z.1,z.2))* + average (fun z : UnitPair outside.prod=>residuePairSpectator g outside outside.prod newh newk (z.1,z.2))* + average (fun z : UnitPair (frequencyModulus h k (K+2))=>independentRTest K h k σ ((z.1:ZMod (frequencyModulus h k (K+2))), + (z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : UnitPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := by + unfold referenceResidueTest + exact four_unit_projected_product_average _ _ _ _ hc hd hA hD hR hB fA + (residuePairSpectator g outside outside.prod newh newk) + (fun z => independentRTest K h k σ z x) (primeResidueIndicatorAt h k hs ks v) + +theorem reference_mixed_average : + average (fun z : MixedPair M => + referenceResidueTest K h k hs ks newh newk g σ x v M hA hD hR hB fA (z.1,z.2)) = + average (fun z : MixedPair (rootModulus newh)=>fA (z.1,z.2))* + average (fun z : MixedPair outside.prod=>residuePairSpectator g outside outside.prod newh newk (z.1,z.2))* + average (fun z : MixedPair (frequencyModulus h k (K+2))=>independentRTest K h k σ ((z.1:ZMod (frequencyModulus h k (K+2))), + (z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : MixedPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := by + unfold referenceResidueTest + exact four_mixed_projected_product_average _ _ _ _ hc hd hA hD hR hB fA + (residuePairSpectator g outside outside.prod newh newk) + (fun z => independentRTest K h k σ z x) (primeResidueIndicatorAt h k hs ks v) + +omit fA in + +theorem reference_unit_root_average : + average (fun z : UnitPair M => + referenceResidueTest K h k hs ks newh newk g σ x v M hA hD hR hB + (rootResidueIndicator newh) (z.1,z.2)) = + average (fun z : UnitPair outside.prod=>residuePairSpectator g outside outside.prod newh newk (z.1,z.2))* + average (fun z : UnitPair (frequencyModulus h k (K+2))=>independentRTest K h k σ ((z.1:ZMod (frequencyModulus h k (K+2))), + (z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : UnitPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := by + rw [reference_unit_average K h k hs ks newh newk g σ x v M hA hD hR hB + (rootResidueIndicator newh) hc hd,HistorySignedResidueMainFactors.root_unit_average,one_mul] + +end Average +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportBudget.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..55df1ac279b534585393dc15b623f43e271fd8a1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportBudget.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualBoundsBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open LogCellPartition HistoryGiantGridCellBounds HistoryGiantReplacementError +open HistoryGiantPrincipalMassBounds HistoryGiantPriorExceptionalError SourcePriorGridDeletion +open PrimeCellReplacement HistoryGiantXiReplacementActual Filter + +theorem eventually_periodic_error_bounds (k₀ : ℕ) (c₀ : ℝ) + {K δ : ℝ} (hK : 0 ≤ K) (hδ : 0 < δ) : + ∀ᶠ L : ℝ in atTop, ∀ (G L₀ : ℝ) (M : ℕ) [NeZero M] + (deleted : Finset ℕ), deleted.card ≤ 2 → + Real.log (M:ℝ) ≤ Real.exp (giant.μ*L) → + Real.exp (giant.a₀*L) ≤ G-1 → + PrimeBounds k₀ δ K L₀ G L M deleted → + ∀ (a : ℕ), a ≤ residueCostExponent k₀ → + ∀ D A H Sp Sm : ℝ, 0 ≤ D → 0 ≤ A → 0 ≤ H → 0 ≤ Sp → 0 ≤ Sm → + D ≤ smoothGrowthFactor k₀ c₀ giant.μ L → + A ≤ smoothGrowthFactor k₀ c₀ giant.μ L → + H ≤ (M:ℝ)^a*smoothGrowthFactor k₀ c₀ giant.μ L → + Sp ≤ (M:ℝ)^a → Sm ≤ (M:ℝ)^a → + (deletionCap G deleted*(1+fullMassRatio G deleted)*H + + (2*(2*D*meshWidth giant L)*principalMass M + (fun _ : Bool => G-1) (fun _ => G+1) (fun _ => logCellMass G deleted) + + (2*D*meshWidth giant L+A)* + ((Fintype.card (GridBoxIndex (fun _ : Bool => G-1) (fun _ => G+1) + (fun _ => meshWidth giant L)):ℝ)*(8*giantPrimeError K δ G deleted)))*Sp ≤ + 29*Real.exp (-Real.exp (giant.target*L))) ∧ + ((Real.exp 1+1)*deletionCap G deleted*H + + (2*(2*D*meshWidth giant L)*mixedPrincipalMass M + (G-1) (G+1) G smoothPartition (fun _ : Unit => G-1) (fun _ => G+1) + (fun _ => logCellMass G deleted) + + (2*D*meshWidth giant L+A)* + ((Fintype.card (MixedGridIndex (G-1) (G+1) (meshWidth giant L) + (fun _ : Unit => G-1) (fun _ => G+1) (fun _ => meshWidth giant L)):ℝ)* + giantMixedError K δ G L deleted))*Sm ≤ + 8*Real.exp (-Real.exp (giant.target*L))) := by + have ht : Tendsto (fun L : ℝ => Real.exp (giant.a₁*L)) atTop atTop := + Real.tendsto_exp_atTop.comp (tendsto_id.const_mul_atTop (by norm_num [giant])) + filter_upwards [eventually_giant_grid_errors k₀ (C:=c₀) hK hδ, + eventually_variation_with_mass k₀ c₀ (by norm_num : (0:ℝ) ≤ 10), + eventually_exceptional_errors k₀ c₀, ht.eventually_ge_atTop 2, + eventually_ge_atTop (0:ℝ)] with L hgrid hvar hexc hlen hL + intro G L₀ M _ deleted hdeleted hmod hlo hb a ha D A H Sp Sm hD hA hH hSp hSm + hDF hAF hHF hSpQ hSmQ + have hM : 0 < M := NeZero.pos M + have hG : 2 ≤ G := by + have := Real.one_le_exp (mul_nonneg (show 0 ≤ giant.a₀ by norm_num [giant]) hL) + linarith + have hmass := original_giant_principal_masses M hM (bulkSize k₀ L) G deleted + hG hb.mass_pos hb.inverse_cost + have hgrid' := hgrid G L₀ M deleted hM hmod hb a ha + have hvarp := hvar a M + (principalMass M (fun _ : Bool => G-1) (fun _ => G+1) (fun _ => logCellMass G deleted)) + ha hM hmod hmass.1.2 + have hvarm := hvar a M + (mixedPrincipalMass M (G-1) (G+1) G smoothPartition + (fun _ : Unit => G-1) (fun _ => G+1) (fun _ => logCellMass G deleted)) + ha hM hmod hmass.2.2 + have hex := (hexc G M hM hmod hlo deleted hdeleted).errors a H ha hH hHF + constructor + · simpa only [show (5+3*(8:ℝ))=29 by norm_num] using + replacement_error_algebra _ D A (meshWidth giant L) _ _ Sp + (smoothGrowthFactor k₀ c₀ giant.μ L) ((meshIntervals giant L:ℝ)^2) ((M:ℝ)^a) + (giantPrimeError K δ G deleted) 8 (Real.exp (-Real.exp (giant.target*L))) + hD hA hb.mesh_pos.le hmass.1.1 (by positivity) hSp (Real.exp_nonneg _) + (by positivity) (by positivity) hb.error_nonneg (by norm_num) hb.mesh_le_one + hDF hAF (prime_grid_card_le G L hlen) hSpQ hex.1 hvarp hgrid'.1 + · simpa only [one_mul,show (5+3*(1:ℝ))=8 by norm_num] using + replacement_error_algebra _ D A (meshWidth giant L) _ _ Sm + (smoothGrowthFactor k₀ c₀ giant.μ L) ((meshIntervals giant L:ℝ)^2) ((M:ℝ)^a) + (giantMixedError K δ G L deleted) 1 (Real.exp (-Real.exp (giant.target*L))) + hD hA hb.mesh_pos.le hmass.2.1 (by positivity) hSm (Real.exp_nonneg _) + (by positivity) (by positivity) (giantMixedError_nonneg hb.error_nonneg) + (by norm_num) hb.mesh_le_one hDF hAF (mixed_grid_card_le G L hlen) hSmQ + hex.2.2.1 hvarm hgrid'.2 + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportCorrectedMixedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportCorrectedMixedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..22ae254b182a0c6ac69a2e480c44d3b4fbf0c9fc --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportCorrectedMixedSource.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportMixedGuarded +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSourceBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantGridCellBounds HistoryGiantReplacementGeometry +open HistoryGiantReplacementError HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open PrimeCellReplacement PrimeCellFreezing LogCellPartition HistoryGiantPriorGrid +open HistoryPairSmoothXi HistoryOccurrenceVariables HistoryPairPattern HistoryPairBulkCoordinates +open HistoryPairGiantCoordinates HistoryActiveCoordinates HistorySymbolicEncoding HistoryProductWindows +open HistoryBulkGiantCorrectedBounds HistoryBulkReferenceGiantDerivative + +theorem corrected_mixed_source_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {k₀ : ℕ} (hk₀ : 0 C.giantCenter-1) (fun _ => C.giantCenter+1)) + (_hsrc₂ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)), + ∀ (ι : Type) [Fintype ι] [DecidableEq ι] + (eB : ι ≃ bulkCoordinates h k) (u : ι→ℝ), (∀i,0 jointCorrectedScalar C s h k hs ks (optionEquiv h k) eB v u) - + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) (mixedGiantPrimeTest C.giantCenter (fun v => jointCorrectedScalar C s h k hs ks (optionEquiv h k) eB v u)) * average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + obtain ⟨δ,K,L₀,hδ,hK,hL₀,hreplace⟩ := exists_guarded_periodic_mixed_replacement_core + filter_upwards [hreplace k₀ (cutoffExponent Bs BD Bz k₀), + selected_gridCellBounds_eventually d Bs BD Bz hk₀ hK.le hδ L₀, + (bulkSize_tendsto_atTop hk₀).eventually_ge_atTop (1:ℝ)] with L hrep hgrid hbulk + intro E C hG hGu hcl hcu hb hd l s outside houtside hout h k hs ks hl hh hk matchRoots + hsrc₁ hsrc₂ ι _ _ eB u hu M _ hmod deleted hdeleted hZ a ha R hR hsum + have hm : 1≤bulkSize k₀ L := by exact_mod_cast hbulk + have hg := hgrid E C hG hGu hcl hcu hb hd M (NeZero.pos M) hmod + have hcut := corrected_mixed_giant_bounds C hBs hk₀ hm s houtside hout h k hs ks hl hh hk + matchRoots hsrc₁ hsrc₂ (optionEquiv h k) eB u hu + have hraw := corrected_giant_bounds C hBs hk₀ hm s houtside hout h k hs ks hl hh hk + matchRoots hsrc₁ hsrc₂ (optionEquiv h k) eB u hu + have hoc (a : ℝ) : Option.elim' a (fun _ : Unit => a) = (fun _ : Option Unit => a) := by + funext i + cases i <;> rfl + have he := cutoff_exp_le_smoothGrowth Bs BD Bz L k₀ + have her := selected_exp_le_cutoff_smoothGrowth Bs BD Bz L k₀ + apply hrep C.giantCenter M deleted hZ hdeleted hmod hg.1.lower_scale hg.1 + (hg.2 deleted hdeleted).1 a ha R hR hsum (fun v => jointCorrectedScalar C s h k hs ks (optionEquiv h k) eB v u) + · intro z hz + exact hcut.1.differentiable (by simp) z + · intro z hz i + exact ((hcut.2 z (by simpa only [hoc] using hz)).1 i).trans he + · intro z hz + exact ((hcut.2 z (by simpa only [hoc] using hz)).2).trans he + · intro z hz + exact ((hraw.2 z (by simpa only [hoc] using hz)).2).trans her + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportFlags.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportFlags.lean new file mode 100644 index 0000000000000000000000000000000000000000..019d6461a0f946b44eb53421d998adb85f831c1d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportFlags.lean @@ -0,0 +1,95 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsInsertion + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Characters.RationalHistory ClearedCoefficientFlags MvPolynomial +open HistoryOccurrenceVariables HistoryPairPattern HistoryPairRows HistoryPairGiantCoordinates +open HistoryBulkReferenceTests HistoryCRTIntegration HistoryOccurrenceRows +open HistorySymbolicScope HistoryCoefficientBounds HistoryRepeatedRenaming +variable {l : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + +theorem flag_vars_not_giant (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) (i : Occurrences h k) : + (∀j∈(leftFlag h k hs ks i).vars,j∉giantCoordinates h k) ∧ + (∀j∈(rightFlag h k hs ks i).vars,j∉giantCoordinates h k) := by + classical + let lev : PairKey h k → ℕ := fun j => if j∈giantCoordinates h k then 0 else l+1 + have hl : ∀j,lev (leftMap h k j)=rootFreeLevel h j := by + intro j + rcases j with b | j + · simp only [lev,giant_mem,ite_true,rootFreeLevel,Sum.elim_inl] + · simp only [lev,left_small_not_mem,ite_false,rootFreeLevel,Sum.elim_inr] + have hr : ∀j,lev (rightMap h k j)=rootFreeLevel k j := by + intro j + rcases j with b | j + · rw [←shared_giant] + simp only [lev,giant_mem,ite_true,rootFreeLevel,Sum.elim_inl] + · simp only [lev,right_small_not_mem,ite_false,rootFreeLevel,Sum.elim_inr] + have ha : Above lev (level h k i) (row h k hs ks i).1 ∧ + Above lev (level h k i) (row h k hs ks i).2 := by + rcases i with i | i + · have hf := rows_above h hs _ _ (rootFreeLevel h) + (coefficientHistory_rootFreeAbove h hs false) + (coefficientHistory_rootFreeAbove h hs true) i + exact ⟨(above_rename _ _ _ _ hl _).mpr hf.1,(above_rename _ _ _ _ hl _).mpr hf.2⟩ + · have hf := rows_above k ks _ _ (rootFreeLevel k) + (coefficientHistory_rootFreeAbove k ks false) + (coefficientHistory_rootFreeAbove k ks true) i + exact ⟨(above_rename _ _ _ _ hr _).mpr hf.1,(above_rename _ _ _ _ hr _).mpr hf.2⟩ + have hf := coefficients_above lev (level h k i) _ _ ha.1 ha.2 + constructor + · intro j hj hg + have hh := hf.1 j hj + simp only [lev,hg,ite_true,Nat.not_lt_zero] at hh + · intro j hj hg + have hh := hf.2.1 j hj + simp only [lev,hg,ite_true,Nat.not_lt_zero] at hh + +theorem flags_eval_eq_off_giants (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (v w : PairKey h k→ℤ) (hvw : ∀j,j∉giantCoordinates h k→v j=w j) + (i : Occurrences h k) : + eval v (leftFlag h k hs ks i)=eval w (leftFlag h k hs ks i) ∧ + eval v (rightFlag h k hs ks i)=eval w (rightFlag h k hs ks i) := by + constructor + · apply eval₂Hom_congr' rfl _ rfl + intro j hj _ + exact hvw j ((flag_vars_not_giant h k hs ks i).1 j hj) + · apply eval₂Hom_congr' rfl _ rfl + intro j hj _ + exact hvw j ((flag_vars_not_giant h k hs ks i).2 j hj) + +theorem primeResidueIndicatorAt_eq_off_giants (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (v w : PairKey h k→ℤ) (hvw : ∀j,j∉giantCoordinates h k→v j=w j) + (z : ZMod (representativeModulus h k)×ZMod (representativeModulus h k)) : + primeResidueIndicatorAt h k hs ks v z=primeResidueIndicatorAt h k hs ks w z := by + have he : finiteOwnPrimeLinesAt h k hs ks v z ↔ finiteOwnPrimeLinesAt h k hs ks w z := by + unfold finiteOwnPrimeLinesAt ownPrimeLineAt ownPrimeSquareLineAt + simp only [(flags_eval_eq_off_giants h k hs ks v w hvw _).1, + (flags_eval_eq_off_giants h k hs ks v w hvw _).2] + unfold primeResidueIndicatorAt + rw [he] + +theorem orderedSourceIndicatorB_eq_fixed_giants (sources : SourceFamily) (m k₀ : ℕ) + (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) + (hh : Template.Matches (Template.current (Template.initial m k₀) l) h.root.small) + (x : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (Xp Xm : ℤ) : + orderedSourceIndicatorB sources m k₀ h k hs ks hh x Xp Xm = + primeResidueIndicatorAt h k hs ks + (integerInsertOrderedGiants m k₀ h k hs hh + (orderedIntegerSourceValues sources m k₀ l x) (fun _=>0)) (Xp,Xm) := by + apply primeResidueIndicatorAt_eq_off_giants + intro j hj + simp only [integerInsertOrderedGiants,dite_eq_right hj] + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportGuard.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportGuard.lean new file mode 100644 index 0000000000000000000000000000000000000000..d79701579d0d9906e269076aa9a23b7d54f9a8d0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportGuard.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSamples + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistorySignedResidues PrimeCellFreezing HistoryGiantWeightedPriorReplacement + +private theorem weight_ne_zero_of_mass {G : ℝ} {E : Finset ℕ} + {hZ : 0G-1) (fun _=>G+1), + ‖f (fun i=>Real.exp (z i))‖≤A) : + ‖guardedPeriodicSourcePrimeMean G E hZ M R f- + periodicSourcePrimeMean G E hZ M R f‖≤ + (B*A)*(Real.exp (1-G)/Construction.logCellMass G E) := by + have hh := GiantCollisionError.logCell_guard_support G E hZ + (fun x=>R (x.1.val,x.2.val)* + f (fun t=>if t then (x.2.val:ℝ) else (x.1.val:ℝ))) (by positivity : 0≤B*A) (by + intro p q hp hq _ + exact periodic_prime_sample_bound M R B hB hR G A f hf + p.val (Finset.mem_sdiff.mp p.property).1 (weight_ne_zero_of_mass p hp) + q.val (Finset.mem_sdiff.mp q.property).1 (weight_ne_zero_of_mass q hq)) + simp only [FinitePrior.pair_cmean,guardedPeriodicSourcePrimeMean,periodicSourcePrimeMean,logCellPrimeSource] at hh ⊢ + convert hh using 1 + congr 1 + +theorem guarded_periodic_mixed_error (G : ℝ) (E : Finset ℕ) + (hZ : 0G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)),‖f (fun i=>Real.exp (z i))‖≤A) : + ‖guardedPeriodicSourceMixedMean G E hZ M R f- + periodicSourceMixedMean G E hZ M R f‖≤ + (B*A)*(8*Real.exp (-G)) := by + have hh := GiantCollisionError.logCell_integer_guard_support G E hZ + (fun q n=>R (n,q.val)* + f (Option.elim' (n:ℝ) (fun _ : Unit=>(q.val:ℝ)))) (by positivity : 0≤B*A) (by + intro q hq n hn hnw _ + exact periodic_mixed_sample_bound M R B hB hR G A f hf + n hn hnw q.val (Finset.mem_sdiff.mp q.property).1 (weight_ne_zero_of_mass q hq)) + simp only [guardedPeriodicSourceMixedMean,periodicSourceMixedMean,FinitePrior.cmean_sum, + FinitePrior.cmean_mul_left,logCellPrimeSource] at hh ⊢ + convert hh using 1 + congr 1 + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportGuardBudget.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportGuardBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..2628a8220b3cc6b831b482c4a66db5a314811c75 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportGuardBudget.lean @@ -0,0 +1,49 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportGuard +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantPriorExceptionalError + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryGiantWeightedPriorReplacement PrimeCellFreezing +open ScaleBudget PrimeCellActualErrorBudget HistoryGiantReplacementError Filter +open HistoryGiantPriorExceptionalError + +theorem eventually_periodic_guard_errors (k₀ : ℕ) (c₀ : ℝ) : + ∀ᶠ L : ℝ in atTop, ∀ (G : ℝ) (M : ℕ), 0G-1) (fun _=>G+1), + ‖f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + ‖guardedPeriodicSourcePrimeMean G E hZ M R f-periodicSourcePrimeMean G E hZ M R f‖≤ + Real.exp (-Real.exp (giant.target*L))) ∧ + (∀ f : (Option Unit→ℝ)→ℂ, + (∀z∈logRectangle (Option.elim' (G-1) (fun _ : Unit=>G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)), + ‖f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + ‖guardedPeriodicSourceMixedMean G E hZ M R f-periodicSourceMixedMean G E hZ M R f‖≤ + Real.exp (-Real.exp (giant.target*L))) := by + filter_upwards [eventually_exceptional_errors k₀ c₀] with L hexc + intro G M hM hmod hlo E hE hZ a ha R hR + have hex := (hexc G M hM hmod hlo E hE).errors a + ((M:ℝ)^a*smoothGrowthFactor k₀ c₀ giant.μ L) ha (mul_nonneg (pow_nonneg (Nat.cast_nonneg M) _) (Real.exp_nonneg _)) le_rfl + constructor + · intro f hf + exact (guarded_periodic_prime_error G E hZ M R ((M:ℝ)^a) (by positivity) hR f + (Real.exp_nonneg _) hf).trans hex.2.2.2.1 + · intro f hf + exact (guarded_periodic_mixed_error G E hZ M R ((M:ℝ)^a) (by positivity) hR f + (Real.exp_nonneg _) hf).trans hex.2.2.2.2 + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourceCorrectedMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourceCorrectedMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..d47deab5696ea55ca13ae3863a0bef596eabcde6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourceCorrectedMixed.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportCorrectedMixedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding + +theorem corrected_mixed_integer_source_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ (l s : ℕ) (outside : List ℕ) + (_ : ∀q∈outside,0jointCorrectedScalar C s h k hs ks (optionEquiv h k) eB v u)- + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (mixedGiantPrimeTest C.giantCenter (fun v=>jointCorrectedScalar C s h k hs ks (optionEquiv h k) eB v u))* + average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [corrected_mixed_source_eventually d Bs BD Bz hBs hk₀] with L hsource + intro E C hG hGu hcl hcu hb hd l s outside houtside hout hl x₀ y₀ s₀ t₀ P₀ Q₀ c e + hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu M _ hmod deleted hdeleted hZ a ha R hR hsum + have hsrc := selected_reference_sourceBounds C (frequencyBound Bs BD Bz k₀ L) l + x₀ y₀ s₀ t₀ c e P₀ Q₀ hx hy hc he hP hQ hPc hQc + have hh := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l x₀ s₀ P₀ Q₀ c + have hk := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l y₀ t₀ P₀ Q₀ e + exact hsource E C hG hGu hcl hcu hb hd l s outside houtside hout _ _ hs ks hl hh hk + hmatch hsrc.1 hsrc.2 ι eB u hu M hmod deleted hdeleted hZ a ha R hR hsum + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourcePlainMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourcePlainMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..1ec1955b9b3916c91d2bb8bda3b6a4c870fd5ee0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourcePlainMixed.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportPlainMixedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding + +theorem plain_mixed_integer_source_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ (l s : ℕ) (outside : List ℕ) + (_houtside : ∀q∈outside,0jointScalar C s h k hs ks (optionEquiv h k) eB v u)- + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (mixedGiantPrimeTest C.giantCenter (fun v=>jointScalar C s h k hs ks (optionEquiv h k) eB v u))* + average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [plain_mixed_source_eventually d Bs BD Bz hBs hk₀] with L hsource + intro E C hG hGu hcl hcu hb hd l s outside houtside hout hl x₀ y₀ s₀ t₀ P₀ Q₀ c e + hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu M _ hmod deleted hdeleted hZ a ha R hR hsum + have hsrc := selected_reference_sourceBounds C (frequencyBound Bs BD Bz k₀ L) l + x₀ y₀ s₀ t₀ c e P₀ Q₀ hx hy hc he hP hQ hPc hQc + have hh := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l x₀ s₀ P₀ Q₀ c + have hk := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l y₀ t₀ P₀ Q₀ e + exact hsource E C hG hGu hcl hcu hb hd l s outside houtside hout _ _ hs ks hl hh hk + hmatch hsrc.1 hsrc.2 ι eB u hu M hmod deleted hdeleted hZ a ha R hR hsum + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourcePlainPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourcePlainPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c28bd07c1c0437d20ac22683d84e4a943cb4110 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportIntegerSourcePlainPrime.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportPlainPrimeSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding + +theorem plain_prime_integer_source_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ (l s : ℕ) (outside : List ℕ) + (_ : ∀q∈outside,0jointScalar C s h k hs ks (boolEquiv h k) eB v u)- + primeIntegral (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (primeCutoff C.giantCenter (fun v=>jointScalar C s h k hs ks (boolEquiv h k) eB v u))* + average (fun z : UnitPair M=>R (z.1,z.2))‖≤ + 30*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [plain_prime_source_eventually d Bs BD Bz hBs hk₀] with L hsource + intro E C hG hGu hcl hcu hb hd l s outside houtside hout hl x₀ y₀ s₀ t₀ P₀ Q₀ c e + hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu M _ hmod deleted hdeleted hZ a ha R hR hsum + have hsrc := selected_reference_sourceBounds C (frequencyBound Bs BD Bz k₀ L) l + x₀ y₀ s₀ t₀ c e P₀ Q₀ hx hy hc he hP hQ hPc hQc + have hh := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l x₀ s₀ P₀ Q₀ c + have hk := assigned_giant_tree_source_labels C.sources _ (frequencyBound Bs BD Bz k₀ L) + l y₀ t₀ P₀ Q₀ e + exact hsource E C hG hGu hcl hcu hb hd l s outside houtside hout _ _ hs ks hl hh hk + hmatch hsrc.1 hsrc.2 ι eB u hu M hmod deleted hdeleted hZ a ha R hR hsum + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMaskBounds.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMaskBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..3eafe817d9a71c95c17018cf7edda596832fa6ad --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMaskBounds.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportA +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportNorm +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalSmallGiantTransportBounds + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistoryPrincipalIntegralAverage ResidueHaar HistorySignedResidueFactorization +open HistorySignedResidueWeightedAverages HistoryDiagonalSmallAverage DiagonalSmallResidueNorm +open HistoryGiantWeightedPriorReplacement +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + +lemma norm_rootResidueIndicator_le_one (h : History l) (z : ZMod (rootModulus h)×ZMod (rootModulus h)) : + ‖rootResidueIndicator h z‖ ≤ 1 := by + classical + unfold rootResidueIndicator guardIndicator + split_ifs <;> simp + +lemma norm_mixed_rootSmallTest_le (d : Decomposition) (h : History l) + (outerU xs : List SmallSlot) (hslots : h.root.small.Perm (outerU++xs)) + (D P q : ℕ) (v : ℤ) [∀i,Fact (smallPrime xs outerU i).Prime] + (hu : SmallUnitData D P q outerU xs v) (z : ZMod (rootModulus h)×ZMod (rootModulus h)) : + ‖rootResidueIndicator h z * mixedExtension + (fun u => (rootSmallTest d h outerU xs hslots D P q v hu u:ℂ)) z‖ ≤ (rootModulus h:ℝ) := by + classical + rw [norm_mul] + have he : ‖mixedExtension (fun u => (rootSmallTest d h outerU xs hslots D P q v hu u:ℂ)) z‖ ≤ + (rootModulus h:ℝ) := by + unfold mixedExtension + split_ifs + · exact rootSmallTest_norm_le d h outerU xs hslots D P q v hu _ + · simp + exact (mul_le_mul (norm_rootResidueIndicator_le_one h z) he (norm_nonneg _) (by norm_num)).trans_eq (one_mul _) + +theorem reference_test_budget (d : Decomposition) (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (newh newk : History l) (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) (M : ℕ) [NeZero M] + (hA : rootModulus newh∣M) (hD : outside.prod∣M) + (hR : frequencyModulus h k (K+2)∣M) (hB : representativeModulus h k∣M) + (fA : ZMod (rootModulus newh)×ZMod (rootModulus newh)→ℂ) + (hout : ∀q∈outside,q.Prime) (hW : ∀z,‖fA z‖≤(M:ℝ)) : + let R := referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA + (∀z,‖R z‖≤(M:ℝ)^(3+2^(l+1))) ∧ + (∑u : Bool→(ZMod M)ˣ,‖primeTest R u‖)≤(M:ℝ)^(3+2^(l+1)) ∧ + (∑r : ZMod M,∑u : Unit→(ZMod M)ˣ,‖mixedTest R r u‖)≤(M:ℝ)^(3+2^(l+1)) := by + dsimp only + refine ⟨?_,sum_norm_reference_primeTest_le_modulus_succ d K h k hs ks newh newk σ x v M + hA hD hR hB fA hout M (Nat.cast_nonneg M) hW le_rfl, + sum_norm_reference_mixedTest_le_modulus_succ d K h k hs ks newh newk σ x v M + hA hD hR hB fA hout M (Nat.cast_nonneg M) hW le_rfl⟩ + intro z + have ho : (outside.prod:ℝ)≤M := by exact_mod_cast Nat.le_of_dvd (NeZero.pos M) hD + have hm : (1:ℝ)≤M := by exact_mod_cast NeZero.pos M + refine (norm_referenceResidueTest_le d K h k hs ks newh newk σ x v M hA hD hR hB fA + hout M (Nat.cast_nonneg M) hW z).trans ?_ + calc + _ ≤ (M:ℝ)*(M:ℝ)^(2^(l+1)) := by gcongr + _ = (M:ℝ)^(1+2^(l+1)) := by rw [pow_add (M:ℝ) 1 (2^(l+1)),pow_one] + _ ≤ _ := pow_le_pow_right₀ hm (by omega) + +lemma root_test_norm_le_modulus (newh : History l) (M : ℕ) [NeZero M] + (z : ZMod (rootModulus newh)×ZMod (rootModulus newh)) : + ‖rootResidueIndicator newh z‖≤(M:ℝ) := + (norm_rootResidueIndicator_le_one newh z).trans (by exact_mod_cast NeZero.pos M) + +lemma mixed_small_test_norm_le_modulus (d : Decomposition) (newh : History l) + (outerU xs : List SmallSlot) (hslots : newh.root.small.Perm (outerU++xs)) + (D P q : ℕ) (v : ℤ) [∀i,Fact (smallPrime xs outerU i).Prime] + (hu : SmallUnitData D P q outerU xs v) (M : ℕ) [NeZero M] + (hA : rootModulus newh∣M) (z : ZMod (rootModulus newh)×ZMod (rootModulus newh)) : + ‖rootResidueIndicator newh z * mixedExtension + (fun u => (rootSmallTest d newh outerU xs hslots D P q v hu u:ℂ)) z‖≤(M:ℝ) := + (norm_mixed_rootSmallTest_le d newh outerU xs hslots D P q v hu z).trans + (by exact_mod_cast Nat.le_of_dvd (NeZero.pos M) hA) + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMixedCore.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMixedCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..0f70b75a1f09f2dc9dac2b95466c4fb2bec89e96 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMixedCore.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSamples +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPrincipalIntegralAverage + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantGridCellBounds HistoryGiantReplacementGeometry +open HistoryGiantReplacementError HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open PrimeCellReplacement PrimeCellFreezing LogCellPartition HistoryGiantPriorGrid +open HistoryPairSmoothXi + +theorem exists_periodic_mixed_replacement_core : + ∃ δ K L₀ : ℝ, 0<δ ∧ 0G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)), + DifferentiableAt ℝ (fun y=>mixedGiantPrimeTest G f (fun i=>Real.exp (y i))) z) → + (∀z∈logRectangle (Option.elim' (G-1) (fun _ : Unit=>G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)),∀i, + ‖deriv (fun t=>mixedGiantPrimeTest G f + (Characters.RationalHistory.Expr.logCurve (fun q=>Real.exp (z q)) i t)) 0‖≤ + smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (Option.elim' (G-1) (fun _ : Unit=>G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)), + ‖mixedGiantPrimeTest G f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (Option.elim' (G-1) (fun _ : Unit=>G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)), + ‖f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + ‖periodicSourceMixedMean G deleted hZ M R f- + mixedIntegral (G-1) (G+1) G smoothPartition + (fun _ : Unit=>G-1) (fun _=>G+1) (fun _=>logCellMass G deleted) + (mixedGiantPrimeTest G f)*average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 8*Real.exp (-Real.exp (giant.target*L)) := by + obtain ⟨δ,K,L₀,hδ,hK,hL₀,hreplace⟩ := exists_periodicSourceMixedMean_replacement_constants + refine ⟨δ,K,L₀,hδ,hK,hL₀,?_⟩ + intro k₀ c₀ + filter_upwards [eventually_periodic_error_bounds k₀ c₀ hK.le hδ] with L hbudget + intro G M _ deleted hZ hdeleted hmod hlo hg hb a ha R hR hsum f hf hderiv hA hraw + let F := smoothGrowthFactor k₀ c₀ giant.μ L + have hF : 0≤F := Real.exp_nonneg _ + have hQ : 0≤(M:ℝ)^a := by positivity + have hSm : 0≤∑r : ZMod M,∑u : Unit→(ZMod M)ˣ,‖mixedTest R r u‖ := + Finset.sum_nonneg (fun _ _=>Finset.sum_nonneg (fun _ _=>norm_nonneg _)) + have hbound := hreplace G deleted hZ M R hg.modulus_lt_cell + (meshWidth giant L) (fun _=>meshWidth giant L) + (by have := hg.lower_threshold; linarith) hg.lower_threshold hb.mesh_pos + (fun _=>⟨hb.mesh_pos,hb.mesh_le_one⟩) hg.modulus_admissible + (giantPrimeError K δ G deleted) 2 (giantMixedError K δ G L deleted) + hb.error_nonneg (by norm_num) (giantMixedError_nonneg hb.error_nonneg) + (fun j i=>(hb.boxes Unit j.2 i).2.2.2.1) + (fun j i=>(add_le_add le_rfl (hb.boxes Unit j.2 i).2.2.2.1).trans + (hb.boxes Unit j.2 i).2.2.2.2) + (fun j=>mixedGridError_le_giantMixedError hb (NeZero.pos M) hg j.1) + f F (meshWidth giant L) F ((M:ℝ)^a*F) hF hb.mesh_pos.le (mul_nonneg hQ hF) + le_rfl (fun _=>le_rfl) hf hderiv hA + (periodic_mixed_sample_bound M R ((M:ℝ)^a) hQ hR G F f hraw) + have hnum := (hbudget G L₀ M deleted hdeleted hmod hlo hb a ha + F F ((M:ℝ)^a*F) 0 (∑r : ZMod M,∑u : Unit→(ZMod M)ˣ,‖mixedTest R r u‖) + hF hF (mul_nonneg hQ hF) le_rfl hSm le_rfl le_rfl le_rfl hQ hsum).2 + have hfinal := hbound.trans hnum + simp only [mixedTest] at hfinal + rw [mixedPrincipalIntegral_pair M (G-1) (G+1) G smoothPartition + (fun _ : Unit=>G-1) (fun _=>G+1) (fun _=>logCellMass G deleted) + (mixedGiantPrimeTest G f) (fun z : MixedPair M=>R (z.1,z.2))] at hfinal + exact hfinal + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMixedGuarded.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMixedGuarded.lean new file mode 100644 index 0000000000000000000000000000000000000000..b9025552ff40d487e7e4d3821147cbb3cfe6d166 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportMixedGuarded.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportGuardBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportMixedCore +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPrincipalIntegralAverage + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantGridCellBounds HistoryGiantReplacementGeometry +open HistoryGiantReplacementError HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open PrimeCellReplacement PrimeCellFreezing LogCellPartition HistoryGiantPriorGrid +open HistoryPairSmoothXi + +theorem exists_guarded_periodic_mixed_replacement_core : + ∃ δ K L₀ : ℝ, 0<δ ∧ 0G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)), + DifferentiableAt ℝ (fun y=>mixedGiantPrimeTest G f (fun i=>Real.exp (y i))) z) → + (∀z∈logRectangle (Option.elim' (G-1) (fun _ : Unit=>G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)),∀i, + ‖deriv (fun t=>mixedGiantPrimeTest G f + (Characters.RationalHistory.Expr.logCurve (fun q=>Real.exp (z q)) i t)) 0‖≤ + smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (Option.elim' (G-1) (fun _ : Unit=>G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)), + ‖mixedGiantPrimeTest G f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (Option.elim' (G-1) (fun _ : Unit=>G-1)) + (Option.elim' (G+1) (fun _ : Unit=>G+1)), + ‖f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + ‖guardedPeriodicSourceMixedMean G deleted hZ M R f- + mixedIntegral (G-1) (G+1) G smoothPartition + (fun _ : Unit=>G-1) (fun _=>G+1) (fun _=>logCellMass G deleted) + (mixedGiantPrimeTest G f)*average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + obtain ⟨δ,K,L₀,hδ,hK,hL₀,hreplace⟩ := exists_periodic_mixed_replacement_core + refine ⟨δ,K,L₀,hδ,hK,hL₀,?_⟩ + intro k₀ c₀ + filter_upwards [hreplace k₀ c₀,eventually_periodic_guard_errors k₀ c₀] with L hcore hguard + intro G M _ deleted hZ hdeleted hmod hlo hg hb a ha R hR hsum f hf hderiv hA hraw + have hp := hcore G M deleted hZ hdeleted hmod hlo hg hb a ha R hR hsum f hf hderiv hA hraw + have hg' := (hguard G M (NeZero.pos M) hmod hlo deleted hdeleted hZ a ha R hR).2 f hraw + exact (norm_sub_le_norm_sub_add_norm_sub _ (periodicSourceMixedMean G deleted hZ M R f) _).trans + ((add_le_add hg' hp).trans_eq (by ring)) + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportModulus.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportModulus.lean new file mode 100644 index 0000000000000000000000000000000000000000..cb94fecaf80b55b8fe091334226de3a162ed7f96 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportModulus.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportMaskBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceNewModuliBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistorySignedResidueFactorization HistoryGiantWeightedPriorReplacement HistoryBulkReferenceNewModuli +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + +lemma new_A_dvd (newh h k : History l) (outside : List ℕ) (K : ℕ) : + rootModulus newh∣newComparisonModulus newh h k outside K := by + refine ⟨outside.prod*frequencyModulus h k (K+2)*representativeModulus h k,?_⟩ + unfold newComparisonModulus + ring + +lemma new_D_dvd (newh h k : History l) (outside : List ℕ) (K : ℕ) : + outside.prod∣newComparisonModulus newh h k outside K := by + refine ⟨rootModulus newh*frequencyModulus h k (K+2)*representativeModulus h k,?_⟩ + unfold newComparisonModulus + ring + +lemma new_R_dvd (newh h k : History l) (outside : List ℕ) (K : ℕ) : + frequencyModulus h k (K+2)∣newComparisonModulus newh h k outside K := by + refine ⟨rootModulus newh*outside.prod*representativeModulus h k,?_⟩ + unfold newComparisonModulus + ring + +lemma new_B_dvd (newh h k : History l) (outside : List ℕ) (K : ℕ) : + representativeModulus h k∣newComparisonModulus newh h k outside K := by + refine ⟨rootModulus newh*outside.prod*frequencyModulus h k (K+2),?_⟩ + unfold newComparisonModulus + ring + +def newReferenceResidueTest (d : Decomposition) (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) (newh newk : History l) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) + (fA : ZMod (rootModulus newh)×ZMod (rootModulus newh)→ℂ) : + ZMod (newComparisonModulus newh h k outside K)×ZMod (newComparisonModulus newh h k outside K)→ℂ := + referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v + (newComparisonModulus newh h k outside K) (new_A_dvd newh h k outside K) + (new_D_dvd newh h k outside K) (new_R_dvd newh h k outside K) (new_B_dvd newh h k outside K) fA + +theorem new_reference_test_budget (d : Decomposition) (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) (newh newk : History l) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) + (fA : ZMod (rootModulus newh)×ZMod (rootModulus newh)→ℂ) + (hout : ∀q∈outside,q.Prime) + [NeZero (newComparisonModulus newh h k outside K)] + (hW : ∀z,‖fA z‖≤(rootModulus newh:ℝ)) : + let M := newComparisonModulus newh h k outside K + let R := newReferenceResidueTest d K h k hs ks newh newk σ x v fA + (∀z,‖R z‖≤(M:ℝ)^(3+2^(l+1))) ∧ + (∑u : Bool→(ZMod M)ˣ,‖primeTest R u‖)≤(M:ℝ)^(3+2^(l+1)) ∧ + (∑r : ZMod M,∑u : Unit→(ZMod M)ˣ,‖mixedTest R r u‖)≤(M:ℝ)^(3+2^(l+1)) := by + apply reference_test_budget d K h k hs ks newh newk σ x v _ _ _ _ _ fA hout + intro z + exact (hW z).trans (by exact_mod_cast Nat.le_of_dvd (NeZero.pos _) (new_A_dvd newh h k outside K)) + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportModulusCRT.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportModulusCRT.lean new file mode 100644 index 0000000000000000000000000000000000000000..6c765529348206cf71b4217f1c2fe2dbc93fd824 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportModulusCRT.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportModulus +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceNewModuli + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistoryPrincipalIntegralAverage ResidueHaar HistorySignedResidueFactorization +open HistorySignedResidueWeightedAverages HistoryDiagonalSmallAverage DiagonalSmallResidueNorm +open HistoryBulkReferenceNewModuli +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} +section Average +variable (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (newh newk : History l) (d : Decomposition) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) + [NeZero (rootModulus newh)] [NeZero outside.prod] + [NeZero (frequencyModulus h k (K+2))] [NeZero (representativeModulus h k)] [NeZero (newComparisonModulus newh h k outside K)] + (hc : NewCRTCompatible newh h k outside K) +include hc + +theorem new_reference_unit_root_average : + average (fun z : UnitPair (newComparisonModulus newh h k outside K) => + newReferenceResidueTest d K h k hs ks newh newk σ x v (rootResidueIndicator newh) (z.1,z.2)) = + average (fun z : UnitPair outside.prod=>residuePairSpectator (residueTransform d) outside outside.prod newh newk (z.1,z.2))* + average (fun z : UnitPair (frequencyModulus h k (K+2))=>independentRTest K h k σ + ((z.1:ZMod (frequencyModulus h k (K+2))),(z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : UnitPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := + reference_unit_root_average K h k hs ks newh newk (residueTransform d) σ x v + (newComparisonModulus newh h k outside K) (new_A_dvd newh h k outside K) + (new_D_dvd newh h k outside K) (new_R_dvd newh h k outside K) + (new_B_dvd newh h k outside K) hc dvd_rfl + +theorem new_reference_mixed_small_average + (outerU xs : List SmallSlot) (hslots : newh.root.small.Perm (outerU++xs)) + (D₀ P₀ q₀ : ℕ) (v₀ : ℤ) [∀i,Fact (smallPrime xs outerU i).Prime] + (huA : SmallUnitData D₀ P₀ q₀ outerU xs v₀) : + average (fun z : MixedPair (newComparisonModulus newh h k outside K) => + newReferenceResidueTest d K h k hs ks newh newk σ x v + (fun a => rootResidueIndicator newh a * mixedExtension + (fun u => (rootSmallTest d newh outerU xs hslots D₀ P₀ q₀ v₀ huA u:ℂ)) a) (z.1,z.2)) = + ((∏i : Fin outerU.length, (((outerU[i].value-1:ℕ):ℝ)/outerU[i].value):ℝ):ℂ)* + average (fun z : MixedPair outside.prod=>residuePairSpectator (residueTransform d) outside outside.prod newh newk (z.1,z.2))* + average (fun z : MixedPair (frequencyModulus h k (K+2))=>independentRTest K h k σ + ((z.1:ZMod (frequencyModulus h k (K+2))),(z.2:ZMod (frequencyModulus h k (K+2)))) x)* + average (fun z : MixedPair (representativeModulus h k)=>primeResidueIndicatorAt h k hs ks v (z.1,z.2)) := + reference_mixed_small_average K h k hs ks newh newk (residueTransform d) σ x v + (newComparisonModulus newh h k outside K) (new_A_dvd newh h k outside K) + (new_D_dvd newh h k outside K) (new_R_dvd newh h k outside K) + (new_B_dvd newh h k outside K) hc dvd_rfl d outerU xs hslots D₀ P₀ q₀ v₀ huA + +end Average +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportNorm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportNorm.lean new file mode 100644 index 0000000000000000000000000000000000000000..af565555b4ad4cdf3724e17b42374964b7ec1047 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportNorm.lean @@ -0,0 +1,131 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportNormBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantWeightedPriorReplacementBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistoryPrincipalIntegralAverage ResidueHaar HistorySignedResidueFactorization +open HistoryGiantWeightedPriorReplacement + +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + +theorem norm_primeResidueIndicatorAt_le (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (v : PairKey h k→ℤ) (z : ZMod (representativeModulus h k)×ZMod (representativeModulus h k)) : + ‖primeResidueIndicatorAt h k hs ks v z‖≤1 := by + classical + unfold primeResidueIndicatorAt guardIndicator + split_ifs <;> simp + +section Bounds +variable (d : Decomposition) (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (newh newk : History l) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) (M : ℕ) + (hA : rootModulus newh∣M) (hD : outside.prod∣M) + (hR : frequencyModulus h k (K+2)∣M) (hB : representativeModulus h k∣M) + (fA : ZMod (rootModulus newh)×ZMod (rootModulus newh)→ℂ) + (hout : ∀q∈outside,q.Prime) (BW : ℝ) (hBW : 0≤BW) (hW : ∀z,‖fA z‖≤BW) + +include hout hBW hW + +theorem norm_referenceResidueTest_le (z : ZMod M×ZMod M) : + ‖referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA z‖≤ + BW*(outside.prod:ℝ)^(2^(l+1)) := by + unfold referenceResidueTest + simp only [norm_mul] + calc + _ ≤ BW*(outside.prod:ℝ)^(2^(l+1))*1*1 := by + gcongr + · exact hW _ + · exact norm_actual_residuePairSpectator_le d outside hout outside.prod newh newk _ + · exact independentRTest_norm_le K h k σ _ x + · exact norm_primeResidueIndicatorAt_le h k hs ks v _ + _ = _ := by ring + +variable [NeZero M] + +theorem sum_norm_reference_primeTest_le : + (∑u : Bool→(ZMod M)ˣ, + ‖primeTest (referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA) u‖)≤ + BW*(M.totient:ℝ)^2*(outside.prod:ℝ)^(2^(l+1)) := by + calc + _ ≤ ∑_u : Bool→(ZMod M)ˣ,BW*(outside.prod:ℝ)^(2^(l+1)) := + Finset.sum_le_sum (fun u _=>norm_referenceResidueTest_le + d K h k hs ks newh newk σ x v M hA hD hR hB fA hout BW hBW hW _) + _ = _ := by + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Fintype.card_fun, + Fintype.card_bool,ZMod.card_units_eq_totient,Nat.cast_pow] + ring + +theorem sum_norm_reference_mixedTest_le : + (∑r : ZMod M,∑u : Unit→(ZMod M)ˣ, + ‖mixedTest (referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA) r u‖)≤ + BW*(M:ℝ)*(M.totient:ℝ)*(outside.prod:ℝ)^(2^(l+1)) := by + calc + _ ≤ ∑_r : ZMod M,∑_u : Unit→(ZMod M)ˣ,BW*(outside.prod:ℝ)^(2^(l+1)) := by + apply Finset.sum_le_sum + intro r _ + exact Finset.sum_le_sum (fun u _=>norm_referenceResidueTest_le + d K h k hs ks newh newk σ x v M hA hD hR hB fA hout BW hBW hW _) + _ = _ := by + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Fintype.card_fun, + Fintype.card_unit,pow_one,ZMod.card_units_eq_totient,ZMod.card] + ring + +theorem sum_norm_reference_primeTest_le_modulus : + (∑u : Bool→(ZMod M)ˣ, + ‖primeTest (referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA) u‖)≤ + BW*(M:ℝ)^(2+2^(l+1)) := by + have ho : (outside.prod:ℝ)≤M := by exact_mod_cast Nat.le_of_dvd (NeZero.pos M) hD + have ht : (M.totient:ℝ)≤M := by exact_mod_cast Nat.totient_le M + refine (sum_norm_reference_primeTest_le d K h k hs ks newh newk σ x v M hA hD hR hB fA hout BW hBW hW).trans ?_ + calc + _ ≤ BW*(M:ℝ)^2*(M:ℝ)^(2^(l+1)) := by gcongr + _ = _ := by rw [pow_add (M:ℝ) 2 (2^(l+1))]; ring + +theorem sum_norm_reference_mixedTest_le_modulus : + (∑r : ZMod M,∑u : Unit→(ZMod M)ˣ, + ‖mixedTest (referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA) r u‖)≤ + BW*(M:ℝ)^(2+2^(l+1)) := by + have ho : (outside.prod:ℝ)≤M := by exact_mod_cast Nat.le_of_dvd (NeZero.pos M) hD + have ht : (M.totient:ℝ)≤M := by exact_mod_cast Nat.totient_le M + refine (sum_norm_reference_mixedTest_le d K h k hs ks newh newk σ x v M hA hD hR hB fA hout BW hBW hW).trans ?_ + calc + _ ≤ BW*(M:ℝ)*(M:ℝ)*(M:ℝ)^(2^(l+1)) := by gcongr + _ = _ := by rw [pow_add (M:ℝ) 2 (2^(l+1)),pow_two]; ring + +theorem sum_norm_reference_primeTest_le_modulus_succ (hWM : BW≤M) : + (∑u : Bool→(ZMod M)ˣ, + ‖primeTest (referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA) u‖)≤ + (M:ℝ)^(3+2^(l+1)) := by + refine (sum_norm_reference_primeTest_le_modulus d K h k hs ks newh newk σ x v M hA hD hR hB fA hout BW hBW hW).trans ?_ + calc + _ ≤ (M:ℝ)*(M:ℝ)^(2+2^(l+1)) := mul_le_mul_of_nonneg_right hWM (by positivity) + _ = _ := by rw [show 3+2^(l+1)=(2+2^(l+1))+1 by omega,pow_succ]; ring + +theorem sum_norm_reference_mixedTest_le_modulus_succ (hWM : BW≤M) : + (∑r : ZMod M,∑u : Unit→(ZMod M)ˣ, + ‖mixedTest (referenceResidueTest K h k hs ks newh newk (residueTransform d) σ x v M hA hD hR hB fA) r u‖)≤ + (M:ℝ)^(3+2^(l+1)) := by + refine (sum_norm_reference_mixedTest_le_modulus d K h k hs ks newh newk σ x v M hA hD hR hB fA hout BW hBW hW).trans ?_ + calc + _ ≤ (M:ℝ)*(M:ℝ)^(2+2^(l+1)) := mul_le_mul_of_nonneg_right hWM (by positivity) + _ = _ := by rw [show 3+2^(l+1)=(2+2^(l+1))+1 by omega,pow_succ]; ring + +end Bounds +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportNormBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportNormBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..af97d56ac1576d66e69c0c7585d28b50f7e04a86 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportNormBasic.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedResiduesBounds + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistorySignedSpectatorCRT HistorySignedResidues + +theorem norm_residueLeaf_le_product (g : (q : ℕ) → ZMod q → ℂ) + (outside : List ℕ) (B : ℕ → ℝ) (hB : ∀q∈outside,0≤B q) + (hg : ∀q∈outside,∀x,‖g q x‖≤B q) (N : ℕ) (a : State) (Xp Xm : ZMod N) : + ‖residueLeaf g outside N a Xp Xm‖≤(outside.map B).prod := + norm_map_prod_le outside _ B hB (fun q hq=>hg q hq _) + +theorem norm_residueSpectator_le_power (g : (q : ℕ) → ZMod q → ℂ) + (outside : List ℕ) (B : ℕ → ℝ) (hB : ∀q∈outside,0≤B q) + (hg : ∀q∈outside,∀x,‖g q x‖≤B q) (N : ℕ) {l : ℕ} (h : History l) + (Xp Xm : ZMod N) : ‖residueSpectator g outside N h Xp Xm‖≤(outside.map B).prod^(2^l) := by + have hP : 0≤(outside.map B).prod := List.prod_nonneg (by + intro x hx + obtain ⟨q,hq,rfl⟩ := List.mem_map.mp hx + exact hB q hq) + induction h generalizing Xp Xm with + | leaf a => + simpa only [residueSpectator,pow_zero,pow_one] using + norm_residueLeaf_le_product g outside B hB hg N a Xp Xm + | @node l a p u hp hm left right il ir => + simp only [residueSpectator,norm_mul,Complex.norm_conj] + calc + _ ≤ (outside.map B).prod^(2^l)*(outside.map B).prod^(2^l) := + mul_le_mul (il _ Xp) (ir _ Xm) (norm_nonneg _) (pow_nonneg hP _) + _ = (outside.map B).prod^(2^(l+1)) := by rw [pow_succ,pow_mul,pow_two] + +theorem norm_residuePairSpectator_le_power (g : (q : ℕ) → ZMod q → ℂ) + (outside : List ℕ) (B : ℕ → ℝ) (hB : ∀q∈outside,0≤B q) + (hg : ∀q∈outside,∀x,‖g q x‖≤B q) (N : ℕ) {l : ℕ} (h k : History l) + (z : ZMod N×ZMod N) : ‖residuePairSpectator g outside N h k z‖≤(outside.map B).prod^(2^(l+1)) := by + have hP : 0≤(outside.map B).prod := List.prod_nonneg (by + intro x hx + obtain ⟨q,hq,rfl⟩ := List.mem_map.mp hx + exact hB q hq) + rw [residuePairSpectator,norm_mul,Complex.norm_conj] + calc + _ ≤ (outside.map B).prod^(2^l)*(outside.map B).prod^(2^l) := + mul_le_mul (norm_residueSpectator_le_power g outside B hB hg N h z.1 z.2) + (norm_residueSpectator_le_power g outside B hB hg N k z.1 z.2) + (norm_nonneg _) (pow_nonneg hP _) + _ = (outside.map B).prod^(2^(l+1)) := by rw [pow_succ,pow_mul,pow_two] + +theorem norm_actual_residuePairSpectator_le (d : Decomposition) (outside : List ℕ) + (hout : ∀q∈outside,q.Prime) (N : ℕ) {l : ℕ} (h k : History l) (z : ZMod N×ZMod N) : + ‖residuePairSpectator (residueTransform d) outside N h k z‖≤(outside.prod:ℝ)^(2^(l+1)) := by + simpa only [Nat.cast_list_prod] using norm_residuePairSpectator_le_power + (residueTransform d) outside (fun q=>(q:ℝ)) (fun q _=>Nat.cast_nonneg q) + (fun q hq x=>residueTransform_norm_le_prime d q (hout q hq) x) N h k z + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPlainMixedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPlainMixedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..efb84b92d7f69723467837832c6f264c3ac6a27c --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPlainMixedSource.lean @@ -0,0 +1,87 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportMixedGuarded +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSourceBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantGridCellBounds HistoryGiantReplacementGeometry +open HistoryGiantReplacementError HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open PrimeCellReplacement PrimeCellFreezing LogCellPartition HistoryGiantPriorGrid +open HistoryPairSmoothXi HistoryOccurrenceVariables HistoryPairPattern HistoryPairBulkCoordinates +open HistoryPairGiantCoordinates HistoryActiveCoordinates HistorySymbolicEncoding HistoryProductWindows +open HistoryBulkGiantCorrectedBounds HistoryBulkReferenceGiantDerivative + +theorem plain_mixed_source_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {k₀ : ℕ} (hk₀ : 0 C.giantCenter-1) (fun _ => C.giantCenter+1)) + (_hsrc₂ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)), + ∀ (ι : Type) [Fintype ι] [DecidableEq ι] + (eB : ι ≃ bulkCoordinates h k) (u : ι→ℝ), (∀i,0 jointScalar C s h k hs ks (optionEquiv h k) eB v u) - + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) (mixedGiantPrimeTest C.giantCenter (fun v => jointScalar C s h k hs ks (optionEquiv h k) eB v u)) * average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + obtain ⟨δ,K,L₀,hδ,hK,hL₀,hreplace⟩ := exists_guarded_periodic_mixed_replacement_core + filter_upwards [hreplace k₀ (cutoffExponent Bs BD Bz k₀), + selected_gridCellBounds_eventually d Bs BD Bz hk₀ hK.le hδ L₀, + (bulkSize_tendsto_atTop hk₀).eventually_ge_atTop (1:ℝ)] with L hrep hgrid hbulk + intro E C hG hGu hcl hcu hb hd l s outside houtside hout h k hs ks hl hh hk matchRoots + hsrc₁ hsrc₂ ι _ _ eB u hu M _ hmod deleted hdeleted hZ a ha R hR hsum + have hm : 1≤bulkSize k₀ L := by exact_mod_cast hbulk + have hg := hgrid E C hG hGu hcl hcu hb hd M (NeZero.pos M) hmod + have hcut := plain_mixed_giant_bounds C hBs hk₀ hm s houtside hout h k hs ks hl hh hk + matchRoots hsrc₁ hsrc₂ (optionEquiv h k) eB u hu + have hraw := plain_giant_bounds C hBs hk₀ hm s houtside hout h k hs ks hl hh hk + matchRoots hsrc₁ hsrc₂ (optionEquiv h k) eB u hu + have hoc (a : ℝ) : Option.elim' a (fun _ : Unit => a) = (fun _ : Option Unit => a) := by + funext i + cases i <;> rfl + have he := cutoff_exp_le_smoothGrowth Bs BD Bz L k₀ + have her := selected_exp_le_cutoff_smoothGrowth Bs BD Bz L k₀ + apply hrep C.giantCenter M deleted hZ hdeleted hmod hg.1.lower_scale hg.1 + (hg.2 deleted hdeleted).1 a ha R hR hsum (fun v => jointScalar C s h k hs ks (optionEquiv h k) eB v u) + · intro z hz + exact hcut.1.differentiable (by simp) z + · intro z hz i + exact ((hcut.2 z (by simpa only [hoc] using hz)).1 i).trans he + · intro z hz + exact ((hcut.2 z (by simpa only [hoc] using hz)).2).trans he + · intro z hz + exact ((hraw.2 z (by simpa only [hoc] using hz)).2).trans her + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPlainPrimeSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPlainPrimeSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..c8599e387102ac714bdf42f76013717461a24f90 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPlainPrimeSource.lean @@ -0,0 +1,83 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportPrimeGuarded +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSourceBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators ContDiff +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantGridCellBounds HistoryGiantReplacementGeometry +open HistoryGiantReplacementError HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open PrimeCellReplacement PrimeCellFreezing LogCellPartition HistoryGiantPriorGrid +open HistoryPairSmoothXi HistoryOccurrenceVariables HistoryPairPattern HistoryPairBulkCoordinates +open HistoryPairGiantCoordinates HistoryActiveCoordinates HistorySymbolicEncoding HistoryProductWindows +open HistoryBulkGiantCorrectedBounds HistoryBulkReferenceGiantDerivative + +theorem plain_prime_source_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0≤Bs) {k₀ : ℕ} (hk₀ : 0 C.giantCenter-1) (fun _ => C.giantCenter+1)) + (_ : SourceBounds (bulkSize k₀ L/2) k₀ C.giantCenter (C.cells.center (bulkSize k₀ L/2)) + k (rightMap h k) (giantCoordinates h k) (pairBackground h k) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1)), + ∀ (ι : Type) [Fintype ι] [DecidableEq ι] + (eB : ι ≃ bulkCoordinates h k) (u : ι→ℝ), (∀i,0 jointScalar C s h k hs ks (boolEquiv h k) eB v u) - + primeIntegral (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) (primeCutoff C.giantCenter (fun v => jointScalar C s h k hs ks (boolEquiv h k) eB v u)) * average (fun z : UnitPair M=>R (z.1,z.2))‖≤ + 30*Real.exp (-Real.exp (giant.target*L)) := by + obtain ⟨δ,K,L₀,hδ,hK,hL₀,hreplace⟩ := exists_guarded_periodic_prime_replacement_core + filter_upwards [hreplace k₀ (cutoffExponent Bs BD Bz k₀), + selected_gridCellBounds_eventually d Bs BD Bz hk₀ hK.le hδ L₀, + (bulkSize_tendsto_atTop hk₀).eventually_ge_atTop (1:ℝ)] with L hrep hgrid hbulk + intro E C hG hGu hcl hcu hb hd l s outside houtside hout h k hs ks hl hh hk matchRoots + hsrc₁ hsrc₂ ι _ _ eB u hu M _ hmod deleted hdeleted hZ a ha R hR hsum + have hm : 1≤bulkSize k₀ L := by exact_mod_cast hbulk + have hg := hgrid E C hG hGu hcl hcu hb hd M (NeZero.pos M) hmod + have hcut := plain_prime_giant_bounds C hBs hk₀ hm s houtside hout h k hs ks hl hh hk + matchRoots hsrc₁ hsrc₂ (boolEquiv h k) eB u hu + have hraw := plain_giant_bounds C hBs hk₀ hm s houtside hout h k hs ks hl hh hk + matchRoots hsrc₁ hsrc₂ (boolEquiv h k) eB u hu + have he := cutoff_exp_le_smoothGrowth Bs BD Bz L k₀ + have her := selected_exp_le_cutoff_smoothGrowth Bs BD Bz L k₀ + apply hrep C.giantCenter M deleted hZ hdeleted hmod hg.1.lower_scale hg.1 + (hg.2 deleted hdeleted).1 a ha R hR hsum (fun v => jointScalar C s h k hs ks (boolEquiv h k) eB v u) + · intro z hz + exact hcut.1.differentiable (by simp) z + · intro z hz i + exact ((hcut.2 z hz).1 i).trans he + · intro z hz + exact ((hcut.2 z hz).2).trans he + · intro z hz + exact ((hraw.2 z hz).2).trans her + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPrimeCore.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPrimeCore.lean new file mode 100644 index 0000000000000000000000000000000000000000..052f2eae2cd947069ff2e2c45fdf1f23d2a0b5f2 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPrimeCore.lean @@ -0,0 +1,77 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSamples +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPrincipalIntegralAverage + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantGridCellBounds HistoryGiantReplacementGeometry +open HistoryGiantReplacementError HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open PrimeCellReplacement PrimeCellFreezing LogCellPartition HistoryGiantPriorGrid + +theorem exists_periodic_prime_replacement_core : + ∃ δ K L₀ : ℝ, 0<δ ∧ 0G-1) (fun _=>G+1), + DifferentiableAt ℝ (fun y=>primeCutoff G f (fun i=>Real.exp (y i))) z) → + (∀z∈logRectangle (fun _ : Bool=>G-1) (fun _=>G+1),∀i, + ‖deriv (fun t=>primeCutoff G f + (Characters.RationalHistory.Expr.logCurve (fun q=>Real.exp (z q)) i t)) 0‖≤ + smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (fun _ : Bool=>G-1) (fun _=>G+1), + ‖primeCutoff G f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (fun _ : Bool=>G-1) (fun _=>G+1), + ‖f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + ‖periodicSourcePrimeMean G deleted hZ M R f- + primeIntegral (fun _ : Bool=>G-1) (fun _=>G+1) (fun _=>logCellMass G deleted) + (primeCutoff G f)*average (fun z : UnitPair M=>R (z.1,z.2))‖≤ + 29*Real.exp (-Real.exp (giant.target*L)) := by + obtain ⟨δ,K,L₀,hδ,hK,hL₀,hreplace⟩ := exists_periodicSourcePrimeMean_replacement_constants + refine ⟨δ,K,L₀,hδ,hK,hL₀,?_⟩ + intro k₀ c₀ + filter_upwards [eventually_periodic_error_bounds k₀ c₀ hK.le hδ] with L hbudget + intro G M _ deleted hZ hdeleted hmod hlo hg hb a ha R hR hsum f hf hderiv hA hraw + let F := smoothGrowthFactor k₀ c₀ giant.μ L + have hF : 0≤F := Real.exp_nonneg _ + have hQ : 0≤(M:ℝ)^a := by positivity + have hSp : 0≤∑u : Bool→(ZMod M)ˣ,‖primeTest R u‖ := Finset.sum_nonneg (fun _ _=>norm_nonneg _) + have hbound := hreplace G deleted hZ M R hg.modulus_lt_cell (fun _=>meshWidth giant L) + hg.lower_threshold (fun _=>⟨hb.mesh_pos,hb.mesh_le_one⟩) hg.modulus_admissible + (giantPrimeError K δ G deleted) 2 hb.error_nonneg (by norm_num) + (fun j i=>(hb.boxes Bool j i).2.2.2.1) + (fun j i=>(add_le_add le_rfl (hb.boxes Bool j i).2.2.2.1).trans + (hb.boxes Bool j i).2.2.2.2) + f F (meshWidth giant L) F ((M:ℝ)^a*F) hF hb.mesh_pos.le (mul_nonneg hQ hF) + (fun _=>le_rfl) hf hderiv hA + (periodic_prime_sample_bound M R ((M:ℝ)^a) hQ hR G F f hraw) + have hnum := (hbudget G L₀ M deleted hdeleted hmod hlo hb a ha + F F ((M:ℝ)^a*F) (∑u : Bool→(ZMod M)ˣ,‖primeTest R u‖) 0 + hF hF (mul_nonneg hQ hF) hSp le_rfl le_rfl le_rfl le_rfl hsum hQ).1 + have he (ε : ℝ) : 2*ε*(2:ℝ)^2=8*ε := by ring + have hfinal := hbound.trans (by simpa only [he] using hnum) + simp only [primeTest] at hfinal + rw [principalIntegral_pair M (fun _ : Bool=>G-1) (fun _=>G+1) + (fun _=>logCellMass G deleted) (primeCutoff G f) + (fun z : UnitPair M=>R (z.1,z.2))] at hfinal + exact hfinal + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPrimeGuarded.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPrimeGuarded.lean new file mode 100644 index 0000000000000000000000000000000000000000..ef154d5468265db78a9a6e0ece850564d9ee2ff0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportPrimeGuarded.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportGuardBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportPrimeCore +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPrincipalIntegralAverage + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellMeshBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantGridCellBounds HistoryGiantReplacementGeometry +open HistoryGiantReplacementError HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open PrimeCellReplacement PrimeCellFreezing LogCellPartition HistoryGiantPriorGrid + +theorem exists_guarded_periodic_prime_replacement_core : + ∃ δ K L₀ : ℝ, 0<δ ∧ 0G-1) (fun _=>G+1), + DifferentiableAt ℝ (fun y=>primeCutoff G f (fun i=>Real.exp (y i))) z) → + (∀z∈logRectangle (fun _ : Bool=>G-1) (fun _=>G+1),∀i, + ‖deriv (fun t=>primeCutoff G f + (Characters.RationalHistory.Expr.logCurve (fun q=>Real.exp (z q)) i t)) 0‖≤ + smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (fun _ : Bool=>G-1) (fun _=>G+1), + ‖primeCutoff G f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + (∀z∈logRectangle (fun _ : Bool=>G-1) (fun _=>G+1), + ‖f (fun i=>Real.exp (z i))‖≤ smoothGrowthFactor k₀ c₀ giant.μ L) → + ‖guardedPeriodicSourcePrimeMean G deleted hZ M R f- + primeIntegral (fun _ : Bool=>G-1) (fun _=>G+1) (fun _=>logCellMass G deleted) + (primeCutoff G f)*average (fun z : UnitPair M=>R (z.1,z.2))‖≤ + 30*Real.exp (-Real.exp (giant.target*L)) := by + obtain ⟨δ,K,L₀,hδ,hK,hL₀,hreplace⟩ := exists_periodic_prime_replacement_core + refine ⟨δ,K,L₀,hδ,hK,hL₀,?_⟩ + intro k₀ c₀ + filter_upwards [hreplace k₀ c₀,eventually_periodic_guard_errors k₀ c₀] with L hcore hguard + intro G M _ deleted hZ hdeleted hmod hlo hg hb a ha R hR hsum f hf hderiv hA hraw + have hp := hcore G M deleted hZ hdeleted hmod hlo hg hb a ha R hR hsum f hf hderiv hA hraw + have hg' := (hguard G M (NeZero.pos M) hmod hlo deleted hdeleted hZ a ha R hR).1 f hraw + exact (norm_sub_le_norm_sub_add_norm_sub _ (periodicSourcePrimeMean G deleted hZ M R f) _).trans + ((add_le_add hg' hp).trans_eq (by ring)) + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSamples.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSamples.lean new file mode 100644 index 0000000000000000000000000000000000000000..df9e262c2ef1519beba928c5985eafcd09351316 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSamples.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantWeightedPriorReplacement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiPriorReplacementSamples + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryGiantXiPriorReplacement PrimeCellFreezing + +theorem periodic_prime_sample_bound (M : ℕ) (R : ZMod M × ZMod M → ℂ) + (B : ℝ) (hB : 0 ≤ B) (hR : ∀z, ‖R z‖ ≤ B) (G A : ℝ) (f : (Bool → ℝ) → ℂ) + (hA : ∀ z ∈ logRectangle (fun _ : Bool => G-1) (fun _ => G+1), + ‖f (fun i => Real.exp (z i))‖ ≤ A) + (p : ℕ) (hp : p ∈ logCellPrimes G) (hpw : logCellWeight G p ≠ 0) + (q : ℕ) (hq : q ∈ logCellPrimes G) (hqw : logCellWeight G q ≠ 0) : + ‖R (p,q) * + f (fun t => if t then (q : ℝ) else (p : ℝ))‖ ≤ + B*A := by + have hpp := prime_weight_log_bounds G p hp hpw + have hqq := prime_weight_log_bounds G q hq hqw + have hf : ‖f (fun t => if t then (q : ℝ) else (p : ℝ))‖ ≤ A := by + have hz : (fun t : Bool => if t then Real.log (q : ℝ) else Real.log (p : ℝ)) ∈ + logRectangle (fun _ => G-1) (fun _ => G+1) := by + intro i hi + cases i + · exact hpp.2 + · exact hqq.2 + have he : (fun i : Bool => Real.exp (if i then Real.log (q : ℝ) else Real.log (p : ℝ))) = + (fun t => if t then (q : ℝ) else (p : ℝ)) := by + funext i + cases i <;> simp only [Bool.false_eq_true, ite_false, ite_true, Real.exp_log hpp.1, + Real.exp_log hqq.1] + simpa only [he] using hA _ hz + rw [norm_mul] + exact mul_le_mul (hR _) hf (norm_nonneg _) hB + +theorem periodic_mixed_sample_bound (M : ℕ) (R : ZMod M × ZMod M → ℂ) + (B : ℝ) (hB : 0 ≤ B) (hR : ∀z, ‖R z‖ ≤ B) (G A : ℝ) (f : (Option Unit → ℝ) → ℂ) + (hA : ∀ z ∈ logRectangle (Option.elim' (G-1) (fun _ : Unit => G-1)) + (Option.elim' (G+1) (fun _ => G+1)), ‖f (fun i => Real.exp (z i))‖ ≤ A) + (n : ℕ) (hn : n ∈ integerPivotCell G) (hnw : externalPivotWeight G n ≠ 0) + (p : ℕ) (hp : p ∈ logCellPrimes G) (hpw : logCellWeight G p ≠ 0) : + ‖R (n,p) * + f (Option.elim' (n : ℝ) (fun _ : Unit => (p : ℝ)))‖ ≤ + B*A := by + have hnn := integer_weight_log_bounds G n hn hnw + have hpp := prime_weight_log_bounds G p hp hpw + have hf : ‖f (Option.elim' (n : ℝ) (fun _ : Unit => (p : ℝ)))‖ ≤ A := by + have hz : Option.elim' (Real.log (n : ℝ)) (fun _ : Unit => Real.log (p : ℝ)) ∈ + logRectangle (Option.elim' (G-1) (fun _ : Unit => G-1)) + (Option.elim' (G+1) (fun _ => G+1)) := by + intro i hi + cases i + · exact hnn.2 + · exact hpp.2 + have he : (fun i => Real.exp (Option.elim' (Real.log (n : ℝ)) + (fun _ : Unit => Real.log (p : ℝ)) i)) = + Option.elim' (n : ℝ) (fun _ : Unit => (p : ℝ)) := by + funext i + cases i <;> simp only [Option.elim'_none, Option.elim'_some, Real.exp_log hnn.1, + Real.exp_log hpp.1] + simpa only [he] using hA _ hz + rw [norm_mul] + exact mul_le_mul (hR _) hf (norm_nonneg _) hB + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..d03b653c68bd66fd5a642ae3bda6f783d74a3ee1 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedBasic.lean @@ -0,0 +1,35 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportModulus +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceNewModuliBounds + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryCRTIntegration HistoryBulkReferenceNewModuli HistoryPairBulkTransport + +lemma selected_spectator_primes (spectator : PrimeSource) {n : ℕ} + (ds : Fin n → spectator.Sample) : ∀q∈spectatorList spectator ds,q.Prime := by + intro q hq + obtain ⟨i,rfl⟩ := List.mem_ofFn.mp hq + exact spectator.prime (ds i).val (ds i).property + +lemma assigned_newComparisonModulus_pos (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ→ℕ) (l : ℕ) (s : ℤ) (gp gm : ℕ) + (x : SourceAssignment sources (Template.current seed l)) + (c : HistoryChoices sources seed V l) (h k : History l) + {outside : List ℕ} (hs : h.Supported V outside) (ks : k.Supported V outside) + (hout : ∀q∈outside,q.Prime) (K : ℕ) : + 0 < newComparisonModulus (assignedHistory sources seed V l s gp gm x c) h k outside K := + mul_pos (mul_pos (mul_pos (assigned_rootModulus_pos sources seed V l s gp gm x c) + (outsideModulus_pos hout)) (frequencyModulus_pos h k hs ks (K+2))) + (representativeModulus_pos h k hs ks) + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedCorrectedMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedCorrectedMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..44d6a57728e29bc876f64bfa4d568791066e2e0e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedCorrectedMixed.lean @@ -0,0 +1,110 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportIntegerSourceCorrectedMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding +open HistoryBulkReferenceNewModuli HistoryPairBulkTransport + +theorem corrected_mixed_selected_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ (ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample) + (l : ℕ) (_ : l < k₀) + (xn x₀ y₀ : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (snew s₀ t₀ P₀ Q₀ : ℤ) (gp gm : ℕ) + (cnew c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass xn ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x₀ ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y₀ ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_ : 0jointCorrectedScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u)- + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (mixedGiantPrimeTest C.giantCenter (fun v=>jointCorrectedScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u))* + average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [corrected_mixed_integer_source_eventually d Bs BD Bz hBs hk₀, + selected_newComparisonModulus_cap_eventually d Bs BD Bz hk₀] with L hsource hcap + intro E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ snew s₀ t₀ P₀ Q₀ gp gm + cnew c e hxn hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu newk m σ xUnits v fA hWA deleted hdeleted hZ + have hout := selected_spectator_primes spectator ds + have hsize := hcap E C hG hcl hcu hb hd spectator hspec ds l hl.le + xn x₀ y₀ snew s₀ t₀ gp gm P₀ Q₀ cnew c e hxn hx hy hc he hs ks + let M := newComparisonModulus + (assignedHistory C.sources _ _ l snew gp gm xn cnew) + (decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ x₀ s₀) P₀ Q₀) c) + (decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ y₀ t₀) P₀ Q₀) e) + (spectatorList spectator ds) k₀ + let : NeZero M := ⟨hsize.1.ne'⟩ + have hmod : Real.log (M:ℝ)≤Real.exp (giant.μ*L) := by + simpa only [giant, show (12/1000:ℝ)=(3/250:ℝ) by norm_num] using hsize.2.1 + have hbudget := new_reference_test_budget d k₀ _ _ hs ks + (assignedHistory C.sources _ _ l snew gp gm xn cnew) newk σ xUnits v fA hout hWA + have ha : 3+2^(l+1)≤residueCostExponent k₀ := by + exact Nat.add_le_add_left (Nat.pow_le_pow_right (by norm_num : 1≤(2:ℕ)) + (Nat.add_le_add_right hl.le 1)) 3 + exact hsource E C hG hGu hcl hcu hb hd l (bulkSize k₀ L/2) + (spectatorList spectator ds) (fun q hq=>(hout q hq).pos) + (by simp [spectatorList]) hl x₀ y₀ s₀ t₀ P₀ Q₀ c e hx hy hc he hP hQ hPc hQc + hs ks hmatch ι eB u hu M hmod deleted hdeleted hZ (3+2^(l+1)) ha _ + hbudget.1 hbudget.2.2 + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedPlainMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedPlainMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..eb86f32231543ec6816728067f81e5edaaf6073b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedPlainMixed.lean @@ -0,0 +1,110 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportIntegerSourcePlainMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding +open HistoryBulkReferenceNewModuli HistoryPairBulkTransport + +theorem plain_mixed_selected_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ (ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample) + (l : ℕ) (_hl : l ≤ k₀) + (xn x₀ y₀ : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (snew s₀ t₀ P₀ Q₀ : ℤ) (gp gm : ℕ) + (cnew c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_hxn : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass xn ≠ 0) + (_hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x₀ ≠ 0) + (_hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y₀ ≠ 0) + (_hc : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_he : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_hP : 0jointScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u)- + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (mixedGiantPrimeTest C.giantCenter (fun v=>jointScalar C (bulkSize k₀ L/2) h k hs ks (optionEquiv h k) eB v u))* + average (fun z : MixedPair M=>R (z.1,z.2))‖≤ + 9*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [plain_mixed_integer_source_eventually d Bs BD Bz hBs hk₀, + selected_newComparisonModulus_cap_eventually d Bs BD Bz hk₀] with L hsource hcap + intro E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ snew s₀ t₀ P₀ Q₀ gp gm + cnew c e hxn hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu newk m σ xUnits v fA hWA deleted hdeleted hZ + have hout := selected_spectator_primes spectator ds + have hsize := hcap E C hG hcl hcu hb hd spectator hspec ds l hl + xn x₀ y₀ snew s₀ t₀ gp gm P₀ Q₀ cnew c e hxn hx hy hc he hs ks + let M := newComparisonModulus + (assignedHistory C.sources _ _ l snew gp gm xn cnew) + (decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ x₀ s₀) P₀ Q₀) c) + (decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ y₀ t₀) P₀ Q₀) e) + (spectatorList spectator ds) k₀ + let : NeZero M := ⟨hsize.1.ne'⟩ + have hmod : Real.log (M:ℝ)≤Real.exp (giant.μ*L) := by + simpa only [giant, show (12/1000:ℝ)=(3/250:ℝ) by norm_num] using hsize.2.1 + have hbudget := new_reference_test_budget d k₀ _ _ hs ks + (assignedHistory C.sources _ _ l snew gp gm xn cnew) newk σ xUnits v fA hout hWA + have ha : 3+2^(l+1)≤residueCostExponent k₀ := by + exact Nat.add_le_add_left (Nat.pow_le_pow_right (by norm_num : 1≤(2:ℕ)) + (Nat.add_le_add_right hl 1)) 3 + exact hsource E C hG hGu hcl hcu hb hd l (bulkSize k₀ L/2) + (spectatorList spectator ds) (fun q hq=>(hout q hq).pos) + (by simp [spectatorList]) hl x₀ y₀ s₀ t₀ P₀ Q₀ c e hx hy hc he hP hQ hPc hQc + hs ks hmatch ι eB u hu M hmod deleted hdeleted hZ (3+2^(l+1)) ha _ + hbudget.1 hbudget.2.2 + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedPlainPrime.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedPlainPrime.lean new file mode 100644 index 0000000000000000000000000000000000000000..6a7541cbc0da3d795b6756e3cf7fbbe3d658f2e0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSelectedPlainPrime.lean @@ -0,0 +1,109 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportIntegerSourcePlainPrime +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportSelectedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantXiReplacementActualMetadata + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion Filter ScaleBudget PrimeCellActualErrorBudget +open HistoryGiantWeightedPriorReplacement HistoryGiantReplacementError +open HistoryPrincipalIntegralAverage HistoryCRTIntegration ResidueHaar +open LogCellPartition HistoryGiantPriorGrid HistoryPairSmoothXi HistoryPairPattern +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkGiantCorrectedBounds +open HistoryGiantXiReplacementActual HistoryGiantReferenceSourceBounds HistoryGiantReferenceMean +open HistorySignedXiTransport HistorySymbolicEncoding +open HistoryBulkReferenceNewModuli HistoryPairBulkTransport + +theorem plain_prime_selected_eventually (d : Decomposition) (Bs BD Bz : ℝ) + (hBs : 0 ≤ Bs) {k₀ : ℕ} (hk₀ : 0 < k₀) : + ∀ᶠ L : ℝ in atTop, + ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k₀ L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀p : spectator.Sample, Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀ (ds : Fin (2*(bulkSize k₀ L/2))→spectator.Sample) + (l : ℕ) (_ : l ≤ k₀) + (xn x₀ y₀ : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)) + (snew s₀ t₀ P₀ Q₀ : ℤ) (gp gm : ℕ) + (cnew c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) + (frequencyBound Bs BD Bz k₀ L) l) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass xn ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass x₀ ≠ 0) + (_ : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k₀ L/2)) k₀) l)).mass y₀ ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l c ≠ 0) + (_ : choicesMass C.sources (Template.initial (2*(bulkSize k₀ L/2)) k₀) (frequencyBound Bs BD Bz k₀ L) l e ≠ 0) + (_ : 0jointScalar C (bulkSize k₀ L/2) h k hs ks (boolEquiv h k) eB v u)- + primeIntegral (fun _ : Bool=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter deleted) + (primeCutoff C.giantCenter (fun v=>jointScalar C (bulkSize k₀ L/2) h k hs ks (boolEquiv h k) eB v u))* + average (fun z : UnitPair M=>R (z.1,z.2))‖≤ + 30*Real.exp (-Real.exp (giant.target*L)) := by + filter_upwards [plain_prime_integer_source_eventually d Bs BD Bz hBs hk₀, + selected_newComparisonModulus_cap_eventually d Bs BD Bz hk₀] with L hsource hcap + intro E C hG hGu hcl hcu hb hd spectator hspec ds l hl xn x₀ y₀ snew s₀ t₀ P₀ Q₀ gp gm + cnew c e hxn hx hy hc he hP hQ hPc hQc + dsimp only + intro hs ks hmatch ι _ _ eB u hu newk m σ xUnits v fA hWA deleted hdeleted hZ + have hout := selected_spectator_primes spectator ds + have hsize := hcap E C hG hcl hcu hb hd spectator hspec ds l hl + xn x₀ y₀ snew s₀ t₀ gp gm P₀ Q₀ cnew c e hxn hx hy hc he hs ks + let M := newComparisonModulus + (assignedHistory C.sources _ _ l snew gp gm xn cnew) + (decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ x₀ s₀) P₀ Q₀) c) + (decodeHistory C.sources _ _ l (giantState (sourceState C.sources _ y₀ t₀) P₀ Q₀) e) + (spectatorList spectator ds) k₀ + let : NeZero M := ⟨hsize.1.ne'⟩ + have hmod : Real.log (M:ℝ)≤Real.exp (giant.μ*L) := by + simpa only [giant, show (12/1000:ℝ)=(3/250:ℝ) by norm_num] using hsize.2.1 + have hbudget := new_reference_test_budget d k₀ _ _ hs ks + (assignedHistory C.sources _ _ l snew gp gm xn cnew) newk σ xUnits v fA hout hWA + have ha : 3+2^(l+1)≤residueCostExponent k₀ := by + exact Nat.add_le_add_left (Nat.pow_le_pow_right (by norm_num : 1≤(2:ℕ)) + (Nat.add_le_add_right hl 1)) 3 + exact hsource E C hG hGu hcl hcu hb hd l (bulkSize k₀ L/2) + (spectatorList spectator ds) (fun q hq=>(hout q hq).pos) + (by simp [spectatorList]) hl x₀ y₀ s₀ t₀ P₀ Q₀ c e hx hy hc he hP hQ hPc hQc + hs ks hmatch ι eB u hu M hmod deleted hdeleted hZ (3+2^(l+1)) ha _ + hbudget.1 hbudget.2.1 + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSourceBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSourceBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..3256a85142c62abe26388695aa53547b79072161 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportSourceBasic.lean @@ -0,0 +1,32 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceGiantDerivativeCutoff +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantGridCellBounds + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction Conclusion ScaleBudget PrimeCellActualErrorBudget +open HistoryBulkReferenceGiantDerivative HistorySelectedPairDerivativeBounds + +lemma cutoff_exp_le_smoothGrowth (Bs BD Bz L : ℝ) (k₀ : ℕ) : + Real.exp (cutoffExponent Bs BD Bz k₀*((bulkSize k₀ L:ℝ)+1)) ≤ + smoothGrowthFactor k₀ (cutoffExponent Bs BD Bz k₀) giant.μ L := by + apply Real.exp_le_exp.mpr + nlinarith [mul_nonneg (mul_nonneg (cutoffExponent_pos Bs BD Bz k₀).le + (show 0≤(bulkSize k₀ L:ℝ)+1 by positivity)) (Real.exp_nonneg (giant.μ*L))] + +lemma selected_exp_le_cutoff_smoothGrowth (Bs BD Bz L : ℝ) (k₀ : ℕ) : + Real.exp (selectedExponent Bs BD Bz k₀*((bulkSize k₀ L:ℝ)+1)) ≤ + smoothGrowthFactor k₀ (cutoffExponent Bs BD Bz k₀) giant.μ L := + (exp_le_cutoff_exp (selectedExponent Bs BD Bz k₀) (bulkSize k₀ L)).trans + (cutoff_exp_le_smoothGrowth Bs BD Bz L k₀) + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportValues.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportValues.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5cd028191cf9816b3fae6e6a6017848dea55003 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGiantPrincipalTransportValues.lean @@ -0,0 +1,32 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransportModulus + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport +open Construction HistoryPairPattern HistoryCRTIntegration HistorySignedSpectatorCRT +open HistoryBulkReferenceTests HistoryBulkResidueNormSum HistoryFrequencyResidues +open HistorySignedResidueFactorization HistoryBulkReferenceNewModuli +variable {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + +theorem newReferenceResidueTest_intCast (d : Decomposition) (K : ℕ) (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) (newh newk : History l) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x : Fin (2^l)×Fin m→(ZMod (frequencyModulus h k (K+2)))ˣ) + (v : PairKey h k→ℤ) + (fA : ZMod (rootModulus newh)×ZMod (rootModulus newh)→ℂ) (P Q : ℤ) : + newReferenceResidueTest d K h k hs ks newh newk σ x v fA + ((P:ZMod (newComparisonModulus newh h k outside K)),Q) = + fA (P,Q)*residuePairSpectator (residueTransform d) outside outside.prod newh newk (P,Q)* + independentRTest K h k σ (P,Q) x*primeResidueIndicatorAt h k hs ks v (P,Q) := by + simp only [newReferenceResidueTest,referenceResidueTest,projectedRingPair,map_intCast] + +end Ostmann.Arithmetic.HistoryBulkGiantPrincipalTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternAggregation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternAggregation.lean new file mode 100644 index 0000000000000000000000000000000000000000..35487391f32f0bc7144e1c742bdd1e988471de60 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternAggregation.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternAggregationFamily +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternPrincipalFrame + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGoodPatternAggregation +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryBulkGoodPatternPrincipalFrame +open HistoryBulkUniversalPatternAggregation HistoryRepresentativeSourceSeparation Filter +open scoped BigOperators +local instance goodSelectedInternalDecidable (template : List SourceSlot) (l : ℕ) : + DecidableEq (Internal template l) := Classical.decEq _ + +theorem exists_complete_good_pattern_budget + (d : Decomposition) (Bs BD Bz H : ℝ) (hBs : 0 ≤ Bs) {k : ℕ} (hk : 2 ≤ k) + (hH : 0 ≤ H) : + ∃ ε : ℝ,0 < ε ∧ ∀ᶠ L : ℝ in atTop,∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + (∀p : spectator.Sample,(FiniteField.correlationBound (residueTransform d p.val):ℝ) ≤ ε) → + ∀ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀l : ℕ,l ≤ k → + ∃hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L jfamilyValue (families p b) b corrected mixed hV)‖ ≤ + Real.exp (-H*(2:ℝ)^l*(bulkSize k L:ℝ)) := by + have hk' : 0 < k := by omega + obtain ⟨ε,hε,hPaid⟩ := exists_principalOperator_budget d Bs BD Bz H hBs hk' hH + refine ⟨ε,hε,?_⟩ + filter_upwards [hPaid,selected_patternComplexSum_eventually d Bs BD Bz hk, + SourceFrequencyBounds.frequency_lt_of_log_lower_eventually Bs BD Bz hk' + (by norm_num : (0:ℝ)<1/2000)] with L hPaid hPattern hFreq + intro spectator hband hflat ds E C hG hGu hc hcu hb hd l hl + have hV : ∀q∈spectatorList spectator ds,∀j≤l,frequencyBound Bs BD Bz k L j + let := hi + simp only [Finset.univ_eq_empty,Finset.sum_empty,norm_zero] + exact mul_nonneg (div_nonneg hT hE.le) hK + | inr hi => + let := hi + have hn : (0:ℝ)r.weight b mixed * + principalOperator r.frame corrected mixed r.permutation hV) + +theorem familyValue_norm_le_of_paid (F : Family C outside l p) + (b : Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (corrected mixed : Bool) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j(F i).elim 0 (fun r=>r.weight b mixed) + let J := fun i=>(F i).elim 0 (fun r=>principalOperator r.frame corrected mixed r.permutation hV) + have hvalue : familyValue F b corrected mixed hV=∑i,W i*J i := by + apply Finset.sum_congr rfl + intro i _ + cases he : F i <;> simp only [W,J,he,Option.elim_none,Option.elim_some,zero_mul] + rw [hvalue] + apply norm_sum_mul_le_of_paid W J _ _ T (Real.exp_pos _) + (Finset.prod_nonneg (fun q _=>div_nonneg (by norm_num) (Nat.cast_nonneg _))) hT + · intro i + cases he : F i with + | none => simp only [W,he,Option.elim_none,norm_zero]; positivity + | some r => simpa only [W,he,Option.elim_some] using r.weight_norm_le b mixed + · intro i + cases he : F i with + | none => simpa only [J,he,Option.elim_none,norm_zero,mul_zero] using hT + | some r => + simpa only [J,he,Option.elim_some,principalPayment] using hpaid i r he + +end Ostmann.Arithmetic.HistoryBulkGoodPatternAggregation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternAggregationReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternAggregationReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c585cec9dfbf12f95a556d994b13a6654b67468 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternAggregationReference.lean @@ -0,0 +1,63 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternAggregationBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCompensationBiasedKernelSumSymbolic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGoodPatternAggregation +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryPairRepresentatives HistoryPairKernelReplacement +open HistoryBulkFibreGiantApproximation +open scoped BigOperators +attribute [local instance] Classical.propDecidable +local instance goodPatternInternalDecidable (template : List SourceSlot) (l : ℕ) : + DecidableEq (Internal template l) := Classical.decEq _ + +structure Reference {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) where + frame : Frame (l:=l) C outside + permutation : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2))) + good : ¬TransferBadArrangement permutation + representative : Block p ≃ Representative frame.left frame.right + mask : ℝ + mask_mem : 0 ≤ mask ∧ mask ≤ 1 + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +def Reference.weight (r : Reference C outside l p) + (b : Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (mixed : Bool) : ℂ := + ((r.mask * ∏q:Block p,symbolicKernel mixed r.frame.left r.frame.right + r.frame.left_supported r.frame.right_supported (r.representative q) (b q).val:ℝ):ℂ) + +theorem Reference.weight_norm_le (r : Reference C outside l p) + (b : Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (mixed : Bool) : ‖r.weight b mixed‖≤∏q:Block p,2/((b q).val:ℝ) := by + have hK (q : Block p) := symbolicKernel_le_two_div mixed r.frame.left r.frame.right + r.frame.left_supported r.frame.right_supported (r.representative q) (b q).val + (commonSample_prime C.sources _ (b q)) + have hn : 0≤∏q:Block p,symbolicKernel mixed r.frame.left r.frame.right + r.frame.left_supported r.frame.right_supported (r.representative q) (b q).val := + Finset.prod_nonneg (fun q _=>(hK q).1) + rw [Reference.weight,Complex.norm_real,Real.norm_eq_abs, + abs_of_nonneg (mul_nonneg r.mask_mem.1 hn)] + exact (mul_le_of_le_one_left hn r.mask_mem.2).trans + (Finset.prod_le_prod₀ (fun q _=>(hK q).1) (fun q _=>(hK q).2)) + +abbrev Family (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) := + FrequencyChoices (frequencyBound Bs BD Bz k L) (l+1) → Option (Reference C outside l p) + +end Ostmann.Arithmetic.HistoryBulkGoodPatternAggregation + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternPrincipalFrame.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternPrincipalFrame.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5b493f83edadfd35a1f430917863a735d546092 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternPrincipalFrame.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkGoodPatternPrincipalFrameDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGoodPatternPrincipalFrame +open Construction Conclusion Filter HistoryPairPattern HistoryPairBulkTransport +open HistoryBulkFibreGiantApproximation HistoryBulkSelectedGoodOperator +open HistorySignedSpectatorCRT HistorySignedSpectatorDiagramAverage + +theorem exists_principalOperator_budget (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0≤Bs) (hk : 0(hflat p).trans (min_le_left _ _) + have hcflat : ∀p : spectator.Sample, + (FiniteField.correlationBound (residueTransform d p.val):ℝ) ≤ εc := + fun p=>(hflat p).trans (min_le_right _ _) + cases corrected with + | false => + have hb := hplain spectator hband hpflat ds E C hblock hcenter hupper hbulk hspectator + l hl σ r.leftSource r.rightSource r.s r.t r.P r.Q r.leftChoices r.rightChoices + r.left_mass r.right_mass r.left_choices_mass r.right_choices_mass + r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching (orderedBulkEquiv r) hV hgood + cases mixed + · have h := hb.1 + simp only [principalOperator,principalIntegral,Bool.false_eq_true,ite_false, + Frame.left,Frame.right,assignedHistory,assignedRoot, + HistorySignedXiTransport.giantState,HistoryGiantReferenceMean.sourceState] at h ⊢ + exact h + · have h := hb.2 + simp only [principalOperator,principalIntegral,Bool.false_eq_true,ite_false,ite_true, + Frame.left,Frame.right,assignedHistory,assignedRoot, + HistorySignedXiTransport.giantState,HistoryGiantReferenceMean.sourceState] at h ⊢ + exact h + | true => + have hb := hcorrected spectator hband hcflat ds E C hblock hcenter hupper hbulk hspectator + l (hstage rfl) σ r.leftSource r.rightSource r.s r.t r.P r.Q r.leftChoices r.rightChoices + r.left_mass r.right_mass r.left_choices_mass r.right_choices_mass + r.plus_pos r.minus_pos r.plus_cell r.minus_cell + r.left_supported r.right_supported r.matching (orderedBulkEquiv r) hV hgood + cases mixed + · have h := hb.1 + simp only [principalOperator,principalIntegral,ite_true, + Frame.left,Frame.right,assignedHistory,assignedRoot, + HistorySignedXiTransport.giantState,HistoryGiantReferenceMean.sourceState] at h ⊢ + exact h + · have h := hb.2 + simp only [principalOperator,principalIntegral,ite_true, + Frame.left,Frame.right,assignedHistory,assignedRoot, + HistorySignedXiTransport.giantState,HistoryGiantReferenceMean.sourceState] at h ⊢ + exact h + +end Ostmann.Arithmetic.HistoryBulkGoodPatternPrincipalFrame + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternPrincipalFrameDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternPrincipalFrameDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..5f5b183cecd41b4bbc16c8ce373642a39f9f0420 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkGoodPatternPrincipalFrameDefs.lean @@ -0,0 +1,59 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationDefs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedGoodOperatorReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkGoodPatternPrincipalFrame +open Construction Conclusion HistoryPairBulkTransport HistoryPairPattern +open HistoryBulkFibreGiantApproximation HistoryBulkGiantCorrectedBounds +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryBulkReferenceScalarCoordinates +open HistoryBulkSelectedIntegralReplacement HistoryBulkReplacementGeometry +open HistoryBulkResidueNormSum HistoryPrincipalIntegralAverage ResidueHaar +open HistoryCRTIntegration HistoryBulkCorrectedXiBounds HistorySelectedJointIntegralBounds +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +def orderedBulkEquiv (r : Frame (l:=l) C outside) : + (Fin (2^l)×Fin (2*(bulkSize k L/2))) ≃ bulkCoordinates r.left r.right := + orderedEquiv (2*(bulkSize k L/2)) k r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat + r.leftSource r.leftChoices)) + +def principalIntegral (r : Frame (l:=l) C outside) (corrected mixed : Bool) : ℂ := + if mixed then + nestedMixedIntegral L C.giantCenter E + (if corrected then + jointCorrectedScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (optionEquiv r.left r.right) (orderedBulkEquiv r) + else + jointScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (optionEquiv r.left r.right) (orderedBulkEquiv r)) + else + nestedPrimeIntegral L C.giantCenter E + (if corrected then + jointCorrectedScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (boolEquiv r.left r.right) (orderedBulkEquiv r) + else + jointScalar C (bulkSize k L/2) r.left r.right r.left_supported + r.right_supported (boolEquiv r.left r.right) (orderedBulkEquiv r)) + +def principalOperator (r : Frame (l:=l) C outside) (corrected mixed : Bool) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz k L j leftData (d p)) (fun p => leftFactors (f p)) b p + (leftContext c) t x = leftContext (exposureStep K R d f b p c t x) := by + by_cases hj : c.1-1 + simp [exposureStep,leftContext,leftData,leftFactors,hj] + rfl + +theorem exposureStep_right (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) (b : Bool) (p : List Bool) + (c : PairedContext R) (t x : (ZMod (R^(K+2)))ˣ) : + exposureStep K R (fun p => rightData (d p)) (fun p => rightFactors (f p)) b p + (rightContext c) t x = rightContext (exposureStep K R d f b p c t x) := by + by_cases hj : c.1-1 + simp [exposureStep,rightContext,rightData,rightFactors,hj] + rfl + +theorem exposureConstraint_split (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) (j : ℕ) (p : List Bool) + (c : PairedContext R) (t x : (ZMod (R^(K+2)))ˣ) : + exposureConstraint K R d f j (p,c) t x ↔ + exposureConstraint K R (fun p => leftData (d p)) (fun p => leftFactors (f p)) + j (p,leftContext c) t x ∧ + exposureConstraint K R (fun p => rightData (d p)) (fun p => rightFactors (f p)) + j (p,rightContext c) t x := by + simp only [exposureConstraint,constraint,exposureCoefficients,Template.ambientData, + leftData,rightData,leftFactors,rightFactors,leftContext,rightContext] + constructor + · rintro ⟨hl,hr⟩ + exact ⟨⟨hl,hl⟩,hr,hr⟩ + · rintro ⟨hl,hr⟩ + exact ⟨hl.1,hr.1⟩ + +end Ostmann.Arithmetic.HistoryBulkIdentityFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyGuards.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyGuards.lean new file mode 100644 index 0000000000000000000000000000000000000000..809ca2354e10bbb4e82a39befaaab2b086c11e8e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyGuards.lean @@ -0,0 +1,36 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIdentityFrequencyBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIdentityFrequency +open Construction Characters FrequencyExposure BinaryExposure HistoryFrequencyResidues + +theorem knownPairFrequencyUnits_split (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) {l : ℕ} (h k : History l) + (p : List Bool) (c : PairedContext R) + (z : BinaryHaar.Leaves (ZMod (R^(K+2)))ˣ l) : + knownPairFrequencyUnits K R d f h k p c z ↔ + knownPairFrequencyUnits K R (fun p => leftData (d p)) + (fun p => leftFactors (f p)) h h p (leftContext c) z ∧ + knownPairFrequencyUnits K R (fun p => rightData (d p)) + (fun p => rightFactors (f p)) k k p (rightContext c) z := by + induction h generalizing p c with + | leaf a => + cases k + simp only [knownPairFrequencyUnits,leftContext,rightContext,and_self] + | @node l a pivot u hp hm left right ihl ihr => + cases k with + | node a' pivot' u' hp' hm' left' right' => + simp only [knownPairFrequencyUnits,exposureStep_left,exposureStep_right] + rw [ihl,ihr] + simp only [leftContext,rightContext] + tauto + +end Ostmann.Arithmetic.HistoryBulkIdentityFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyIndicator.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyIndicator.lean new file mode 100644 index 0000000000000000000000000000000000000000..f11087860ec0445fc0354f9e3f643deba7989f2a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyIndicator.lean @@ -0,0 +1,32 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIdentityFrequencyGuards +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIdentityFrequencyLeaf + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIdentityFrequency +open Construction Characters FrequencyExposure BinaryExposure HistoryFrequencyResidues +open HistoryPairedFrequencyAverage HistorySignedResidueFactorization + +theorem leafIndicator_split (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) {l : ℕ} (h k : History l) + (p : List Bool) (c : PairedContext R) + (z : BinaryHaar.Leaves (ZMod (R^(K+2)))ˣ l) : + leafIndicator K R d f h k p c z = + leafIndicator K R (fun p => leftData (d p)) (fun p => leftFactors (f p)) + h h p (leftContext c) z * + leafIndicator K R (fun p => rightData (d p)) (fun p => rightFactors (f p)) + k k p (rightContext c) z := by + simp only [leafIndicator] + rw [knownPairFrequencyUnits_split,leafAdmissible_split,← guardIndicator_and] + congr 1 + apply propext + tauto + +end Ostmann.Arithmetic.HistoryBulkIdentityFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyLeaf.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyLeaf.lean new file mode 100644 index 0000000000000000000000000000000000000000..bf236bd9ab19822117107baa2b6ccd7f4e894396 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyLeaf.lean @@ -0,0 +1,54 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIdentityFrequencyBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIdentityFrequency +open Construction Characters FrequencyExposure BinaryExposure HistoryFrequencyResidues + +theorem admissible_split (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) (l : ℕ) (p : List Bool) + (c : PairedContext R) (t : (ZMod (R^(K+2)))ˣ) + (z : BinaryHaar.Splits (ZMod (R^(K+2)))ˣ l) : + admissible (exposureConstraint K R d f) + (update false (exposureStep K R d f false)) + (update true (exposureStep K R d f true)) l (p,c) t z ↔ + admissible (exposureConstraint K R (fun p=>leftData (d p)) (fun p=>leftFactors (f p))) + (update false (exposureStep K R (fun p=>leftData (d p)) (fun p=>leftFactors (f p)) false)) + (update true (exposureStep K R (fun p=>leftData (d p)) (fun p=>leftFactors (f p)) true)) + l (p,leftContext c) t z ∧ + admissible (exposureConstraint K R (fun p=>rightData (d p)) (fun p=>rightFactors (f p))) + (update false (exposureStep K R (fun p=>rightData (d p)) (fun p=>rightFactors (f p)) false)) + (update true (exposureStep K R (fun p=>rightData (d p)) (fun p=>rightFactors (f p)) true)) + l (p,rightContext c) t z := by + induction l generalizing p c t with + | zero => simp only [admissible,true_and] + | succ l ih => + rcases z with ⟨x,zL,zR⟩ + simp only [admissible,update,exposureStep_left,exposureStep_right] + rw [exposureConstraint_split,ih,ih] + tauto + +theorem leafAdmissible_split (K R : ℕ) (d : List Bool → Data R) + (f : List Bool → FixedFactors × FixedFactors) (l : ℕ) (p : List Bool) + (c : PairedContext R) (z : BinaryHaar.Leaves (ZMod (R^(K+2)))ˣ l) : + leafAdmissible (exposureConstraint K R d f) + (update false (exposureStep K R d f false)) + (update true (exposureStep K R d f true)) l (p,c) z ↔ + leafAdmissible (exposureConstraint K R (fun p=>leftData (d p)) (fun p=>leftFactors (f p))) + (update false (exposureStep K R (fun p=>leftData (d p)) (fun p=>leftFactors (f p)) false)) + (update true (exposureStep K R (fun p=>leftData (d p)) (fun p=>leftFactors (f p)) true)) + l (p,leftContext c) z ∧ + leafAdmissible (exposureConstraint K R (fun p=>rightData (d p)) (fun p=>rightFactors (f p))) + (update false (exposureStep K R (fun p=>rightData (d p)) (fun p=>rightFactors (f p)) false)) + (update true (exposureStep K R (fun p=>rightData (d p)) (fun p=>rightFactors (f p)) true)) + l (p,rightContext c) z := + admissible_split K R d f l p c _ _ + +end Ostmann.Arithmetic.HistoryBulkIdentityFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyRootTest.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyRootTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..e6548c0807abbd3050a36c92c7c8ce0ce36f7e9e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIdentityFrequencyRootTest.lean @@ -0,0 +1,34 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIdentityFrequency +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedIntegralReplacementTests + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIdentityFrequency +open Construction HistoryBulkSelectedIntegralReplacement HistoryBulkResidueRootAverage +open HistoryBulkResidueNormSum HistoryFrequencyResidues + +theorem rootTest_identity (mixed : Bool) (d : Decomposition) {l m : ℕ} + {V : ℕ→ℕ} {outside : List ℕ} (h k : History l) + (hs : h.Supported V outside) (ks : k.Supported V outside) + (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V j f (reverseAddressSchedule root left right p)) = + reverseAddressSchedule (f root) (fun p => f (left p)) (fun p => f (right p)) := by + funext p + unfold reverseAddressSchedule + split <;> rfl + +theorem leftData_frequencyScheduleAux (R : ℕ) {l : ℕ} (h k : History l) + (hF : ∀ s ∈ h.frequencies, s.natAbs ∣ R) + (kF : ∀ s ∈ k.frequencies, s.natAbs ∣ R) : + (fun p => leftData (frequencyScheduleAux R h k hF kF p)) = + frequencyScheduleAux R h h hF hF := by + induction h with + | leaf a => cases k; rfl + | node a pivot u hp hm left right ihl ihr => + cases k with + | node a' pivot' u' hp' hm' left' right' => + simp only [frequencyScheduleAux] + rw [map_reverseAddressSchedule, ihl, ihr] + rfl + +theorem rightData_frequencyScheduleAux (R : ℕ) {l : ℕ} (h k : History l) + (hF : ∀ s ∈ h.frequencies, s.natAbs ∣ R) + (kF : ∀ s ∈ k.frequencies, s.natAbs ∣ R) : + (fun p => rightData (frequencyScheduleAux R h k hF kF p)) = + frequencyScheduleAux R k k kF kF := by + induction h with + | leaf a => cases k; rfl + | node a pivot u hp hm left right ihl ihr => + cases k with + | node a' pivot' u' hp' hm' left' right' => + simp only [frequencyScheduleAux] + rw [map_reverseAddressSchedule, ihl, ihr] + rfl + +theorem leftFactors_fixedFactorSchedule {l : ℕ} (h k : History l) : + (fun p => leftFactors (fixedFactorSchedule h k p)) = fixedFactorSchedule h h := by + induction h with + | leaf a => cases k; rfl + | node a pivot u hp hm left right ihl ihr => + cases k with + | node a' pivot' u' hp' hm' left' right' => + simp only [fixedFactorSchedule] + rw [map_reverseAddressSchedule, ihl, ihr] + rfl + +theorem rightFactors_fixedFactorSchedule {l : ℕ} (h k : History l) : + (fun p => rightFactors (fixedFactorSchedule h k p)) = fixedFactorSchedule k k := by + induction h with + | leaf a => cases k; rfl + | node a pivot u hp hm left right ihl ihr => + cases k with + | node a' pivot' u' hp' hm' left' right' => + simp only [fixedFactorSchedule] + rw [map_reverseAddressSchedule, ihl, ihr] + rfl + +end Ostmann.Arithmetic.HistoryBulkIdentityFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreMassCompatibility.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreMassCompatibility.lean new file mode 100644 index 0000000000000000000000000000000000000000..0920dd89a7c1142576530a492df2e4e1f273846a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreMassCompatibility.lean @@ -0,0 +1,103 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingPositionsValues + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreMass +open Construction Conclusion +open HistoryDiagonalCorrectedOriginalMean HistoryDiagonalRemainingRootMatching +open HistoryDiagonalSmallOriginalMean HistoryGiantOriginalMeanFactorization +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference + +theorem smallCounterpartCoordinate_permutation (sources : SourceFamily) (T : List SourceSlot) + (x : SourceAssignment sources T) (e : Equiv.Perm (RemainingIndex T)) + (he : PreservesRemainingBands T e) (i : Fin T.length) : + smallCounterpartCoordinate sources T x e i = (x (smallPermutation e he i)).val := by + unfold smallCounterpartCoordinate + rw [←smallPermutation_succ e he i] + rfl + +theorem smallCounterpartCompatible_iff_of_nonbulk + (sources : SourceFamily) (T : List SourceSlot) (bulk : PrimeSource) + (hbulk : ∀i : Fin T.length, (T.get i).role = .bulk → sources (T.get i).origin = bulk) + (x₀ x : SourceAssignment sources T) (e : Equiv.Perm (RemainingIndex T)) + (he : PreservesRemainingBands T e) + (hfixed : ∀i : Fin T.length, (T.get i).role ≠ .bulk → (x i).val = (x₀ i).val) : + SmallCounterpartCompatible sources T x e ↔ SmallCounterpartCompatible sources T x₀ e := by + have step (a b : SourceAssignment sources T) + (hab : ∀i : Fin T.length, (T.get i).role ≠ .bulk → (a i).val = (b i).val) + (ha : SmallCounterpartCompatible sources T a e) : + SmallCounterpartCompatible sources T b e := by + intro i + rw [smallCounterpartCoordinate_permutation sources T b e he i] + by_cases hi : (T.get i).role = .bulk + · have hj : (T.get (smallPermutation e he i)).role = .bulk := + (smallPermutation_role e he i).trans hi + have hsource : sources (T.get (smallPermutation e he i)).origin = sources (T.get i).origin := + (hbulk _ hj).trans (hbulk _ hi).symm + have hp := (b (smallPermutation e he i)).property + change (b (smallPermutation e he i)).val ∈ (sources (T.get (smallPermutation e he i)).origin).candidates at hp + rw [hsource] at hp + exact hp + · have hj : (T.get (smallPermutation e he i)).role ≠ .bulk := by + simpa only [smallPermutation_role e he i] using hi + have hmem := ha i + rw [smallCounterpartCoordinate_permutation sources T a e he i, hab _ hj] at hmem + exact hmem + exact ⟨step x x₀ hfixed, step x₀ x (fun i hi => (hfixed i hi).symm)⟩ + +theorem restoringAssignment_nonbulk_fixed (sources : SourceFamily) (j : ℕ) + (T : List SourceSlot) (x₀ x : SourceAssignment sources T) + (hfixed : ∀i : Fin T.length, (T.get i).role ≠ .bulk → (x i).val = (x₀ i).val) + (r : Fin (Template.remainder j T).length) + (hr : ((Template.remainder j T).get r).role ≠ .bulk) : + ((restoringAssignmentEquiv sources j T x).2 r).val = + ((restoringAssignmentEquiv sources j T x₀).2 r).val := by + let i := (splitPositions j T).symm (.inr r) + have hi : splitPositions j T i = .inr r := (splitPositions j T).apply_symm_apply _ + have hs := splitPositions_slot_inr j T i r hi + exact (restoringAssignment_value_inr sources j T x i r hi).symm.trans + ((hfixed i (by simpa only [hs] using hr)).trans + (restoringAssignment_value_inr sources j T x₀ i r hi)) + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem selected_remainder_bulk_source (C : InitialSourceChoice d Bs BD Bz k L E) + (r : Fin (Template.remainder (l+1) (SelectedTemplate k L l)).length) + (hr : ((Template.remainder (l+1) (SelectedTemplate k L l)).get r).role = .bulk) : + C.sources ((Template.remainder (l+1) (SelectedTemplate k L l)).get r).origin = C.bulk := by + let i := (splitPositions (l+1) (SelectedTemplate k L l)).symm (.inr r) + have hi : splitPositions (l+1) (SelectedTemplate k L l) i = .inr r := + (splitPositions (l+1) (SelectedTemplate k L l)).apply_symm_apply _ + have hs := splitPositions_slot_inr (l+1) (SelectedTemplate k L l) i r hi + rw [←hs] + apply selected_bulk_source C l ⟨i, ?_⟩ + change ((SelectedTemplate k L l).get i).role = .bulk + rw [hs] + exact hr + +theorem fibre_smallCounterpartCompatible_iff + (C : InitialSourceChoice d Bs BD Bz k L E) + (a : SelectedNonbulkSample C l) (u₀ u : SelectedBulkSample C l) + (e : Equiv.Perm (RemainingIndex (Template.remainder (l+1) (SelectedTemplate k L l)))) + (he : PreservesRemainingBands _ e) : + SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u)) e ↔ + SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u₀)) e := by + apply smallCounterpartCompatible_iff_of_nonbulk C.sources _ C.bulk + (selected_remainder_bulk_source C) _ _ e he + intro r hr + exact restoringAssignment_nonbulk_fixed C.sources (l+1) (SelectedTemplate k L l) + (fibreAssignment C a u₀) (fibreAssignment C a u) + (fibreAssignment_nonbulk_fixed C a u u₀) r hr + +end Ostmann.Arithmetic.HistoryBulkIndependentFibreMass + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreMassFactorization.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreMassFactorization.lean new file mode 100644 index 0000000000000000000000000000000000000000..3fe7243bddce428103eef502abfd5d96dd938a30 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreMassFactorization.lean @@ -0,0 +1,100 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferenceLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreOriginalReferencePermutation +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreMass +open Construction Conclusion HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryDiagonalRemainingRootMatching +open HistoryDiagonalCorrectedOriginalMean HistoryDiagonalSmallOriginalMean +open HistoryGiantOriginalMeanFactorization (Current) +open HistoryBulkIndependentReferenceFrequency CanonicalHistoryLeafBulk +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) +variable (a : SelectedNonbulkSample C l) +variable (e : Equiv.Perm (RemainingIndex + (Template.remainder (l+1) (Current (k:=k) (L:=L) (l:=l))))) +variable (he : PreservesRemainingBands _ e) +include he + +theorem counterpart_fibreAssignment_bulk_coordinates (u : SelectedBulkSample C l) + (hc : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u)) e) : + (selectedSourceEquiv C l (counterpartCurrentAssignment C (fibreAssignment C a u) e hc)).2 = + fun j => u (inducedBulkPermutation (2*(bulkSize k L/2)) k l + (fullPermutation (l+1) _ e he) (fullPermutation_bulk (l+1) _ e he) j) := by + funext j + apply Subtype.ext + rw [selectedSourceEquiv_bulk_val] + change bulkSamples C.sources (2*(bulkSize k L/2)) k l + (counterpartCurrentAssignment C (fibreAssignment C a u) e hc) j.1 j.2 = _ + rw [counterpartCurrentAssignment_bulkSamples C (fibreAssignment C a u) e he hc] + have h := selectedSourceEquiv_bulk_val C l (fibreAssignment C a u) + (inducedBulkPermutation (2*(bulkSize k L/2)) k l + (fullPermutation (l+1) _ e he) (fullPermutation_bulk (l+1) _ e he) j) + simpa only [fibreAssignment, Equiv.apply_symm_apply, bulkSamples] using h.symm + +theorem counterpart_fibreAssignment_nonbulk_coordinates (u₀ u : SelectedBulkSample C l) + (hc₀ : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u₀)) e) + (hc : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u)) e) : + (selectedSourceEquiv C l (counterpartCurrentAssignment C (fibreAssignment C a u) e hc)).1 = + (selectedSourceEquiv C l (counterpartCurrentAssignment C (fibreAssignment C a u₀) e hc₀)).1 := by + funext i + apply Subtype.ext + exact counterpartCurrentAssignment_nonbulk_fixed C + (fibreAssignment C a u₀) (fibreAssignment C a u) e he hc₀ hc + (fibreAssignment_nonbulk_fixed C a u u₀) i.val i.property + +theorem counterpart_fibreAssignment_mass (u₀ u : SelectedBulkSample C l) + (hc₀ : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u₀)) e) + (hc : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u)) e) : + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (counterpartCurrentAssignment C (fibreAssignment C a u) e hc) = + (selectedNonbulkPrior C l).mass + (selectedSourceEquiv C l + (counterpartCurrentAssignment C (fibreAssignment C a u₀) e hc₀)).1 * + (selectedBulkPrior C l).mass u := by + rw [selectedSourceEquiv_mass, + counterpart_fibreAssignment_nonbulk_coordinates C a e he u₀ u hc₀ hc, + counterpart_fibreAssignment_bulk_coordinates C a e he u hc] + congr 1 + exact bulkDrawPermutation_mass C + (inducedBulkPermutation (2*(bulkSize k L/2)) k l + (fullPermutation (l+1) _ e he) (fullPermutation_bulk (l+1) _ e he)) u + +theorem counterpart_fibreAssignment_mass_ne_zero_iff (u₀ u : SelectedBulkSample C l) + (hc₀ : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u₀)) e) + (hc : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u)) e) + (hu₀ : (selectedBulkPrior C l).mass u₀ ≠ 0) + (hu : (selectedBulkPrior C l).mass u ≠ 0) : + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (counterpartCurrentAssignment C (fibreAssignment C a u) e hc) ≠ 0 ↔ + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (counterpartCurrentAssignment C (fibreAssignment C a u₀) e hc₀) ≠ 0 := by + rw [counterpart_fibreAssignment_mass C a e he u₀ u hc₀ hc, + counterpart_fibreAssignment_mass C a e he u₀ u₀ hc₀ hc₀] + simp only [ne_eq, mul_eq_zero, hu, hu₀, or_false] + +theorem counterpart_fibreAssignment_mass_eq_zero_iff (u₀ u : SelectedBulkSample C l) + (hc₀ : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u₀)) e) + (hc : SmallCounterpartCompatible C.sources _ (smallAssignment C (fibreAssignment C a u)) e) + (hu₀ : (selectedBulkPrior C l).mass u₀ ≠ 0) + (hu : (selectedBulkPrior C l).mass u ≠ 0) : + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (counterpartCurrentAssignment C (fibreAssignment C a u) e hc) = 0 ↔ + (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (counterpartCurrentAssignment C (fibreAssignment C a u₀) e hc₀) = 0 := by + rw [counterpart_fibreAssignment_mass C a e he u₀ u hc₀ hc, + counterpart_fibreAssignment_mass C a e he u₀ u₀ hc₀ hc₀] + simp only [mul_eq_zero, hu, hu₀, or_false] + +end Ostmann.Arithmetic.HistoryBulkIndependentFibreMass + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReference.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReference.lean new file mode 100644 index 0000000000000000000000000000000000000000..a150e865a7994d781c92f9aac6543581b2b1d73b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReference.lean @@ -0,0 +1,81 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDisintegration +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceMean + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreReference +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryGiantOriginalMeanFactorization (Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def FixedFibreReference + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (a : SelectedNonbulkSample C l) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) + (he : PreservesRemainingBands _ e) (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) (K : ℕ) : Prop := + mixedFibreMean C outside a e s t c₁ c₂=0 ∨ + ∃r : Reference C outside a e s t c₁ c₂, + (∀u,(selectedBulkPrior C l).mass u≠0 → ∀P Q : ℤ,0

term_eq_fixedReferenceTerm C outside a e he s t c₁ c₂ + hactual K hle hl ha hc₁ hc₂ houtside r u hu P Q hp hq), + mixedFibreMean_eq_referenceMean C outside a e he s t c₁ c₂ + hactual K hle hl ha hc₁ hc₂ houtside r⟩ + +def SelectedFibreReferences + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) : Prop := + ∀(outside : List ℕ),(∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) → + ∀(l K : ℕ),l≤K → l≤k → + ∀(a : SelectedNonbulkSample C l) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) (he : PreservesRemainingBands _ e) + (s t : ℤ) (c₁ c₂ : Choices (l:=l) C), + 0 < (selectedNonbulkPrior C l).mass a → + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c₁≠0 → + choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c₂≠0 → + FixedFibreReference C outside a e he s t c₁ c₂ K + +theorem selected_fibre_references_eventually + (d : Decomposition) (Bs BD Bz : ℝ) {k : ℕ} (hk : 0mixedMean C.giantCenter C.giant + (term C outside a e s t c₁ c₂ u)) + +def Supported (u : SelectedBulkSample C l) (hc : Compatible C a e u) (P Q : ℤ) : Prop := + (history C (fibreAssignment C a u) s P Q c₁).Supported (frequencyBound Bs BD Bz k L) outside ∧ + (history C (rightAssignment C a e u hc) t P Q c₂).Supported (frequencyBound Bs BD Bz k L) outside + +end Ostmann.Arithmetic.HistoryBulkIndependentFibreReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceDisintegration.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceDisintegration.lean new file mode 100644 index 0000000000000000000000000000000000000000..4328088796dc53f0226237a89bd8068afb16e046 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceDisintegration.lean @@ -0,0 +1,37 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceLaws + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreReference +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryGiantOriginalMeanFactorization (Current Choices) +open HistoryDiagonalSmallOriginalMean (smallAssignment) +open HistoryDiagonalCorrectedOriginalMean hiding originalMixedMean +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem sourceMean_disintegration + (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) + (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) : + (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).cmean + (fun x=>if hc : SmallCounterpartCompatible C.sources _ (smallAssignment C x) e then + HistoryDiagonalCorrectedOriginalMean.originalMixedMean C outside x + (counterpartCurrentAssignment C x e hc) s t c₁ c₂ else 0)= + (selectedNonbulkPrior C l).cmean (fun a=>mixedFibreMean C outside a e s t c₁ c₂) := by + rw [selected_source_cmean_disintegration C l] + apply congrArg (fun f=>(selectedNonbulkPrior C l).cmean f) + funext a + apply congrArg (fun f=>(selectedBulkPrior C l).cmean f) + funext u + exact (mixedMean_term_eq C outside a e s t c₁ c₂ u).symm + +end Ostmann.Arithmetic.HistoryBulkIndependentFibreReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceLaws.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceLaws.lean new file mode 100644 index 0000000000000000000000000000000000000000..2e4a1ba12d347742e2305d352a50fb3fd0ae23f8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceLaws.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreReference +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryGiantReferenceMean +open HistoryGiantOriginalMeanFactorization (Current Choices history counterpart) +open HistoryDiagonalCorrectedOriginalMean hiding originalMixedMean +open HistorySignedXiTransport +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (a : SelectedNonbulkSample C l) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) +variable (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) + +theorem mixedMean_term_eq (u : SelectedBulkSample C l) : + mixedMean C.giantCenter C.giant (term C outside a e s t c₁ c₂ u)= + if hc : Compatible C a e u then + HistoryDiagonalCorrectedOriginalMean.originalMixedMean C outside (fibreAssignment C a u) + (rightAssignment C a e u hc) s t c₁ c₂ else 0 := by + by_cases hc : Compatible C a e u + · have hf : term C outside a e s t c₁ c₂ u=compatibleTerm C outside a e s t c₁ c₂ u hc := by + funext P Q + simp only [term,hc,dite_true] + rw [hf] + simp only [hc,dite_true] + rfl + · simp only [term,hc,dite_false,mixedMean,FinitePrior.cmean,mul_zero,Finset.sum_const_zero] + +theorem mixedFibreMean_eq_weighted : + mixedFibreMean C outside a e s t c₁ c₂= + HistoryBulkFibreReference.originalMean (selectedBulkPrior C l).mass + (mixedWeight C.giantCenter C.giant) + (fun u r=>term C outside a e s t c₁ c₂ u + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r)) := by + simp only [mixedFibreMean,mixedMean_eq_weighted,FinitePrior.cmean, + HistoryBulkFibreReference.originalMean,Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + +theorem compatibleTerm_ne_zero_supported (u : SelectedBulkSample C l) + (hc : Compatible C a e u) (P Q : ℤ) + (hne : compatibleTerm C outside a e s t c₁ c₂ u hc P Q≠0) : + Supported C outside a e s t c₁ c₂ u hc P Q := by + have hh : supportedHistoryPairXi d (frequencyBound Bs BD Bz k L) outside + (bulkSize k L/2) (bulkSize k L/2) C.scale C.bulkBin C.spectatorBin C.giantCenter + (history C (fibreAssignment C a u) s P Q c₁) + (history C (rightAssignment C a e u hc) t P Q c₂)≠0 := + (mul_ne_zero_iff.mp hne).2 + by_contra hs + exact hh (HistorySignedResidues.supportedHistoryPairXi_eq_zero_of_not _ _ _ _ _ _ _ _ _ _ _ hs) + +theorem weighted_compatibleTerm_zero_of_right_mass_zero + (u : SelectedBulkSample C l) (hc : Compatible C a e u) + (hx : (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).mass (fibreAssignment C a u)≠0) + (hy : (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).mass (rightAssignment C a e u hc)=0) + (r : MixedDraw C.giantCenter C.giant) : + (mixedWeight C.giantCenter C.giant r:ℂ)* + compatibleTerm C outside a e s t c₁ c₂ u hc + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r)=0 := by + have hsmall := smallAssignment_mass_zero_of_right_mass_zero C (fibreAssignment C a u) + (rightAssignment C a e u hc) hx (counterpartCurrentAssignment_outer C _ e hc) hy + have hz := weighted_counterpart_zero_of_small_mass_zero C (rightAssignment C a e u hc) + hsmall r.1.val r.2 + simp only [mixedWeight,mixedP,mixedQ,compatibleTerm,sourceIntegrand,multiplier,Complex.ofReal_mul] + have halg (v b s q f : ℂ) (h : v*q=0) : (v*b)*((s*q)*f)=0 := by + calc + _ = (v*q)*(b*s*f) := by ring + _ = 0 := by rw [h,zero_mul] + exact halg _ _ _ _ _ hz + +end Ostmann.Arithmetic.HistoryBulkIndependentFibreReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceMean.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceMean.lean new file mode 100644 index 0000000000000000000000000000000000000000..65a289a7275808a0521e9c67d2ac2f342a9450eb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceMean.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreMassCompatibility +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreMassFactorization +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceTerm + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreReference +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryGiantReferenceMean +open HistoryGiantOriginalMeanFactorization (Current Choices) +open HistoryBulkIndependentFibreMass +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (a : SelectedNonbulkSample C l) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) +variable (he : PreservesRemainingBands _ e) (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) +include he + +theorem reference_compatible_all (r : Reference C outside a e s t c₁ c₂) + (u : SelectedBulkSample C l) : Compatible C a e u := + (fibre_smallCounterpartCompatible_iff C a r.bulk u e he).mpr r.compatible + +theorem reference_right_mass_nonzero (r : Reference C outside a e s t c₁ c₂) + (u : SelectedBulkSample C l) (hc : Compatible C a e u) + (hu : (selectedBulkPrior C l).mass u≠0) : + (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).mass (rightAssignment C a e u hc)≠0 := + (counterpart_fibreAssignment_mass_ne_zero_iff C a e he r.bulk u r.compatible hc + (ne_of_gt r.bulk_pos) hu).mpr r.right_mass + +def fixedReferenceTerm (K : ℕ) (r : Reference C outside a e s t c₁ c₂) + (u : SelectedBulkSample C l) (P Q : ℤ) : ℂ := + referenceTerm C outside a e he s t c₁ c₂ K r u + (reference_compatible_all C outside a e he s t c₁ c₂ r u) P Q + +def referenceMean (K : ℕ) (r : Reference C outside a e s t c₁ c₂) : ℂ := + (selectedBulkPrior C l).cmean (fun u=>mixedMean C.giantCenter C.giant + (fixedReferenceTerm C outside a e he s t c₁ c₂ K r u)) + +theorem term_eq_fixedReferenceTerm + {spectator : PrimeSource} + (hactual : HistoryBulkIndependentReferenceTerm.SelectedOrderedReferenceEquality C spectator) + (K : ℕ) (hle : l≤K) (hl : l≤k) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc₁ : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c₁≠0) + (hc₂ : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c₂≠0) + (houtside : ∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) + (r : Reference C outside a e s t c₁ c₂) (u : SelectedBulkSample C l) + (hu : (selectedBulkPrior C l).mass u≠0) (P Q : ℤ) (hp : 0 + fixedReferenceTerm C outside a e he s t c₁ c₂ K r u + (mixedP C.giantCenter C.giant z) (mixedQ C.giantCenter C.giant z)) := by + simp only [referenceMean,mixedMean_eq_weighted,FinitePrior.cmean, + HistoryBulkFibreReference.originalMean,Complex.ofReal_mul,Finset.mul_sum,mul_assoc] + rw [hr] + apply HistoryBulkFibreReference.originalMean_congr + intro u z hu _ + exact term_eq_fixedReferenceTerm C outside a e he s t c₁ c₂ hactual K hle hl + ha hc₁ hc₂ houtside r u hu _ _ + (mixedDraw_positive C.giantCenter C.giant z).1 (mixedDraw_positive C.giantCenter C.giant z).2 + +end Ostmann.Arithmetic.HistoryBulkIndependentFibreReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceSelection.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceSelection.lean new file mode 100644 index 0000000000000000000000000000000000000000..3e4cfdf7fd3c185780435206caa45a8825f164e7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceSelection.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceLaws + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreReference +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryGiantReferenceMean +open HistoryGiantOriginalMeanFactorization (Current Choices) +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (a : SelectedNonbulkSample C l) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) +variable (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) + +structure Reference where + bulk : SelectedBulkSample C l + draw : MixedDraw C.giantCenter C.giant + compatible : Compatible C a e bulk + bulk_pos : 0 < (selectedBulkPrior C l).mass bulk + draw_pos : 0 < mixedWeight C.giantCenter C.giant draw + term_ne_zero : compatibleTerm C outside a e s t c₁ c₂ bulk compatible + (mixedP C.giantCenter C.giant draw) (mixedQ C.giantCenter C.giant draw)≠0 + right_mass : (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).mass + (rightAssignment C a e bulk compatible)≠0 + supported : Supported C outside a e s t c₁ c₂ bulk compatible + (mixedP C.giantCenter C.giant draw) (mixedQ C.giantCenter C.giant draw) + +theorem mixedFibreMean_eq_zero_or_reference + (ha : 0 < (selectedNonbulkPrior C l).mass a) : + mixedFibreMean C outside a e s t c₁ c₂=0 ∨ + Nonempty (Reference C outside a e s t c₁ c₂) := by + rw [mixedFibreMean_eq_weighted] + rcases HistoryBulkFibreReference.originalMean_eq_zero_or_reference + (selectedBulkPrior C l).mass (mixedWeight C.giantCenter C.giant) + (fun u r=>term C outside a e s t c₁ c₂ u + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r)) + (selectedBulkPrior C l).mass_nonneg (mixedWeight_nonneg C.giantCenter C.giant) + (fun _ _=>True) (fun _ _ _ _ _=>True.intro) with + hz | ⟨u,r,hu,hr,hne,_⟩ + · exact Or.inl hz + · by_cases hc : Compatible C a e u + · have ht : compatibleTerm C outside a e s t c₁ c₂ u hc + (mixedP C.giantCenter C.giant r) (mixedQ C.giantCenter C.giant r)≠0 := by + simpa only [term,hc,dite_true] using hne + have hy : (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).mass + (rightAssignment C a e u hc)≠0 := by + intro hzero + have hz := weighted_compatibleTerm_zero_of_right_mass_zero C outside a e s t c₁ c₂ + u hc (ne_of_gt (fibreAssignment_mass_pos C a u ha hu)) hzero r + exact (mul_ne_zero (Complex.ofReal_ne_zero.mpr (ne_of_gt hr)) ht) hz + exact Or.inr ⟨⟨u,r,hc,hu,hr,ht,hy, + compatibleTerm_ne_zero_supported C outside a e s t c₁ c₂ u hc _ _ ht⟩⟩ + · exact (hne (by simp only [term,hc,dite_false])).elim + +end Ostmann.Arithmetic.HistoryBulkIndependentFibreReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceTerm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceTerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ce1695dc50d2eec99c88c8c190ed49a54fc4156 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentFibreReferenceTerm.lean @@ -0,0 +1,72 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentFibreReferenceSelection +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermOrdered +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryDiagonalRemainingRootMatchingActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentFibreReference +open Construction Conclusion HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryGiantReferenceMean +open HistoryGiantOriginalMeanFactorization (Current Choices) +open HistoryDiagonalRemainingRootMatching HistoryBulkIndependentReferenceFrequency +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) +variable (a : SelectedNonbulkSample C l) (e : RemainingPermutation (k:=k) (L:=L) (l:=l)) +variable (he : PreservesRemainingBands _ e) (s t : ℤ) (c₁ c₂ : Choices (l:=l) C) + +def bulkPermutation := + inducedBulkPermutation (2*(bulkSize k L/2)) k l (fullPermutation (l+1) _ e he) + (fullPermutation_bulk (l+1) _ e he) + +def referenceTerm (K : ℕ) (r : Reference C outside a e s t c₁ c₂) + (u : SelectedBulkSample C l) (hc : Compatible C a e u) (P Q : ℤ) : ℂ := + HistoryBulkIndependentReferenceTerm.orderedReferenceTerm C (frequencyBound Bs BD Bz k L) + outside l K (bulkPermutation e he) + (fibreAssignment C a r.bulk) (rightAssignment C a e r.bulk r.compatible) + (fibreAssignment C a u) (rightAssignment C a e u hc) s t + (mixedP C.giantCenter C.giant r.draw).toNat (mixedQ C.giantCenter C.giant r.draw).toNat c₁ c₂ + r.supported.1 r.supported.2 (bulkSize k L/2) (bulkSize k L/2) + C.scale C.bulkBin C.spectatorBin C.giantCenter (multiplier C outside a e s u hc) P Q + +theorem compatibleTerm_eq_referenceTerm + {spectator : PrimeSource} + (hactual : HistoryBulkIndependentReferenceTerm.SelectedOrderedReferenceEquality C spectator) + (K : ℕ) (hle : l≤K) (hl : l≤k) + (ha : 0 < (selectedNonbulkPrior C l).mass a) + (hc₁ : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c₁≠0) + (hc₂ : choicesMass C.sources _ (frequencyBound Bs BD Bz k L) l c₂≠0) + (houtside : ∀q∈outside,∃p : spectator.Sample,(p:ℕ)=q) + (r : Reference C outside a e s t c₁ c₂) (u : SelectedBulkSample C l) + (hc : Compatible C a e u) (hu : (selectedBulkPrior C l).mass u≠0) + (hy : (assignmentPrior C.sources (Current (k:=k) (L:=L) (l:=l))).mass + (rightAssignment C a e u hc)≠0) + (P Q : ℤ) (hp : 0samples (σ u)) := by + apply frequencyLeaves_decode_slots M sources m k V l a c y hy (fun u=>samples (σ u)) + intro u + rw [hsamples,hbulk] + +theorem independentRTest_source_eq_reference_of_mass + (K m k l : ℕ) (sources : SourceFamily) (V : ℕ→ℕ) + (old old' : History l) (a a' : State) + (c c' : HistoryChoices sources (Template.initial m k) V l) + (x y : SourceAssignment sources (Template.current (Template.initial m k) l)) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (hx : a.small=assignedSlots sources (Template.current (Template.initial m k) l) x) + (hy : a'.small=assignedSlots sources (Template.current (Template.initial m k) l) y) + (hbulk : ∀u : Fin (2^l)×Fin m, + bulkSamples sources m k l y u.1 u.2=bulkSamples sources m k l x (σ u).1 (σ u).2) + {outside : List ℕ} (hs : old.Supported V outside) (hs' : old'.Supported V outside) + (hmass : (assignmentPrior sources (Template.current (Template.initial m k) l)).mass x≠0) + (hfreq : ∀j≤l,∀origin,(sources origin).AboveFrequency (V j)) + (z : ZMod ((pairedFrequencyProduct old old')^(K+2)) × + ZMod ((pairedFrequencyProduct old old')^(K+2))) : + independentRTest K old old' σ z + (sourceBulkUnits ((pairedFrequencyProduct old old')^(K+2)) sources m k l x)= + independentReferenceIndicator K old old' + (decodeHistory sources (Template.initial m k) V l a c) + (decodeHistory sources (Template.initial m k) V l a' c') z := by + let M := (pairedFrequencyProduct old old')^(K+2) + have hcop := source_bulk_coprime_frequency_power old old' hs hs' hfreq + (Template.current (Template.initial m k) l) x hmass (K+2) + have hsample := sourceBulkUnits_coe M sources m k l x hcop + have hleft := frequencyLeaves_decode_slots M sources m k V l a c x hx + (sourceBulkUnits M sources m k l x) hsample + have hright := frequencyLeaves_decode_slots_related M m k l sources V a' c' x y σ hy hbulk + (sourceBulkUnits M sources m k l x) hsample + unfold independentRTest independentReferenceIndicator + dsimp only + rw [hleft,hright] + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceFrequencyForward.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceFrequencyForward.lean new file mode 100644 index 0000000000000000000000000000000000000000..4b6194d7606992a12011c31b86f617a396a20f9d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceFrequencyForward.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequencyBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceForwardRSource + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequency +open Construction Conclusion HistoryBulkProducts HistoryFrequencyResidues +open HistoryBulkSupportConverse HistoryBulkResidueNormSum HistoryPairBulkTransport HistoryBulkDiagramParameters +open HistoryPairedFrequencyAverageHaar HistoryBulkSpectatorReferenceRaw CanonicalHistoryLeafBulk + +theorem independentRTest_eq_one_of_supported + (K m k l : ℕ) (sources : SourceFamily) (V : ℕ→ℕ) (outside : List ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin m)) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k) l)) + (s t : ℤ) (gp gm gp' gm' : ℕ) + (c e : HistoryChoices sources (Template.initial m k) V l) + (hfixed : ∀i : Fin (Template.current (Template.initial m k) l).length, + ((Template.current (Template.initial m k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hfixed' : ∀i : Fin (Template.current (Template.initial m k) l).length, + ((Template.current (Template.initial m k) l).get i).role≠.bulk → (y i).val=(y₀ i).val) + (hbulk : ∀u : Fin (2^l)×Fin m, + bulkSamples sources m k l y u.1 u.2=bulkSamples sources m k l x (σ u).1 (σ u).2) + (hs : (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c).Supported V outside) + (hs' : (assignedHistory sources (Template.initial m k) V l t gp gm y₀ e).Supported V outside) + (hnew : (assignedHistory sources (Template.initial m k) V l s gp' gm' x c).Supported V outside) + (hnew' : (assignedHistory sources (Template.initial m k) V l t gp' gm' y e).Supported V outside) + (hx : (assignmentPrior sources (Template.current (Template.initial m k) l)).mass x≠0) + (hy : (assignmentPrior sources (Template.current (Template.initial m k) l)).mass y≠0) + (hc : choicesMass sources (Template.initial m k) V l c≠0) + (he : choicesMass sources (Template.initial m k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(sources origin).AboveFrequency (V j)) (hle : l≤K) : + independentRTest K + (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c) + (assignedHistory sources (Template.initial m k) V l t gp gm y₀ e) + σ (gp',gm') + (sourceBulkUnits + ((pairedFrequencyProduct (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c) + (assignedHistory sources (Template.initial m k) V l t gp gm y₀ e))^(K+2)) sources m k l x)=1 := by + rw [independentRTest_source_eq_reference_of_mass K m k l sources V + (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c) + (assignedHistory sources (Template.initial m k) V l t gp gm y₀ e) + (assignedRoot sources _ s gp' gm' x) (assignedRoot sources _ t gp' gm' y) + c e x y σ rfl rfl hbulk hs hs' hx hfreq] + apply HistoryBulkReferenceForwardR.decoded_independent_reference_eq_one K sources (Template.initial m k) V l + (assignedRoot sources _ s gp' gm' x) (assignedRoot sources _ t gp' gm' y) + (assignedRoot sources _ s gp gm x₀) (assignedRoot sources _ t gp gm y₀) + c e outside hnew hnew' + (assignedRoot_matches sources _ s gp' gm' x) (assignedRoot_matches sources _ t gp' gm' y) + (assignedSlots_source_mass_ne_zero sources _ x hx) (assignedSlots_source_mass_ne_zero sources _ y hy) + hc he hfreq rfl rfl rfl rfl + · exact assignedSlots_erase_eq sources _ x x₀ hfixed + · exact assignedSlots_erase_eq sources _ y y₀ hfixed' + · exact hle + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceFrequencyPermutation.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceFrequencyPermutation.lean new file mode 100644 index 0000000000000000000000000000000000000000..dce97167f5da086309f1ba79d4bdecc3a4bbd43a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceFrequencyPermutation.lean @@ -0,0 +1,46 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequencyBasic + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequency +open Construction Conclusion CanonicalHistoryLeafBulk + +def inducedBulkPermutation (m k l : ℕ) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k) l).length)) + (hπ : ∀i,((Template.current (Template.initial m k) l).get i).role=.bulk ↔ + ((Template.current (Template.initial m k) l).get (π i)).role=.bulk) : + Equiv.Perm (Fin (2^l)×Fin m) := + (currentBulkPositionEquiv m k l).symm.trans + ((π.subtypePerm (fun i=> (hπ i).symm)).trans (currentBulkPositionEquiv m k l)) + +theorem inducedBulkPermutation_position (m k l : ℕ) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k) l).length)) + (hπ : ∀i,((Template.current (Template.initial m k) l).get i).role=.bulk ↔ + ((Template.current (Template.initial m k) l).get (π i)).role=.bulk) + (u : Fin (2^l)×Fin m) : + ((currentBulkPositionEquiv m k l).symm (inducedBulkPermutation m k l π hπ u)).val= + π ((currentBulkPositionEquiv m k l).symm u).val := by + simp only [inducedBulkPermutation,Equiv.trans_apply,Equiv.symm_apply_apply] + rfl + +theorem bulkSamples_fullPermutation (sources : SourceFamily) (m k l : ℕ) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k) l).length)) + (hπ : ∀i,((Template.current (Template.initial m k) l).get i).role=.bulk ↔ + ((Template.current (Template.initial m k) l).get (π i)).role=.bulk) + (x y : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hvalues : ∀i,(y i).val=(x (π i)).val) (u : Fin (2^l)×Fin m) : + bulkSamples sources m k l y u.1 u.2= + bulkSamples sources m k l x (inducedBulkPermutation m k l π hπ u).1 + (inducedBulkPermutation m k l π hπ u).2 := by + unfold bulkSamples + rw [hvalues] + exact (congrArg (fun i=>(x i).val) (inducedBulkPermutation_position m k l π hπ u)).symm + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequency + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTerm.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTerm.lean new file mode 100644 index 0000000000000000000000000000000000000000..09f72e87365362485d1b291da3f25de277d43d8b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTerm.lean @@ -0,0 +1,56 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermConverse +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermSupported + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryPairSmoothXi HistoryGiantReferenceMean +open HistoryRepresentativeSourceSeparation + +theorem sourceIntegrand_eq_referenceTerm + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) (hle : l≤K) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length)) + (hold : ∀i, (y₀ i).val=(x₀ (π i)).val) + (hmatch : ∀i, (y i).val=(x (π i)).val) + (hfixed : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hfixedy : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (y i).val=(y₀ i).val) + (hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass y≠0) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l c≠0) (he : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) + (hp : 0 ⟨hprime q hq,houtfreq q hq⟩) + (by simpa only [giantState,sourceState,Int.toNat_natCast,assignedHistory,assignedRoot] using hs) + (by simpa only [giantState,sourceState,Int.toNat_natCast,assignedHistory,assignedRoot] using ks) + apply sourceIntegrand_eq_referenceTerm C V outside l K x₀ y₀ x y s t gp gm c e hs ks + b sw X tb td G Jmul P Q hsep hle π hold hmatch hfixed hfixedy hy hx hc he hfreq hp hq ?_ hprime houtfreq + simpa only [giantState,sourceState,Int.toNat_natCast,assignedHistory,assignedRoot] using had + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..dcbc2c6b705c93b5ad4489060a4641d4e4cb7ef9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermBasic.lean @@ -0,0 +1,45 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsActualSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceMeanLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedSpectatorDiagramActual + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryPairSmoothXi +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates HistorySignedSpectatorCRT +open HistoryBulkResidueNormSum HistoryBulkSpectatorReferenceRaw HistoryFrequencyResidues +open HistoryGiantReferenceMean HistorySignedXiTransport + +def referenceTerm + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) : ℂ := + if (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) s P.toNat Q.toNat x).Coprime outside ∧ + (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) t P.toNat Q.toNat y).Coprime outside then + Jmul P Q * (((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c).compensationProduct:ℂ)*((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e).compensationProduct:ℂ)) * + orderedSourceIndicatorB C.sources (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) hs ks + (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)) x P Q * + independentReferenceIndicator K (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s P.toNat Q.toNat x c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t P.toNat Q.toNat y e) (P,Q) * + residuePairSpectator (residueTransform d) outside outside.prod (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s P.toNat Q.toNat x c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t P.toNat Q.toNat y e) (P,Q) * + pairedRealXi b sw X tb td G (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) hs ks + (insertOrderedGiants (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) hs + (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)) + (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l x) + (fun a => if a then (Q:ℝ) else (P:ℝ))) + else 0 + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermConverse.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermConverse.lean new file mode 100644 index 0000000000000000000000000000000000000000..3a7600c4f39e37f5a906cfc0bd9aa0fcee705806 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermConverse.lean @@ -0,0 +1,66 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermSupport + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryPairSmoothXi +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates HistorySignedSpectatorCRT +open HistoryBulkResidueNormSum HistoryBulkSpectatorReferenceRaw HistoryFrequencyResidues +open HistoryBulkIndependentReferenceTerm HistorySignedSpectatorDiagram + +theorem supported_of_referenceTerm_ne_zero + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) (hle : l≤K) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length)) + (hold : ∀i, (y₀ i).val=(x₀ (π i)).val) + (hnew : ∀i, (y i).val=(x (π i)).val) + (hfixed : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hfixedy : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (y i).val=(y₀ i).val) + (hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass y≠0) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l c≠0) (he : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) + (hp : 0 (z:ZMod N)) hpI + have hqc (N : ℕ) : (Q.toNat:ZMod N)=(Q:ZMod N) := by + simpa only [Int.cast_natCast] using congrArg (fun z:ℤ => (z:ZMod N)) hqI + apply inserted_pair_supported_of_actual_source_tests C V outside l K x₀ y₀ x y s t gp gm + P.toNat Q.toNat c e hs ks b sw X tb td G hsep hle π hold hnew hfixed hfixedy hy hx hc he hfreq + (by omega) (by omega) hroot.1 hroot.2 + ?_ ?_ ?_ (residueTransform d) hprime (fun q _ => actual_residueTransform_zero d q) houtfreq ?_ + · simpa only [hpI,hqI] using hB + · simpa only [hpR,hqR] using hXi + · simpa only [hpc,hqc] using hR + · simpa only [hpc,hqc] using hD + · exact False.elim (hz rfl) + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardB.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardB.lean new file mode 100644 index 0000000000000000000000000000000000000000..3eb8e3d2394b80acb0f60f32a0fb5ebd655d1943 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardB.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransportIntegerCoordinates +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceForwardBBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceForwardBRows +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsSourceLeft + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairPattern HistorySymbolicEncoding HistoryPairBulkTransport HistoryOccurrenceVariables +open HistoryBulkSupportConverse HistoryBulkSupportConversePlan HistoryBulkReferenceTests +open HistoryBulkReferenceForwardB + +theorem orderedSourceIndicatorB_eq_one_of_supported + (sources : SourceFamily) (m k : ℕ) (V : ℕ→ℕ) (l : ℕ) (s t : ℤ) + (gp gm gp' gm' : ℕ) (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k) l).length)) + (hold : ∀i, (y₀ i).val=(x₀ (π i)).val) + (hnew : ∀i, (y i).val=(x (π i)).val) + (c d : HistoryChoices sources (Template.initial m k) V l) {outside : List ℕ} + (hs : (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c).Supported V outside) (ks : (assignedHistory sources (Template.initial m k) V l t gp gm y₀ d).Supported V outside) + (hs' : (assignedHistory sources (Template.initial m k) V l s gp' gm' x c).Supported V outside) (ks' : (assignedHistory sources (Template.initial m k) V l t gp' gm' y d).Supported V outside) + (hfixed : ∀i : Fin (Template.current (Template.initial m k) l).length, ((Template.current (Template.initial m k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hx : (assignmentPrior sources (Template.current (Template.initial m k) l)).mass x≠0) + (hy : (assignmentPrior sources (Template.current (Template.initial m k) l)).mass y≠0) + (hc : choicesMass sources (Template.initial m k) V l c≠0) + (hd : choicesMass sources (Template.initial m k) V l d≠0) + (hfreq : ∀j≤l,∀origin,(sources origin).AboveFrequency (V j)) + (hanc : ReferenceAncestorUnits sources (Template.initial m k) V l (assignedRoot sources (Template.current (Template.initial m k) l) s gp' gm' x) c (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp' gm' x) gp' gm') + (hanc' : ReferenceAncestorUnits sources (Template.initial m k) V l (assignedRoot sources (Template.current (Template.initial m k) l) t gp' gm' y) d (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp' gm' y) gp' gm') : + orderedSourceIndicatorB sources m k (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k) V l t gp gm y₀ d) hs ks (root_matches (assignedLabels sources (Template.initial m k) V l s gp gm x₀ c)) x gp' gm'=1 := by + have hlines := reference_lines_squares_of_supported_source sources (Template.initial m k) V outside l + (assignedRoot sources (Template.current (Template.initial m k) l) s gp gm x₀) (assignedRoot sources (Template.current (Template.initial m k) l) s gp' gm' x) c (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp gm x₀) (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp' gm' x) rfl hs hs' + (assignedSlots_source_mass_ne_zero sources (Template.current (Template.initial m k) l) x hx) hc hfreq hanc + have hlines' := reference_lines_squares_of_supported_source sources (Template.initial m k) V outside l + (assignedRoot sources (Template.current (Template.initial m k) l) t gp gm y₀) (assignedRoot sources (Template.current (Template.initial m k) l) t gp' gm' y) d (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp gm y₀) (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp' gm' y) rfl ks ks' + (assignedSlots_source_mass_ne_zero sources (Template.current (Template.initial m k) l) y hy) hd hfreq hanc' + exact indicator_eq_one_of_reference_lines sources (Template.initial m k) V outside l + (assignedRoot sources (Template.current (Template.initial m k) l) s gp gm x₀) (assignedRoot sources (Template.current (Template.initial m k) l) t gp gm y₀) (assignedRoot sources (Template.current (Template.initial m k) l) s gp' gm' x) (assignedRoot sources (Template.current (Template.initial m k) l) t gp' gm' y) c d (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp gm x₀) (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp gm y₀) (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp' gm' x) (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp' gm' y) hs ks _ gp' gm' + (integerInsertOrderedGiants_left_projection sources m k V l s gp gm gp' gm' + x₀ x c (assignedHistory sources (Template.initial m k) V l t gp gm y₀ d) hs hfixed gp' gm') + (HistoryBulkIndependentReferenceTransport.integerInsertOrderedGiants_right_projection sources m k V l s t gp gm gp' gm' + x₀ y₀ x y π hold hnew c d hs hfixed gp' gm') hlines hlines' + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardBActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardBActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..922e421a0b9e70d1eff36b8a1f3f782173575659 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardBActual.lean @@ -0,0 +1,44 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermForwardB +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceCollisionAncestors + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairPattern HistorySymbolicEncoding HistoryPairBulkTransport HistoryOccurrenceVariables +open HistoryBulkSupportConverse HistoryBulkSupportConversePlan HistoryBulkReferenceTests + +theorem actual_orderedSourceIndicatorB_eq_one_of_supported + {D : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice D Bs BD Bz k L E) {spectator : PrimeSource} + (hsep : C.CrossRoleSeparation spectator) (V : ℕ→ℕ) (l : ℕ) (s t : ℤ) + (gp gm gp' gm' : ℕ) (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length)) + (hold : ∀i, (y₀ i).val=(x₀ (π i)).val) + (hnew : ∀i, (y i).val=(x (π i)).val) + (c d : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) {outside : List ℕ} + (hs : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c).Supported V outside) (ks : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ d).Supported V outside) + (hs' : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp' gm' x c).Supported V outside) (ks' : (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp' gm' y d).Supported V outside) + (hfixed : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length, ((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass y≠0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l c≠0) + (hd : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l d≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) + : + orderedSourceIndicatorB C.sources (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ d) hs ks (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)) x gp' gm'=1 := by + apply orderedSourceIndicatorB_eq_one_of_supported C.sources (2*(bulkSize k L/2)) k V l s t + gp gm gp' gm' x₀ y₀ x y π hold hnew c d hs ks hs' ks' hfixed hx hy hc hd hfreq + · exact HistoryBulkSourceCollision.newIntegerSample_ancestor_units C hsep V l x hx c hc + s gp' gm' gp' gm' + · exact HistoryBulkSourceCollision.newIntegerSample_ancestor_units C hsep V l y hy d hd + t gp' gm' gp' gm' + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardR.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardR.lean new file mode 100644 index 0000000000000000000000000000000000000000..25a529664af70095cc4bc893115ee7929f3aa7c4 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermForwardR.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceForwardR +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairBulkTransportAssigned + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion HistoryBulkSupportConverse HistoryBulkDiagramParameters +open HistoryPairBulkTransport HistoryBulkReferenceForwardR + +theorem independentReferenceIndicator_eq_one_of_supported + (K : ℕ) (sources : SourceFamily) (m k l : ℕ) (V : ℕ→ℕ) (outside : List ℕ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k) l)) (s t : ℤ) (gp gm gp' gm' : ℕ) + (c e : HistoryChoices sources (Template.initial m k) V l) + (hfixed : ∀i : Fin ((Template.current (Template.initial m k) l)).length,(((Template.current (Template.initial m k) l)).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hnew : (assignedHistory sources (Template.initial m k) V l s gp' gm' x c).Supported V outside) + (hnew' : (assignedHistory sources (Template.initial m k) V l t gp' gm' + y e).Supported V outside) + (hx : (assignmentPrior sources (Template.current (Template.initial m k) l)).mass x≠0) + (hy : (assignmentPrior sources (Template.current (Template.initial m k) l)).mass y≠0) + (hfixedy : ∀i : Fin ((Template.current (Template.initial m k) l)).length,(((Template.current (Template.initial m k) l)).get i).role≠.bulk → (y i).val=(y₀ i).val) + (hc : choicesMass sources (Template.initial m k) V l c≠0) + (he : choicesMass sources (Template.initial m k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(sources origin).AboveFrequency (V j)) + (hle : l≤K) : + independentReferenceIndicator K + (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c) + (assignedHistory sources (Template.initial m k) V l t gp gm y₀ e) + (assignedHistory sources (Template.initial m k) V l s gp' gm' x c) + (assignedHistory sources (Template.initial m k) V l t gp' gm' y e) (gp',gm')=1 := by + apply decoded_independent_reference_eq_one K sources (Template.initial m k) V l + (assignedRoot sources (Template.current (Template.initial m k) l) s gp' gm' x) (assignedRoot sources (Template.current (Template.initial m k) l) t gp' gm' y) + (assignedRoot sources (Template.current (Template.initial m k) l) s gp gm x₀) (assignedRoot sources (Template.current (Template.initial m k) l) t gp gm y₀) + c e outside hnew hnew' + (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp' gm' x) + (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp' gm' y) + (assignedSlots_source_mass_ne_zero sources (Template.current (Template.initial m k) l) x hx) + (assignedSlots_source_mass_ne_zero sources (Template.current (Template.initial m k) l) y hy) + hc he hfreq rfl rfl rfl rfl + · exact assignedSlots_erase_eq sources (Template.current (Template.initial m k) l) x x₀ hfixed + · exact assignedSlots_erase_eq sources (Template.current (Template.initial m k) l) y y₀ hfixedy + · exact hle + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermOrdered.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermOrdered.lean new file mode 100644 index 0000000000000000000000000000000000000000..8e02163c592740f4f078a2ca9c682916cb432674 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermOrdered.lean @@ -0,0 +1,74 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermOrderedBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermSelected + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Filter Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryGiantReferenceMean + +def SelectedOrderedReferenceEquality {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) : Prop := + let m := 2*(bulkSize k L/2) + let seed := Template.initial m k + let V := frequencyBound Bs BD Bz k L + ∀ (outside : List ℕ) (l K : ℕ), l≤K → l≤k → + ∀ (x₀ y₀ x y : SourceAssignment C.sources (Template.current seed l)) + (s t : ℤ) (gp gm : ℕ) (c e : HistoryChoices C.sources seed V l), + let H := assignedHistory C.sources seed V l s gp gm x₀ c + let J := assignedHistory C.sources seed V l t gp gm y₀ e + ∀ (hs : H.Supported V outside) (ks : J.Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ), + ∀(π : Equiv.Perm (Fin (Template.current seed l).length)) + (hπ : ∀i, ((Template.current seed l).get i).role=.bulk ↔ + ((Template.current seed l).get (π i)).role=.bulk), + (∀i, (y₀ i).val=(x₀ (π i)).val) → + (∀i, (y i).val=(x (π i)).val) → + (∀i : Fin (Template.current seed l).length, + ((Template.current seed l).get i).role≠.bulk → (x i).val=(x₀ i).val) → + (∀i : Fin (Template.current seed l).length, + ((Template.current seed l).get i).role≠.bulk → (y i).val=(y₀ i).val) → + (assignmentPrior C.sources (Template.current seed l)).mass y₀≠0 → + (assignmentPrior C.sources (Template.current seed l)).mass y≠0 → + (assignmentPrior C.sources (Template.current seed l)).mass x₀≠0 → + (assignmentPrior C.sources (Template.current seed l)).mass x≠0 → + choicesMass C.sources seed V l c≠0 → choicesMass C.sources seed V l e≠0 → + 0

hfreq j (hj.trans hl))) + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermOrderedBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermOrderedBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..30a28941354379d9d1c2dc01d4864b795da4d30d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermOrderedBasic.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceFrequency +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceMeanLaws +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySignedSpectatorDiagramActual + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped Classical +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryPairSmoothXi +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates HistorySignedSpectatorCRT +open HistoryBulkResidueNormSum HistoryBulkSpectatorReferenceRaw HistoryFrequencyResidues +open HistoryGiantReferenceMean HistorySignedXiTransport + +def orderedReferenceTerm + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*(bulkSize k L/2)))) + (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) : ℂ := + if (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) s P.toNat Q.toNat x).Coprime outside ∧ + (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) t P.toNat Q.toNat y).Coprime outside then + Jmul P Q * (((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c).compensationProduct:ℂ)*((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e).compensationProduct:ℂ)) * + orderedSourceIndicatorB C.sources (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) hs ks + (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)) x P Q * + independentRTest K (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) σ (P,Q) + (sourceBulkUnits ((pairedFrequencyProduct (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e))^(K+2)) C.sources (2*(bulkSize k L/2)) k l x) * + residuePairSpectator (residueTransform d) outside outside.prod (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s P.toNat Q.toNat x c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t P.toNat Q.toNat y e) (P,Q) * + pairedRealXi b sw X tb td G (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) hs ks + (insertOrderedGiants (2*(bulkSize k L/2)) k (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) hs + (root_matches (assignedLabels C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)) + (orderedSourceValues C.sources (2*(bulkSize k L/2)) k l x) + (fun a => if a then (Q:ℝ) else (P:ℝ))) + else 0 + +theorem referenceTerm_eq_orderedReferenceTerm + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length)) + (hπ : ∀i, ((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role=.bulk ↔ ((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get (π i)).role=.bulk) + (hnew : ∀i, (y i).val=(x (π i)).val) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) : + referenceTerm C V outside l K x₀ y₀ x y s t gp gm c e hs ks b sw X tb td G Jmul P Q = + orderedReferenceTerm C V outside l K + (HistoryBulkIndependentReferenceFrequency.inducedBulkPermutation (2*(bulkSize k L/2)) k l π hπ) + x₀ y₀ x y s t gp gm c e hs ks b sw X tb td G Jmul P Q := by + have hR := HistoryBulkIndependentReferenceFrequency.independentRTest_source_eq_reference_of_fullPermutation + K (2*(bulkSize k L/2)) k l C.sources V (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) + (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) s P.toNat Q.toNat x) + (assignedRoot C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l) t P.toNat Q.toNat y) c e x y π hπ hnew + rfl rfl hs ks hx hfreq (P,Q) + unfold referenceTerm orderedReferenceTerm + rw [hR] + rfl + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ef8eeee2b55f0a41290ca90dbb9c37945d180d9 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermSelected.lean @@ -0,0 +1,73 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermActual + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Filter Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryGiantReferenceMean + +def SelectedReferenceEquality {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) (spectator : PrimeSource) : Prop := + let m := 2*(bulkSize k L/2) + let seed := Template.initial m k + let V := frequencyBound Bs BD Bz k L + ∀ (outside : List ℕ) (l K : ℕ), l≤K → l≤k → + ∀ (x₀ y₀ x y : SourceAssignment C.sources (Template.current seed l)) + (s t : ℤ) (gp gm : ℕ) (c e : HistoryChoices C.sources seed V l), + let H := assignedHistory C.sources seed V l s gp gm x₀ c + let J := assignedHistory C.sources seed V l t gp gm y₀ e + ∀ (hs : H.Supported V outside) (ks : J.Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) (Jmul : ℤ→ℤ→ℂ) (P Q : ℤ), + ∀π : Equiv.Perm (Fin (Template.current seed l).length), + (∀i, (y₀ i).val=(x₀ (π i)).val) → + (∀i, (y i).val=(x (π i)).val) → + (∀i : Fin (Template.current seed l).length, + ((Template.current seed l).get i).role≠.bulk → (x i).val=(x₀ i).val) → + (∀i : Fin (Template.current seed l).length, + ((Template.current seed l).get i).role≠.bulk → (y i).val=(y₀ i).val) → + (assignmentPrior C.sources (Template.current seed l)).mass y₀≠0 → + (assignmentPrior C.sources (Template.current seed l)).mass y≠0 → + (assignmentPrior C.sources (Template.current seed l)).mass x₀≠0 → + (assignmentPrior C.sources (Template.current seed l)).mass x≠0 → + choicesMass C.sources seed V l c≠0 → choicesMass C.sources seed V l e≠0 → + 0

hfreq j (hj.trans hl)) hp hq hprime + intro q hq j hj + obtain ⟨p,rfl⟩ := houtside q hq + exact houtfreq p j (hj.trans hl) + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermSupport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermSupport.lean new file mode 100644 index 0000000000000000000000000000000000000000..35e91339c57504d3193654703ddf03b1434e0a4d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTermSupport.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTermTests +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs +import OAI.NumberTheory.Ostmann.Conclusion.BulkPositionPermutation + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm +open Construction Conclusion Construction.CanonicalOccurrenceTransport +open HistoryPairBulkTransport HistoryBulkSupportConverse HistoryPairSmoothXi +open HistoryBulkReferenceTests HistoryBulkReferenceScalarCoordinates HistorySignedSpectatorCRT + +theorem inserted_pair_supported_of_actual_source_tests + {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) {spectator : PrimeSource} + (V : ℕ→ℕ) (outside : List ℕ) (l K : ℕ) + (x₀ y₀ x y : SourceAssignment C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)) (s t : ℤ) + (gp gm gp' gm' : ℕ) (c e : HistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) V l) + (hs : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e)).Supported V outside) + (b sw : ℕ) (X tb td G : ℝ) + (hsep : C.CrossRoleSeparation spectator) (hle : l≤K) + (π : Equiv.Perm (Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length)) + (hold : ∀i, (y₀ i).val=(x₀ (π i)).val) + (hnew : ∀i, (y i).val=(x (π i)).val) + (hfixed : ∀i : Fin ((Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).length, (((Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).get i).role≠.bulk → (x i).val=(x₀ i).val) + (hfixedy : ∀i : Fin (Template.current (Template.initial (2*(bulkSize k L/2)) k) l).length,((Template.current (Template.initial (2*(bulkSize k L/2)) k) l).get i).role≠.bulk → (y i).val=(y₀ i).val) + (hy : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass y≠0) + (hx : (assignmentPrior C.sources (Template.current (Template.initial (2*(bulkSize k L/2)) k) l)).mass x≠0) + (hc : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l c≠0) (he : choicesMass C.sources (Template.initial (2*(bulkSize k L/2)) k) V l e≠0) + (hfreq : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (V j)) + (hp : 0 if a then (gm':ℝ) else (gp':ℝ)))≠0) + (hR : independentReferenceIndicator K (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp gm x₀ c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp gm y₀ e) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l s gp' gm' x c) (assignedHistory C.sources (Template.initial (2*(bulkSize k L/2)) k) V l t gp' gm' y e) (gp',gm')≠0) + (g : (q:ℕ)→ZMod q→ℂ) (hprime : ∀q∈outside,q.Prime) + (hg : ∀q∈outside,g q 0=0) (houtfreq : ∀q∈outside,∀j≤l,V j if a then (gm':ℝ) else (gp':ℝ)))≠0) : + ReferenceTests b sw X tb td G sources (Template.initial m k) V outside l + (assignedRoot sources (Template.current (Template.initial m k) l) s gp gm x₀) (assignedRoot sources (Template.current (Template.initial m k) l) s gp' gm' x) c + (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp gm x₀) + (assignedRoot_matches sources (Template.current (Template.initial m k) l) s gp' gm' x) hs ∧ + ReferenceTests b sw X tb td G sources (Template.initial m k) V outside l + (assignedRoot sources (Template.current (Template.initial m k) l) t gp gm y₀) (assignedRoot sources (Template.current (Template.initial m k) l) t gp' gm' y) e + (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp gm y₀) + (assignedRoot_matches sources (Template.current (Template.initial m k) l) t gp' gm' y) ks := by + have hL := source_left_lines_squares_of_B sources m k V l s gp gm gp' gm' + x₀ x c (assignedHistory sources (Template.initial m k) V l t gp gm y₀ e) hs hfixed gp' gm' ks hB + have hR := right_reference_lines_squares_of_B sources (Template.initial m k) V outside l + (assignedRoot sources (Template.current (Template.initial m k) l) t gp gm y₀) + (assignedRoot sources (Template.current (Template.initial m k) l) t gp' gm' y) e + (assignedRoot_matches sources _ t gp gm y₀) + (assignedRoot_matches sources _ t gp' gm' y) ks + (assignedHistory sources (Template.initial m k) V l s gp gm x₀ c) hs _ gp' gm' + (HistoryBulkIndependentReferenceTransport.integerInsertOrderedGiants_right_projection + sources m k V l s t gp gm gp' gm' x₀ y₀ x y π hold hnew c e hs hfixed gp' gm') hB + refine ⟨⟨fun i => (hL i).1, fun i => (hL i).2, ?_⟩, + ⟨fun i => (hR i).1, fun i => (hR i).2, ?_⟩⟩ + · apply inserted_pairedRealXi_left_scalar_ne_zero sources m k V l s gp gm gp' gm' + x₀ x c (assignedHistory sources (Template.initial m k) V l t gp gm y₀ e) hs ks hfixed gp' gm' b sw X tb td G + simpa only [Int.cast_natCast] using hXi + · have hh := (pairedRealXi_ne_zero_scalars b sw X tb td G _ _ hs ks _ hXi).2 + have hr := HistoryBulkIndependentReferenceTransport.insertOrderedGiants_right_projection + sources m k V l s t gp gm gp' gm' x₀ y₀ x y π hold hnew c e hs hfixed gp' gm' + simp only [Int.cast_natCast] at hr + simp only [hr] at hh + simpa only [assignedHistory,assignedRoot] using hh + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTerm + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransport.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransport.lean new file mode 100644 index 0000000000000000000000000000000000000000..69eebfaad0b652741c97ffd0bf55dd705cc0b21a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransport.lean @@ -0,0 +1,62 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportFactors +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransportInteger + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates +open HistorySignedXiTransport HistoryGiantReferenceMean HistorySignedSpectatorCRT +open HistoryRepresentativeSourceSeparation + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm : ℕ) (P Q : ℤ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hold : ∀i, (y₀ i).val = (x₀ (π i)).val) + (hnew : ∀i, (y i).val = (x (π i)).val) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +include hold hnew + +theorem integer_sourceIntegrand_residue_transport (d : Decomposition) (hP : 0≤P) (hQ : 0≤Q) + (had : PairAdmissible (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) outside) + (hs : ((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).Supported V outside) + (hs' : ((assignedHistory sources (Template.initial m k₀) V l s P.toNat Q.toNat x c)).Supported V outside) (ks' : ((assignedHistory sources (Template.initial m k₀) V l t P.toNat Q.toNat y e)).Supported V outside) + (hfixed : ∀i : Fin ((Template.current (Template.initial m k₀) l)).length, (((Template.current (Template.initial m k₀) l)).get i).role≠.bulk → (x i).val=(x₀ i).val) + (J : ℤ→ℤ→ℂ) (bc sc : ℕ) (X tb td G : ℝ) : + sourceIntegrand d sources (Template.initial m k₀) V outside l + (sourceState sources (Template.current (Template.initial m k₀) l) x s) + (sourceState sources (Template.current (Template.initial m k₀) l) y t) + c e J bc sc X tb td G P Q = + J P Q * ((((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).compensationProduct:ℂ)*(((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).compensationProduct:ℂ))* + residuePairSpectator (residueTransform d) outside outside.prod (assignedHistory sources (Template.initial m k₀) V l s P.toNat Q.toNat x c) (assignedHistory sources (Template.initial m k₀) V l t P.toNat Q.toNat y e) (P,Q)* + pairedRealXi bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs ks + (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (Q:ℝ) else (P:ℝ))) := by + rw [integer_sourceIntegrand_transport sources m k₀ V outside l s t gp gm P Q + x₀ y₀ x y π hold hnew c e d hP hQ hs ks hs' ks' hfixed J bc sc X tb td G] + have hd := HistoryBulkFixedReferenceTransport.assigned_pair_leafProduct_eq_residue_of_reference sources + (Template.initial m k₀) V outside l s t gp gm P.toNat Q.toNat + x₀ y₀ + x y c e had hs' ks' (residueTransform d) + have hPD : (P.toNat:ZMod outside.prod)=(P:ZMod outside.prod) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hP] + have hQD : (Q.toNat:ZMod outside.prod)=(Q:ZMod outside.prod) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hQ] + rw [hPD,hQD] at hd + rw [hd] + exact mul_right_comm _ _ _ + +end Pair +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportCoordinates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..7919daf456afa148c48df352c91a0e8207d592b0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportCoordinates.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceScalarCoordinatesLeft + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistoryPairGiantCoordinates HistorySymbolicEncoding +open HistoryPairBulkCoordinates HistoryPairBulkTransport HistoryBulkSupportConversePlan +open HistoryBulkReferenceScalarCoordinates + +theorem assigned_right_root_key (sources : SourceFamily) (seed : List SourceSlot) + (V : ℕ → ℕ) (l : ℕ) (s t : ℤ) (gp gm : ℕ) + (x₀ y₀ : SourceAssignment sources (Template.current seed l)) + (π : Equiv.Perm (Fin (Template.current seed l).length)) + (hold : ∀i,(y₀ i).val=(x₀ (π i)).val) + (c e : HistoryChoices sources seed V l) (i : Fin (Template.current seed l).length) : + rightMap (assignedHistory sources seed V l s gp gm x₀ c) + (assignedHistory sources seed V l t gp gm y₀ e) + (coordinateEquiv seed (assignedHistory sources seed V l t gp gm y₀ e) + (assignedLabels sources seed V l t gp gm y₀ e) (.inr (.inl i))) = + leftMap (assignedHistory sources seed V l s gp gm x₀ c) + (assignedHistory sources seed V l t gp gm y₀ e) + (coordinateEquiv seed (assignedHistory sources seed V l s gp gm x₀ c) + (assignedLabels sources seed V l s gp gm x₀ c) (.inr (.inl (π i)))) := by + apply Subtype.ext + change Sum.inr (l+1, coordinateSample seed (assignedHistory sources seed V l t gp gm y₀ e) + (assignedLabels sources seed V l t gp gm y₀ e) (.inr (.inl i))) = + Sum.inr (l+1, coordinateSample seed (assignedHistory sources seed V l s gp gm x₀ c) + (assignedLabels sources seed V l s gp gm x₀ c) (.inr (.inl (π i)))) + rw [assigned_root_sample,assigned_root_sample,hold i] + +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ → ℕ) (l : ℕ) + (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hold : ∀i,(y₀ i).val=(x₀ (π i)).val) + (hnew : ∀i,(y i).val=(x (π i)).val) + (c e : HistoryChoices sources (Template.initial m k₀) V l) {outside : List ℕ} + (hs : (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c).Supported V outside) + (hfixedLeft : ∀i:Fin (Template.current (Template.initial m k₀) l).length,((Template.current (Template.initial m k₀) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (Xp Xm : ℤ) +include hold hnew hfixedLeft + +theorem insertOrderedGiants_right_coordinate (i : Coordinate (Template.initial m k₀) l) : + insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) (fun u => if u then (Xm:ℝ) else (Xp:ℝ)) (rightMap (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) ((decodedCoordinateEquiv sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp gm y₀) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp gm y₀)) i)) = (newSourceSample sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp' gm' y) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp' gm' y) Xp Xm i:ℝ) := by + rcases i with u | i | i + · change insertOrderedGiants _ _ _ _ _ _ _ _ (rightMap (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) (.inl u)) = _ + rw [insertOrderedGiants_right_giant] + cases u <;> simp only [newSourceSample_plus,newSourceSample_minus,Rat.cast_intCast, + Bool.false_eq_true,↓reduceIte] + · change insertOrderedGiants _ _ _ _ _ _ _ _ + (rightMap (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) (coordinateEquiv (Template.initial m k₀) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) (assignedLabels sources (Template.initial m k₀) V l t gp gm y₀ e) (.inr (.inl i)))) = _ + rw [assigned_right_root_key sources (Template.initial m k₀) V l s t gp gm x₀ y₀ π hold c e i] + have hl := HistoryBulkReferenceScalarCoordinates.insertOrderedGiants_left_coordinate + sources m k₀ V l s gp gm gp' gm' x₀ x c (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs hfixedLeft Xp Xm (.inr (.inl (π i))) + simp only [newSourceSample_assigned_root,hnew,decodedCoordinateEquiv,assignedHistory] at hl ⊢ + convert hl using 1 + · change insertOrderedGiants _ _ _ _ _ _ _ _ + (rightMap (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) (.inr (.inr (internalEquiv (Template.initial m k₀) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) (assignedLabels sources (Template.initial m k₀) V l t gp gm y₀ e) i)))) = _ + rw [insertOrderedGiants_right_small,insertOrdered_right_internal,newSourceSample_internal,Rat.cast_natCast] + change (((internalSlot (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) (internalEquiv (Template.initial m k₀) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) (assignedLabels sources (Template.initial m k₀) V l t gp gm y₀ e) i)).value:ℤ):ℝ) = _ + rw [Int.cast_natCast] + exact congrArg (fun n : ℕ => (n:ℝ)) + (decoded_internalSlot_eq_historyDraw sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp gm y₀) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp gm y₀) i) + +theorem insertOrderedGiants_right_projection (q : Key (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)) : + insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) (fun u => if u then (Xm:ℝ) else (Xp:ℝ)) (rightMap (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) q) = (newSourceSample sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp' gm' y) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp' gm' y) Xp Xm ((decodedCoordinateEquiv sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp gm y₀) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp gm y₀)).symm q):ℝ) := by + obtain ⟨i,rfl⟩ := (decodedCoordinateEquiv sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp gm y₀) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp gm y₀)).surjective q + rw [Equiv.symm_apply_apply] + exact insertOrderedGiants_right_coordinate sources m k₀ V l s t gp gm gp' gm' + x₀ y₀ x y π hold hnew c e hs hfixedLeft Xp Xm i + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportInteger.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportInteger.lean new file mode 100644 index 0000000000000000000000000000000000000000..ff54f5619dc118b31e38a3a0c05b9bd65e3970e0 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportInteger.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransportPair + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped ComplexConjugate +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates +open HistorySignedXiTransport HistoryGiantReferenceMean + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm : ℕ) (P Q : ℤ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hold : ∀i, (y₀ i).val = (x₀ (π i)).val) + (hnew : ∀i, (y i).val = (x (π i)).val) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +include hold hnew + +theorem integer_sourceIntegrand_transport (d : Decomposition) (hP : 0≤P) (hQ : 0≤Q) + (hs : ((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).Supported V outside) + (hs' : ((assignedHistory sources (Template.initial m k₀) V l s P.toNat Q.toNat x c)).Supported V outside) (ks' : ((assignedHistory sources (Template.initial m k₀) V l t P.toNat Q.toNat y e)).Supported V outside) + (hfixed : ∀i : Fin ((Template.current (Template.initial m k₀) l)).length, (((Template.current (Template.initial m k₀) l)).get i).role≠.bulk → (x i).val=(x₀ i).val) + (J : ℤ→ℤ→ℂ) (bc sc : ℕ) (X tb td G : ℝ) : + sourceIntegrand d sources (Template.initial m k₀) V outside l + (sourceState sources (Template.current (Template.initial m k₀) l) x s) + (sourceState sources (Template.current (Template.initial m k₀) l) y t) + c e J bc sc X tb td G P Q = + J P Q * ((((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).compensationProduct:ℂ)*(((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).compensationProduct:ℂ))* + pairedRealXi bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs ks + (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (Q:ℝ) else (P:ℝ)))* + (((assignedHistory sources (Template.initial m k₀) V l s P.toNat Q.toNat x c)).leafProduct (spectatorFactor (residueTransform d) outside)* + conj (((assignedHistory sources (Template.initial m k₀) V l t P.toNat Q.toNat y e)).leafProduct (spectatorFactor (residueTransform d) outside))) := by + have h := assigned_sourceIntegrand_transport sources m k₀ V outside l s t + gp gm P.toNat Q.toNat x₀ y₀ x y π hold hnew c e d hs ks hs' ks' hfixed J bc sc X tb td G + have hPr : (P.toNat:ℝ)=(P:ℝ) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hP] + have hQr : (Q.toNat:ℝ)=(Q:ℝ) := by + rw [←Int.cast_natCast,Int.toNat_of_nonneg hQ] + simpa only [Int.toNat_of_nonneg hP,Int.toNat_of_nonneg hQ,hPr,hQr] using h + +end Pair +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportIntegerCoordinates.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportIntegerCoordinates.lean new file mode 100644 index 0000000000000000000000000000000000000000..c75c7df107766dffdcd9709f6677e615b47ed19f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportIntegerCoordinates.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransportCoordinates +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsInsertion + +namespace OAI + +open Erdos970 + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistoryPairGiantCoordinates +open HistoryPairBulkCoordinates HistoryPairBulkTransport HistoryBulkSupportConversePlan +open HistoryBulkReferenceScalarCoordinates HistoryBulkSupportConverse +open HistoryBulkReferenceTests + +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (l : ℕ) + (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hold : ∀i, (y₀ i).val = (x₀ (π i)).val) + (hnew : ∀i, (y i).val = (x (π i)).val) + (c e : HistoryChoices sources (Template.initial m k₀) V l) {outside : List ℕ} + (hs : (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c).Supported V outside) + (hfixedLeft : ∀i : Fin (Template.current (Template.initial m k₀) l).length, ((Template.current (Template.initial m k₀) l).get i).role≠.bulk → (x i).val=(x₀ i).val) + (Xp Xm : ℤ) +include hold hnew hfixedLeft + +theorem integerInsertOrderedGiants_right_projection (q : Key (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)) : + integerInsertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedIntegerSourceValues sources m k₀ l x) (fun u => if u then Xm else Xp) + (rightMap (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) q) = + newIntegerSample sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp' gm' y) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp' gm' y) Xp Xm + ((decodedCoordinateEquiv sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp gm y₀) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp gm y₀)).symm q) := by + have he := insertOrderedGiants_right_projection sources m k₀ V l s t gp gm gp' gm' + x₀ y₀ x y π hold hnew c e hs hfixedLeft Xp Xm q + have hc := congrFun (integerInsertOrderedGiants_cast m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedIntegerSourceValues sources m k₀ l x) (fun u => if u then Xm else Xp)) + (rightMap (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) q) + simp only [orderedIntegerSourceValues_cast, Int.cast_ite] at hc + have hz := congrArg (fun r : ℚ => (r : ℝ)) + (congrFun (newIntegerSample_cast sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp' gm' y) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp' gm' y) Xp Xm) + ((decodedCoordinateEquiv sources (Template.initial m k₀) V l (assignedRoot sources (Template.current (Template.initial m k₀) l) t gp gm y₀) e (assignedRoot_matches sources (Template.current (Template.initial m k₀) l) t gp gm y₀)).symm q)) + simp only [Rat.cast_intCast] at hz + exact_mod_cast hc.trans (he.trans hz.symm) + +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportPair.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportPair.lean new file mode 100644 index 0000000000000000000000000000000000000000..5af41360af8ce8f7e564545e686e067d8cf90a27 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportPair.lean @@ -0,0 +1,76 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransportScalar +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceMeanLaws + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped ComplexConjugate +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates +open HistorySignedXiTransport HistoryGiantReferenceMean + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hold : ∀i, (y₀ i).val = (x₀ (π i)).val) + (hnew : ∀i, (y i).val = (x (π i)).val) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +include hold hnew + +theorem assigned_supportedPair_transport (d : Decomposition) + (hs : ((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).Supported V outside) + (hs' : ((assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c)).Supported V outside) (ks' : ((assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e)).Supported V outside) + (hfixed : ∀i : Fin ((Template.current (Template.initial m k₀) l)).length, (((Template.current (Template.initial m k₀) l)).get i).role≠.bulk → (x i).val=(x₀ i).val) + (bc sc : ℕ) (X tb td G : ℝ) : + supportedHistoryPairXi d V outside bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c) (assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e) = + ((((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).compensationProduct:ℂ)*(((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).compensationProduct:ℂ))* + pairedRealXi bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs ks + (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (gm':ℝ) else (gp':ℝ)))* + (((assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c)).leafProduct (spectatorFactor (residueTransform d) outside)* + conj (((assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e)).leafProduct (spectatorFactor (residueTransform d) outside))) := by + rw [supportedHistoryPairXi,dite_eq_left hs',dite_eq_left ks', + ←assigned_pairedRealXi_insertOrderedGiants sources m k₀ V outside l s t + gp gm gp' gm' x₀ y₀ x y π hold hnew c e hs ks hs' ks' hfixed bc sc X tb td G] + have hh : ((assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c)).compensationProduct=((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).compensationProduct := + decoded_compensationProduct_eq sources (Template.initial m k₀) V l _ _ c + have hk : ((assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e)).compensationProduct=((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).compensationProduct := + decoded_compensationProduct_eq sources (Template.initial m k₀) V l _ _ e + rw [hh,hk] + +theorem assigned_sourceIntegrand_transport (d : Decomposition) + (hs : ((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).Supported V outside) + (hs' : ((assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c)).Supported V outside) (ks' : ((assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e)).Supported V outside) + (hfixed : ∀i : Fin ((Template.current (Template.initial m k₀) l)).length, (((Template.current (Template.initial m k₀) l)).get i).role≠.bulk → (x i).val=(x₀ i).val) + (J : ℤ→ℤ→ℂ) (bc sc : ℕ) (X tb td G : ℝ) : + sourceIntegrand d sources (Template.initial m k₀) V outside l + (sourceState sources (Template.current (Template.initial m k₀) l) x s) + (sourceState sources (Template.current (Template.initial m k₀) l) y t) + c e J bc sc X tb td G gp' gm' = + J gp' gm' * ((((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).compensationProduct:ℂ)*(((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).compensationProduct:ℂ))* + pairedRealXi bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs ks + (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (gm':ℝ) else (gp':ℝ)))* + (((assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c)).leafProduct (spectatorFactor (residueTransform d) outside)* + conj (((assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e)).leafProduct (spectatorFactor (residueTransform d) outside))) := by + change J gp' gm' * supportedHistoryPairXi d V outside bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c) (assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e) = _ + rw [assigned_supportedPair_transport sources m k₀ V outside l s t + gp gm gp' gm' x₀ y₀ x y π hold hnew c e d hs ks hs' ks' hfixed bc sc X tb td G] + simp only [mul_assoc] + +end Pair +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportScalar.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportScalar.lean new file mode 100644 index 0000000000000000000000000000000000000000..08104a480aaaf8213f6a480e44b86455cc803663 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIndependentReferenceTransportScalar.lean @@ -0,0 +1,57 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFixedReferenceTransportScalarBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransportCoordinates + +namespace OAI + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport +open Construction Construction.CanonicalOccurrenceTransport Conclusion +open HistoryOccurrenceVariables HistoryPairPattern HistorySymbolicEncoding HistoryPairSmoothXi +open HistoryPairBulkTransport HistoryBulkSupportConversePlan HistoryBulkReferenceScalarCoordinates + +section Pair +variable (sources : SourceFamily) (m k₀ : ℕ) (V : ℕ→ℕ) (outside : List ℕ) (l : ℕ) + (s t : ℤ) (gp gm gp' gm' : ℕ) + (x₀ y₀ x y : SourceAssignment sources (Template.current (Template.initial m k₀) l)) + (π : Equiv.Perm (Fin (Template.current (Template.initial m k₀) l).length)) + (hold : ∀i, (y₀ i).val = (x₀ (π i)).val) + (hnew : ∀i, (y i).val = (x (π i)).val) + (c e : HistoryChoices sources (Template.initial m k₀) V l) +include hold hnew + +theorem assigned_pairedRealXi_insertOrderedGiants + (hs : ((assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c)).Supported V outside) (ks : ((assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e)).Supported V outside) + (hs' : ((assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c)).Supported V outside) (ks' : ((assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e)).Supported V outside) + (hfixed : ∀i : Fin ((Template.current (Template.initial m k₀) l)).length, (((Template.current (Template.initial m k₀) l)).get i).role≠.bulk → (x i).val=(x₀ i).val) + (bc sc : ℕ) (X tb td G : ℝ) : + pairedRealXi bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs ks + (insertOrderedGiants m k₀ (assignedHistory sources (Template.initial m k₀) V l s gp gm x₀ c) (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs + (root_matches (assignedLabels sources (Template.initial m k₀) V l s gp gm x₀ c)) + (orderedSourceValues sources m k₀ l x) + (fun u => if u then (gm':ℝ) else (gp':ℝ))) = + pairedRealXi bc sc X tb td G (assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c) (assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e) hs' ks' + (fun i => (pairSample (assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c) (assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e) i:ℝ)) := by + have hr : RootGiantsAgree (assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c) (assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e) := by + simp [RootGiantsAgree,assignedHistory,decodeHistory_root,assignedRoot] + simp only [pairedRealXi,actualRealXi,leftMap_sample,rightMap_sample (assignedHistory sources (Template.initial m k₀) V l s gp' gm' x c) (assignedHistory sources (Template.initial m k₀) V l t gp' gm' y e) hr] + apply congrArg₂ (fun a b : ℂ => a * star b) + · apply HistoryBulkFixedReferenceTransport.assigned_scalar_transport sources (Template.initial m k₀) V outside l s gp gm gp' gm' + x₀ x c hs hs' bc sc X tb td G + intro i + simpa only [Int.cast_natCast] using + insertOrderedGiants_left_coordinate sources m k₀ V l s gp gm gp' gm' + x₀ x c (assignedHistory sources (Template.initial m k₀) V l t gp gm y₀ e) hs hfixed gp' gm' i + · apply HistoryBulkFixedReferenceTransport.assigned_scalar_transport sources (Template.initial m k₀) V outside l t gp gm gp' gm' + y₀ + y e ks ks' bc sc X tb td G + intro i + simpa only [Int.cast_natCast] using + insertOrderedGiants_right_coordinate sources m k₀ V l s t gp gm gp' gm' + x₀ y₀ x y π hold hnew c e hs hfixed gp' gm' i + +end Pair +end Ostmann.Arithmetic.HistoryBulkIndependentReferenceTransport + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..5c958143352041c1f23ade04f1f1fa1196301f4a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacement.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIntegralReplacementRegular + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkIntegralReplacement +open Construction Conclusion HistoryBulkPriorGrid HistoryPrincipalIntegralAverage +open HistoryPrincipalIntegralFinite HistoryBulkReplacementError PrimeCellFreezing ScaleBudget Filter + +theorem prime_joint_replacement_eventually (k : ℕ) (C : ℝ) : + ∀ᶠ L : ℝ in atTop, ∀(ι κ:Type*) [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ], + ∀(M:ℕ) [NeZero M], ∀(a:ℕ)(E:Finset ℕ), + Fintype.card ι ≤ 2^k*bulkSize k L → a ≤ residueCostExponent k → + Real.log (M:ℝ) ≤ Real.exp (bulk.μ*L) → E.card ≤ 2 → + ∀(hZ:0 < harmonicPrimeMass (bulkPrimeBand L E)) + (hsize:(M:ℝ) < Real.exp (bulkLogLower L)) + (F:(ι→(ZMod M)ˣ)→ℂ)(lo hi Z:κ→ℝ), + (∀i,0Real.exp (t i)))) → + ContinuousOn (fun z : (κ→ℝ)×(ι→ℝ)=> + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) + (logRectangle lo hi ×ˢ logRectangle (fun _ : ι=>bulkLogLower L) + (fun _=>bulkLogUpper L)) → + ‖sourceBulkMean L E hZ M hsize F (fun x=>primeIntegral lo hi Z (fun y=>f y x))- + primeIntegral lo hi Z (fun y=>bulkMain L E F (f y))‖ ≤ + (3*Real.exp (-Real.exp (bulk.target*L)))* + PrimeCellFreezing.logCellMass (fun i=>(Z i)⁻¹) lo hi := by + filter_upwards [prime_integrated_replacement_eventually k C] with L hL + intro ι κ _ _ _ _ M _ a E hn ha hm hE hZ hsize F lo hi Z hlo hZo f hF hf hjoint + exact hL ι κ M a E hn ha hm hE hZ hsize F lo hi Z hlo hZo f hF hf + (sampled_scalar_continuousOn L E hZ _ f hjoint) + (bulkMain_continuousOn L E F _ (isCompact_logRectangle lo hi) f hjoint) + +theorem mixed_joint_replacement_eventually (k : ℕ) (C : ℝ) : + ∀ᶠ L : ℝ in atTop, ∀(ι κ:Type*) [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ], + ∀(M:ℕ) [NeZero M], ∀(a:ℕ)(E:Finset ℕ), + Fintype.card ι ≤ 2^k*bulkSize k L → a ≤ residueCostExponent k → + Real.log (M:ℝ) ≤ Real.exp (bulk.μ*L) → E.card ≤ 2 → + ∀(hZ:0 < harmonicPrimeMass (bulkPrimeBand L E)) + (hsize:(M:ℝ) < Real.exp (bulkLogLower L)) + (F:(ι→(ZMod M)ˣ)→ℂ)(loI hiI G:ℝ)(φ:ℝ→ℝ)(lo hi Z:κ→ℝ), + Continuous φ → (∀t∈Set.Icc loI hiI,0≤φ (t-G)) → + (∀i,0Real.exp (t i)))) → + ContinuousOn (fun z : (Option κ→ℝ)×(ι→ℝ)=> + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) + (logRectangle (Option.elim' loI lo) (Option.elim' hiI hi) ×ˢ + logRectangle (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L)) → + ‖sourceBulkMean L E hZ M hsize F + (fun x=>mixedIntegral loI hiI G φ lo hi Z (fun y=>f y x))- + mixedIntegral loI hiI G φ lo hi Z (fun y=>bulkMain L E F (f y))‖ ≤ + (3*Real.exp (-Real.exp (bulk.target*L)))* + MixedCellIntegralFreezing.mixedLogMass 1 loI hiI G φ (fun i=>(Z i)⁻¹) lo hi := by + filter_upwards [mixed_integrated_replacement_eventually k C] with L hL + intro ι κ _ _ _ _ M _ a E hn ha hm hE hZ hsize F loI hiI G φ lo hi Z hφ hφ0 hlo hZo + f hF hf hjoint + exact hL ι κ M a E hn ha hm hE hZ hsize F loI hiI G φ lo hi Z hφ hφ0 hlo hZo f hF hf + (sampled_scalar_continuousOn L E hZ _ f hjoint) + (bulkMain_continuousOn L E F _ (isCompact_logRectangle _ _) f hjoint) + +end Ostmann.Arithmetic.HistoryBulkIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..06b93311a0617ff0a929d871cd11e43084c754d3 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementBasic.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReplacementErrorSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPrincipalIntegralFiniteBounds + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkIntegralReplacement +open Construction HistoryBulkPriorGrid HistoryPrincipalIntegralAverage HistoryPrincipalIntegralFinite +open PrimeCellFreezing +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +theorem sourceBulkMean_primeIntegral + (L : ℝ) (E : Finset ℕ) (hZ : 0 < harmonicPrimeMass (bulkPrimeBand L E)) + (M : ℕ) [NeZero M] (hsize : (M:ℝ) f (fun i=>Real.exp (t i)) (fun i=>((p i).val:ℝ))) + (logRectangle lo hi)) : + sourceBulkMean L E hZ M hsize F (fun x=>primeIntegral lo hi Z (fun y=>f y x)) = + primeIntegral lo hi Z (fun y=>sourceBulkMean L E hZ M hsize F (f y)) := by + classical + unfold sourceBulkMean + rw [primeIntegral_cmean (bulkProductPrior (ι:=ι) L E hZ) lo hi Z hlo + (fun p y => F (fun i=>bulkPrimeUnit L M hsize (p i).val + (bulkPrimeBand_subset_closed L E (p i).property))*f y (fun i=>((p i).val:ℝ))) + (fun p=>continuousOn_const.mul (hf p))] + unfold FinitePrior.cmean + apply Finset.sum_congr rfl + intro p hp + dsimp only + rw [primeIntegral_const_mul] + +theorem sourceBulkMean_mixedIntegral + (L : ℝ) (E : Finset ℕ) (hZ : 0 < harmonicPrimeMass (bulkPrimeBand L E)) + (M : ℕ) [NeZero M] (hsize : (M:ℝ) f (fun i=>Real.exp (t i)) (fun i=>((p i).val:ℝ))) + (logRectangle (Option.elim' loI lo) (Option.elim' hiI hi))) : + sourceBulkMean L E hZ M hsize F + (fun x=>mixedIntegral loI hiI G φ lo hi Z (fun y=>f y x)) = + mixedIntegral loI hiI G φ lo hi Z (fun y=>sourceBulkMean L E hZ M hsize F (f y)) := by + classical + unfold sourceBulkMean + rw [mixedIntegral_cmean (bulkProductPrior (ι:=ι) L E hZ) loI hiI G φ lo hi Z hφ hlo + (fun p y => F (fun i=>bulkPrimeUnit L M hsize (p i).val + (bulkPrimeBand_subset_closed L E (p i).property))*f y (fun i=>((p i).val:ℝ))) + (fun p=>continuousOn_const.mul (hf p))] + unfold FinitePrior.cmean + apply Finset.sum_congr rfl + intro p hp + dsimp only + rw [mixedIntegral_const_mul] + +omit [Fintype κ] [DecidableEq κ] in + +theorem sourceBulkMean_continuousOn + (L : ℝ) (E : Finset ℕ) (hZ : 0 < harmonicPrimeMass (bulkPrimeBand L E)) + (M : ℕ) [NeZero M] (hsize : (M:ℝ) f (fun i=>Real.exp (t i)) (fun i=>((p i).val:ℝ))) S) : + ContinuousOn (fun t=>sourceBulkMean L E hZ M hsize F (f (fun i=>Real.exp (t i)))) S := by + classical + unfold sourceBulkMean FinitePrior.cmean + exact continuousOn_finsetSum _ (fun p _=>continuousOn_const.mul + (continuousOn_const.mul (hf p))) + +end Ostmann.Arithmetic.HistoryBulkIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementBounds.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementBounds.lean new file mode 100644 index 0000000000000000000000000000000000000000..699d89fbc6800548983cdb5e8c1dfca67af989e5 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementBounds.lean @@ -0,0 +1,51 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIntegralReplacementBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkIntegralReplacement +open Construction Conclusion HistoryBulkPriorGrid HistoryPrincipalIntegralAverage +open HistoryPrincipalIntegralFinite HistoryBulkReplacementError PrimeCellFreezing ScaleBudget Filter +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +structure BulkBounds (k : ℕ) (L C : ℝ) (f : (ι→ℝ)→ℂ) : Prop where + differentiable : ∀z∈logRectangle (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L), + DifferentiableAt ℝ (fun y=>f (fun i=>Real.exp (y i))) z + derivative : ∀z∈logRectangle (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L),∀i, + ‖deriv (fun t=>f (Characters.RationalHistory.Expr.logCurve (fun q=>Real.exp (z q)) i t)) 0‖ ≤ + Real.exp (C*((bulkSize k L:ℝ)+1)) + norm : ∀z∈logRectangle (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L), + ‖f (fun i=>Real.exp (z i))‖ ≤ Real.exp (C*((bulkSize k L:ℝ)+1)) + +def bulkMain (L : ℝ) (E : Finset ℕ) {M : ℕ} [NeZero M] + (F : (ι→(ZMod M)ˣ)→ℂ) (f : (ι→ℝ)→ℂ) : ℂ := + primeIntegral (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L) + (fun _=>bulkNormalizer L E) f * ResidueHaar.average F + +theorem sourceBulkMean_average_replacement_eventually (k : ℕ) (C : ℝ) : + ∀ᶠ L : ℝ in atTop, ∀(ι:Type*) [Fintype ι] [DecidableEq ι], + ∀(M:ℕ) [NeZero M], ∀(a:ℕ)(E:Finset ℕ), + Fintype.card ι ≤ 2^k*bulkSize k L → a ≤ residueCostExponent k → + Real.log (M:ℝ) ≤ Real.exp (bulk.μ*L) → E.card ≤ 2 → + ∀(hZ:0 < harmonicPrimeMass (bulkPrimeBand L E)) + (hsize:(M:ℝ) < Real.exp (bulkLogLower L)) + (F:(ι→(ZMod M)ˣ)→ℂ)(f:(ι→ℝ)→ℂ), + (∑u:ι→(ZMod M)ˣ,‖F u‖) ≤ (M:ℝ)^(Fintype.card ι+a) → + BulkBounds k L C f → + ‖sourceBulkMean L E hZ M hsize F f-bulkMain L E F f‖ ≤ + 3*Real.exp (-Real.exp (bulk.target*L)) := by + filter_upwards [sourceBulkMean_replacement_eventually k C] with L hL + intro ι _ _ M _ a E hn ha hm hE hZ hsize F f hF hf + simpa only [principalIntegral_mul_sum,bulkMain] using + hL ι M a E hn ha hm hE hZ hsize F f hF hf.differentiable hf.derivative hf.norm + +end Ostmann.Arithmetic.HistoryBulkIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementIntegrated.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementIntegrated.lean new file mode 100644 index 0000000000000000000000000000000000000000..5a28ac3367332fc4a93f16f5adc6ab0954b6efe6 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementIntegrated.lean @@ -0,0 +1,82 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIntegralReplacementBounds + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkIntegralReplacement +open Construction Conclusion HistoryBulkPriorGrid HistoryPrincipalIntegralAverage +open HistoryPrincipalIntegralFinite HistoryBulkReplacementError PrimeCellFreezing ScaleBudget Filter + +theorem prime_integrated_replacement_eventually (k : ℕ) (C : ℝ) : + ∀ᶠ L : ℝ in atTop, ∀(ι κ:Type*) [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ], + ∀(M:ℕ) [NeZero M], ∀(a:ℕ)(E:Finset ℕ), + Fintype.card ι ≤ 2^k*bulkSize k L → a ≤ residueCostExponent k → + Real.log (M:ℝ) ≤ Real.exp (bulk.μ*L) → E.card ≤ 2 → + ∀(hZ:0 < harmonicPrimeMass (bulkPrimeBand L E)) + (hsize:(M:ℝ) < Real.exp (bulkLogLower L)) + (F:(ι→(ZMod M)ˣ)→ℂ)(lo hi Z:κ→ℝ), + (∀i,0Real.exp (t i)))) → + (∀p:ι→(bulkPrimeSource L E hZ).Sample, + ContinuousOn (fun t=>f (fun i=>Real.exp (t i)) (fun i=>((p i).val:ℝ))) + (logRectangle lo hi)) → + ContinuousOn (fun t=>bulkMain L E F (f (fun i=>Real.exp (t i)))) (logRectangle lo hi) → + ‖sourceBulkMean L E hZ M hsize F (fun x=>primeIntegral lo hi Z (fun y=>f y x))- + primeIntegral lo hi Z (fun y=>bulkMain L E F (f y))‖ ≤ + (3*Real.exp (-Real.exp (bulk.target*L)))* + PrimeCellFreezing.logCellMass (fun i=>(Z i)⁻¹) lo hi := by + filter_upwards [sourceBulkMean_average_replacement_eventually k C] with L hL + intro ι κ _ _ _ _ M _ a E hn ha hm hE hZ hsize F lo hi Z hlo hZo f hF hf hsample hmain + rw [sourceBulkMean_primeIntegral L E hZ M hsize F lo hi Z hlo f hsample] + apply primeIntegral_difference_le_mass lo hi Z hlo hZo + (fun y=>sourceBulkMean L E hZ M hsize F (f y)) (fun y=>bulkMain L E F (f y)) + (sourceBulkMean_continuousOn L E hZ M hsize F _ f hsample) hmain + intro t ht + exact hL ι M a E hn ha hm hE hZ hsize F _ hF (hf t ht) + +theorem mixed_integrated_replacement_eventually (k : ℕ) (C : ℝ) : + ∀ᶠ L : ℝ in atTop, ∀(ι κ:Type*) [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ], + ∀(M:ℕ) [NeZero M], ∀(a:ℕ)(E:Finset ℕ), + Fintype.card ι ≤ 2^k*bulkSize k L → a ≤ residueCostExponent k → + Real.log (M:ℝ) ≤ Real.exp (bulk.μ*L) → E.card ≤ 2 → + ∀(hZ:0 < harmonicPrimeMass (bulkPrimeBand L E)) + (hsize:(M:ℝ) < Real.exp (bulkLogLower L)) + (F:(ι→(ZMod M)ˣ)→ℂ)(loI hiI G:ℝ)(φ:ℝ→ℝ)(lo hi Z:κ→ℝ), + Continuous φ → (∀t∈Set.Icc loI hiI,0≤φ (t-G)) → + (∀i,0Real.exp (t i)))) → + (∀p:ι→(bulkPrimeSource L E hZ).Sample, + ContinuousOn (fun t=>f (fun i=>Real.exp (t i)) (fun i=>((p i).val:ℝ))) + (logRectangle (Option.elim' loI lo) (Option.elim' hiI hi))) → + ContinuousOn (fun t=>bulkMain L E F (f (fun i=>Real.exp (t i)))) + (logRectangle (Option.elim' loI lo) (Option.elim' hiI hi)) → + ‖sourceBulkMean L E hZ M hsize F + (fun x=>mixedIntegral loI hiI G φ lo hi Z (fun y=>f y x))- + mixedIntegral loI hiI G φ lo hi Z (fun y=>bulkMain L E F (f y))‖ ≤ + (3*Real.exp (-Real.exp (bulk.target*L)))* + MixedCellIntegralFreezing.mixedLogMass 1 loI hiI G φ (fun i=>(Z i)⁻¹) lo hi := by + filter_upwards [sourceBulkMean_average_replacement_eventually k C] with L hL + intro ι κ _ _ _ _ M _ a E hn ha hm hE hZ hsize F loI hiI G φ lo hi Z hφ hφ0 hlo hZo + f hF hf hsample hmain + rw [sourceBulkMean_mixedIntegral L E hZ M hsize F loI hiI G φ lo hi Z hφ hlo f hsample] + apply mixedIntegral_difference_le_mass loI hiI G φ lo hi Z hφ hφ0 hlo hZo + (fun y=>sourceBulkMean L E hZ M hsize F (f y)) (fun y=>bulkMain L E F (f y)) + (sourceBulkMean_continuousOn L E hZ M hsize F _ f hsample) hmain + intro t ht + exact hL ι M a E hn ha hm hE hZ hsize F _ hF (hf t ht) + +end Ostmann.Arithmetic.HistoryBulkIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementMain.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementMain.lean new file mode 100644 index 0000000000000000000000000000000000000000..cf23ef7986965b96bdf70a78a04de3072c1104dd --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementMain.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIntegralReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIntegralReplacement +open Construction Conclusion HistoryBulkPriorGrid HistoryPrincipalIntegralAverage +open HistoryPrincipalIntegralFinite PrimeCellFreezing ScaleBudget Filter +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] + +theorem primeIntegral_bulkMain (L : ℝ) (E : Finset ℕ) {M : ℕ} [NeZero M] + (F : (ι→(ZMod M)ˣ)→ℂ) (lo hi Z : κ→ℝ) + (f : (κ→ℝ)→(ι→ℝ)→ℂ) : + primeIntegral lo hi Z (fun y=>bulkMain L E F (f y)) = + primeIntegral lo hi Z (fun y=>primeIntegral (fun _ : ι=>bulkLogLower L) + (fun _=>bulkLogUpper L) (fun _=>bulkNormalizer L E) (f y))* + ResidueHaar.average F := by + simp only [bulkMain,mul_comm _ (ResidueHaar.average F)] + rw [primeIntegral_const_mul] + +theorem mixedIntegral_bulkMain (L : ℝ) (E : Finset ℕ) {M : ℕ} [NeZero M] + (F : (ι→(ZMod M)ˣ)→ℂ) (loI hiI G : ℝ) (φ : ℝ→ℝ) (lo hi Z : κ→ℝ) + (f : (Option κ→ℝ)→(ι→ℝ)→ℂ) : + mixedIntegral loI hiI G φ lo hi Z (fun y=>bulkMain L E F (f y)) = + mixedIntegral loI hiI G φ lo hi Z (fun y=>primeIntegral (fun _ : ι=>bulkLogLower L) + (fun _=>bulkLogUpper L) (fun _=>bulkNormalizer L E) (f y))* + ResidueHaar.average F := by + simp only [bulkMain,mul_comm _ (ResidueHaar.average F)] + rw [mixedIntegral_const_mul] + +theorem norm_le_main_and_error {S I H : ℂ} {A B ε : ℝ} + (herr : ‖S-I*H‖≤ε) (hI : ‖I‖≤A) (hH : ‖H‖≤B) : + ‖S‖≤A*B+ε := by + have hmain : ‖I*H‖≤A*B := by + rw [norm_mul] + exact mul_le_mul hI hH (norm_nonneg _) ((norm_nonneg _).trans hI) + calc + ‖S‖ ≤ ‖I*H‖+‖S-I*H‖ := by + simpa only [add_sub_cancel] using norm_add_le (I*H) (S-I*H) + _ ≤ A*B+ε := add_le_add hmain herr + +end Ostmann.Arithmetic.HistoryBulkIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementRegular.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementRegular.lean new file mode 100644 index 0000000000000000000000000000000000000000..da46de973536c102882660819fe444ce2b618d87 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkIntegralReplacementRegular.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkIntegralReplacementIntegrated +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPrincipalIntegralParameter + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkIntegralReplacement +open Construction HistoryBulkPriorGrid HistoryPrincipalIntegralAverage PrimeCellFreezing +open HistoryPrincipalIntegralParameter +variable {ι κ : Type*} [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] + +omit [Fintype ι] [DecidableEq ι] in + +theorem bulk_sample_log_mem (L : ℝ) (E : Finset ℕ) + (hZ : 0Real.log ((p i).val:ℝ)) ∈ + logRectangle (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L) := by + intro i hi + have hm := (mem_bulkClosedSupport L (p i).val).mp + (bulkPrimeBand_subset_closed L E (p i).property) + exact ⟨hm.2.1,hm.2.2⟩ + +omit [Fintype ι] [DecidableEq ι] [Fintype κ] [DecidableEq κ] in + +theorem sampled_scalar_continuousOn (L : ℝ) (E : Finset ℕ) + (hZ : 0 + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) + (S ×ˢ logRectangle (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L))) + (p : ι→(bulkPrimeSource L E hZ).Sample) : + ContinuousOn (fun t=>f (fun i=>Real.exp (t i)) (fun i=>((p i).val:ℝ))) S := by + have hh := hf.comp (continuous_id.prodMk continuous_const).continuousOn + (fun t ht=>⟨ht,bulk_sample_log_mem L E hZ p⟩) + have he : (fun i=>Real.exp (Real.log ((p i).val:ℝ)))=(fun i=>((p i).val:ℝ)) := by + funext i + exact Real.exp_log (by exact_mod_cast ((bulkPrimeSource L E hZ).prime (p i).val (p i).property).pos) + change ContinuousOn (fun t=>f (fun i=>Real.exp (t i)) + (fun i=>Real.exp (Real.log ((p i).val:ℝ)))) S at hh + rw [he] at hh + exact hh + +omit [DecidableEq κ] in + +theorem bulkMain_continuousOn (L : ℝ) (E : Finset ℕ) {M : ℕ} [NeZero M] + (F : (ι→(ZMod M)ˣ)→ℂ) (S : Set (κ→ℝ)) (hS : IsCompact S) + (f : (κ→ℝ)→(ι→ℝ)→ℂ) + (hf : ContinuousOn (fun z : (κ→ℝ)×(ι→ℝ)=> + f (fun i=>Real.exp (z.1 i)) (fun i=>Real.exp (z.2 i))) + (S ×ˢ logRectangle (fun _ : ι=>bulkLogLower L) (fun _=>bulkLogUpper L))) : + ContinuousOn (fun t=>bulkMain L E F (f (fun i=>Real.exp (t i)))) S := by + exact (primeIntegral_continuousOn hS (fun _ : ι=>bulkLogLower L) + (fun _=>bulkLogUpper L) (fun _=>bulkNormalizer L E) + (fun _=>Real.exp_pos _) (fun t=>f (fun i=>Real.exp (t i))) hf).mul continuousOn_const + +end Ostmann.Arithmetic.HistoryBulkIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPatternIntegralReplacement.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPatternIntegralReplacement.lean new file mode 100644 index 0000000000000000000000000000000000000000..62eb33c388dba0c3c7e8a729cf5708e396d6593e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPatternIntegralReplacement.lean @@ -0,0 +1,94 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacementBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns Filter +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryBulkFibreGiantApproximation +open HistoryBulkFibreIntegralReplacementFrame HistoryBulkUniversalPatternAggregation +open HistorySelectedBulkErrorBudget +open scoped BigOperators +attribute [local instance] Classical.propDecidable +local instance bulkPatternSelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem patternComplexSum_sub {ι : Type*} [Fintype ι] [DecidableEq ι] + (sources : SourceFamily) (origin τ : ι → ℕ) + (F G : ∀p : Pattern τ,(Block p → CommonSample sources origin) → ℂ) : + patternComplexSum sources origin τ F-patternComplexSum sources origin τ G= + patternComplexSum sources origin τ (fun p b=>F p b-G p b) := by + unfold patternComplexSum + rw [←Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro p _ + rw [←Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro b _ + split_ifs <;> ring + +theorem selected_pattern_bulk_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop,∀spectator : PrimeSource, + (∀p:spectator.Sample,Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ)familyValue false (F p b) b corrected mixed hV) + let after := patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>familyValue true (F p b) b corrected mixed hV) + ‖before-after‖ ≤ Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + ‖before-after‖ ≤ Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [selected_weighted_bulkMean_error_eventually d Bs BD Bz hBs (by omega : 0familyValue false (F p b) b corrected mixed hV- + familyValue true (F p b) b corrected mixed hV) _ hA (by + intro p b _ _ + apply familyValue_sub_norm_le _ _ _ _ _ _ (by positivity) + intro i r _ + exact hbulk spectator hspec ds E C hG hcl l hl r.frame corrected mixed + r.nonbulk r.permutation hV hstage) + have hs : ‖patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>familyValue false (F p b) b corrected mixed hV- + familyValue true (F p b) b corrected mixed hV)‖ ≤ + ((Fintype.card (FrequencyChoices (frequencyBound Bs BD Bz k L) (l+1)):ℝ)* + Real.exp (2*(2:ℝ)^l*(bulkSize k L:ℝ)))* + (192*Real.exp (-Real.exp (ScaleBudget.bulk.target*L))) := by + convert hsum using 1 + ring + exact ⟨hs.trans (hpay l hl).1,hs.trans (hpay l hl).2⟩ + +end Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPatternIntegralReplacementBackground.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPatternIntegralReplacementBackground.lean new file mode 100644 index 0000000000000000000000000000000000000000..9c981172a91fd140d94baefdb5936454079ab25b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPatternIntegralReplacementBackground.lean @@ -0,0 +1,71 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkActualPrincipalBlockFamilyOuterBackground +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacement + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacement +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns Filter +open HistoryPairSourceLaws HistoryBulkUniversalPatternAggregation HistoryBulkActualPrincipalBlockFamily +open scoped BigOperators +local instance bulkBackgroundInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +def backgroundValue (after : Bool) + (F : Background C l → ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → + Family C outside l p) + (corrected mixed : Bool) + (hV : ∀q∈outside,∀j ≤ l,frequencyBound Bs BD Bz k L jpatternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>familyValue after (F bg p b) b corrected mixed hV)) + +theorem selected_background_bulk_error_eventually (d : Decomposition) (Bs BD Bz H : ℝ) + {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0 ≤ H) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop,∀spectator : PrimeSource, + (∀p:spectator.Sample,Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ds : Fin (2*(bulkSize k L/2)) → spectator.Sample, + ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2<(C.giantCenter:ℝ) → + (C.giantCenter:ℝ)(hK q).1) + rw [Reference.weight,Complex.norm_real,Real.norm_eq_abs, + abs_of_nonneg (mul_nonneg r.mask_mem.1 hn)] + exact (mul_le_of_le_one_left hn r.mask_mem.2).trans + (Finset.prod_le_prod₀ (fun q _=>(hK q).1) (fun q _=>(hK q).2)) + +abbrev Family (C : InitialSourceChoice d Bs BD Bz k L E) (outside : List ℕ) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) := + FrequencyChoices (frequencyBound Bs BD Bz k L) (l+1) → Option (Reference C outside l p) + +def familyValue (after : Bool) (F : Family C outside l p) + (b : Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (corrected mixed : Bool) + (hV : ∀q∈outside,∀j ≤ l,frequencyBound Bs BD Bz k L jr.weight b mixed * + (rootDensity r.frame mixed * (if after then + principalOperator r.frame corrected mixed r.permutation hV else + bulkMean r.frame corrected mixed r.nonbulk r.permutation hV))) + +theorem familyValue_sub_norm_le (F : Family C outside l p) + (b : Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) + (corrected mixed : Bool) + (hV : ∀q∈outside,∀j ≤ l,frequencyBound Bs BD Bz k L jr.weight b mixed*(rootDensity r.frame mixed* + (if false then principalOperator r.frame corrected mixed r.permutation hV else + bulkMean r.frame corrected mixed r.nonbulk r.permutation hV)))- + (F i).elim 0 (fun r=>r.weight b mixed*(rootDensity r.frame mixed* + (if true then principalOperator r.frame corrected mixed r.permutation hV else + bulkMean r.frame corrected mixed r.nonbulk r.permutation hV)))‖ := norm_sum_le _ _ + _ ≤ ∑_i:FrequencyChoices (frequencyBound Bs BD Bz k L) (l+1), + ε*(∏q:Block p,2/((b q).val:ℝ)) := by + apply Finset.sum_le_sum + intro i _ + cases hi : F i with + | none => simp only [Option.elim_none,sub_self,norm_zero]; positivity + | some r => + simp only [Option.elim_some,Bool.false_eq_true,ite_false,ite_true] + rw [←mul_sub,norm_mul] + simpa only [mul_comm] using mul_le_mul (r.weight_norm_le b mixed) + (herr i r hi) (norm_nonneg _) (by positivity : 0 ≤ ∏q:Block p,2/((b q).val:ℝ)) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul]; ring + +end Ostmann.Arithmetic.HistoryBulkPatternIntegralReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceAmplitude.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..d3a8a85854467b2edf7ca85a00fada3a502447d7 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceAmplitude.lean @@ -0,0 +1,78 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorAmplitude +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantReferenceSourceBounds + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReference +open Construction CanonicalOccurrenceTransport Conclusion HistoryOccurrenceVariables +open HistoryPairPattern HistoryPairBulkCoordinates HistoryPairGiantCoordinates +open HistoryBulkReferenceTests HistoryPairBulkTransport HistoryBulkSpectatorReferenceRaw +open HistoryBulkFibreGiantApproximation HistoryBulkPrincipalCollisionError +open HistoryGiantReferenceSourceBounds HistorySymbolicEncoding HistoryBulkReplacementGeometry +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} + +def newBulk (x : Frame.Source (C:=C) (l:=l)) : + (Fin (2^l)×Fin (2*(bulkSize depth L/2)))→C.bulk.Sample := fun u => by + let i := (currentBulkPositionEquiv (2*(bulkSize depth L/2)) depth l).symm u + refine ⟨(x i.val).val,?_⟩ + have hs : C.sources ((Template.current (Template.initial (2*(bulkSize depth L/2)) depth) l)[i.val].origin)=C.bulk := + current_bulk_source (bulkSize depth L/2) depth l C.bulk + (C.cells.topSource E C.deleted_card) (C.cells.compSource E C.deleted_card) i + rw [←hs] + exact (x i.val).property + +@[simp] theorem newBulk_val (x : Frame.Source (C:=C) (l:=l)) + (u : Fin (2^l)×Fin (2*(bulkSize depth L/2))) : + ((newBulk x u).val:ℤ) = orderedIntegerSourceValues C.sources + (2*(bulkSize depth L/2)) depth l x u := rfl + +def principalAmplitude (r : Frame (l:=l) C outside) (sw : ℕ) + (hout : outside.length=2*sw) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L j rfl + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceDensity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed1082bdee8334698029e6c6696ebfc19cc6658a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceDensity.lean @@ -0,0 +1,120 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootPrincipals +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferenceSplice +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensityBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReference +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairPattern HistoryPairRows HistoryPairRepresentatives +open HistoryCompensationRepresentativePatterns HistoryPairVariableBSquareErrorSelected +open HistoryBulkFibreGiantApproximation HistoryPairSourceLaws HistorySymbolicEncoding +open HistoryRepresentativeSourceSeparation HistoryBulkPrincipalBSquareReplacement +open HistoryBulkReferencePeriodicMeanSource +attribute [local instance] Classical.propDecidable +local instance squareReferenceDensityInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} +variable (r : Frame (l:=l) C outside) (x : Frame.Source (C:=C) (l:=l)) + (hx : (assignmentPrior C.sources _).mass x≠0) +variable (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize depth L/2)) depth) l)) + (b : BlockDraw p (CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize depth L/2)) depth) l))) + (hslots : ∀i, (slot r.left r.right (pairedInternalEquiv + (Template.initial (2*(bulkSize depth L/2)) depth) r.left r.right + (leftDraw r).labels (rightDraw r).labels i)).value=(expand p b i).val) + (had : PairAdmissible r.left r.right outside) + +variable (hout : outside.length=2*(bulkSize depth L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L j + simp only [Bool.false_eq_true,ite_false] + rw [←density_principal_bMean_eq r x hx p b hslots had hout hV σ corrected] + ring + | true => + simp only [ite_true] + rw [←density_principal_probabilityProduct_eq r x hx p b hslots had hout hV σ corrected] + ring + +theorem densityPatternFactor_static_eq_mixedRootPrincipal + (R : ReferenceFamily C outside l) (X : DensitySources C l) + (hR : R p b.val=some (principalSquareReference r x hx p b hslots had + (bulkSize depth L/2) hout hV σ depth)) + (hX : X p b.val=r.leftSource) (corrected : Bool) + (y : Frame.Source (C:=C) (l:=l)) : + densityPatternFactor R X false corrected true + (fun _ _=>((r.newLeft x).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime ∧ + ((r.newRight y).root.small.map SmallSlot.value++outside).Pairwise Nat.Coprime) p b.val= + staticPairMask (r.newLeft x) (r.newRight y) outside * + r.mixedRootPrincipal hV σ x corrected := by + rw [densityPatternFactor_eq_mixedRootPrincipal r x hx p b hslots had hout hV σ R X hR hX] + rfl + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReference + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceMatched.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceMatched.lean new file mode 100644 index 0000000000000000000000000000000000000000..a94d7b0e42ca5c670b761b71cbf031a212b82970 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReferenceMatched.lean @@ -0,0 +1,50 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReferencePattern +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagExpectationMatchedReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReference +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairRows HistoryCompensationRepresentativePatterns HistorySymbolicEncoding +open HistoryBulkFibreGiantApproximation HistoryPairReferenceFlagExpectation +open HistoryRepresentativeSourceSeparation HistoryBulkPrincipalBSquareReplacement +local instance squareReferenceMatchedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {depth l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz depth L E} {outside : List ℕ} +variable (r : Frame (l:=l) C outside) +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize depth L/2)) depth) l)} +variable (B : MatchedBlockReference C.sources (Template.initial (2*(bulkSize depth L/2)) depth) + (frequencyBound Bs BD Bz depth L) outside l p) + (hl : leftDraw r=B.left) (hr : rightDraw r=B.right) + +include hl hr + +theorem slots_of_matchedBlockReference : ∀i,(slot r.left r.right (pairedInternalEquiv + (Template.initial (2*(bulkSize depth L/2)) depth) r.left r.right + (leftDraw r).labels (rightDraw r).labels i)).value=(expand p B.blockDraw i).val := by + change ∀i,(slot (leftDraw r).history (rightDraw r).history + (pairedOccurrenceEquiv (leftDraw r) (rightDraw r) i)).value=(expand p B.blockDraw i).val + rw [hl,hr] + intro i + exact B.slot_values i + +def principalSquareReference_of_matchedBlockReference + (x : Frame.Source (C:=C) (l:=l)) (hx : (assignmentPrior C.sources _).mass x≠0) + (had : PairAdmissible r.left r.right outside) (sw : ℕ) (hout : outside.length=2*sw) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L jhfreq j (hj.trans hl)) + (fun q hq=>⟨r.outside_primes q hq,hV q hq⟩) r.left_supported r.right_supported + +theorem selected_principalSquareReference_eventually (d : Decomposition) (Bs BD Bz : ℝ) + {depth : ℕ} (hdepth : 0 rfl + +@[simp] theorem principalSquareReference_probabilityProduct (sw hout hV σ K) (mixed : Bool) : + HistoryBulkPrincipalBSquareReplacement.probabilityProduct + (principalSquareReference r x hx p b hslots had sw hout hV σ K) mixed = + (probabilityProduct r mixed x : ℂ) := rfl + +def giantIntegralFactor (r : Frame (l:=l) C outside) (corrected mixed : Bool) + (x : Frame.Source (C:=C) (l:=l)) : ℂ := + if mixed then + mixedIntegral (C.giantCenter-1) (C.giantCenter+1) C.giantCenter smoothPartition + (fun _ : Unit=>C.giantCenter-1) (fun _=>C.giantCenter+1) + (fun _=>logCellMass C.giantCenter ∅) + (mixedGiantPrimeTest C.giantCenter + (if corrected then r.correctedMixedScalar x else r.mixedScalar x)) + else if corrected then + primeGiantScalar C.giantCenter (logCellMass C.giantCenter ∅) + (jointCorrectedScalar C (bulkSize depth L/2) r.left r.right + r.left_supported r.right_supported (boolEquiv r.left r.right) + (orderedEquiv (2*(bulkSize depth L/2)) depth r.left r.right r.left_supported + (root_matches (assignedLabels C.sources _ _ l r.s r.P.toNat r.Q.toNat + r.leftSource r.leftChoices)))) + (orderedSourceValues C.sources (2*(bulkSize depth L/2)) depth l x) + else r.giantIntegral x + +@[simp] theorem giantIntegralFactor_plain_prime : + giantIntegralFactor r false false x=r.giantIntegral x := rfl + +theorem mixed_principal_eq (corrected : Bool) + (σ : Equiv.Perm (Frame.Slots (depth:=depth) (L:=L) (l:=l))) + (y : Frame.Source (C:=C) (l:=l)) : + (if corrected then r.principalCorrectedMixed σ x y else r.principalMixed σ x y)= + giantIntegralFactor r corrected true x * r.mixedBlockAverage σ x y := by + cases corrected <;> rfl + +theorem principalAmplitude_value_eq + (hout : outside.length=2*(bulkSize depth L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L j cases mixed <;> rfl + +theorem principalSquareReference_value_eq + (hout : outside.length=2*(bulkSize depth L/2)) + (hV : ∀q∈outside,∀j≤l,frequencyBound Bs BD Bz depth L jprincipalBExpressionSum (R f g a) false corrected mixed (mask f g a))- + μ.cmean (fun a=>principalBExpressionSum (R f g a) true corrected mixed (mask f g a))‖) ≤ + Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + filter_upwards [selected_principal_B_cmean_frequencies_eventually d Bs BD Bz hBs hk] with L hL + intro E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl outside hpos hlen hlog + α _ μ R mask + simp_rw [GiantCollisionError.cmean_sub_eq,principalBExpressionSum_sub] + exact hL E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl outside hpos hlen hlog + α μ R mask + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..7299422df040d122c1ef3abe1f65390b7d4d422e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementBasic.lean @@ -0,0 +1,69 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorAmplitude +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairVariableBSquareErrorSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum +open HistoryPairVariableBSquareErrorSelected HistoryBulkPrincipalCollisionError +attribute [local instance] Classical.propDecidable +local instance squareBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +structure PrincipalSquareReference (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (l : ℕ) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) where + square : DecodedSquareReference C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) p b + (frequencyBound Bs BD Bz k L) outside l + principal : PrincipalAmplitudeData C outside l + left_eq : principal.left = square.leftDraw.history + right_eq : principal.right = square.rightDraw.history + newBulk : (Fin (2^l) × Fin (2*(bulkSize k L/2))) → C.bulk.Sample + +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +abbrev ReferenceFamily (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (l : ℕ) := + ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → + Option (PrincipalSquareReference C outside l p b) + +def squareReferences (R : ReferenceFamily C outside l) := + fun p b => (R p b).map PrincipalSquareReference.square + +def principalAmplitude (R : ReferenceFamily C outside l) (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) : ℂ := + match R p b.val with + | none => 0 + | some r => r.principal.value corrected mixed r.newBulk + +def principalBErrorSum (R : ReferenceFamily C outside l) (corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : ℂ := + weightedOriginalDecodedBErrorSum C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + mixed (frequencyBound Bs BD Bz k L) outside l (squareReferences R) + (fun p b => if mask p b then 1 else 0) (principalAmplitude R corrected mixed) + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..d962a573097468df81d2944661ade8d175af3d3d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensity.lean @@ -0,0 +1,68 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensitySelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementFrequency + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum Filter +attribute [local instance] Classical.propDecidable +local instance squareDensityFinalInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_density_B_replacement_eventually (d : Decomposition) + (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0≤Bs) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop, ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then ldensityBExpressionSum (R f g a) (X f g a) false corrected mixed (mask f g a))- + μ.cmean (fun a=>densityBExpressionSum (R f g a) (X f g a) true corrected mixed (mask f g a))‖) ≤ + Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + filter_upwards [selected_density_B_error_eventually d Bs BD Bz hBs hk, + frequency_error_eventually Bs BD Bz (by omega : 0 exact hl + | true => exact Nat.le_of_lt hl + apply hf l hl' + intro f g + rw [GiantCollisionError.cmean_sub_eq] + simp_rw [densityBExpressionSum_sub] + apply GiantCollisionError.norm_cmean_le_of_mass_ne_zero + intro a _ + exact he E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl + outside hpos hlen hlog (R f g a) (X f g a) (mask f g a) + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensityBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensityBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..11cd1a97a158f8e019303e05f9b3eabb466dabba --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensityBasic.lean @@ -0,0 +1,104 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementOriginal + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum HistoryPairVariableBSquareErrorSelected +open HistoryBulkFibreGiantApproximation HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +local instance squareDensityBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +abbrev DensitySources (C : InitialSourceChoice d Bs BD Bz k L E) (l : ℕ) := + ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → + Frame.Source (C:=C) (l:=l) + +def densityFactor (X : DensitySources C l) (mixed : Bool) (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + if mixed then Frame.extractedDensity (C:=C) (X p b) else 1 + +theorem norm_densityFactor_le (X : DensitySources C l) (mixed : Bool) (p b) : + ‖densityFactor X mixed p b‖≤1 := by + cases mixed + · exact le_of_eq (norm_one : ‖(1:ℂ)‖=1) + · exact Frame.norm_extractedDensity_le (X p b) + +def densityAmplitude (R : ReferenceFamily C outside l) (X : DensitySources C l) + (corrected mixed : Bool) (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : BlockDraw p (CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l))) : ℂ := + densityFactor X mixed p b.val * principalAmplitude R corrected mixed p b + +def densityBErrorSum (R : ReferenceFamily C outside l) (X : DensitySources C l) + (corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : ℂ := + weightedOriginalDecodedBErrorSum C + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + mixed (frequencyBound Bs BD Bz k L) outside l (squareReferences R) + (fun p b=>if mask p b then 1 else 0) (densityAmplitude R X corrected mixed) + +def densityPatternFactor (R : ReferenceFamily C outside l) (X : DensitySources C l) + (probability corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + densityFactor X mixed p b * principalPatternFactor R probability corrected mixed mask p b + +def densityBExpressionSum (R : ReferenceFamily C outside l) (X : DensitySources C l) + (probability corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : ℂ := + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (densityPatternFactor R X probability corrected mixed mask) + +theorem densityBExpressionSum_sub (R : ReferenceFamily C outside l) (X : DensitySources C l) + (corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : + densityBExpressionSum R X false corrected mixed mask- + densityBExpressionSum R X true corrected mixed mask=densityBErrorSum R X corrected mixed mask := by + unfold densityBExpressionSum densityBErrorSum weightedOriginalDecodedBErrorSum + rw [←sum_pattern_original_eq_patternComplexSum,←sum_pattern_original_eq_patternComplexSum] + simp only [←Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + unfold densityPatternFactor principalPatternFactor densityAmplitude principalValue principalAmplitude + cases hr : R p b.val with + | none => simp [optionalPrincipalBFactor,optionalDecodedBError,squareReferences,hr] + | some r => + simp only [optionalPrincipalBFactor,hr,Bool.false_eq_true,ite_false,ite_true, + optionalDecodedBError,squareReferences,Option.map_some] + split_ifs <;> simp only [Complex.ofReal_one,Complex.ofReal_zero,one_mul,zero_mul,mul_zero] + · rw [←bMean_sub_probabilityProduct] + ring + · simp + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensityRoot.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensityRoot.lean new file mode 100644 index 0000000000000000000000000000000000000000..f637a75ca42b11c47abd417d0df95f5b53b24809 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensityRoot.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedRootFlagErrorNumerics + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum Filter HistorySelectedRootFlagError +attribute [local instance] Classical.propDecidable +local instance squareDensityRootInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_root_density_B_replacement_eventually (d : Decomposition) + (Bs BD Bz D H : ℝ) {k : ℕ} (hBs : 0≤Bs) (hH : 0≤H) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop, ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then ldensityBExpressionSum (R v f g a) (X v f g a) false corrected mixed (mask v f g a))- + μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) true corrected mixed (mask v f g a))‖) ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,‖μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) false corrected mixed (mask v f g a))- + μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) true corrected mixed (mask v f g a))‖) ≤ Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [selected_density_B_replacement_eventually d Bs BD Bz hBs hk, + selected_root_flag_error_eventually Bs BD Bz 1 D H (by norm_num) hH + (by omega : 0 exact hl + | true => exact Nat.le_of_lt hl + let err (v : AllowedFrequency (frequencyBound Bs BD Bz k L) l) : ℝ := + ∑f,∑g,‖μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) false corrected mixed (mask v f g a))- + μ.cmean (fun a=>densityBExpressionSum (R v f g a) (X v f g a) true corrected mixed (mask v f g a))‖ + have hsum : (∑v,err v)≤ + (Fintype.card (AllowedFrequency (frequencyBound Bs BD Bz k L) l):ℝ)* + Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + calc + _ ≤ ∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + apply Finset.sum_le_sum + intro v _ + exact hbase E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl + outside hpos hlen hlog α μ (R v) (X v) (mask v) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + have hpaid : Real.exp (D*(L+1)^2)*(∑v,err v)≤ + (Fintype.card (AllowedFrequency (frequencyBound Bs BD Bz k L) l):ℝ)*1* + Real.exp (D*(L+1)^2)*Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + convert mul_le_mul_of_nonneg_left hsum (Real.exp_nonneg (D*(L+1)^2)) using 1 + ring + exact ⟨hpaid.trans (hbudget l hl').1,hpaid.trans (hbudget l hl').2⟩ + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensitySelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensitySelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..2673ded9520d9765f8157210fa91d5029844d584 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementDensitySelected.lean @@ -0,0 +1,77 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementDensityBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum +open HistoryPairVariableBSquareErrorSelected HistoryBulkPrincipalCollisionError +open HistorySelectedPairDerivativeBounds Filter +attribute [local instance] Classical.propDecidable +local instance squareDensitySelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_density_B_error_eventually (d : Decomposition) + (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then l exact hl + | true => exact Nat.le_of_lt hl + have hsource := hinputs E C hG hcl hcu hb hd spectator hspec + have hV : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j) := + fun j hj=>hsource.2.1 j (hj.trans hl') + apply herror E C hG hGu hcl hcu hb hd l hl' mixed + (frequencyBound Bs BD Bz k L) outside hpos hlen hlog hsource.1 hV + (squareReferences R) (fun p b=>if mask p b then 1 else 0) + (by intro p b; split_ifs <;> norm_num) (densityAmplitude R X corrected mixed) + intro p b + simp only [zero_mul, Real.exp_zero,mul_one] + calc + ‖densityAmplitude R X corrected mixed p b‖ ≤ ‖principalAmplitude R corrected mixed p b‖ := by + rw [densityAmplitude,norm_mul] + simpa only [one_mul] using mul_le_mul_of_nonneg_right + (norm_densityFactor_le X mixed p b.val) (norm_nonneg (principalAmplitude R corrected mixed p b)) + _ ≤ _ := by + unfold principalAmplitude + cases hr : R p b.val with + | none => simp only [norm_zero]; positivity + | some r => exact hnorm E C hG hcl outside l r.principal corrected mixed hl r.newBulk + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..7052e7d681bb2ad379a3d0b3be5e5d7afd728d45 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementFinite.lean @@ -0,0 +1,93 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum +open HistoryPairVariableBSquareErrorSelected HistoryBulkPrincipalCollisionError +open HistoryPairPattern HistoryPairRepresentatives HistoryPairKernelReplacement +open HistoryCRTIntegration HistorySignedResidueFactorization HistoryBulkReferenceTests ResidueHaar +attribute [local instance] Classical.propDecidable +local instance squareFiniteInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} +variable {b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)} + +def bMean (r : PrincipalSquareReference C outside l p b) (mixed : Bool) : ℂ := + let D := r.square.leftDraw + let F := r.square.rightDraw + letI : NeZero (representativeModulus D.history F.history) := + ⟨(representativeModulus_pos D.history F.history D.supported F.supported).ne'⟩ + if mixed then + average (fun z : MixedPair (representativeModulus D.history F.history) => + primeResidueIndicatorAt D.history F.history D.supported F.supported r.square.sample (z.1,z.2)) + else + average (fun z : UnitPair (representativeModulus D.history F.history) => + primeResidueIndicatorAt D.history F.history D.supported F.supported r.square.sample (z.1,z.2)) + +def probabilityProduct (r : PrincipalSquareReference C outside l p b) (mixed : Bool) : ℂ := + ((∏q : Representative r.square.leftDraw.history r.square.rightDraw.history, + actualProbability mixed r.square.leftDraw.history r.square.rightDraw.history + r.square.leftDraw.supported r.square.rightDraw.supported q + (prime r.square.leftDraw.history r.square.rightDraw.history q) r.square.sample):ℝ) + +theorem bMean_sub_probabilityProduct (r : PrincipalSquareReference C outside l p b) + (mixed : Bool) : bMean r mixed-probabilityProduct r mixed= + decodedBProbabilityError mixed r.square.leftDraw r.square.rightDraw r.square.sample := rfl + +def optionalPrincipalBFactor (R : ReferenceFamily C outside l) (probability mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + match R p b with + | none => 0 + | some r => if probability then probabilityProduct r mixed else bMean r mixed + +def principalBExpressionSum (R : ReferenceFamily C outside l) (probability corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : ℂ := + let origin := pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l + let τ := pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l + ∑p:Pattern τ,∑b:BlockDraw p (CommonSample C.sources origin), + (((∏q,blockWeight p (sourceWeight C.sources origin) q (b.val q))* + (∏i,((expand p b i).val:ℝ)):ℝ):ℂ)* + ((if mask p b.val then (1:ℂ) else 0)* + (principalAmplitude R corrected mixed p b*optionalPrincipalBFactor R probability mixed p b.val)) + +theorem principalBExpressionSum_sub (R : ReferenceFamily C outside l) (corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : + principalBExpressionSum R false corrected mixed mask- + principalBExpressionSum R true corrected mixed mask=principalBErrorSum R corrected mixed mask := by + unfold principalBExpressionSum principalBErrorSum weightedOriginalDecodedBErrorSum + simp only [←Finset.sum_sub_distrib] + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + cases hr : R p b.val with + | none => simp [optionalPrincipalBFactor,optionalDecodedBError,squareReferences,hr] + | some r => + simp only [optionalPrincipalBFactor,hr,Bool.false_eq_true,ite_false,ite_true, + optionalDecodedBError,squareReferences,Option.map_some] + split_ifs <;> simp only [Complex.ofReal_one,Complex.ofReal_zero,one_mul,zero_mul] + · rw [←mul_sub,←mul_sub,bMean_sub_probabilityProduct] + · simp + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementFrequency.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementFrequency.lean new file mode 100644 index 0000000000000000000000000000000000000000..39dcb25f898529fb71498221230eecfffaecf94d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementFrequency.lean @@ -0,0 +1,91 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.GiantCollisionError +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantFrequencyCount + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum Filter +open HistoryGiantFrequencyCount ScaleBudget +attribute [local instance] Classical.propDecidable +local instance squareFrequencyInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem frequency_error_eventually (Bs BD Bz : ℝ) {k : ℕ} (hk : 0Finset.sum_le_sum (fun g _=>hz f g)) + _ = (Fintype.card (FrequencyChoices (frequencyBound Bs BD Bz k L) l × + FrequencyChoices (frequencyBound Bs BD Bz k L) l):ℝ)* + Real.exp (-Real.exp ((1/500:ℝ)*L)) := by + simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul,Fintype.card_prod,Nat.cast_mul,mul_assoc] + _ ≤ Real.exp (A*L)*Real.exp (-Real.exp ((1/500:ℝ)*L)) := + mul_le_mul_of_nonneg_right (hc l hl) (Real.exp_nonneg _) + _ ≤ _ := by + rw [←Real.exp_add] + simpa only [zero_mul,Real.exp_zero,mul_one,pow_one,one_mul,neg_mul,add_comm] using herr + +theorem selected_principal_B_cmean_frequencies_eventually (d : Decomposition) + (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0≤Bs) (hk : 2≤k) : + ∀ᶠ L : ℝ in atTop, ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then lprincipalBErrorSum (R f g a) corrected mixed (mask f g a))‖) ≤ + Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + filter_upwards [selected_principal_B_error_eventually d Bs BD Bz hBs hk, + frequency_error_eventually Bs BD Bz (by omega : 0 exact hl + | true => exact Nat.le_of_lt hl + apply hf l hl' + intro f g + apply GiantCollisionError.norm_cmean_le_of_mass_ne_zero + intro a _ + exact he E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl + outside hpos hlen hlog (R f g a) (mask f g a) + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementOriginal.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementOriginal.lean new file mode 100644 index 0000000000000000000000000000000000000000..f34b8c4892095b285e04d5e3635546d809bb1932 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementOriginal.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkUniversalPatternAggregationOriginalBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum HistoryBulkUniversalPatternAggregation +attribute [local instance] Classical.propDecidable +local instance squareOriginalInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} + +def principalValue (R : ReferenceFamily C outside l) (corrected mixed : Bool) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + match R p b with + | none => 0 + | some r => r.principal.value corrected mixed r.newBulk + +def principalPatternFactor (R : ReferenceFamily C outside l) (probability corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + (if mask p b then (1:ℂ) else 0) * + (principalValue R corrected mixed p b * optionalPrincipalBFactor R probability mixed p b) + +theorem principalBExpressionSum_eq_patternComplexSum + (R : ReferenceFamily C outside l) (probability corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : + principalBExpressionSum R probability corrected mixed mask= + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (principalPatternFactor R probability corrected mixed mask) := by + rw [←sum_pattern_original_eq_patternComplexSum] + unfold principalBExpressionSum + apply Finset.sum_congr rfl + intro p _ + apply Finset.sum_congr rfl + intro b _ + unfold principalPatternFactor principalValue principalAmplitude + by_cases hm : mask p b.val <;> simp only [hm,ite_true,ite_false,one_mul,zero_mul,mul_zero] + congr 1 + cases R p b.val <;> rfl + +theorem patternComplexSum_sub_eq_principalBErrorSum + (R : ReferenceFamily C outside l) (corrected mixed : Bool) + (mask : ∀p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l), + (Block p → CommonSample C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) → Prop) : + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (principalPatternFactor R false corrected mixed mask)- + patternComplexSum C.sources + (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (principalPatternFactor R true corrected mixed mask)=principalBErrorSum R corrected mixed mask := by + rw [←principalBExpressionSum_eq_patternComplexSum,←principalBExpressionSum_eq_patternComplexSum] + exact principalBExpressionSum_sub R corrected mixed mask + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..73a5fdf9e8c9f91ec4e14e280879843c1eee7ddf --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalBSquareReplacementSelected.lean @@ -0,0 +1,71 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacementBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum +open HistoryPairVariableBSquareErrorSelected HistoryBulkPrincipalCollisionError +open HistorySelectedPairDerivativeBounds Filter +attribute [local instance] Classical.propDecidable +local instance squareSelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_principal_B_error_eventually (d : Decomposition) + (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then l exact hl + | true => exact Nat.le_of_lt hl + have hsource := hinputs E C hG hcl hcu hb hd spectator hspec + have hV : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j) := + fun j hj=>hsource.2.1 j (hj.trans hl') + apply herror E C hG hGu hcl hcu hb hd l hl' mixed + (frequencyBound Bs BD Bz k L) outside hpos hlen hlog hsource.1 hV + (squareReferences R) (fun p b=>if mask p b then 1 else 0) + (by intro p b; split_ifs <;> norm_num) (principalAmplitude R corrected mixed) + intro p b + simp only [zero_mul, Real.exp_zero,mul_one] + unfold principalAmplitude + cases hr : R p b.val with + | none => simp only [norm_zero]; positivity + | some r => exact hnorm E C hG hcl outside l r.principal corrected mixed hl r.newBulk + +end Ostmann.Arithmetic.HistoryBulkPrincipalBSquareReplacement + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorActual.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorActual.lean new file mode 100644 index 0000000000000000000000000000000000000000..18b46f50a041311c93f65cf43602b0a46677de6d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorActual.lean @@ -0,0 +1,94 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorScaling +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction CanonicalOccurrenceTransport Conclusion Filter CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryCompensationBiasedKernelSum +open HistorySelectedPairDerivativeBounds +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_collisionPrincipalMean_error_eventually + (d : Decomposition) (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ (spectator : PrimeSource), + (∀ p : spectator.Sample,Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (corrected mixed : Bool), (if corrected then l if (refs p b).isSome then mask u p b else 0 + let rs := collisionPatternReferences C origin τ outside a refs + let amp := collisionAmplitude C origin τ outside a refs corrected mixed + have hl' : l ≤ k := by cases corrected <;> simp only [Bool.false_eq_true,ite_false,ite_true] at hl <;> omega + have hm' : ∀u p b,0 ≤ mask' u p b ∧ mask' u p b ≤ 1 := by + intro u p b + dsimp only [mask'] + split_ifs + · exact hm u p b + · norm_num + have hr : ∀u,μ.mass u≠0 → ∀(p:Pattern τ) (b:BlockDraw p (CommonSample C.sources origin)), + mask' u p b.val≠0 → ∃y,fibreSmallOutsideGuard C outside a y := by + intro u hu p b hb + cases hh : refs p b.val with + | none => simp only [mask',hh,Option.isSome_none,Bool.false_eq_true,ite_false,ne_eq,not_true_eq_false] at hb + | some r => exact ⟨r.referenceBulk,r.reference_guard⟩ + have ha' : ∀u,μ.mass u≠0 → ∀p b,mask' u p b.val≠0 → + ‖amp u p b‖ ≤ ((outside.prod:ℝ)^(2^(l+1))* + Real.exp ((selectedExponent Bs BD Bz k+64)*((bulkSize k L:ℝ)+1)))*Real.exp (0*(L+1)^2) := by + intro u hu p b hb + simp only [zero_mul,Real.exp_zero,mul_one] + cases hh : refs p b.val with + | none => simp only [amp,collisionAmplitude,hh,norm_zero]; positivity + | some r => + simpa only [amp,collisionAmplitude,hh,PrincipalCollisionReference.value] using + hamp E C hG hcl outside l (r.amplitudeAt u) corrected mixed hl u + have he := herror E C hG hGu hcl hcu hb hd spectator hs l hl' outside hlen hout a ha + mixed (frequencyBound Bs BD Bz k L) (fun _=>rs) mask' amp hm' hr ha' + rw [collisionPrincipalMean_activeMask C origin τ outside a refs mask corrected mixed true, + collisionPrincipalMean_activeMask C origin τ outside a refs mask corrected mixed false] + rw [collisionPrincipalMean_true,collisionPrincipalMean_false] + exact he + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorActualDefs.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorActualDefs.lean new file mode 100644 index 0000000000000000000000000000000000000000..be8af64d17b205786bbafb71729c62204cfbaf8b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorActualDefs.lean @@ -0,0 +1,80 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorReferences + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction Conclusion CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryBulkSourceDisintegration HistoryCompensationBiasedKernelSum +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {ι : Type*} [Fintype ι] [DecidableEq ι] + +def collisionPatternReferences (C : InitialSourceChoice d Bs BD Bz k L E) + (origin τ : ι → ℕ) (outside : List ℕ) (a : SelectedNonbulkSample C l) + (refs : ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PrincipalCollisionReference C outside a p)) : + ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PatternReference p (frequencyBound Bs BD Bz k L) outside l) := + fun p b => (refs p b).map PrincipalCollisionReference.patternReference + +def collisionAmplitude (C : InitialSourceChoice d Bs BD Bz k L E) + (origin τ : ι → ℕ) (outside : List ℕ) (a : SelectedNonbulkSample C l) + (refs : ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PrincipalCollisionReference C outside a p)) + (corrected mixed : Bool) (u : SelectedBulkSample C l) (p : Pattern τ) + (b : BlockDraw p (CommonSample C.sources origin)) : ℂ := + match refs p b.val with + | none => 0 + | some r => r.value corrected mixed u + +def collisionPrincipalMean (C : InitialSourceChoice d Bs BD Bz k L E) + (origin τ : ι → ℕ) (outside : List ℕ) (a : SelectedNonbulkSample C l) + (refs : ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PrincipalCollisionReference C outside a p)) + (mask : SelectedBulkSample C l → ∀p:Pattern τ, + (Block p → CommonSample C.sources origin) → ℝ) + (corrected mixed guarded : Bool) : ℂ := + let K := fun _ : SelectedBulkSample C l => + optionalDrawSymbolicPatternKernel C.sources origin τ mixed (frequencyBound Bs BD Bz k L) + outside l (collisionPatternReferences C origin τ outside a refs) + let amp := collisionAmplitude C origin τ outside a refs corrected mixed + originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask + (fun u p b => if guarded ∧ ¬fibreSmallOutsideGuard C outside a u then 0 else + principalTest C.sources origin τ K amp u p b) + +theorem collisionPrincipalMean_activeMask (C : InitialSourceChoice d Bs BD Bz k L E) + (origin τ : ι → ℕ) (outside : List ℕ) (a : SelectedNonbulkSample C l) + (refs : ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PrincipalCollisionReference C outside a p)) + (mask : SelectedBulkSample C l → ∀p:Pattern τ, + (Block p → CommonSample C.sources origin) → ℝ) + (corrected mixed guarded : Bool) : + collisionPrincipalMean C origin τ outside a refs mask corrected mixed guarded = + collisionPrincipalMean C origin τ outside a refs + (fun u p b => if (refs p b).isSome then mask u p b else 0) corrected mixed guarded := by + unfold collisionPrincipalMean originalBulkPrincipalSum + apply Finset.sum_congr rfl + intro p hp + apply Finset.sum_congr rfl + intro b hb + congr 1 + apply congrArg (selectedBulkPrior C l).cmean + funext u + cases hr : refs p b.val with + | none => + simp only [Option.isSome_none,Bool.false_eq_true,ite_false, + principalTest,collisionAmplitude,hr,zero_mul,Complex.ofReal_zero] + split_ifs <;> simp only [mul_zero] + | some r => simp only [hr,Option.isSome_some,ite_true] + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorAmplitude.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorAmplitude.lean new file mode 100644 index 0000000000000000000000000000000000000000..2d4e9188e8c73082f4390fd133f8c2c9a0224394 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorAmplitude.lean @@ -0,0 +1,118 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedPrincipalAmplitudeProduct +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedPrincipalAmplitudeSource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction Conclusion Filter HistoryPairPattern HistoryPairSmoothXi +open HistoryPairBulkCoordinates HistoryPairGiantCoordinates HistoryActiveCoordinates +open HistorySymbolicEncoding HistoryProductWindows HistoryBulkGiantCorrectedBounds +open HistoryBulkSelectedPrincipalAmplitude HistorySelectedPairDerivativeBounds +open HistoryBulkSelectedIntegralReplacement HistoryBulkReplacementGeometry +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k : ℕ} {E : Finset ℕ} + +structure PrincipalAmplitudeData (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (l : ℕ) where + left : History l + right : History l + leftSupported : left.Supported (frequencyBound Bs BD Bz k L) outside + rightSupported : right.Supported (frequencyBound Bs BD Bz k L) outside + leftLabels : TreeSourceLabels (Template.initial (2*(bulkSize k L/2)) k) left + rightLabels : TreeSourceLabels (Template.initial (2*(bulkSize k L/2)) k) right + rootMatching : RootMatching left right + leftSource : SourceBounds (bulkSize k L/2) k C.giantCenter (C.cells.center (bulkSize k L/2)) + left (leftMap left right) (giantCoordinates left right) (pairBackground left right) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1) + rightSource : SourceBounds (bulkSize k L/2) k C.giantCenter (C.cells.center (bulkSize k L/2)) + right (rightMap left right) (giantCoordinates left right) (pairBackground left right) + (fun _ => C.giantCenter-1) (fun _ => C.giantCenter+1) + s : ℕ + outsideLength : outside.length = 2*s + outsidePrime : ∀ q ∈ outside, q.Prime + outsideFrequency : ∀ q ∈ outside, ∀ j ≤ l, frequencyBound Bs BD Bz k L j < q + primeEquiv : Bool ≃ giantCoordinates left right + mixedEquiv : Option Unit ≃ giantCoordinates left right + bulkEquiv : (Fin (2^l) × Fin (2*(bulkSize k L/2))) ≃ bulkCoordinates left right + permutation : Equiv.Perm (Fin (2^l) × Fin (2*(bulkSize k L/2))) + K : ℕ + residue : Fin (2^l) × Fin (2*(bulkSize k L/2)) → + (ZMod (bulkModulus left right outside K))ˣ + independent : Bool + +namespace PrincipalAmplitudeData +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} {l : ℕ} + +def value (P : PrincipalAmplitudeData C outside l) (corrected mixed : Bool) + (u : (Fin (2^l) × Fin (2*(bulkSize k L/2))) → C.bulk.Sample) : ℂ := + rootTest P.independent mixed d P.left P.right P.leftSupported P.rightSupported + P.outsidePrime P.outsideFrequency P.permutation P.K P.residue * + if corrected then + if mixed then + mixedGiantScalar C.giantCenter (Construction.logCellMass C.giantCenter ∅) + (jointCorrectedScalar C P.s P.left P.right P.leftSupported P.rightSupported + P.mixedEquiv P.bulkEquiv) (fun i => ((u i).val : ℝ)) + else + primeGiantScalar C.giantCenter (Construction.logCellMass C.giantCenter ∅) + (jointCorrectedScalar C P.s P.left P.right P.leftSupported P.rightSupported + P.primeEquiv P.bulkEquiv) (fun i => ((u i).val : ℝ)) + else + if mixed then + mixedGiantScalar C.giantCenter (Construction.logCellMass C.giantCenter ∅) + (jointScalar C P.s P.left P.right P.leftSupported P.rightSupported + P.mixedEquiv P.bulkEquiv) (fun i => ((u i).val : ℝ)) + else + primeGiantScalar C.giantCenter (Construction.logCellMass C.giantCenter ∅) + (jointScalar C P.s P.left P.right P.leftSupported P.rightSupported + P.primeEquiv P.bulkEquiv) (fun i => ((u i).val : ℝ)) + +end PrincipalAmplitudeData + +theorem selected_principalAmplitudeData_norm_eventually + (d : Decomposition) (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20 : ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter : ℝ) → + ∀ (outside : List ℕ) (l : ℕ) (P : PrincipalAmplitudeData C outside l) + (corrected mixed : Bool), + (if corrected then l < k else l ≤ k) → + ∀ u : (Fin (2^l) × Fin (2*(bulkSize k L/2))) → C.bulk.Sample, + ‖P.value corrected mixed u‖ ≤ (outside.prod : ℝ)^(2^(l+1)) * + Real.exp ((selectedExponent Bs BD Bz k+64)*((bulkSize k L : ℝ)+1)) := by + filter_upwards [source_corrected_giantScalar_eventually d Bs BD Bz hBs hk, + source_plain_giantScalar_eventually d Bs BD Bz hBs hk] with L hcorrected hplain + intro E C hblock hcenter outside l P corrected mixed hl u + have hpos : ∀ q ∈ outside, 0 < q := fun q hq => (P.outsidePrime q hq).pos + cases corrected with + | false => + have hscalar := hplain E C hblock hcenter P.s hpos P.outsideLength l + P.left P.right P.leftSupported P.rightSupported hl P.leftLabels P.rightLabels + P.rootMatching P.leftSource P.rightSource P.primeEquiv P.mixedEquiv P.bulkEquiv u + cases mixed + · exact norm_rootTest_mul_le P.independent false d P.left P.right + P.leftSupported P.rightSupported P.outsidePrime P.outsideFrequency + P.permutation P.K P.residue (bulkSize k L) (selectedExponent Bs BD Bz k) _ hscalar.1 + · exact norm_rootTest_mul_le P.independent true d P.left P.right + P.leftSupported P.rightSupported P.outsidePrime P.outsideFrequency + P.permutation P.K P.residue (bulkSize k L) (selectedExponent Bs BD Bz k) _ hscalar.2 + | true => + have hscalar := hcorrected E C hblock hcenter P.s hpos P.outsideLength l + P.left P.right P.leftSupported P.rightSupported hl P.leftLabels P.rightLabels + P.rootMatching P.leftSource P.rightSource P.primeEquiv P.mixedEquiv P.bulkEquiv u + cases mixed + · exact norm_rootTest_mul_le P.independent false d P.left P.right + P.leftSupported P.rightSupported P.outsidePrime P.outsideFrequency + P.permutation P.K P.residue (bulkSize k L) (selectedExponent Bs BD Bz k) _ hscalar.1 + · exact norm_rootTest_mul_le P.independent true d P.left P.right + P.leftSupported P.rightSupported P.outsidePrime P.outsideFrequency + P.permutation P.K P.residue (bulkSize k L) (selectedExponent Bs BD Bz k) _ hscalar.2 + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..2473bbb8b709bf7e7c2ec413dbc9c33748551a0a --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorBasic.lean @@ -0,0 +1,125 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceCollisionBirthday +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairVariableBSquareErrorSelectedSum +import OAI.NumberTheory.Ostmann.Construction.OffDiagonalExpectations + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryCompensationBiasedKernelSum HistoryPairVariableBSquareErrorSelectedSum +variable {ι Ω : Type*} [Fintype ι] [DecidableEq ι] [Fintype Ω] + +def originalPrincipalSum (sources : SourceFamily) (origin τ : ι → ℕ) + (mask : ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (test : ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) : ℂ := + ∑p:Pattern τ,∑b:BlockDraw p (CommonSample sources origin), + (((∏q,blockWeight p (sourceWeight sources origin) q (b.val q))* + (∏i:ι,((expand p b i).val:ℝ)):ℝ):ℂ) * ((mask p b.val:ℂ)*test p b) + +def originalBulkPrincipalSum (sources : SourceFamily) (origin τ : ι → ℕ) + (μ : FinitePrior Ω) + (mask : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (test : Ω → ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) : ℂ := + ∑p:Pattern τ,∑b:BlockDraw p (CommonSample sources origin), + (((∏q,blockWeight p (sourceWeight sources origin) q (b.val q))* + (∏i:ι,((expand p b i).val:ℝ)):ℝ):ℂ) * + μ.cmean (fun u => (mask u p b.val:ℂ)*test u p b) + +theorem originalBulkPrincipalSum_eq_cmean (sources : SourceFamily) (origin τ : ι → ℕ) + (μ : FinitePrior Ω) + (mask : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (test : Ω → ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) : + originalBulkPrincipalSum sources origin τ μ mask test = + μ.cmean (fun u => originalPrincipalSum sources origin τ (mask u) (test u)) := by + unfold originalBulkPrincipalSum originalPrincipalSum + simp_rw [FinitePrior.cmean_sum,FinitePrior.cmean_mul_left] + +theorem originalPrincipalSum_norm_le (sources : SourceFamily) (origin τ : ι → ℕ) + (K : ∀p:Pattern τ,(Block p → CommonSample sources origin) → Block p → ℝ) + (mask : ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (δ : ℝ) (test : ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) + (hδ : 0 ≤ δ) (hK : ∀p b q,0 ≤ K p b q) (hm : ∀p b,0 ≤ mask p b) + (ht : ∀p b,mask p b.val ≠ 0 → ‖test p b‖ ≤ δ*∏q,K p b.val q) : + ‖originalPrincipalSum sources origin τ mask test‖ ≤ + δ*biasedKernelSum sources origin τ K mask := by + let e := fun (p:Pattern τ) (b:BlockDraw p (CommonSample sources origin)) => + if mask p b.val = 0 then (0:ℂ) else test p b + have he : ∀p b,‖e p b‖ ≤ δ*∏q,K p b.val q := by + intro p b + by_cases hz : mask p b.val = 0 + · simp only [e,hz,ite_true,norm_zero] + exact mul_nonneg hδ (Finset.prod_nonneg (fun q _ => hK p b.val q)) + · simpa only [e,hz,ite_false] using ht p b hz + have eq : originalPrincipalSum sources origin τ mask test = + originalPrincipalSum sources origin τ mask e := by + unfold originalPrincipalSum + apply Finset.sum_congr rfl + intro p hp + apply Finset.sum_congr rfl + intro b hb + by_cases hz : mask p b.val = 0 <;> simp only [e,hz,ite_true,ite_false,Complex.ofReal_zero,zero_mul,mul_zero] + rw [eq] + exact original_error_sum_norm_le_biasedKernelSum sources origin τ K mask δ e hδ hK hm he + +theorem originalPrincipalSum_sub (sources : SourceFamily) (origin τ : ι → ℕ) + (mask : ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (f g : ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) : + originalPrincipalSum sources origin τ mask f-originalPrincipalSum sources origin τ mask g = + originalPrincipalSum sources origin τ mask (fun p b => f p b-g p b) := by + simp only [originalPrincipalSum,mul_sub,Finset.sum_sub_distrib] + +theorem originalBulkPrincipalSum_error_le (sources : SourceFamily) (origin τ : ι → ℕ) + (μ : FinitePrior Ω) (Bad : Ω → Prop) + (K : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → Block p → ℝ) + (mask : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (f g : Ω → ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) + (W M : ℝ) (hW : 0 ≤ W) (_hM : 0 ≤ M) + (hK : ∀u p b q,0 ≤ K u p b q) (hm : ∀u p b,0 ≤ mask u p b) + (hbudget : ∀u,μ.mass u ≠ 0 → biasedKernelSum sources origin τ (K u) (mask u) ≤ M) + (heq : ∀u,μ.mass u ≠ 0 → ¬Bad u → ∀p b,mask u p b.val ≠ 0 → f u p b=g u p b) + (hbound : ∀u,μ.mass u ≠ 0 → Bad u → ∀p b,mask u p b.val ≠ 0 → + ‖f u p b-g u p b‖ ≤ W*∏q,K u p b.val q) : + ‖originalBulkPrincipalSum sources origin τ μ mask f- + originalBulkPrincipalSum sources origin τ μ mask g‖ ≤ + W*M*μ.mean (fun u => if Bad u then 1 else 0) := by + rw [originalBulkPrincipalSum_eq_cmean,originalBulkPrincipalSum_eq_cmean] + let F := fun u => originalPrincipalSum sources origin τ (mask u) (f u) + let G := fun u => originalPrincipalSum sources origin τ (mask u) (g u) + change ‖μ.cmean F-μ.cmean G‖ ≤ _ + have hsub : μ.cmean F-μ.cmean G = μ.cmean (fun u => F u-G u) := by + simp only [FinitePrior.cmean,mul_sub,Finset.sum_sub_distrib] + rw [hsub] + apply (μ.norm_cmean_le _).trans + change (∑u,μ.mass u*‖F u-G u‖) ≤ _ + rw [FinitePrior.mean,Finset.mul_sum] + apply Finset.sum_le_sum + intro u hu + by_cases hz : μ.mass u = 0 + · simp only [hz,zero_mul,mul_zero,le_refl] + · have hnorm : ‖F u-G u‖ ≤ if Bad u then W*M else 0 := by + dsimp only [F,G] + rw [originalPrincipalSum_sub] + by_cases hb : Bad u + · rw [ite_eq_left hb] + exact (originalPrincipalSum_norm_le sources origin τ (K u) (mask u) W _ + hW (hK u) (hm u) (hbound u hz hb)).trans + (mul_le_mul_of_nonneg_left (hbudget u hz) hW) + · rw [ite_eq_right hb] + have hn := originalPrincipalSum_norm_le sources origin τ (K u) (mask u) 0 + (fun p b => f u p b-g u p b) (by norm_num) (hK u) (hm u) + (fun p b ha => by rw [heq u hz hb p b ha]; simp only [sub_self,norm_zero,zero_mul,le_refl]) + simpa only [zero_mul] using hn + calc + _ ≤ μ.mass u*(if Bad u then W*M else 0) := + mul_le_mul_of_nonneg_left hnorm (μ.mass_nonneg u) + _ = W*M*(μ.mass u*(if Bad u then 1 else 0)) := by split_ifs <;> ring + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorBudget.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorBudget.lean new file mode 100644 index 0000000000000000000000000000000000000000..bacf14c350dcbe8f4c2a49dcf2e9bed45fa4c0ad --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorBudget.lean @@ -0,0 +1,55 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceCollisionBudget + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction Conclusion Filter HistoryBulkSourceCollision + +theorem selected_compensated_collision_budget_eventually (k : ℕ) (A D : ℝ) : + ∀ᶠ L : ℝ in atTop, ∀ l ≤ k, ∀ outside : List ℕ, + (∀ p ∈ outside, 0 < p) → outside.length ≤ bulkSize k L → + (∀ p ∈ outside, Real.log (p : ℝ) ≤ Real.exp ((1/1000 : ℝ)*L)) → + ((outside.prod : ℝ)^(2^(l+1)) * Real.exp (A*((bulkSize k L : ℝ)+1))) * + Real.exp (D*(L+1)^2) * ((2^l*(2*(bulkSize k L/2)) : ℕ) : ℝ)^2 * + Real.exp (L-Real.exp ((39/10000 : ℝ)*L)) * + Real.exp (2*(2 : ℝ)^l*(bulkSize k L : ℝ)) ≤ + Real.exp (-Real.exp ((1/500 : ℝ)*L)) := by + filter_upwards [selected_collision_budget_eventually k (A+2*(2 : ℝ)^k) D] with L hL + intro l hl outside hpos hlen hlog + have hpow : (2 : ℝ)^l ≤ (2 : ℝ)^k := pow_le_pow_right₀ (by norm_num) hl + have hkernel : + Real.exp (A*((bulkSize k L : ℝ)+1)) * + Real.exp (2*(2 : ℝ)^l*(bulkSize k L : ℝ)) ≤ + Real.exp ((A+2*(2 : ℝ)^k)*((bulkSize k L : ℝ)+1)) := by + rw [← Real.exp_add] + apply Real.exp_le_exp.mpr + have hm := Nat.cast_nonneg (bulkSize k L) (α := ℝ) + have hmul := mul_le_mul_of_nonneg_right hpow hm + have hp : 0 ≤ (2 : ℝ)^k := pow_nonneg (by norm_num) k + nlinarith + calc + _ = (outside.prod : ℝ)^(2^(l+1)) * + (Real.exp (A*((bulkSize k L : ℝ)+1)) * + Real.exp (2*(2 : ℝ)^l*(bulkSize k L : ℝ))) * + Real.exp (D*(L+1)^2) * ((2^l*(2*(bulkSize k L/2)) : ℕ) : ℝ)^2 * + Real.exp (L-Real.exp ((39/10000 : ℝ)*L)) := by ring + _ ≤ ((outside.prod : ℝ)^(2^(l+1)) * + Real.exp ((A+2*(2 : ℝ)^k)*((bulkSize k L : ℝ)+1))) * + Real.exp (D*(L+1)^2) * ((2^l*(2*(bulkSize k L/2)) : ℕ) : ℝ)^2 * + Real.exp (L-Real.exp ((39/10000 : ℝ)*L)) := by + apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) + apply mul_le_mul_of_nonneg_right _ (sq_nonneg _) + apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) + exact mul_le_mul_of_nonneg_left hkernel (by positivity) + _ ≤ _ := hL l hl outside hpos hlen hlog + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..41d97db5f9a158cb00b0859d89c3d1e6609a9318 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorFinite.lean @@ -0,0 +1,52 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorBasic + +namespace OAI + +open Erdos970 + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryCompensationBiasedKernelSum +variable {ι Ω : Type*} [Fintype ι] [DecidableEq ι] [Fintype Ω] + +def principalTest (sources : SourceFamily) (origin τ : ι → ℕ) + (K : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → Block p → ℝ) + (amp : Ω → ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) + (u : Ω) (p : Pattern τ) (b : BlockDraw p (CommonSample sources origin)) : ℂ := + amp u p b * ((∏q,K u p b.val q:ℝ):ℂ) + +theorem originalBulkPrincipalSum_guard_error_le + (sources : SourceFamily) (origin τ : ι → ℕ) (μ : FinitePrior Ω) + (Bad : Ω → Prop) + (K : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → Block p → ℝ) + (mask : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (guard : Ω → ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → Prop) + (amp : Ω → ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) + (W M : ℝ) (hW : 0 ≤ W) (hM : 0 ≤ M) + (hK : ∀u p b q,0 ≤ K u p b q) (hm : ∀u p b,0 ≤ mask u p b) + (hbudget : ∀u,μ.mass u ≠ 0 → biasedKernelSum sources origin τ (K u) (mask u) ≤ M) + (hguard : ∀u,μ.mass u ≠ 0 → ¬Bad u → ∀p b,mask u p b.val ≠ 0 → guard u p b) + (hamp : ∀u,μ.mass u ≠ 0 → ∀p b,mask u p b.val ≠ 0 → ‖amp u p b‖ ≤ W) : + ‖originalBulkPrincipalSum sources origin τ μ mask + (fun u p b => if guard u p b then principalTest sources origin τ K amp u p b else 0)- + originalBulkPrincipalSum sources origin τ μ mask (principalTest sources origin τ K amp)‖ ≤ + W*M*μ.mean (fun u => if Bad u then 1 else 0) := by + apply originalBulkPrincipalSum_error_le sources origin τ μ Bad K mask _ _ W M hW hM hK hm hbudget + · intro u hu hbad p b ha + simp only [hguard u hu hbad p b ha,ite_true] + · intro u hu hbad p b ha + by_cases hg : guard u p b + · simp only [hg,ite_true,sub_self,norm_zero] + exact mul_nonneg hW (Finset.prod_nonneg (fun q _ => hK u p b.val q)) + · simp only [hg,ite_false,zero_sub,norm_neg,principalTest,norm_mul,Complex.norm_real, + Real.norm_eq_abs,abs_of_nonneg (Finset.prod_nonneg (fun q _ => hK u p b.val q))] + exact mul_le_mul_of_nonneg_right (hamp u hu p b ha) + (Finset.prod_nonneg (fun q _ => hK u p b.val q)) + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorGuard.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorGuard.lean new file mode 100644 index 0000000000000000000000000000000000000000..ee04dc49021dd80c0c4037bd834c5d1527a84c8e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorGuard.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreSourceMeanValues +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceCollisionSelected + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction Conclusion Filter HistoryBulkSourceDisintegration +open HistoryBulkFibreOriginalReference HistoryBulkFibreSourceMean HistoryBulkSourceCollision +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +def fibreSmallOutsideGuard (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (a : SelectedNonbulkSample C l) (u : SelectedBulkSample C l) : Prop := + ((assignedSlots C.sources (SelectedTemplate k L l) (fibreAssignment C a u)).map + SmallSlot.value ++ outside).Pairwise Nat.Coprime + +theorem selected_fibreSmallOutsideGuard_eventually + (d : Decomposition) (Bs BD Bz : ℝ) {k : ℕ} (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20 : ℝ)*L) ≤ C.blockBase → + C.blockBase-2 < (C.giantCenter : ℝ) → + (C.giantCenter : ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin : ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin : ℝ)| ≤ favorableBlockWidth L/16 → + ∀ spectator : PrimeSource, + (∀ p : spectator.Sample, Real.exp ((1/2000 : ℝ)*L) ≤ Real.log (p : ℕ) ∧ + Real.log (p : ℕ) ≤ Real.exp ((1/1000 : ℝ)*L)) → + ∀ (l : ℕ) (a : SelectedNonbulkSample C l) (u y : SelectedBulkSample C l), + (selectedNonbulkPrior C l).mass a ≠ 0 → + (selectedBulkPrior C l).mass u ≠ 0 → + ∀ outside : List ℕ, + (∀ q ∈ outside, ∃ p : spectator.Sample, p.val = q ∧ spectator.law.mass p ≠ 0) → + fibreSmallOutsideGuard C outside a y → + Function.Injective (fun j => (u j).val) → + fibreSmallOutsideGuard C outside a u := by + filter_upwards [selected_small_outside_pairwise_eventually d Bs BD Bz hk] with L hL + intro E C hG hcl hcu hb hd spectator hs l a u y ha hu outside hout href hinj + have hx : (assignmentPrior C.sources (SelectedTemplate k L l)).mass + (fibreAssignment C a u) ≠ 0 := by + rw [fibreAssignment_mass] + exact mul_ne_zero ha hu + apply hL E C hG hcl hcu hb hd spectator hs l + (fibreAssignment C a u) (fibreAssignment C a y) hx + · intro i hi + exact fibreAssignment_nonbulk_fixed C a u y i hi + · exact hout + · exact href + · intro i j hij + apply hinj + exact (bulkSamples_fibreAssignment C a u i.1 i.2).symm.trans + (hij.trans (bulkSamples_fibreAssignment C a u j.1 j.2)) + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorReferences.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorReferences.lean new file mode 100644 index 0000000000000000000000000000000000000000..c32de1525ef894c45e8000809e2a1576b5ac2598 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorReferences.lean @@ -0,0 +1,61 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorAmplitude +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorGuard +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCompensationBiasedKernelSumDrawReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction Conclusion CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryBulkSourceDisintegration HistoryBulkFibreOriginalReference +open HistoryCompensationBiasedKernelSum HistoryPairRepresentatives HistoryBulkReplacementGeometry +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {ι : Type*} [Fintype ι] [DecidableEq ι] {τ : ι → ℕ} + +structure PrincipalCollisionReference (C : InitialSourceChoice d Bs BD Bz k L E) + (outside : List ℕ) (a : SelectedNonbulkSample C l) (p : Pattern τ) where + amplitude : PrincipalAmplitudeData C outside l + referenceBulk : SelectedBulkSample C l + leftSmall : amplitude.left.root.small = + assignedSlots C.sources (SelectedTemplate k L l) (fibreAssignment C a referenceBulk) + representative : Block p → Representative amplitude.left amplitude.right + residues : SelectedBulkSample C l → (Fin (2^l) × Fin (2*(bulkSize k L/2))) → + (ZMod (bulkModulus amplitude.left amplitude.right outside amplitude.K))ˣ + +namespace PrincipalCollisionReference +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {a : SelectedNonbulkSample C l} {p : Pattern τ} + +def patternReference (r : PrincipalCollisionReference C outside a p) : + PatternReference p (frequencyBound Bs BD Bz k L) outside l := + ⟨r.amplitude.left,r.amplitude.right,r.amplitude.leftSupported, + r.amplitude.rightSupported,r.representative⟩ + +omit [Fintype ι] [DecidableEq ι] in + +theorem reference_guard (r : PrincipalCollisionReference C outside a p) : + fibreSmallOutsideGuard C outside a r.referenceBulk := by + have hc := History.supported_root_coprime r.amplitude.leftSupported + simp only [State.Coprime,State.values,List.cons_append,List.pairwise_cons] at hc + change ((assignedSlots C.sources (SelectedTemplate k L l) + (fibreAssignment C a r.referenceBulk)).map SmallSlot.value ++ outside).Pairwise Nat.Coprime + rw [←r.leftSmall] + exact hc.2.2 + +def amplitudeAt (r : PrincipalCollisionReference C outside a p) (u : SelectedBulkSample C l) : + PrincipalAmplitudeData C outside l := {r.amplitude with residue := r.residues u} + +def value (r : PrincipalCollisionReference C outside a p) (corrected mixed : Bool) + (u : SelectedBulkSample C l) : ℂ := (r.amplitudeAt u).value corrected mixed u + +end PrincipalCollisionReference + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorScaled.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorScaled.lean new file mode 100644 index 0000000000000000000000000000000000000000..0ab406549f81320721c8818fe166b201011f4851 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorScaled.lean @@ -0,0 +1,124 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorActual + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction CanonicalOccurrenceTransport Conclusion Filter CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryBulkSourceDisintegration HistoryCompensationBiasedKernelSum +open HistorySelectedPairDerivativeBounds +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_collisionPrincipalMean_scaled_error_eventually + (d : Decomposition) (Bs BD Bz D : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ (spectator : PrimeSource), + (∀ p : spectator.Sample,Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ) (corrected mixed : Bool), (if corrected then l if (refs p b).isSome then mask u p b else 0 + let rs := collisionPatternReferences C origin τ outside a refs + let amp := collisionAmplitude C origin τ outside a refs corrected mixed + let c : ℂ := Real.exp (D*(L+1)^2) + let scaled := fun u p b => c*amp u p b + let K := fun _ : SelectedBulkSample C l => optionalDrawSymbolicPatternKernel C.sources origin τ + mixed (frequencyBound Bs BD Bz k L) outside l rs + have hc : ‖c‖ = Real.exp (D*(L+1)^2) := by + simp only [c,Complex.norm_real,Real.norm_eq_abs,abs_of_pos (Real.exp_pos _)] + have hl' : l ≤ k := by cases corrected <;> simp only [Bool.false_eq_true,ite_false,ite_true] at hl <;> omega + have hm' : ∀u p b,0 ≤ mask' u p b ∧ mask' u p b ≤ 1 := by + intro u p b + dsimp only [mask'] + split_ifs + · exact hm u p b + · norm_num + have hr : ∀u,μ.mass u≠0 → ∀(p:Pattern τ) (b:BlockDraw p (CommonSample C.sources origin)), + mask' u p b.val≠0 → ∃y,fibreSmallOutsideGuard C outside a y := by + intro u hu p b hb + cases hh : refs p b.val with + | none => simp only [mask',hh,Option.isSome_none,Bool.false_eq_true,ite_false,ne_eq,not_true_eq_false] at hb + | some r => exact ⟨r.referenceBulk,r.reference_guard⟩ + have ha' : ∀u,μ.mass u≠0 → ∀p b,mask' u p b.val≠0 → + ‖scaled u p b‖ ≤ ((outside.prod:ℝ)^(2^(l+1))* + Real.exp ((selectedExponent Bs BD Bz k+64)*((bulkSize k L:ℝ)+1)))*Real.exp (D*(L+1)^2) := by + intro u hu p b hb + have ha0 : ‖amp u p b‖ ≤ (outside.prod:ℝ)^(2^(l+1))* + Real.exp ((selectedExponent Bs BD Bz k+64)*((bulkSize k L:ℝ)+1)) := by + cases hh : refs p b.val with + | none => simp only [amp,collisionAmplitude,hh,norm_zero]; positivity + | some r => + simpa only [amp,collisionAmplitude,hh,PrincipalCollisionReference.value] using + hamp E C hG hcl outside l (r.amplitudeAt u) corrected mixed hl u + dsimp only [scaled] + rw [norm_mul,hc,mul_comm] + exact mul_le_mul_of_nonneg_right ha0 (Real.exp_nonneg _) + have he := herror E C hG hGu hcl hcu hb hd spectator hs l hl' outside hlen hout a ha + mixed (frequencyBound Bs BD Bz k L) (fun _=>rs) mask' scaled hm' hr ha' + change ‖originalBulkPrincipalSum C.sources origin τ μ mask' + (fun u p b => if fibreSmallOutsideGuard C outside a u then + principalTest C.sources origin τ K scaled u p b else 0)- + originalBulkPrincipalSum C.sources origin τ μ mask' + (principalTest C.sources origin τ K scaled)‖ ≤ _ at he + have hleft : originalBulkPrincipalSum C.sources origin τ μ mask' + (fun u p b => if fibreSmallOutsideGuard C outside a u then + principalTest C.sources origin τ K scaled u p b else 0) = + c*collisionPrincipalMean C origin τ outside a refs mask' corrected mixed true := by + rw [←collisionPrincipalMean_scaledTest C origin τ outside a refs mask' corrected mixed true c] + apply congrArg (originalBulkPrincipalSum C.sources origin τ μ mask') + funext u p b + by_cases hg : fibreSmallOutsideGuard C outside a u <;> simp only [hg,not_true_eq_false, + not_false_eq_true,and_false,and_true,ite_true,ite_false] + rfl + have hright : originalBulkPrincipalSum C.sources origin τ μ mask' + (principalTest C.sources origin τ K scaled) = + c*collisionPrincipalMean C origin τ outside a refs mask' corrected mixed false := by + rw [←collisionPrincipalMean_scaledTest C origin τ outside a refs mask' corrected mixed false c] + simp only [Bool.false_eq_true,false_and,ite_false] + rfl + rw [hleft,hright,←mul_sub,norm_mul,hc,mul_comm] at he + rw [collisionPrincipalMean_activeMask C origin τ outside a refs mask corrected mixed true, + collisionPrincipalMean_activeMask C origin τ outside a refs mask corrected mixed false] + exact he + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorScaling.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorScaling.lean new file mode 100644 index 0000000000000000000000000000000000000000..14a3e12843e7d62c37921cb24e7e10afb7c38124 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorScaling.lean @@ -0,0 +1,99 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorActualDefs + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction Conclusion CompensationEqualityPatterns HistoryPairSourceLaws +open HistoryBulkSourceDisintegration HistoryCompensationBiasedKernelSum +variable {ι Ω : Type*} [Fintype ι] [DecidableEq ι] [Fintype Ω] + +theorem originalBulkPrincipalSum_scale (sources : SourceFamily) (origin τ : ι → ℕ) + (μ : FinitePrior Ω) + (mask : Ω → ∀p:Pattern τ,(Block p → CommonSample sources origin) → ℝ) + (test : Ω → ∀p:Pattern τ,BlockDraw p (CommonSample sources origin) → ℂ) (c : ℂ) : + originalBulkPrincipalSum sources origin τ μ mask (fun u p b => c*test u p b) = + c*originalBulkPrincipalSum sources origin τ μ mask test := by + simp only [originalBulkPrincipalSum,FinitePrior.cmean,Finset.mul_sum] + apply Finset.sum_congr rfl + intro p hp + apply Finset.sum_congr rfl + intro b hb + apply Finset.sum_congr rfl + intro u hu + ring + +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + +theorem collisionPrincipalMean_scaledTest (C : InitialSourceChoice d Bs BD Bz k L E) + (origin τ : ι → ℕ) (outside : List ℕ) (a : SelectedNonbulkSample C l) + (refs : ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PrincipalCollisionReference C outside a p)) + (mask : SelectedBulkSample C l → ∀p:Pattern τ, + (Block p → CommonSample C.sources origin) → ℝ) + (corrected mixed guarded : Bool) (c : ℂ) : + let K := fun _ : SelectedBulkSample C l => + optionalDrawSymbolicPatternKernel C.sources origin τ mixed (frequencyBound Bs BD Bz k L) + outside l (collisionPatternReferences C origin τ outside a refs) + let amp := collisionAmplitude C origin τ outside a refs corrected mixed + originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask + (fun u p b => if guarded ∧ ¬fibreSmallOutsideGuard C outside a u then 0 else + principalTest C.sources origin τ K (fun u p b => c*amp u p b) u p b) = + c*collisionPrincipalMean C origin τ outside a refs mask corrected mixed guarded := by + dsimp only + unfold collisionPrincipalMean + rw [←originalBulkPrincipalSum_scale] + apply congrArg (originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask) + funext u p b + by_cases hg : guarded ∧ ¬fibreSmallOutsideGuard C outside a u + · simp [hg] + · simp [hg,principalTest,mul_assoc] + +theorem collisionPrincipalMean_true (C : InitialSourceChoice d Bs BD Bz k L E) + (origin τ : ι → ℕ) (outside : List ℕ) (a : SelectedNonbulkSample C l) + (refs : ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PrincipalCollisionReference C outside a p)) + (mask : SelectedBulkSample C l → ∀p:Pattern τ, + (Block p → CommonSample C.sources origin) → ℝ) + (corrected mixed : Bool) : + collisionPrincipalMean C origin τ outside a refs mask corrected mixed true = + let K := fun _ : SelectedBulkSample C l => + optionalDrawSymbolicPatternKernel C.sources origin τ mixed (frequencyBound Bs BD Bz k L) + outside l (collisionPatternReferences C origin τ outside a refs) + let amp := collisionAmplitude C origin τ outside a refs corrected mixed + originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask + (fun u p b => if fibreSmallOutsideGuard C outside a u then + principalTest C.sources origin τ K amp u p b else 0) := by + unfold collisionPrincipalMean + apply congrArg (originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask) + funext u p b + by_cases hg : fibreSmallOutsideGuard C outside a u <;> simp [hg] + +theorem collisionPrincipalMean_false (C : InitialSourceChoice d Bs BD Bz k L E) + (origin τ : ι → ℕ) (outside : List ℕ) (a : SelectedNonbulkSample C l) + (refs : ∀p:Pattern τ,(Block p → CommonSample C.sources origin) → + Option (PrincipalCollisionReference C outside a p)) + (mask : SelectedBulkSample C l → ∀p:Pattern τ, + (Block p → CommonSample C.sources origin) → ℝ) + (corrected mixed : Bool) : + collisionPrincipalMean C origin τ outside a refs mask corrected mixed false = + let K := fun _ : SelectedBulkSample C l => + optionalDrawSymbolicPatternKernel C.sources origin τ mixed (frequencyBound Bs BD Bz k L) + outside l (collisionPatternReferences C origin τ outside a refs) + originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask + (principalTest C.sources origin τ K (collisionAmplitude C origin τ outside a refs corrected mixed)) := by + unfold collisionPrincipalMean + apply congrArg (originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask) + funext u p b + simp only [Bool.false_eq_true,false_and,ite_false] + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..55d4f12ef4758766eb4564e86ea18427ce402fbf --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalCollisionErrorSelected.lean @@ -0,0 +1,122 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorBudget +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalCollisionErrorGuard +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSourceCollisionAtoms +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCompensationPrincipalBudgetDrawReference + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators Classical +namespace Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError +open Construction CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryPairSourceLaws HistoryCompensationBiasedKernelSum HistoryCompensationPrincipalBudget +open HistoryBulkSourceDisintegration HistoryBulkSourceCollision HistoryBulkSourceCollisionBirthday +open Conclusion Filter +local instance (seed : List SourceSlot) (l : ℕ) : DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_symbolic_guard_error_eventually + (d : Decomposition) (Bs BD Bz A D : ℝ) {k : ℕ} (hk : 2 ≤ k) : + ∀ᶠ L : ℝ in atTop, ∀ (E : Finset ℕ) (C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀ (spectator : PrimeSource), + (∀ p : spectator.Sample,Real.exp ((1/2000:ℝ)*L) ≤ Real.log (p:ℕ) ∧ + Real.log (p:ℕ) ≤ Real.exp ((1/1000:ℝ)*L)) → + ∀ (l : ℕ), l ≤ k → + ∀ (outside : List ℕ), outside.length ≤ bulkSize k L → + (∀q∈outside,∃p:spectator.Sample,p.val=q ∧ spectator.law.mass p≠0) → + ∀ (a : SelectedNonbulkSample C l), (selectedNonbulkPrior C l).mass a≠0 → + let seed := Template.initial (2*(bulkSize k L/2)) k + let origin := pairedInternalOrigin seed l + let τ := pairedHistoryType seed l + ∀ (mixed : Bool) (V : ℕ→ℕ) + (refs : SelectedBulkSample C l → ∀p:Pattern τ, + (Block p → CommonSample C.sources origin) → Option (PatternReference p V outside l)) + (mask : SelectedBulkSample C l → ∀p:Pattern τ, + (Block p → CommonSample C.sources origin) → ℝ) + (amp : SelectedBulkSample C l → ∀p:Pattern τ, + BlockDraw p (CommonSample C.sources origin) → ℂ), + (∀u p b,0 ≤ mask u p b ∧ mask u p b ≤ 1) → + (∀u,(selectedBulkPrior C l).mass u≠0 → ∀(p : Pattern τ) (b : BlockDraw p (CommonSample C.sources origin)),mask u p b.val≠0 → + ∃y,fibreSmallOutsideGuard C outside a y) → + (∀u,(selectedBulkPrior C l).mass u≠0 → ∀p b,mask u p b.val≠0 → + ‖amp u p b‖≤((outside.prod:ℝ)^(2^(l+1))*Real.exp (A*((bulkSize k L:ℝ)+1)))* + Real.exp (D*(L+1)^2)) → + let K := fun u => optionalDrawSymbolicPatternKernel C.sources origin τ mixed V outside l (refs u) + ‖originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask + (fun u p b => if fibreSmallOutsideGuard C outside a u then + principalTest C.sources origin τ K amp u p b else 0)- + originalBulkPrincipalSum C.sources origin τ (selectedBulkPrior C l) mask + (principalTest C.sources origin τ K amp)‖≤Real.exp (-Real.exp ((1/500:ℝ)*L)) := by + filter_upwards [selected_fibreSmallOutsideGuard_eventually d Bs BD Bz (by omega : 0 optionalDrawSymbolicPatternKernel C.sources origin τ mixed V outside l (refs u) + let W := ((outside.prod:ℝ)^(2^(l+1))*Real.exp (A*((bulkSize k L:ℝ)+1)))*Real.exp (D*(L+1)^2) + let M := Real.exp (2*(2:ℝ)^l*(bulkSize k L:ℝ)) + have hW : 0≤W := by dsimp [W]; positivity + have hM : 0≤M := Real.exp_nonneg _ + have hK : ∀u p b q,0≤K u p b q := + fun u p b q => (optionalDrawSymbolicPatternKernel_bounds C.sources origin τ mixed V outside l (refs u) p b q).1 + have he := originalBulkPrincipalSum_guard_error_le C.sources origin τ μ + (fun u => ¬Function.Injective (fun i => (u i).val)) K mask + (fun u _ _ => fibreSmallOutsideGuard C outside a u) amp W M hW hM hK + (fun u p b => (hm u p b).1) + (fun u _ => hkernel E C hG hGu hcl hcu hb hd l hl mixed V outside (refs u) (mask u) (hm u)) + (by + intro u hu hgood p b hactive + obtain ⟨y,hy⟩ := href u hu p b hactive + exact hguard E C hG hcl hcu hb hd spectator hs l a u y ha hu outside hout hy (not_not.mp hgood)) + hamp + have hbday := primeSource_noninjective_mass_le + (ι:=Fin (2^l) × Fin (2*(bulkSize k L/2))) C.bulk _ + (hatom E C.deleted_card C.bulkPositive) + have hpos : ∀p∈outside,0

if ¬Function.Injective (fun i => (u i).val) then 1 else 0) ≤ + ((2^l*(2*(bulkSize k L/2)):ℕ):ℝ)^2*Real.exp (L-Real.exp ((39/10000:ℝ)*L)) := by + simpa only [μ,selectedBulkPrior,bulkPrior,Fintype.card_prod,Fintype.card_fin,Nat.cast_mul] using hbday + apply he.trans + calc + _ ≤ W*M*(((2^l*(2*(bulkSize k L/2)):ℕ):ℝ)^2* + Real.exp (L-Real.exp ((39/10000:ℝ)*L))) := by + convert mul_le_mul_of_nonneg_left hbday' (mul_nonneg hW hM) using 1 + congr 1 + apply congrArg μ.mean + funext u + by_cases hh : Function.Injective (fun i => (u i).val) <;> + simp only [hh,not_true_eq_false,not_false_eq_true,ite_true,ite_false] + _ ≤ _ := by + have hc := hcost l hl outside hpos hlen hlog + dsimp only [W,M] + convert hc using 1 + ring + +end Ostmann.Arithmetic.HistoryBulkPrincipalCollisionError + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..a2c0f5beb5376b8ce778d066c3c976103a333eee --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedBasic.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelReplacementPointwise +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairReferenceFlagPrincipalMatched + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance kernelBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +def referenceSample + (R : MatchedBlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p) + (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : PairKey R.left.history R.right.history→ℤ := + originalDrawValues (fun _ : Bool=>C.giant) C.sources _ l p y ∘ + (typedSourceEquivMatched R.left R.right p R.natDraw R.slot_values R.root_matching).symm + +def sampledJacobian + (R : MatchedBlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p) + (x : PairKey R.left.history R.right.history→ℤ) : ℝ := + ∏r : Representative R.left.history R.right.history, + ((x (representativeMap R.left.history R.right.history r)).toNat:ℝ) + +def kernelDifference (mixed : Bool) + (R : MatchedBlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p) + (x : PairKey R.left.history R.right.history→ℤ) : ℝ := + (∏r : Representative R.left.history R.right.history, + actualProbability mixed R.left.history R.right.history R.left.supported R.right.supported + r (x (representativeMap R.left.history R.right.history r)).toNat x)- + ∏r : Representative R.left.history R.right.history, + symbolicKernel mixed R.left.history R.right.history R.left.supported R.right.supported + r (x (representativeMap R.left.history R.right.history r)).toNat + +def principalDifferenceTerm (F : MatchedPrincipalBlockFamily C outside l f g p) + (corrected mixed : Bool) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) + (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : ℂ := + if hy : F.active (originalDrawOuter (fun _ : Bool=>C.giant) C.sources _ l p y) then + if mask y then + let R := F.reference _ hy + let x := referenceSample R y + (rightRootSupportIndicator R (fun _ : Bool=>C.giant) y:ℂ)*(sampledJacobian R x:ℂ)*(F.principal _ hy).value corrected mixed (originalDrawBulk C l p y)* + (kernelDifference mixed R x:ℂ) + else 0 + else 0 + +def principalDifferenceMean (F : MatchedPrincipalBlockFamily C outside l f g p) + (corrected mixed : Bool) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) : ℂ := + ∑y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p, + (originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y:ℂ)* + principalDifferenceTerm F corrected mixed mask y + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensity.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensity.lean new file mode 100644 index 0000000000000000000000000000000000000000..80e13c48a087280e482915fc8e73717a811d4845 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensity.lean @@ -0,0 +1,64 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedDensityBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance kernelDensityInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +theorem densityPrincipalDifferenceMean_le_of_pointwise + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) (corrected mixed : Bool) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) + (A : ℝ) + (h : ∀y, originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y ≠ 0 → + ‖densityPrincipalDifferenceTerm F X corrected mixed mask y‖ ≤ A*weightedFlags F corrected mixed y) : + ‖densityPrincipalDifferenceMean F X corrected mixed mask‖ ≤ A*F.mean corrected mixed := by + rw [densityPrincipalDifferenceMean,mean_eq_sum_weightedFlags,Finset.mul_sum] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro y _ + by_cases hy : originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y=0 + · simp only [hy,Complex.ofReal_zero,zero_mul,mul_zero,norm_zero,le_refl] + rw [norm_mul,Complex.norm_real,Real.norm_eq_abs, + abs_of_nonneg (originalDrawMass_nonneg _ _ _ _ _ y)] + calc + _ ≤ originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y * + (A*weightedFlags F corrected mixed y) := + mul_le_mul_of_nonneg_left (h y hy) (originalDrawMass_nonneg _ _ _ _ _ y) + _ = _ := by ring + +theorem densityPrincipalDifferenceMean_le + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) (corrected mixed : Bool) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) + (hroot : ∀i hi,RootGiantsAgree (F.reference i hi).left.history (F.reference i hi).right.history) + (hV : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j)) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) : + ‖densityPrincipalDifferenceMean F X corrected mixed mask‖ ≤ + (2:ℝ)^(Fintype.card (Block p))*(4*F.mean corrected mixed) := by + apply (densityPrincipalDifferenceMean_le_of_pointwise F X corrected mixed mask (4*2^(Fintype.card (Block p))) ?_).trans_eq (by ring) + intro y hy + exact (norm_densityPrincipalDifferenceTerm_le F X corrected mixed mask y).trans + (principalDifferenceTerm_le F corrected mixed hsep hroot hV mask y hy) + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensityBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensityBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..a5255c609e1019ae53cdd07840203a0d1eb4b44d --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensityBasic.lean @@ -0,0 +1,108 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkFibreGiantApproximationRootTestDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedProducts +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelReplacementPointwise + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance kernelDensityBasicInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +abbrev DensitySources (F : MatchedPrincipalBlockFamily C outside l f g p) := + ∀i, F.active i → HistoryBulkFibreGiantApproximation.Frame.Source (C:=C) (l:=l) + +def densityFactor (F : MatchedPrincipalBlockFamily C outside l f g p) + (X : DensitySources F) (mixed : Bool) + (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : ℂ := + if hi : F.active (originalDrawOuter (fun _ : Bool=>C.giant) C.sources _ l p y) then + if mixed then HistoryBulkFibreGiantApproximation.Frame.extractedDensity (X _ hi) else 1 + else 1 + +theorem norm_densityFactor_le (F : MatchedPrincipalBlockFamily C outside l f g p) + (X : DensitySources F) (mixed : Bool) (y) : ‖densityFactor F X mixed y‖≤1 := by + unfold densityFactor + split + · cases mixed + · exact le_of_eq (norm_one : ‖(1:ℂ)‖=1) + · exact HistoryBulkFibreGiantApproximation.Frame.norm_extractedDensity_le _ + · exact le_of_eq (norm_one : ‖(1:ℂ)‖=1) + +def densityPrincipalProductTerm (symbolic : Bool) + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : ℂ := + densityFactor F X mixed y * principalProductTerm symbolic F corrected mixed mask y + +def densityPrincipalDifferenceTerm + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : ℂ := + densityFactor F X mixed y * principalDifferenceTerm F corrected mixed mask y + +def densityPrincipalProductMean (symbolic : Bool) + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) : ℂ := + ∑y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p, + (originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y:ℂ)* + densityPrincipalProductTerm symbolic F X corrected mixed mask y + +def densityPrincipalDifferenceMean + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) : ℂ := + ∑y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p, + (originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y:ℂ)* + densityPrincipalDifferenceTerm F X corrected mixed mask y + +lemma densityPrincipalProductTerm_sub + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask) (y) : + densityPrincipalProductTerm false F X corrected mixed mask y- + densityPrincipalProductTerm true F X corrected mixed mask y= + densityPrincipalDifferenceTerm F X corrected mixed mask y := by + simp only [densityPrincipalProductTerm,densityPrincipalDifferenceTerm,←mul_sub,principalProductTerm_sub] + +theorem densityPrincipalProductMean_sub + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask) : + densityPrincipalProductMean false F X corrected mixed mask- + densityPrincipalProductMean true F X corrected mixed mask= + densityPrincipalDifferenceMean F X corrected mixed mask := by + simp only [densityPrincipalProductMean,densityPrincipalDifferenceMean, + ←Finset.sum_sub_distrib,←mul_sub,densityPrincipalProductTerm_sub] + +lemma norm_densityPrincipalDifferenceTerm_le + (F : MatchedPrincipalBlockFamily C outside l f g p) (X : DensitySources F) + (corrected mixed : Bool) (mask) (y) : + ‖densityPrincipalDifferenceTerm F X corrected mixed mask y‖≤ + ‖principalDifferenceTerm F corrected mixed mask y‖ := by + rw [densityPrincipalDifferenceTerm,norm_mul] + exact (mul_le_mul_of_nonneg_right (norm_densityFactor_le F X mixed y) (norm_nonneg _)).trans_eq (one_mul _) + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensityRoot.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensityRoot.lean new file mode 100644 index 0000000000000000000000000000000000000000..4967f73deb616b6abaf46ee9191a6b95d9fa968b --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensityRoot.lean @@ -0,0 +1,86 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedDensitySelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedRootFlagErrorNumerics + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables Filter +open HistorySelectedRootFlagError +attribute [local instance] Classical.propDecidable +local instance matchedDensityRootFlagInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_root_density_principal_kernel_error_eventually (d : Decomposition) + (Bs BD Bz D H : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0≤H) (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then lC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop, + Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,∑p, + ‖densityPrincipalDifferenceMean (F v f g p) (X v f g p) corrected mixed (mask v f g p)‖) ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,∑p, + ‖densityPrincipalDifferenceMean (F v f g p) (X v f g p) corrected mixed (mask v f g p)‖) ≤ + Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [selected_density_principal_kernel_error_eventually d Bs BD Bz hBs hk, + selected_root_kernel_flag_error_eventually Bs BD Bz D H hH hk] with L hbase hbudget + intro E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl outside hpos hlen hlog F hroot X mask + have hl' : l≤k := by + cases corrected with + | false => exact hl + | true => exact Nat.le_of_lt hl + have hsum : (∑v,∑f,∑g,∑p, + ‖densityPrincipalDifferenceMean (F v f g p) (X v f g p) corrected mixed (mask v f g p)‖) ≤ + (Fintype.card (AllowedFrequency (frequencyBound Bs BD Bz k L) l):ℝ)* + ((2:ℝ)^(4*k*2^k)*Real.exp (-Real.exp ((3/2000:ℝ)*L))) := by + calc + _ ≤ ∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + (2:ℝ)^(4*k*2^k)*Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + apply Finset.sum_le_sum + intro v hv + exact hbase E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl + outside hpos hlen hlog (F v) (hroot v) (X v) (mask v) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + have hpaid : Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,∑p, + ‖densityPrincipalDifferenceMean (F v f g p) (X v f g p) corrected mixed (mask v f g p)‖) ≤ + (Fintype.card (AllowedFrequency (frequencyBound Bs BD Bz k L) l):ℝ)* + (2:ℝ)^(4*k*2^k)*Real.exp (D*(L+1)^2)*Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + convert mul_le_mul_of_nonneg_left hsum (Real.exp_nonneg (D*(L+1)^2)) using 1 + ring + exact ⟨hpaid.trans (hbudget l hl').1,hpaid.trans (hbudget l hl').2⟩ + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensitySelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensitySelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..f5bf5572a3a62e070c8a4b65163a28493d1a934f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedDensitySelected.lean @@ -0,0 +1,89 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedDensity +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCompensationNormalizationBudgetCounts + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables Filter +attribute [local instance] Classical.propDecidable +local instance kernelDensitySelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_density_principal_kernel_error_eventually (d : Decomposition) + (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then lC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop, + (∑f,∑g,∑p,‖densityPrincipalDifferenceMean (F f g p) (X f g p) corrected mixed (mask f g p)‖) ≤ + (2:ℝ)^(4*k*2^k)*Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + filter_upwards [selected_matched_principal_pattern_frequency_error_eventually d Bs BD Bz hBs hk, + HistoryBulkSupportConverse.selected_source_inputs_eventually d Bs BD Bz hk] with L hflags hinputs + intro E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl outside hpos hlen hlog F hroot X mask + have hl' : l≤k := by + cases corrected with + | false => exact hl + | true => exact Nat.le_of_lt hl + have hsource := hinputs E C hG hcl hcu hb hd spectator hspec + have hV : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j) := + fun j hj=>hsource.2.1 j (hj.trans hl') + have hcount (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) : + Fintype.card (Block p)≤4*k*2^k := by + calc + _ ≤ Fintype.card (Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) := card_block_le p + _ = 4*l*2^l := HistoryCompensationNormalizationBudget.paired_internal_card _ k l hl' + _ ≤ 4*k*2^k := Nat.mul_le_mul (Nat.mul_le_mul_left 4 hl') + (Nat.pow_le_pow_right (by norm_num : 1≤(2:ℕ)) hl') + calc + _ ≤ ∑f,∑g,∑p,(2:ℝ)^(4*k*2^k)*(4*(F f g p).mean corrected mixed) := by + apply Finset.sum_le_sum + intro f _ + apply Finset.sum_le_sum + intro g _ + apply Finset.sum_le_sum + intro p _ + exact (densityPrincipalDifferenceMean_le (F f g p) (X f g p) corrected mixed hsource.1 + (hroot f g p) hV (mask f g p)).trans + (mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by norm_num) (hcount p)) + (mul_nonneg (by norm_num) (principalFlagMean_nonneg (F f g p) corrected mixed))) + _ = (2:ℝ)^(4*k*2^k)*(∑f,∑g,∑p,4*(F f g p).mean corrected mixed) := by + simp only [Finset.mul_sum] + _ ≤ _ := mul_le_mul_of_nonneg_left + (hflags E C hG hGu hcl hcu hb hd l corrected mixed hl outside hpos hlen hlog F) + (pow_nonneg (by norm_num) _) + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedFinite.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedFinite.lean new file mode 100644 index 0000000000000000000000000000000000000000..1bcab8e4ca87aebe7375c777081c755838e82c33 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedFinite.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance kernelFiniteInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +lemma sampledJacobian_nonneg + (R : MatchedBlockReference C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) outside l p) + (x : PairKey R.left.history R.right.history→ℤ) : 0 ≤ sampledJacobian R x := + Finset.prod_nonneg (fun _ _=>Nat.cast_nonneg _) + +def weightedFlags (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) + (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : ℝ := + if hy : F.active (originalDrawOuter (fun _ : Bool=>C.giant) C.sources _ l p y) then + F.weight corrected mixed y * family (F.reference _ hy).left (F.reference _ hy).right + (referenceSample (F.reference _ hy) y) + else 0 + +lemma weightedFlags_nonneg (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) + (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : 0 ≤ weightedFlags F corrected mixed y := by + unfold weightedFlags + split + · exact mul_nonneg (F.weight_nonneg corrected mixed y) (family_nonneg _ _ _) + · exact le_refl _ + +lemma mean_eq_sum_weightedFlags (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) : + F.mean corrected mixed = + ∑y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p, + originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y * weightedFlags F corrected mixed y := rfl + +lemma principalFlagMean_nonneg (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) : + 0 ≤ F.mean corrected mixed := by + rw [mean_eq_sum_weightedFlags] + exact Finset.sum_nonneg (fun y _=>mul_nonneg + (originalDrawMass_nonneg _ _ _ _ _ y) (weightedFlags_nonneg F corrected mixed y)) + +theorem principalDifferenceMean_le_of_pointwise + (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) + (A : ℝ) + (h : ∀y, originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y ≠ 0 → + ‖principalDifferenceTerm F corrected mixed mask y‖ ≤ A*weightedFlags F corrected mixed y) : + ‖principalDifferenceMean F corrected mixed mask‖ ≤ A*F.mean corrected mixed := by + rw [principalDifferenceMean,mean_eq_sum_weightedFlags,Finset.mul_sum] + apply (norm_sum_le _ _).trans + apply Finset.sum_le_sum + intro y _ + by_cases hy : originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y=0 + · simp only [hy,Complex.ofReal_zero,zero_mul,mul_zero,norm_zero,le_refl] + rw [norm_mul,Complex.norm_real,Real.norm_eq_abs, + abs_of_nonneg (originalDrawMass_nonneg _ _ _ _ _ y)] + calc + _ ≤ originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y * + (A*weightedFlags F corrected mixed y) := + mul_le_mul_of_nonneg_left (h y hy) (originalDrawMass_nonneg _ _ _ _ _ y) + _ = _ := by ring + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedProducts.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedProducts.lean new file mode 100644 index 0000000000000000000000000000000000000000..fa7aea493ea8ecbe6b571912ada63b3d527e14bb --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedProducts.lean @@ -0,0 +1,75 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairPattern HistoryPairRepresentatives +open HistoryPairKernelReplacement HistoryPairRepresentativeVariables HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance kernelProductsInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +def principalProductTerm (symbolic : Bool) (F : MatchedPrincipalBlockFamily C outside l f g p) + (corrected mixed : Bool) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) + (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) : ℂ := + if hy : F.active (originalDrawOuter (fun _ : Bool=>C.giant) C.sources _ l p y) then + if mask y then + let R := F.reference _ hy + let x := referenceSample R y + (rightRootSupportIndicator R (fun _ : Bool=>C.giant) y:ℂ)*(sampledJacobian R x:ℂ)*(F.principal _ hy).value corrected mixed (originalDrawBulk C l p y)* + ((∏r : Representative R.left.history R.right.history, + if symbolic then symbolicKernel mixed R.left.history R.right.history R.left.supported R.right.supported + r (x (representativeMap R.left.history R.right.history r)).toNat + else actualProbability mixed R.left.history R.right.history R.left.supported R.right.supported + r (x (representativeMap R.left.history R.right.history r)).toNat x : ℝ):ℂ) + else 0 + else 0 + +def principalProductMean (symbolic : Bool) (F : MatchedPrincipalBlockFamily C outside l f g p) + (corrected mixed : Bool) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) : ℂ := + ∑y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p, + (originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y:ℂ)* + principalProductTerm symbolic F corrected mixed mask y + +lemma principalProductTerm_sub (F : MatchedPrincipalBlockFamily C outside l f g p) + (corrected mixed : Bool) (mask) (y) : + principalProductTerm false F corrected mixed mask y- + principalProductTerm true F corrected mixed mask y= + principalDifferenceTerm F corrected mixed mask y := by + unfold principalProductTerm principalDifferenceTerm + split + · split + · simp only [Bool.false_eq_true,ite_false,ite_true,kernelDifference,Complex.ofReal_sub,mul_sub] + · simp only [sub_self] + · simp only [sub_self] + +theorem principalProductMean_sub (F : MatchedPrincipalBlockFamily C outside l f g p) + (corrected mixed : Bool) (mask) : + principalProductMean false F corrected mixed mask- + principalProductMean true F corrected mixed mask= + principalDifferenceMean F corrected mixed mask := by + simp only [principalProductMean,principalDifferenceMean,←Finset.sum_sub_distrib,←mul_sub, + principalProductTerm_sub] + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedRoot.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedRoot.lean new file mode 100644 index 0000000000000000000000000000000000000000..352d1647829e94b4488a3b688ed1bb7ab501c940 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedRoot.lean @@ -0,0 +1,85 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedSelected +import OAI.NumberTheory.Ostmann.Arithmetic.HistorySelectedRootFlagErrorNumerics + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables Filter +open HistorySelectedRootFlagError +attribute [local instance] Classical.propDecidable +local instance matchedRootFlagInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_root_principal_kernel_error_eventually (d : Decomposition) + (Bs BD Bz D H : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hH : 0≤H) (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then lC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop, + Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,∑p, + ‖principalDifferenceMean (F v f g p) corrected mixed (mask v f g p)‖) ≤ + Real.exp (-frequencyBudget Bs BD Bz k L l-H*(bulkSize k L:ℝ)) ∧ + Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,∑p, + ‖principalDifferenceMean (F v f g p) corrected mixed (mask v f g p)‖) ≤ + Real.exp (-H*(bulkSize k L:ℝ)) := by + filter_upwards [selected_principal_kernel_error_eventually d Bs BD Bz hBs hk, + selected_root_kernel_flag_error_eventually Bs BD Bz D H hH hk] with L hbase hbudget + intro E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl outside hpos hlen hlog F hroot mask + have hl' : l≤k := by + cases corrected with + | false => exact hl + | true => exact Nat.le_of_lt hl + have hsum : (∑v,∑f,∑g,∑p, + ‖principalDifferenceMean (F v f g p) corrected mixed (mask v f g p)‖) ≤ + (Fintype.card (AllowedFrequency (frequencyBound Bs BD Bz k L) l):ℝ)* + ((2:ℝ)^(4*k*2^k)*Real.exp (-Real.exp ((3/2000:ℝ)*L))) := by + calc + _ ≤ ∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + (2:ℝ)^(4*k*2^k)*Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + apply Finset.sum_le_sum + intro v hv + exact hbase E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl + outside hpos hlen hlog (F v) (hroot v) (mask v) + _ = _ := by simp only [Finset.sum_const,Finset.card_univ,nsmul_eq_mul] + have hpaid : Real.exp (D*(L+1)^2)*(∑v,∑f,∑g,∑p, + ‖principalDifferenceMean (F v f g p) corrected mixed (mask v f g p)‖) ≤ + (Fintype.card (AllowedFrequency (frequencyBound Bs BD Bz k L) l):ℝ)* + (2:ℝ)^(4*k*2^k)*Real.exp (D*(L+1)^2)*Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + convert mul_le_mul_of_nonneg_left hsum (Real.exp_nonneg (D*(L+1)^2)) using 1 + ring + exact ⟨hpaid.trans (hbudget l hl').1,hpaid.trans (hbudget l hl').2⟩ + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedSelected.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedSelected.lean new file mode 100644 index 0000000000000000000000000000000000000000..b7349710ceea7e910d9f8088bd242184f184418e --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedSelected.lean @@ -0,0 +1,88 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSupportConverseSelectedInputs +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryCompensationNormalizationBudgetCounts + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables Filter +attribute [local instance] Classical.propDecidable +local instance kernelSelectedInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ + +theorem selected_principal_kernel_error_eventually (d : Decomposition) + (Bs BD Bz : ℝ) {k : ℕ} (hBs : 0 ≤ Bs) (hk : 0 < k) : + ∀ᶠ L : ℝ in atTop,∀(E : Finset ℕ)(C : InitialSourceChoice d Bs BD Bz k L E), + Real.exp ((1/20:ℝ)*L) ≤ C.blockBase → + C.blockBase+favorableBlockWidth L ≤ Real.exp ((9/10:ℝ)*L) → + C.blockBase-2 < (C.giantCenter:ℝ) → + (C.giantCenter:ℝ) < C.blockBase+favorableBlockWidth L+2 → + |(C.bulkBin:ℝ)| ≤ favorableBlockWidth L/16 → + |(C.spectatorBin:ℝ)| ≤ favorableBlockWidth L/16 → + ∀spectator : PrimeSource, + (∀p : spectator.Sample,Real.exp ((1/2000:ℝ)*L)≤Real.log (p:ℕ) ∧ + Real.log (p:ℕ)≤Real.exp ((1/1000:ℝ)*L)) → + ∀l (corrected mixed : Bool),(if corrected then lC.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop, + (∑f,∑g,∑p,‖principalDifferenceMean (F f g p) corrected mixed (mask f g p)‖) ≤ + (2:ℝ)^(4*k*2^k)*Real.exp (-Real.exp ((3/2000:ℝ)*L)) := by + filter_upwards [selected_matched_principal_pattern_frequency_error_eventually d Bs BD Bz hBs hk, + HistoryBulkSupportConverse.selected_source_inputs_eventually d Bs BD Bz hk] with L hflags hinputs + intro E C hG hGu hcl hcu hb hd spectator hspec l corrected mixed hl outside hpos hlen hlog F hroot mask + have hl' : l≤k := by + cases corrected with + | false => exact hl + | true => exact Nat.le_of_lt hl + have hsource := hinputs E C hG hcl hcu hb hd spectator hspec + have hV : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j) := + fun j hj=>hsource.2.1 j (hj.trans hl') + have hcount (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) : + Fintype.card (Block p)≤4*k*2^k := by + calc + _ ≤ Fintype.card (Internal (Template.initial (2*(bulkSize k L/2)) k) l ⊕ + Internal (Template.initial (2*(bulkSize k L/2)) k) l) := card_block_le p + _ = 4*l*2^l := HistoryCompensationNormalizationBudget.paired_internal_card _ k l hl' + _ ≤ 4*k*2^k := Nat.mul_le_mul (Nat.mul_le_mul_left 4 hl') + (Nat.pow_le_pow_right (by norm_num : 1≤(2:ℕ)) hl') + calc + _ ≤ ∑f,∑g,∑p,(2:ℝ)^(4*k*2^k)*(4*(F f g p).mean corrected mixed) := by + apply Finset.sum_le_sum + intro f _ + apply Finset.sum_le_sum + intro g _ + apply Finset.sum_le_sum + intro p _ + exact (principalDifferenceMean_le (F f g p) corrected mixed hsource.1 + (hroot f g p) hV (mask f g p)).trans + (mul_le_mul_of_nonneg_right (pow_le_pow_right₀ (by norm_num) (hcount p)) + (mul_nonneg (by norm_num) (principalFlagMean_nonneg (F f g p) corrected mixed))) + _ = (2:ℝ)^(4*k*2^k)*(∑f,∑g,∑p,4*(F f g p).mean corrected mixed) := by + simp only [Finset.mul_sum] + _ ≤ _ := mul_le_mul_of_nonneg_left + (hflags E C hG hGu hcl hcu hb hd l corrected mixed hl outside hpos hlen hlog F) + (pow_nonneg (by norm_num) _) + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..695801b8e2c85ce12617d601da8416932f982e05 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalKernelReplacementMatchedSource.lean @@ -0,0 +1,90 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatchedFinite +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryPairKernelProductReplacementMatched + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched +open Construction CanonicalOccurrenceTransport Conclusion CompensationEqualityPatterns +open HistoryPairReferenceFlagExpectation HistoryPairReferenceSourceTransport +open HistoryPairPattern HistoryPairRepresentatives HistoryPairRows HistoryPairKernelReplacement +open HistoryPairSourceCoordinates HistoryPairRepresentativeVariables HistoryPairKernelProductReplacement +attribute [local instance] Classical.propDecidable +local instance kernelSourceInternalDecidable (seed : List SourceSlot) (l : ℕ) : + DecidableEq (Internal seed l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} +variable {C : InitialSourceChoice d Bs BD Bz k L E} {outside : List ℕ} +variable {f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l} +variable {p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)} + +theorem principalDifferenceTerm_le + (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) + (hroot : ∀i hi,RootGiantsAgree (F.reference i hi).left.history (F.reference i hi).right.history) + (hV : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j)) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) + (y : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p) + (hy : originalDrawMass (fun _ : Bool=>C.giant) C.sources _ l p y≠0) : + ‖principalDifferenceTerm F corrected mixed mask y‖ ≤ + (4*2^(Fintype.card (Block p)))*weightedFlags F corrected mixed y := by + by_cases ha : F.active (originalDrawOuter (fun _ : Bool=>C.giant) C.sources _ l p y) + · by_cases hm : mask y + · let R := F.reference _ ha + let x := referenceSample R y + let A := (F.principal _ ha).value corrected mixed (originalDrawBulk C l p y) + by_cases hr : RightRootSupported R (fun _ : Bool=>C.giant) y + · have hguard : rightRootSupportIndicator R (fun _ : Bool=>C.giant) y=1 := by + simp only [rightRootSupportIndicator,ite_eq_left hr] + have hp : sampledJacobian R x * |kernelDifference mixed R x| ≤ + 4*2^(Fintype.card (Block p))*family R.left R.right x := + matchedBlockReference_originalDraw_product_error C hsep mixed R (hroot _ ha) + (fun _ : Bool=>C.giant) y hy hr hV + simp only [principalDifferenceTerm,weightedFlags,dite_eq_left ha,ite_eq_left hm] + rw [F.weight_eq_guarded_principal_norm corrected mixed y ha] + change ‖(rightRootSupportIndicator R (fun _ : Bool=>C.giant) y:ℂ)* + (sampledJacobian R x:ℂ)*A*(kernelDifference mixed R x:ℂ)‖ ≤ + (4*2^(Fintype.card (Block p)))* + ((rightRootSupportIndicator R (fun _ : Bool=>C.giant) y*‖A‖)*family R.left R.right x) + rw [hguard] + simp only [Complex.ofReal_one,one_mul] + rw [norm_mul,norm_mul,Complex.norm_real,Complex.norm_real,Real.norm_eq_abs, + Real.norm_eq_abs,abs_of_nonneg (sampledJacobian_nonneg R x)] + calc + _ = ‖A‖*(sampledJacobian R x*|kernelDifference mixed R x|) := by ring + _ ≤ ‖A‖*(4*2^(Fintype.card (Block p))*family R.left R.right x) := + mul_le_mul_of_nonneg_left hp (norm_nonneg A) + _ = _ := by ring + · have hz : rightRootSupportIndicator (F.reference _ ha) (fun _ : Bool=>C.giant) y=0 := by + change rightRootSupportIndicator R (fun _ : Bool=>C.giant) y=0 + simp only [rightRootSupportIndicator,ite_eq_right hr] + simp only [principalDifferenceTerm,dite_eq_left ha,ite_eq_left hm,hz,Complex.ofReal_zero, + zero_mul,norm_zero] + exact mul_nonneg (by positivity) (weightedFlags_nonneg F corrected mixed y) + · simp only [principalDifferenceTerm,dite_eq_left ha,ite_eq_right hm,norm_zero] + exact mul_nonneg (by positivity) (weightedFlags_nonneg F corrected mixed y) + · simp only [principalDifferenceTerm,weightedFlags,dite_eq_right ha,norm_zero,mul_zero,le_refl] + +theorem principalDifferenceMean_le + (F : MatchedPrincipalBlockFamily C outside l f g p) (corrected mixed : Bool) + {spectator : PrimeSource} (hsep : C.CrossRoleSeparation spectator) + (hroot : ∀i hi,RootGiantsAgree (F.reference i hi).left.history (F.reference i hi).right.history) + (hV : ∀j≤l,∀origin,(C.sources origin).AboveFrequency (frequencyBound Bs BD Bz k L j)) + (mask : OriginalDraw (fun _ : Bool=>C.giant) C.sources + (Template.initial (2*(bulkSize k L/2)) k) l p→Prop) : + ‖principalDifferenceMean F corrected mixed mask‖ ≤ + (2:ℝ)^(Fintype.card (Block p))*(4*F.mean corrected mixed) := by + exact (principalDifferenceMean_le_of_pointwise F corrected mixed mask _ + (principalDifferenceTerm_le F corrected mixed hsep hroot hV mask)).trans_eq (by ring) + +end Ostmann.Arithmetic.HistoryBulkPrincipalKernelReplacementMatched + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTest.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTest.lean new file mode 100644 index 0000000000000000000000000000000000000000..32ee4e936167c1b4e55b1216ffdfecfb183439ea --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTest.lean @@ -0,0 +1,12 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTestMixedSource +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTestUnitSource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + + + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..c70eee2f2a75c8ca205ec3162a45a039a16b4dbf --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestBasic.lean @@ -0,0 +1,81 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSelectedIntegralReplacementTests +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSpectatorReferenceRawSamples + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalRootTest +open Construction ResidueHaar HistoryBulkSelectedIntegralReplacement HistoryBulkResidueRootAverage +open HistoryBulkResidueNormSum HistoryBulkSpectatorProduct HistoryFrequencyResidues HistoryCRTIntegration + +theorem average_separated {α β : Type*} [Fintype α] [Fintype β] + (f : α→ℂ) (g : β→ℂ) : + average (fun a=>average (fun b=>f a*g b))=average f*average g := by + simp only [average,←Finset.mul_sum,←Finset.sum_mul] + ring + +variable (d : Decomposition) {l m : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) + (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V j + unitTest h k hs ks hp hV σ (residueTransform d) z + (fun i=>ZMod.unitsMap (Nat.dvd_mul_right _ _) (x i)))* + average (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=> + independentRTest K h k σ ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (fun i=>ZMod.unitsMap (Nat.dvd_mul_left _ _) (x i))) := by + change average (fun zD=>average (fun zR=>_))=_ + exact average_separated _ _ + +theorem independent_mixed_eq_product : + rootTest true true d h k hs ks hp hV σ K x= + average (fun z : MixedPair outside.prod=> + mixedTest h k hs ks hp hV σ (residueTransform d) z + (fun i=>ZMod.unitsMap (Nat.dvd_mul_right _ _) (x i)))* + average (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=> + independentRTest K h k σ ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (fun i=>ZMod.unitsMap (Nat.dvd_mul_left _ _) (x i))) := by + change average (fun zD=>average (fun zR=>_))=_ + exact average_separated _ _ + +theorem canonical_unit_eq_product : + rootTest false false d h k hs ks hp hV σ K x= + average (fun z : UnitPair outside.prod=> + unitTest h k hs ks hp hV σ (residueTransform d) z + (fun i=>ZMod.unitsMap (Nat.dvd_mul_right _ _) (x i)))* + average (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=> + canonicalRTest K h k ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (fun i=>ZMod.unitsMap (Nat.dvd_mul_left _ _) (x i))) := by + change average (fun zD=>average (fun zR=>_))=_ + exact average_separated _ _ + +theorem canonical_mixed_eq_product : + rootTest false true d h k hs ks hp hV σ K x= + average (fun z : MixedPair outside.prod=> + mixedTest h k hs ks hp hV σ (residueTransform d) z + (fun i=>ZMod.unitsMap (Nat.dvd_mul_right _ _) (x i)))* + average (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=> + canonicalRTest K h k ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (fun i=>ZMod.unitsMap (Nat.dvd_mul_left _ _) (x i))) := by + change average (fun zD=>average (fun zR=>_))=_ + exact average_separated _ _ + +end Ostmann.Arithmetic.HistoryBulkPrincipalRootTest + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestMixed.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestMixed.lean new file mode 100644 index 0000000000000000000000000000000000000000..3cc952ea923a1157b0237fd8ebb1beb6571b393f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestMixed.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTestSamples +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSpectatorReferenceRawIndependentMixed + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalRootTest +open Construction Conclusion CanonicalHistoryLeafBulk HistoryBulkProducts HistoryBulkDiagramParameters +open HistoryBulkSupportConverse HistoryBulkFrequencyTransport HistorySignedSpectatorCRT +open HistoryBulkSpectatorProduct HistoryCRTIntegration HistoryBulkSpectatorReferenceRaw +open HistoryBulkSelectedIntegralReplacement HistoryBulkResidueNormSum HistoryFrequencyResidues ResidueHaar + +theorem independent_mixed_source_eq_raw_product (d : Decomposition) (K : ℕ) + (b k l : ℕ) (bulk : PrimeSource) (top : Fin 3→PrimeSource) + (comp : Fin k→Fin 2→PrimeSource) (V : ℕ→ℕ) (outside : List ℕ) + (a0 b0 a a' : State) + (c c' : HistoryChoices (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*b))) + (x y : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (hx : a.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x) + (hx' : a'.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + y) + (hbulk : ∀ u : Fin (2^l)×Fin (2*b), + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l y u.1 u.2 = + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l x (σ u).1 (σ u).2) + (ha0 : Template.Matches (Template.current (Template.initial (2*b) k) l) a0.small) + (hb0 : Template.Matches (Template.current (Template.initial (2*b) k) l) b0.small) + (hf : a0.frequency=a.frequency) (hf' : b0.frequency=a'.frequency) + (hfix : a0.small.map eraseBulkValue=a.small.map eraseBulkValue) + (hfix' : b0.small.map eraseBulkValue=a'.small.map eraseBulkValue) + (hs0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a0 c).Supported V outside) + (ht0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l b0 c').Supported V outside) + (hc : Nat.Coprime (bulkProduct a.small) outside.prod) + (hc' : Nat.Coprime (bulkProduct a'.small) outside.prod) + (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V j + residuePairSpectator (residueTransform d) outside outside.prod + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a c) + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a' c') + (roots.1,roots.2))* + average (fun roots : MixedPair ((pairedFrequencyProduct H G)^(K+2))=> + independentRTest K H G σ ((roots.1:ZMod ((pairedFrequencyProduct H G)^(K+2))), + (roots.2:ZMod ((pairedFrequencyProduct H G)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct H G)^(K+2)) + (initialSourceFamily b k bulk top comp) (2*b) k l x)) := by + dsimp only + let _ : NeZero outside.prod := HistorySignedSpectatorDiagramAverage.outsideNeZero hp + let _ : NeZero (pairedFrequencyProduct (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a0 c) (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l b0 c')) := ⟨pairedFrequencyProduct_ne_zero hs0 ht0⟩ + have hNx : Nat.Coprime (bulkProduct (assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x)) (outside.prod*(pairedFrequencyProduct (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a0 c) (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l b0 c'))^(K+2)) := by + rw [←hx] + exact hN + rw [independent_mixed_source_eq_product d _ _ hs0 ht0 hp hV σ K _ x hNx] + congr 1 + apply congrArg average + funext roots + exact mixedTest_independent_source_eq_raw b k l bulk top comp V outside + a0 b0 a a' c c' σ x y hx hx' hbulk ha0 hb0 hf hf' hfix hfix' hs0 ht0 + hc hc' hp hV (residueTransform d) (fun q _=>HistorySignedSpectatorDiagram.actual_residueTransform_zero d q) roots + +end Ostmann.Arithmetic.HistoryBulkPrincipalRootTest + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestMixedSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestMixedSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..9bbe8231871e33a9f38e07be142bc66c6381cec8 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestMixedSource.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTestMixed +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsFrequencySource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalRootTest +open Construction Conclusion CanonicalHistoryLeafBulk HistoryBulkProducts HistoryBulkDiagramParameters +open HistoryBulkSupportConverse HistoryBulkFrequencyTransport HistorySignedSpectatorCRT +open HistoryBulkSpectatorProduct HistoryCRTIntegration HistoryBulkSpectatorReferenceRaw +open HistoryBulkSelectedIntegralReplacement HistoryBulkResidueNormSum HistoryFrequencyResidues ResidueHaar + +theorem independent_mixed_source_eq_raw_product_of_mass (d : Decomposition) (K : ℕ) + (b k l : ℕ) (bulk : PrimeSource) (top : Fin 3→PrimeSource) + (comp : Fin k→Fin 2→PrimeSource) (V : ℕ→ℕ) (outside : List ℕ) + (a0 b0 a a' : State) + (c c' : HistoryChoices (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*b))) + (x y : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (hx : a.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x) + (hx' : a'.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + y) + (hbulk : ∀ u : Fin (2^l)×Fin (2*b), + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l y u.1 u.2 = + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l x (σ u).1 (σ u).2) + (ha0 : Template.Matches (Template.current (Template.initial (2*b) k) l) a0.small) + (hb0 : Template.Matches (Template.current (Template.initial (2*b) k) l) b0.small) + (hf : a0.frequency=a.frequency) (hf' : b0.frequency=a'.frequency) + (hfix : a0.small.map eraseBulkValue=a.small.map eraseBulkValue) + (hfix' : b0.small.map eraseBulkValue=a'.small.map eraseBulkValue) + (hs0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a0 c).Supported V outside) + (ht0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l b0 c').Supported V outside) + (hc : Nat.Coprime (bulkProduct a.small) outside.prod) + (hc' : Nat.Coprime (bulkProduct a'.small) outside.prod) + (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V j + residuePairSpectator (residueTransform d) outside outside.prod + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a c) + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a' c') + (roots.1,roots.2))* + average (fun roots : MixedPair ((pairedFrequencyProduct H G)^(K+2))=> + independentRTest K H G σ ((roots.1:ZMod ((pairedFrequencyProduct H G)^(K+2))), + (roots.2:ZMod ((pairedFrequencyProduct H G)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct H G)^(K+2)) + (initialSourceFamily b k bulk top comp) (2*b) k l x)) := by + apply independent_mixed_source_eq_raw_product d K b k l bulk top comp V outside + a0 b0 a a' c c' σ x y hx hx' hbulk ha0 hb0 hf hf' hfix hfix' hs0 ht0 hc hc' hp hV + apply Nat.coprime_mul_iff_right.mpr + refine ⟨hc,?_⟩ + rw [hx] + exact HistoryBulkReferenceTestsFrequency.source_bulk_coprime_frequency_power + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a0 c) (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l b0 c') hs0 ht0 hfreq _ x hmass (K+2) + +end Ostmann.Arithmetic.HistoryBulkPrincipalRootTest + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestSamples.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestSamples.lean new file mode 100644 index 0000000000000000000000000000000000000000..7ac5bdeaca92f109b905a1f764135133f8fb0380 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestSamples.lean @@ -0,0 +1,96 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTestBasic + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalRootTest +open Construction ResidueHaar HistoryBulkSelectedIntegralReplacement HistoryBulkResidueRootAverage +open HistoryBulkResidueNormSum HistoryBulkSpectatorProduct HistoryFrequencyResidues HistoryCRTIntegration +open HistoryBulkSpectatorReferenceRaw HistoryBulkProducts CanonicalHistoryLeafBulk + +theorem sourceBulkUnits_map (M D : ℕ) (hD : D∣M) (sources : SourceFamily) (m k l : ℕ) + (x : SourceAssignment sources (Template.current (Template.initial m k) l)) + (hc : Nat.Coprime (bulkProduct (assignedSlots sources + (Template.current (Template.initial m k) l) x)) M) + (u : Fin (2^l)×Fin m) : + ZMod.unitsMap hD (sourceBulkUnits M sources m k l x u)=sourceBulkUnits D sources m k l x u := by + apply Units.ext + change (ZMod.cast (sourceBulkUnits M sources m k l x u:ZMod M):ZMod D)=_ + rw [sourceBulkUnits_coe M sources m k l x hc u,ZMod.cast_natCast hD, + sourceBulkUnits_coe D sources m k l x (hc.of_dvd_right hD) u] + +variable (d : Decomposition) {l m k₀ : ℕ} {V : ℕ→ℕ} {outside : List ℕ} + (h k : History l) (hs : h.Supported V outside) (ks : k.Supported V outside) + (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V j + unitTest h k hs ks hp hV σ (residueTransform d) z + (sourceBulkUnits outside.prod sources m k₀ l x))* + average (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=> + independentRTest K h k σ ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct h k)^(K+2)) sources m k₀ l x)) := by + rw [independent_unit_eq_product] + simp only [sourceBulkUnits_map _ _ _ sources m k₀ l x hc] + +theorem independent_mixed_source_eq_product : + rootTest true true d h k hs ks hp hV σ K + (sourceBulkUnits (outside.prod*(pairedFrequencyProduct h k)^(K+2)) sources m k₀ l x)= + average (fun z : MixedPair outside.prod=> + mixedTest h k hs ks hp hV σ (residueTransform d) z + (sourceBulkUnits outside.prod sources m k₀ l x))* + average (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=> + independentRTest K h k σ ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct h k)^(K+2)) sources m k₀ l x)) := by + rw [independent_mixed_eq_product] + simp only [sourceBulkUnits_map _ _ _ sources m k₀ l x hc] + +theorem canonical_unit_source_eq_product : + rootTest false false d h k hs ks hp hV σ K + (sourceBulkUnits (outside.prod*(pairedFrequencyProduct h k)^(K+2)) sources m k₀ l x)= + average (fun z : UnitPair outside.prod=> + unitTest h k hs ks hp hV σ (residueTransform d) z + (sourceBulkUnits outside.prod sources m k₀ l x))* + average (fun z : UnitPair ((pairedFrequencyProduct h k)^(K+2))=> + canonicalRTest K h k ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct h k)^(K+2)) sources m k₀ l x)) := by + rw [canonical_unit_eq_product] + simp only [sourceBulkUnits_map _ _ _ sources m k₀ l x hc] + +theorem canonical_mixed_source_eq_product : + rootTest false true d h k hs ks hp hV σ K + (sourceBulkUnits (outside.prod*(pairedFrequencyProduct h k)^(K+2)) sources m k₀ l x)= + average (fun z : MixedPair outside.prod=> + mixedTest h k hs ks hp hV σ (residueTransform d) z + (sourceBulkUnits outside.prod sources m k₀ l x))* + average (fun z : MixedPair ((pairedFrequencyProduct h k)^(K+2))=> + canonicalRTest K h k ((z.1:ZMod ((pairedFrequencyProduct h k)^(K+2))), + (z.2:ZMod ((pairedFrequencyProduct h k)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct h k)^(K+2)) sources m k₀ l x)) := by + rw [canonical_mixed_eq_product] + simp only [sourceBulkUnits_map _ _ _ sources m k₀ l x hc] + +end Ostmann.Arithmetic.HistoryBulkPrincipalRootTest + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestUnit.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestUnit.lean new file mode 100644 index 0000000000000000000000000000000000000000..b075874d56a22c4d7ef3d877f35bf9ff6a6a840f --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestUnit.lean @@ -0,0 +1,84 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTestSamples +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkSpectatorReferenceRawIndependentUnit + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalRootTest +open Construction Conclusion CanonicalHistoryLeafBulk HistoryBulkProducts HistoryBulkDiagramParameters +open HistoryBulkSupportConverse HistoryBulkFrequencyTransport HistorySignedSpectatorCRT +open HistoryBulkSpectatorProduct HistoryCRTIntegration HistoryBulkSpectatorReferenceRaw +open HistoryBulkSelectedIntegralReplacement HistoryBulkResidueNormSum HistoryFrequencyResidues ResidueHaar + +theorem independent_unit_source_eq_raw_product (d : Decomposition) (K : ℕ) + (b k l : ℕ) (bulk : PrimeSource) (top : Fin 3→PrimeSource) + (comp : Fin k→Fin 2→PrimeSource) (V : ℕ→ℕ) (outside : List ℕ) + (a0 b0 a a' : State) + (c c' : HistoryChoices (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*b))) + (x y : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (hx : a.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x) + (hx' : a'.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + y) + (hbulk : ∀ u : Fin (2^l)×Fin (2*b), + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l y u.1 u.2 = + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l x (σ u).1 (σ u).2) + (ha0 : Template.Matches (Template.current (Template.initial (2*b) k) l) a0.small) + (hb0 : Template.Matches (Template.current (Template.initial (2*b) k) l) b0.small) + (hf : a0.frequency=a.frequency) (hf' : b0.frequency=a'.frequency) + (hfix : a0.small.map eraseBulkValue=a.small.map eraseBulkValue) + (hfix' : b0.small.map eraseBulkValue=a'.small.map eraseBulkValue) + (hs0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a0 c).Supported V outside) + (ht0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l b0 c').Supported V outside) + (hc : Nat.Coprime (bulkProduct a.small) outside.prod) + (hc' : Nat.Coprime (bulkProduct a'.small) outside.prod) + (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V j + residuePairSpectator (residueTransform d) outside outside.prod + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a c) + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a' c') + (roots.1,roots.2))* + average (fun roots : UnitPair ((pairedFrequencyProduct H G)^(K+2))=> + independentRTest K H G σ ((roots.1:ZMod ((pairedFrequencyProduct H G)^(K+2))), + (roots.2:ZMod ((pairedFrequencyProduct H G)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct H G)^(K+2)) + (initialSourceFamily b k bulk top comp) (2*b) k l x)) := by + dsimp only + let _ : NeZero outside.prod := HistorySignedSpectatorDiagramAverage.outsideNeZero hp + let _ : NeZero (pairedFrequencyProduct (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a0 c) (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l b0 c')) := ⟨pairedFrequencyProduct_ne_zero hs0 ht0⟩ + have hNx : Nat.Coprime (bulkProduct (assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x)) (outside.prod*(pairedFrequencyProduct (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a0 c) (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l b0 c'))^(K+2)) := by + rw [←hx] + exact hN + rw [independent_unit_source_eq_product d _ _ hs0 ht0 hp hV σ K _ x hNx] + congr 1 + apply congrArg average + funext roots + exact unitTest_independent_source_eq_raw b k l bulk top comp V outside + a0 b0 a a' c c' σ x y hx hx' hbulk ha0 hb0 hf hf' hfix hfix' hs0 ht0 + hc hc' hp hV (residueTransform d) (fun q _=>HistorySignedSpectatorDiagram.actual_residueTransform_zero d q) roots + +end Ostmann.Arithmetic.HistoryBulkPrincipalRootTest + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestUnitSource.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestUnitSource.lean new file mode 100644 index 0000000000000000000000000000000000000000..4ccf7feb6be170311ca31b3391754d6be9ae6955 --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalRootTestUnitSource.lean @@ -0,0 +1,79 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalRootTestUnit +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkReferenceTestsFrequencySource + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +open scoped BigOperators +namespace Ostmann.Arithmetic.HistoryBulkPrincipalRootTest +open Construction Conclusion CanonicalHistoryLeafBulk HistoryBulkProducts HistoryBulkDiagramParameters +open HistoryBulkSupportConverse HistoryBulkFrequencyTransport HistorySignedSpectatorCRT +open HistoryBulkSpectatorProduct HistoryCRTIntegration HistoryBulkSpectatorReferenceRaw +open HistoryBulkSelectedIntegralReplacement HistoryBulkResidueNormSum HistoryFrequencyResidues ResidueHaar + +theorem independent_unit_source_eq_raw_product_of_mass (d : Decomposition) (K : ℕ) + (b k l : ℕ) (bulk : PrimeSource) (top : Fin 3→PrimeSource) + (comp : Fin k→Fin 2→PrimeSource) (V : ℕ→ℕ) (outside : List ℕ) + (a0 b0 a a' : State) + (c c' : HistoryChoices (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l) + (σ : Equiv.Perm (Fin (2^l)×Fin (2*b))) + (x y : SourceAssignment (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l)) + (hx : a.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) x) + (hx' : a'.small=assignedSlots (initialSourceFamily b k bulk top comp) + (Template.current (Template.initial (2*b) k) l) + y) + (hbulk : ∀ u : Fin (2^l)×Fin (2*b), + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l y u.1 u.2 = + bulkSamples (initialSourceFamily b k bulk top comp) (2*b) k l x (σ u).1 (σ u).2) + (ha0 : Template.Matches (Template.current (Template.initial (2*b) k) l) a0.small) + (hb0 : Template.Matches (Template.current (Template.initial (2*b) k) l) b0.small) + (hf : a0.frequency=a.frequency) (hf' : b0.frequency=a'.frequency) + (hfix : a0.small.map eraseBulkValue=a.small.map eraseBulkValue) + (hfix' : b0.small.map eraseBulkValue=a'.small.map eraseBulkValue) + (hs0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l a0 c).Supported V outside) + (ht0 : (decodeHistory (initialSourceFamily b k bulk top comp) + (Template.initial (2*b) k) V l b0 c').Supported V outside) + (hc : Nat.Coprime (bulkProduct a.small) outside.prod) + (hc' : Nat.Coprime (bulkProduct a'.small) outside.prod) + (hp : ∀q∈outside,q.Prime) (hV : ∀q∈outside,∀j≤l,V j + residuePairSpectator (residueTransform d) outside outside.prod + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a c) + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a' c') + (roots.1,roots.2))* + average (fun roots : UnitPair ((pairedFrequencyProduct H G)^(K+2))=> + independentRTest K H G σ ((roots.1:ZMod ((pairedFrequencyProduct H G)^(K+2))), + (roots.2:ZMod ((pairedFrequencyProduct H G)^(K+2)))) + (sourceBulkUnits ((pairedFrequencyProduct H G)^(K+2)) + (initialSourceFamily b k bulk top comp) (2*b) k l x)) := by + apply independent_unit_source_eq_raw_product d K b k l bulk top comp V outside + a0 b0 a a' c c' σ x y hx hx' hbulk ha0 hb0 hf hf' hfix hfix' hs0 ht0 hc hc' hp hV + apply Nat.coprime_mul_iff_right.mpr + refine ⟨hc,?_⟩ + rw [hx] + exact HistoryBulkReferenceTestsFrequency.source_bulk_coprime_frequency_power + (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l a0 c) (decodeHistory (initialSourceFamily b k bulk top comp) (Template.initial (2*b) k) V l b0 c') hs0 ht0 hfreq _ x hmass (K+2) + +end Ostmann.Arithmetic.HistoryBulkPrincipalRootTest + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalSourceReindex.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalSourceReindex.lean new file mode 100644 index 0000000000000000000000000000000000000000..d4255960a82778f43d0deaab2fe3a5ac062345df --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalSourceReindex.lean @@ -0,0 +1,65 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexBasic +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindexPatterns + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport CompensationEqualityPatterns +open HistoryGiantOriginalMeanFactorization HistoryPairSourceLaws HistoryBulkUniversalPatternAggregation +open scoped BigOperators +local instance principalReindexInternalDecidable (template : List SourceSlot) (l : ℕ) : + DecidableEq (Internal template l) := Classical.decEq _ +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + +def pairedChoiceTest (F : Choices (l:=l) C → Choices (l:=l) C → ℂ) + (f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l) + (z : PairedInternalSourceDraws C.sources (Template.initial (2*(bulkSize k L/2)) k) l) : ℂ := + F (assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l f (fun i=>z (.inl i))) + (assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l g (fun i=>z (.inr i))) + +def choicePatternValue (F : Choices (l:=l) C → Choices (l:=l) C → ℂ) + (f g : FrequencyChoices (frequencyBound Bs BD Bz k L) l) + (p : Pattern (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l)) + (b : Block p → CommonSample C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l)) : ℂ := + sourcePatternValue C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) (pairedChoiceTest C F f g) p b + +theorem choicesPairSum_eq_patternMean + (F : Choices (l:=l) C → Choices (l:=l) C → ℂ) : + choicesPairSum C F = + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑f : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ∑g : FrequencyChoices (frequencyBound Bs BD Bz k L) l,choicePatternValue C F f g p b) := by + rw [choicesPairSum_eq_frequency_sourceMean] + simp only [patternComplexSum_sum] + apply Finset.sum_congr rfl + intro f _ + apply Finset.sum_congr rfl + intro g _ + exact source_cmean_eq_patternComplexSum C.sources _ _ (pairedChoiceTest C F f g) + +theorem commonRootChoicesSum_eq_patternMean + (F : AllowedFrequency (frequencyBound Bs BD Bz k L) l → + Choices (l:=l) C → Choices (l:=l) C → ℂ) : + (∑v,choicesPairSum C (F v)) = + patternComplexSum C.sources (pairedInternalOrigin (Template.initial (2*(bulkSize k L/2)) k) l) + (pairedHistoryType (Template.initial (2*(bulkSize k L/2)) k) l) + (fun p b=>∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + ∑f : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ∑g : FrequencyChoices (frequencyBound Bs BD Bz k L) l,choicePatternValue C (F v) f g p b) := by + simp only [choicesPairSum_eq_patternMean,patternComplexSum_sum] + +end Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindex + +end + +end OAI diff --git a/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalSourceReindexBasic.lean b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalSourceReindexBasic.lean new file mode 100644 index 0000000000000000000000000000000000000000..ed361ddbb67d0bb5f9b5a3c50a20a438838e8def --- /dev/null +++ b/lean/OAI/NumberTheory/Ostmann/Arithmetic/HistoryBulkPrincipalSourceReindexBasic.lean @@ -0,0 +1,58 @@ +import OAI.NumberTheory.Ostmann.Arithmetic.HistoryGiantOriginalMeanChoicesDefs +import OAI.NumberTheory.Ostmann.Construction.CanonicalHistoryProductChoicesPair + +namespace OAI + +open _root_.Erdos970 _root_.OAI.Erdos970 + +open Erdos970.Erdos970Dependency.SiegelWalfisz + +noncomputable section +namespace Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindex +open Construction Conclusion CanonicalOccurrenceTransport +open HistoryGiantOriginalMeanFactorization +open scoped BigOperators +variable {d : Decomposition} {Bs BD Bz L : ℝ} {k l : ℕ} {E : Finset ℕ} + (C : InitialSourceChoice d Bs BD Bz k L E) + +theorem choicesPairSum_eq_frequency_sourceMean + (F : Choices (l:=l) C → Choices (l:=l) C → ℂ) : + choicesPairSum C F = + ∑f : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ∑g : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + (pairedInternalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).cmean + (fun z=>F + (assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l f (fun i=>z (.inl i))) + (assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l g (fun i=>z (.inr i)))) := by + simpa only [choicesPairSum,FinitePrior.cmean,Complex.ofReal_mul,mul_assoc] using + sum_pair_choicesMass_eq_source_prior C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l F + +theorem sum_cmean_eq_cmean_sum {α ι : Type*} [Fintype α] [Fintype ι] + (μ : FinitePrior α) (F : ι → α → ℂ) : + (∑i,μ.cmean (F i))=μ.cmean (fun a=>∑i,F i a) := by + simp only [FinitePrior.cmean,Finset.mul_sum] + exact Finset.sum_comm + +theorem commonRootChoicesSum_eq_sourceMean + (F : AllowedFrequency (frequencyBound Bs BD Bz k L) l → + Choices (l:=l) C → Choices (l:=l) C → ℂ) : + (∑v,choicesPairSum C (F v)) = + (pairedInternalSourcePrior C.sources (Template.initial (2*(bulkSize k L/2)) k) l).cmean + (fun z=>∑v : AllowedFrequency (frequencyBound Bs BD Bz k L) l, + ∑f : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + ∑g : FrequencyChoices (frequencyBound Bs BD Bz k L) l, + F v + (assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l f (fun i=>z (.inl i))) + (assembleHistoryChoices C.sources (Template.initial (2*(bulkSize k L/2)) k) + (frequencyBound Bs BD Bz k L) l g (fun i=>z (.inr i)))) := by + simp_rw [choicesPairSum_eq_frequency_sourceMean,sum_cmean_eq_cmean_sum] + +end Ostmann.Arithmetic.HistoryBulkPrincipalSourceReindex + +end + +end OAI