Add lean source and binary files (part 107)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SumPeriodBlocks.leanAdded+77
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Support.leanAdded+90
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportEqUsed.leanAdded+107
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportIffExtraOrLabel.leanAdded+107
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Symbolic.leanAdded+154
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedEdgeProduct.leanAdded+96
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShape.leanAdded+106
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShapeMap.leanAdded+111
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Test.leanAdded+163
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TestVacuous.leanAdded+108
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TiltedListLocalMean.leanAdded+99
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TokenSlot.leanAdded+212
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Topology.leanAdded+135
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TopologyTreeSteps.leanAdded+133
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalCodeMass.leanAdded+54
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalUnlitCountEqSubtype.leanAdded+58
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeBlocksWithEdges.leanAdded+77
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeDestinationInjective.leanAdded+112
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdge.leanAdded+137
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdgeInjective.leanAdded+95
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeOccurrences.leanAdded+232
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeOccurrencesEmptyOfFree.leanAdded+155
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreePrimeSupport.leanAdded+131
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeVertices.leanAdded+134
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoBlockRerooting.leanAdded+101
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoTermBinomial.leanAdded+164
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UncutTreeEdges.leanAdded+163
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UnlitPolynomialBound.leanAdded+125
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Unselected.leanAdded+92
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UnselectedCard.leanAdded+24
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedEdgeCode.leanAdded+87
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedReferenceWeight.leanAdded+104
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UsedPrimeReciprocal.leanAdded+133
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexAt.leanAdded+89
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexIndex.leanAdded+128
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexWeight.leanAdded+62
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VerticesInBlock.leanAdded+90
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WalkBetweenSupport.leanAdded+36
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WalkSupportConnected.leanAdded+34
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WalkVertices.leanAdded+88
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Witness.leanAdded+110
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessBaseDoublePath.leanAdded+124
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessConfiguration.leanAdded+149
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessEntropyBase.leanAdded+117
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessSlotCount.leanAdded+100
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestDescriptor.leanAdded+139
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestShape.leanAdded+130
- lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/ZeroExpression.leanAdded+95
- lean/OAI/NumberTheory/Ostmann/All.leanAdded+152
- lean/OAI/NumberTheory/Ostmann/Arithmetic/AccidentalDivisibility.leanAdded+65
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677import Mathlib
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.PeriodicOriginopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990import Mathlib
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.TaggedPrimeGroupsvariable {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] inlemma 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] inlemma 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] inlemma 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Orderedimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessTestDescriptor
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.ArithmeticSavingopen OrdinaryCorrelations.SharedSlotPatternsopen Finset Classicalvariable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L t : ℕ}namespace WitnessConfigurationvariable (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 WitnessConfigurationend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ListSupportimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.LastEdge
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTraceopen Finset Classicalvariable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h L ℓ : ℕ}
namespace Specificationlemma 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Testimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ZeroExpressionimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.EdgeAtimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.LinearCoeffZeroOfNot
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SignedTraceopen Finset Classicalvariable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h L ℓ n : ℕ}namespace PrivateFamily.Testvariable {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.Testend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TokenSlotimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.UntaggedEdgeCode
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ModifiedWeightSameBand
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TopologyTreeStepsimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SpecPrimeSlotimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TaggedShapeimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Enumimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.VertexIndex
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.IntegerResiduesimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrivateFamilyimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CoefficientZeroOfNotSupportimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrefixCoefficientNondvd
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTraceopen Finset Classicalvariable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h L ℓ n : ℕ}namespace PrivateFamilyvariable {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 Testvariable {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 Testend PrivateFamilyend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SpecPrimeSlotimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AttachedMetadataimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Cylinderimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.IntegerResidues
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.SourceCylinderopen Finset Classicalvariable {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 AttachedSpecvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AmplitudeGeOneimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.LocalUnlitCount
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegrationopen Finset Classicalnoncomputable sectionvariable {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:ℝ)⁻¹)
endend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AllSlotMassesimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FlatSlot
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.PivotSummationopen OrdinaryCorrelations.NumericalSubtreesopen Finset Classical Filtervariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TreeDestinationInjective
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filter
namespace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystemopen Finset Classicalvariable {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<n := by have hle := (returnTarget_spec w e her).1 simp only [Fin.val_succ] at hj omega have hi := ih _ hert (returnTarget w e her) rfl rw [(returnTarget_spec w e her).2,htar e her, (returnTarget_spec v e (hR ▸ her)).2] at hi exact hi intro j exact hd j.val j rfl have hall : ∀ e, w.label e=v.label e := by intro e have hw := w.step e have hv := v.step e rw [ho e.succ,ho e.castSucc,hs e] at hw have hn : v.sign e*(h : ℤ) ≠ 0 := mul_ne_zero (by rcases v.sign_mem e with hs | hs <;> 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.BitWeightimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Topology
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystemopen Finset Classicalvariable {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 SameGeometrylemma 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FirstSlot
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.SharedSlotPatternsopen Finset Classicalvariable {σ 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 OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AllCoreLitimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.UncutTreeEdges
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace Finset Classicalnoncomputable sectionvariable {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<t) : (w.treeSteps \ uncutTreeEdges w a).card < t := by exact (cut_tree_edges_le_unlit w a).trans_lt ((totalUnlit_eq_center w a hc).symm ▸ hu)
endend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TreeEdgeInjective
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.ForestTraversal Finset Classical SimpleGraphnoncomputable sectionvariable {h ℓ : ℕ}
theorem tree_blocks_with_edges (w : ClosedLine h ℓ) (hh : 0<h) (H : Finset (Fin ℓ)) (L : ℕ) (hL : 0<L) : ∃ bs : List (Block (edgeGraph w hh (w.treeSteps \ H))), bs.length ≤ (2*ℓ)/L+2*H.card+1 ∧ (∀ b ∈ bs,b.walk.length ≤ L) ∧ (∀ z ∈ treeVertices w,∃ b ∈ bs,z ∈ b.walk.support) ∧ (∀ e ∈ w.treeSteps \ H,∃ b ∈ bs,treeEdge w e ∈ b.walk.edges) := by obtain ⟨p,hplen,hcover,hcount⟩ := grown_tour w hh 0 w.treeSteps (grows_full_tree w) obtain ⟨bs,hbs,hbl,hbc⟩ := chunk_cut_cover (edgeGraph w hh (w.treeSteps \ H)) L hL p refine ⟨bs,?_,hbl,?_,?_⟩ · have hcut := tour_cutCount w hh H p hcount have hcard : w.treeSteps.card ≤ ℓ := by simpa using card_le_univ w.treeSteps have hlen : p.length ≤ 2*ℓ := by rw [hplen]; omega exact hbs.trans (Nat.add_le_add_right (Nat.add_le_add (Nat.div_le_div_right hlen) hcut) 1) · intro z hz exact hbc.1 z (hcover z (reached_full_tree w ▸ hz)) · intro e he apply hbc.2 · apply List.count_pos_iff.mp rw [hcount] have hc : 0<(w.treeSteps.filter (fun f => 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<h) (L : ℕ) (hL : 0<L) : ∃ bs : List (Block (edgeGraph w hh w.treeSteps)), bs.length ≤ (2*ℓ)/L+1 ∧ (∀ b ∈ bs,b.walk.length ≤ L) ∧ (∀ z ∈ treeVertices w,∃ b ∈ bs,z ∈ b.walk.support) ∧ (∀ e ∈ w.treeSteps,∃ b ∈ bs,treeEdge w e ∈ b.walk.edges) := by obtain ⟨p,hplen,hcover,hcount⟩ := grown_tour w hh 0 w.treeSteps (grows_full_tree w) obtain ⟨bs,hbs,hbl,hbc⟩ := chunk_cut_cover (edgeGraph w hh w.treeSteps) L hL p have hcut : cutCount (edgeGraph w hh w.treeSteps) p=0 := by apply List.countP_eq_zero.mpr intro e he hn have hnot : e ∉ (edgeGraph w hh w.treeSteps).edgeSet := of_decide_eq_true hn exact hnot (p.edges_subset_edgeSet he) refine ⟨bs,?_,hbl,?_,?_⟩ · have hcard : w.treeSteps.card ≤ ℓ := by simpa using card_le_univ w.treeSteps have hlen : p.length ≤ 2*ℓ := by rw [hplen]; omega rw [hcut,Nat.add_zero] at hbs exact hbs.trans (Nat.add_le_add_right (Nat.div_le_div_right hlen) 1) · intro z hz exact hbc.1 z (hcover z (reached_full_tree w ▸ hz)) · intro e he apply hbc.2 · apply List.count_pos_iff.mp rw [hcount] have hc : 0<(w.treeSteps.filter (fun f => treeEdge w f=treeEdge w e)).card := card_pos.mpr ⟨e,mem_filter.mpr ⟨he,rfl⟩⟩ omega · exact edgeGraph_adj w hh _ e he
endend OrdinaryCorrelations.NumericalSubtrees
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TreeVertices
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classical
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTraceopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Directed
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystemopen Finset Classical SimpleGraphnoncomputable sectionvariable {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<h) (v : ℤ) (E : Finset (Fin ℓ)) (hg : 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 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<n := by rw [←hcard]; exact card_erase_lt_of_mem he obtain ⟨p,hplen,hcover,hcount⟩ := ih F.card hlt F rfl hFgrow have hsource : w.offset e.castSucc ∈ reached w v F := by rcases hg.2 e he with hr | ⟨j,hj,hje,hjv⟩ · rw [hr]; exact mem_insert_self _ _ · exact mem_insert_of_mem (mem_image.mpr ⟨j,mem_erase.mpr ⟨ne_of_lt hje,hj⟩,hjv⟩) obtain ⟨p₁,p₂,hp⟩ := SimpleGraph.Walk.mem_support_iff_exists_append.mp (hcover _ hsource) let ha := edgeGraph_adj w hh w.treeSteps e (hg.1 he) let loop : (edgeGraph w hh w.treeSteps).Walk (w.offset e.castSucc) (w.offset e.castSucc) := .cons ha (.cons ha.symm .nil) let q := p₁.append (loop.append p₂) refine ⟨q,?_,?_,?_⟩ · have hcard' : E.card=F.card+1 := by rw [←hinsert,card_insert_of_notMem heF] rw [hp,SimpleGraph.Walk.length_append] at hplen simp only [q,loop,SimpleGraph.Walk.length_append,SimpleGraph.Walk.length_cons, SimpleGraph.Walk.length_nil] omega · intro z hz rcases mem_insert.mp hz with hroot | hz · subst z; exact q.start_mem_support · obtain ⟨f,hf,rfl⟩ := mem_image.mp hz by_cases hfe : f=e · subst f exact (SimpleGraph.Walk.mem_support_append_iff p₁ (loop.append p₂)).mpr (Or.inr ((SimpleGraph.Walk.mem_support_append_iff loop p₂).mpr (Or.inl (by simp [loop])))) · have hmem := hcover (w.offset f.succ) (mem_insert_of_mem (mem_image.mpr ⟨f,mem_erase.mpr ⟨hfe,hf⟩,rfl⟩)) rw [hp,SimpleGraph.Walk.mem_support_append_iff] at hmem exact (SimpleGraph.Walk.mem_support_append_iff p₁ (loop.append p₂)).mpr (hmem.imp_right (fun hh => (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
endend OrdinaryCorrelations.NumericalSubtrees
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TreeEdgeimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Append
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.ForestTraversal Finset Classical SimpleGraphnoncomputable sectionvariable {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<h) {e : Fin ℓ} (he : e ∈ w.treeSteps) {E : Finset (Fin ℓ)} (hE : E ⊆ w.treeSteps) : treeEdge w e ∈ (edgeGraph w hh E).edgeSet ↔ e ∈ E := by constructor · rintro ⟨f,hf,hor | hrev⟩ · have hef : treeEdge w e=treeEdge w f := by dsimp only at hor; unfold treeEdge; rw [hor.1,hor.2] exact treeEdge_injective w he (hE hf) hef ▸ hf · have hef : treeEdge w e=treeEdge w f := by dsimp only at hrev; unfold treeEdge; rw [hrev.1,hrev.2]; exact Sym2.eq_swap exact treeEdge_injective w he (hE hf) hef ▸ hf · intro heE exact edgeGraph_adj w hh E e heE
lemma tour_cutCount (w : ClosedLine h ℓ) (hh : 0<h) (H : Finset (Fin ℓ)) (p : (edgeGraph w hh w.treeSteps).Walk 0 0) (hc : ∀ q : Sym2 ℤ,p.edges.count q=2*(w.treeSteps.filter (fun e => 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<h) (H : Finset (Fin ℓ)) (L : ℕ) (hL : 0<L) : ∃ bs : List (Block (edgeGraph w hh (w.treeSteps \ H))), bs.length ≤ (2*ℓ)/L+2*H.card+1 ∧ (∀ b ∈ bs,b.walk.length ≤ L) ∧ (∀ z ∈ treeVertices w,∃ b ∈ bs,z ∈ b.walk.support) := by obtain ⟨p,hplen,hcover,hcount⟩ := grown_tour w hh 0 w.treeSteps (grows_full_tree w) obtain ⟨bs,hbs,hbl,hbc⟩ := chunk_cut_cover (edgeGraph w hh (w.treeSteps \ H)) L hL p refine ⟨bs,?_,hbl,?_⟩ · have hcut := tour_cutCount w hh H p hcount have hcard : w.treeSteps.card ≤ ℓ := by simpa using card_le_univ w.treeSteps have hlen : p.length ≤ 2*ℓ := by rw [hplen]; omega exact hbs.trans (Nat.add_le_add_right (Nat.add_le_add (Nat.div_le_div_right hlen) hcut) 1) · intro z hz exact hbc.1 z (hcover z (reached_full_tree w ▸ hz))
endend OrdinaryCorrelations.NumericalSubtrees
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrimeChargeProduct
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classical
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegrationopen Finset Classicalvariable {S : PrimeSystem} {h ℓ : ℕ}
def treeOccurrences (w : ClosedLine h ℓ) (p : S.Index) : Finset (Fin ℓ) := w.treeSteps.filter (fun i => (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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FixedChargesimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.RecordedTopsimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SingleEdgeWeight
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classical
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegrationopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CardTreeVerticesLeimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrimeFactorsCardLeLog
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classical
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegrationopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.KappaPos
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classical
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.FiniteIntegration OrdinaryCorrelations.SignedTraceopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.GateAncestor
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.Rerootingopen Classical Finset SimpleGraphnoncomputable sectionvariable {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<key q := by by_cases hn0 : n=0 · refine ⟨∅,root₂,(fun 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
endend OrdinaryCorrelations.Rerooting
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.MemSupport
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.SourceCylindervariable {ι : 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 ι] inlemma 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)] inlemma 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.NumericalLineimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.NoFixedQualifyingPath
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace Finset Classicalnoncomputable sectionvariable {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 TreePathvariable {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.length ∧ a p+(P.vertex 0 : ZMod (p.val:ℕ))=0 ∧ a p+(P.vertex (Fin.last P.length) : ZMod (p.val:ℕ))=0 ∧ ∀ j : Fin (P.length+1), 0<j.val → j.val<P.length → a p+(P.vertex j : ZMod (p.val:ℕ))≠0
lemma gap_prime_free (P : TreePath w L) (a : S.FixedResidues w.line) (hu : ∀ i, P.edge i ∈ uncutTreeEdges w.line a) (p : S.FixedIndex w.line) (hg : P.IsGap a p) : ∀ i, ¬(p.val:ℕ) ∣ w.line.label (P.edge i) := by intro i hi have hlen := hg.1 have hd := P.departure_lit a hu p i hi by_cases hz : i.val=0 · have ha : a p+(P.vertex i.succ : ZMod (p.val:ℕ))=0 := by rwa [P.vertex_residue_eq p.val i hi] exact hg.2.2.2 i.succ (by simp) (by simp; omega) ha · exact hg.2.2.2 i.castSucc (by dsimp; omega) (by exact i.isLt) hd
lemma gap_div_displacement (P : TreePath w L) (a : S.FixedResidues w.line) (p : S.FixedIndex w.line) (hg : P.IsGap a p) : ((p.val:ℕ):ℤ) ∣ P.vertex (Fin.last P.length)-P.vertex 0 := by apply (ZMod.intCast_zmod_eq_zero_iff_dvd _ p.val).mp rw [Int.cast_sub] exact sub_eq_zero.mpr (add_left_cancel (hg.2.2.1.trans hg.2.1.symm))
def specification (P : TreePath w L) (p : S.Index) (hfree : ∀ i, ¬(p:ℕ) ∣ w.line.label (P.edge i)) (hd : ((p:ℕ):ℤ) ∣ P.vertex (Fin.last P.length)-P.vertex 0) : S.Specification D h L where length := P.length length_pos := P.length_pos length_le := P.length_le offset j := P.vertex j-P.vertex 0 offset_zero := sub_self _ offsets_distinct := by intro i j he apply P.distinct linarith label i := w.line.label (P.edge i) label_mem i := w.labels (P.edge i) sign := P.pathSign sign_mem := P.pathSign_mem step i := by simpa only [sub_sub_sub_cancel_right] using P.path_step i extra := p extra_not_div := hfree suffix := ⟨0,P.length_pos⟩ extra_div_suffix := by simpa using hd
theorem gap_has_nonfixed (P : TreePath w L) (a : S.FixedResidues w.line) (hu : ∀ i, P.edge i ∈ uncutTreeEdges w.line a) (hf : NoFixedForbidden w.line D L a) (p : S.FixedIndex w.line) (hg : P.IsGap a p) : ∃ (i : Fin P.length) (q : S.Index), (q:ℕ) ∣ w.line.label (P.edge i) ∧ ¬S.IsFixed w.line q := by by_contra hn have ha : ∀ (i : Fin P.length) (q : S.Index), (q:ℕ) ∣ w.line.label (P.edge i) → S.IsFixed w.line q := by intro i q hq by_contra hnf exact hn ⟨i,q,hq,hnf⟩ let s := P.specification p.val (P.gap_prime_free a hu p hg) (P.gap_div_displacement a p hg) apply no_fixed_qualifying_path w.line a hf s (P.vertex 0) · intro j simpa only [s,specification,add_sub_cancel] using P.vertex_mem j · intro q hq rcases mem_insert.mp hq with he | he · have he' : q=p.val := Subtype.ext he exact he' ▸ p.property · obtain ⟨i,_,hqi⟩ := mem_biUnion.mp he exact ha i q (Nat.mem_primeFactors.mp hqi).2.1 · intro q constructor · intro hqp have he : q=p := Subtype.ext (Subtype.ext hqp) subst q exact hg.2.1 · intro i hqi have hl := P.departure_lit a hu q i hqi change a q+((P.vertex 0+(P.vertex i.castSucc-P.vertex 0):ℤ):ZMod (q.val:ℕ))=0 rw [show P.vertex 0+(P.vertex i.castSucc-P.vertex 0)=P.vertex i.castSucc by ring] exact hl
end TreePathendend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SourceWitnessBasicScalesimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.RepeatedUnlitTotalEqFixed
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegration OrdinaryCorrelations.NumericalSubtreesopen Finset Classical Filternamespace NumericalLine
lemma unlit_polynomial_bound (S : PrimeSystem) (M ℓ L J t : ℕ) : unlitPrefactor S ℓ J ≤ witnessEntropyBase S M ℓ L J t ^ witnessEntropyDegree M ℓ L J t := by let Q := witnessEntropyBase S M ℓ L J t let N := ℓ*J let H : ℝ := max 1 (∑ p ∈ S.primes,(p:ℝ)⁻¹) 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 : N ≤ witnessSlotCount ℓ L J t := by simp only [N,witnessSlotCount,WitnessConfiguration.codeSlot_card] omega have hNcast : (N:ℝ) ≤ (witnessSlotCount ℓ L J t:ℝ) := by exact_mod_cast hN have hN0 : (0:ℝ) ≤ N := by positivity have hslot := Nat.cast_nonneg (α:=ℝ) (witnessSlotCount ℓ L J t) have hQ : 2 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H] at *; linarith have hQA : A ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H] at *; linarith have hQℓ : (ℓ:ℝ)+2 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H] at *; linarith have hQN : (N:ℝ)+1 ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H] at *; linarith have hQH : H ≤ Q := by dsimp [Q,witnessEntropyBase]; dsimp only [H] at *; linarith have hQ0 : 0 ≤ Q := by linarith have hHid : max 1 (∑ p : S.Index,(p:ℝ)⁻¹)=H := by exact congrArg (max (1:ℝ)) (sum_coe_sort S.primes (fun p : ℕ => (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 NumericalLineend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192import Mathlib
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.PivotSummationopen Finset Classicalvariable {σ 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 OAI123456789101112131415161718192021222324import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CoordinateEquiv
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.ArithmeticSavingopen Finset Classicallemma 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 omegaend OrdinaryCorrelations.ArithmeticSaving
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ModifiedWeightSameBandimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TopologyTreeStepsimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.VertexIndex
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen Finset Classicalvariable {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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SlotWeightimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.RecordPacketimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ExceptionalCodeSlotimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FlatCode
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.TaggedPrimeGroupsopen Finset Classicalvariable {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 RecordPacketvariable {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 RecordPacketend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SourcePolyDivTendstoimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.FixedIsTagged
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filter
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegrationopen Finset Classical Filtervariable {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 OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.DivisorFamily
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystem.Specificationopen OrdinaryCorrelations.SignedTraceopen Finset Classicalvariable {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.length then s.sign ⟨n,hn⟩*(h:ℤ)*s.label ⟨n,hn⟩ else 0
def coefficientAt (s : S.Specification D h L) (q n : ℕ) : ℤ := if hn : n<s.length then if q ∣ s.label ⟨n,hn⟩ then s.sign ⟨n,hn⟩*(h:ℤ)*(s.label ⟨n,hn⟩/q : ℕ) else 0 else 0
def coefficient (s : S.Specification D h L) (q a b : ℕ) : ℤ := ∑ n ∈ Ico a b, s.coefficientAt q n
lemma edgeAt_eq (s : S.Specification D h L) (n : ℕ) (hn : n<s.length) : s.edgeAt n = s.vertexAt (n+1)-s.vertexAt n := by simp only [edgeAt,vertexAt,dite_eq_left hn,dite_eq_left (show n+1 ≤ s.length by omega), dite_eq_left (show n ≤ s.length by omega)] exact (s.step ⟨n,hn⟩).symm
lemma displacement_eq_sum (s : S.Specification D h L) (a b : ℕ) (hab : a ≤ b) (hb : b ≤ s.length) : s.offset ⟨b,by omega⟩-s.offset ⟨a,by omega⟩ = ∑ n ∈ Ico a b, s.edgeAt n := by calc _ = s.vertexAt b-s.vertexAt a := by simp only [vertexAt,dite_eq_left hb,dite_eq_left (hab.trans hb)] _ = ∑ n ∈ Ico a b, (s.vertexAt (n+1)-s.vertexAt n) := (sum_Ico_sub _ hab).symm _ = _ := sum_congr rfl (fun n hn => (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<b → q ∣ s.label n) : (q:ℤ)*s.coefficient q a b = s.offset ⟨b,by omega⟩-s.offset ⟨a,by omega⟩ := by rw [s.displacement_eq_sum a b hab hb,coefficient,mul_sum] apply sum_congr rfl intro n hn have hi := mem_Ico.mp hn have hn' : n<s.length := by omega have hqn := hq ⟨n,hn'⟩ hi.1 hi.2 simp only [coefficientAt,edgeAt,dite_eq_left hn',ite_eq_left hqn] have he : (q:ℤ)*(s.label ⟨n,hn'⟩/q : ℕ) = (s.label ⟨n,hn'⟩:ℤ) := by exact_mod_cast Nat.mul_div_cancel' hqn calc _ = s.sign ⟨n,hn'⟩*(h:ℤ)*((q:ℤ)*(s.label ⟨n,hn'⟩/q : ℕ)) := by ring _ = _ := by rw [he]
lemma coefficient_restrict (s : S.Specification D h L) (q a b c d : ℕ) (hca : c ≤ a) (hbd : b ≤ d) (hd : d ≤ s.length) (hzero : ∀ i : Fin s.length, c ≤ i.val → i.val<d → (i.val<a ∨ b ≤ i.val) → ¬q ∣ s.label i) : s.coefficient q c d = s.coefficient q a b := by unfold coefficient symm apply sum_subset · intro n hn have hi := mem_Ico.mp hn exact mem_Ico.mpr ⟨hca.trans hi.1,lt_of_lt_of_le hi.2 hbd⟩ · intro n hn hout have hi := mem_Ico.mp hn have hn' : n<s.length := by omega have hsplit : n<a ∨ b ≤ n := by by_contra he push Not at he exact hout (mem_Ico.mpr ⟨by omega,by omega⟩) have hq := hzero ⟨n,hn'⟩ hi.1 hi.2 hsplit simp only [coefficientAt,dite_eq_left hn',ite_eq_right hq]
end OrdinaryCorrelations.GraphKernel.PrimeSystem.Specification
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Nonemptyimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.TopologyTreeSteps
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filter
namespace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.GraphKernel.PrimeSystemopen Finset Classicalvariable {h ℓ : ℕ} {w v : ClosedLine h ℓ}
def vertexIndex (w : ClosedLine h ℓ) (x : ℤ) : Fin (ℓ+1) := if hx : x ∈ treeVertices w then Classical.choose (mem_image.mp hx) else 0
lemma vertexIndex_spec (w : ClosedLine h ℓ) (x : ℤ) (hx : x ∈ treeVertices w) : w.offset (vertexIndex w x)=x := by simpa only [vertexIndex,dite_eq_left hx] using (Classical.choose_spec (mem_image.mp hx)).2
lemma offset_mem_vertices (w : ClosedLine h ℓ) (i : Fin (ℓ+1)) : w.offset i ∈ treeVertices w := mem_image.mpr ⟨i,mem_univ _,rfl⟩
lemma edgeVertices_subset_vertices (w : ClosedLine h ℓ) (E : Finset (Fin ℓ)) : edgeVertices w E ⊆ treeVertices w := by intro x hx rcases mem_union.mp hx with hx | hx · obtain ⟨e,he,rfl⟩ := mem_image.mp hx exact offset_mem_vertices w _ · obtain ⟨e,he,rfl⟩ := mem_image.mp hx exact offset_mem_vertices w _
namespace SameGeometry
def vertexImage (_ : SameGeometry w v) (x : ℤ) : ℤ := v.offset (vertexIndex w x)
lemma vertexImage_offset (H : SameGeometry w v) (i : Fin (ℓ+1)) : H.vertexImage (w.offset i) = v.offset i := (H.pattern _ _).mp (vertexIndex_spec w (w.offset i) (offset_mem_vertices w i))
lemma vertexImage_injective (H : SameGeometry w v) : Set.InjOn H.vertexImage (treeVertices w) := by intro x hx y hy he have hh := (H.pattern (vertexIndex w x) (vertexIndex w y)).mpr he simpa only [vertexIndex_spec w x hx,vertexIndex_spec w y hy] using hh
lemma vertices_image (H : SameGeometry w v) : (treeVertices w).image H.vertexImage = treeVertices v := by simp only [treeVertices,image_image,Function.comp_def,H.vertexImage_offset]
lemma edgeVertices_image (H : SameGeometry w v) (E : Finset (Fin ℓ)) : (edgeVertices w E).image H.vertexImage = edgeVertices v E := by simp only [edgeVertices,image_union,image_image,Function.comp_def,H.vertexImage_offset]
lemma children_image (H : SameGeometry w v) (x : ℤ) (hx : x ∈ treeVertices w) : v.children (H.vertexImage x) = w.children x := by have he := H.children (vertexIndex w x) simpa only [vertexIndex_spec w x hx,vertexImage] using he.symm
lemma weight (H : SameGeometry w v) {S : OrdinaryCorrelations.GraphKernel.PrimeSystem} (p : S.Index) (E : Finset (Fin ℓ)) : subtreeUnionWeight w p E = subtreeUnionWeight v p E := by unfold subtreeUnionWeight congr 1 rw [← H.edgeVertices_image E,prod_image (H.vertexImage_injective.mono (edgeVertices_subset_vertices w E))] apply prod_congr rfl intro x hx rw [H.children_image x (edgeVertices_subset_vertices w E hx)]
lemma modifiedWeight (H : SameGeometry w v) {S : OrdinaryCorrelations.GraphKernel.PrimeSystem} (p : S.Index) (E : Finset (Fin ℓ)) : OrdinaryCorrelations.GraphKernel.PrimeSystem.modifiedWeight w p E = OrdinaryCorrelations.GraphKernel.PrimeSystem.modifiedWeight v p E := by simp only [OrdinaryCorrelations.GraphKernel.PrimeSystem.modifiedWeight,H.weight,H.good]
lemma bandDefect (H : SameGeometry w v) (β : ℝ) : OrdinaryCorrelations.GraphKernel.PrimeSystem.bandDefect w β = OrdinaryCorrelations.GraphKernel.PrimeSystem.bandDefect v β := by unfold OrdinaryCorrelations.GraphKernel.PrimeSystem.bandDefect rw [← H.vertices_image,sum_image H.vertexImage_injective] apply sum_congr rfl intro x hx rw [H.children_image x hx]
def shapeMap (H : SameGeometry w v) (Q : Shape w) : Shape v where top := ⟨v.offset Q.topEdge.castSucc,offset_mem_vertices v _⟩ edges := ⟨Q.edges.val,mem_erase.mpr ⟨Q.nonempty.ne_empty, (mem_shapes ..).mpr (by apply (H.grows Q.topEdge.castSucc Q.edges.val).mp simpa only [Q.topEdge_origin] using Q.grows)⟩⟩
lemma shapeMap_edges (H : SameGeometry w v) (Q : Shape w) : (H.shapeMap Q).edges.val=Q.edges.val := rfl
lemma Shape.ext_edges {w : ClosedLine h ℓ} (Q R : Shape w) (hE : Q.edges.val=R.edges.val) : Q=R := by have htop : Q.top=R.top := by apply Subtype.ext rw [← Q.topEdge_origin,← R.topEdge_origin] congr 2 simp only [Shape.topEdge,hE] cases Q cases R cases htop congr exact Subtype.ext hE
lemma shapeMap_inverse (H : SameGeometry w v) (Q : Shape w) : H.symm.shapeMap (H.shapeMap Q)=Q := Shape.ext_edges _ _ rfl
def shapeEquiv (H : SameGeometry w v) : Shape w ≃ Shape v where toFun := H.shapeMap invFun := H.symm.shapeMap left_inv := H.shapeMap_inverse right_inv := H.symm.shapeMap_inverse
lemma goodEdges (H : SameGeometry w v) : OrdinaryCorrelations.NumericalSubtrees.goodEdges w = OrdinaryCorrelations.NumericalSubtrees.goodEdges v := by ext e simp only [OrdinaryCorrelations.NumericalSubtrees.goodEdges,mem_filter,H.trees,H.good]
end SameGeometry
end OrdinaryCorrelations.NumericalSubtrees
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PrimeSystem
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classical
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.FiniteIntegration OrdinaryCorrelations.SignedTraceopen Finset Classicalvariable {S : PrimeSystem} {h ℓ : ℕ}
def vertexWeight (S : PrimeSystem) (r : S.Residues) (b : ℤ) : ℝ := ∏ p : S.Index, (S.beta p)⁻¹ ^ (if r p + (b : ZMod (p : ℕ)) = 0 then (1 : ℕ) else 0)
lemma vertexWeight_inv (S : PrimeSystem) (r : S.Residues) (b : ℤ) : (S.vertexWeight r b)⁻¹ = ∏ p : S.Index, S.beta p ^ (if r p + (b : ZMod (p : ℕ)) = 0 then (1 : ℕ) else 0) := by simp only [vertexWeight, prod_inv_distrib, inv_pow, inv_inv]
def edgeWeight (S : PrimeSystem) (w : ClosedLine h ℓ) {T : ℝ} (cut : S.Cutoffs T) (r : S.Residues) (i : Fin ℓ) : ℝ := (cut.value (w.label i) (S.shiftCore (S.restrictCore r) (w.offset i.castSucc)) * cut.value (w.label i) (S.shiftCore (S.restrictCore r) (w.offset i.succ))) * ∏ p, S.occurrenceFactor w p i (r p)
def chronologicalKernel (S : PrimeSystem) (w : ClosedLine h ℓ) {T : ℝ} (cut : S.Cutoffs T) (r : S.Residues) : ℝ := ∏ i : Fin ℓ, S.edgeWeight w cut r i / S.vertexWeight r (w.offset i.castSucc)
lemma chronologicalKernel_eq (S : PrimeSystem) (w : ClosedLine h ℓ) {T : ℝ} (cut : S.Cutoffs T) (r : S.Residues) : S.chronologicalKernel w cut r = S.kernel w cut r := by simp only [chronologicalKernel, edgeWeight, div_eq_mul_inv, vertexWeight_inv, kernel, cutoffProduct, primeFactor] trans (∏ i : Fin ℓ, (cut.value (w.label i) (S.shiftCore (S.restrictCore r) (w.offset i.castSucc)) * cut.value (w.label i) (S.shiftCore (S.restrictCore r) (w.offset i.succ))) * (∏ p : S.Index, S.occurrenceFactor w p i (r p) * S.beta p ^ (if r p + (w.offset i.castSucc : ZMod (p : ℕ)) = 0 then 1 else 0))) · apply prod_congr rfl intro i _ rw [prod_mul_distrib] ring · rw [prod_mul_distrib, prod_comm]
lemma center_primeFactor_eq (S : PrimeSystem) (w : ClosedLine h ℓ) (p : S.Index) (hp : ¬S.IsCore p) (r : ZMod (p : ℕ)) : S.primeFactor w p r = centerPrimeFactor w.departures w.label r := by simp only [primeFactor, occurrenceFactor, hp, ite_false, beta, amplitude, add_eq_zero_iff_eq_neg, centerPrimeFactor, activeResidue, ClosedLine.departures, activity, betaZ] rfl
end OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WalkBetweenSupportimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WalkVerticesimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.BlockEdgesimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.AllForward
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.ForestTraversal Finset Classical SimpleGraphnoncomputable sectionvariable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ K : ℕ}variable {w : NumericalLine D h ℓ} {hh : 0<h}
lemma TreePath.vertices_in_block (P : TreePath w K) (b : Block (edgeGraph w.line hh w.line.treeSteps)) (hPE : ∀ i,P.edge i ∈ blockEdges b) : ∀ j,P.vertex j ∈ b.walk.support := by intro j cases j using Fin.cases with | zero => 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<e) := by let e₀ := (blockEdges b).min' hne let c := e₀.castSucc have hc : w.line.offset c ∈ b.walk.support := (block_edge_endpoints b e₀ (min'_mem _ _)).1 refine ⟨c,hc,?_⟩ intro e he by_cases hv : w.line.offset c=w.line.offset e.castSucc · exact Or.inl hv · right have ht : w.line.offset e.castSucc ∈ b.walk.support := (block_edge_endpoints b e he).1 obtain ⟨q,hq⟩ := walk_between_support (u := w.line.offset c) (v := w.line.offset e.castSucc) (localBlockWalk b) (by rwa [localBlockWalk_support]) (by rwa [localBlockWalk_support]) have hlen : q.length ≤ K := by rw [localBlockWalk_length] at hq; exact hq.trans hsmall obtain ⟨P,hP0,hPL,hPE⟩ := exists_treePath w hh (blockEdges_subset b) q hlen (mem_image.mpr ⟨c,mem_univ _,rfl⟩) hv have hf : ∀ i,P.forward i=true := P.all_forward hPE (by rw [hP0] exact min_origin_not_destination w.line (blockEdges_subset b) hne) exact ⟨P,hP0,hPL,P.edges_before_endpoint hf e hPL⟩
lemma block_local_paths (b : Block (edgeGraph w.line hh w.line.treeSteps)) (hsmall : b.walk.length ≤ K) (c v : Fin (ℓ+1)) (hc : w.line.offset c ∈ b.walk.support) (hv : w.line.offset v ∈ b.walk.support) : w.line.offset c=w.line.offset v ∨ ∃ P : TreePath w K, P.vertex 0=w.line.offset c ∧ P.vertex (Fin.last P.length)=w.line.offset v ∧ ∀ i,P.vertex i ∈ b.walk.support := by by_cases he : w.line.offset c=w.line.offset v · exact Or.inl he · right obtain ⟨q,hq⟩ := walk_between_support (u := w.line.offset c) (v := w.line.offset v) (localBlockWalk b) (by rwa [localBlockWalk_support]) (by rwa [localBlockWalk_support]) have hlen : q.length ≤ K := by rw [localBlockWalk_length] at hq; exact hq.trans hsmall obtain ⟨P,hP0,hPL,hPE⟩ := exists_treePath w hh (blockEdges_subset b) q hlen (mem_image.mpr ⟨c,mem_univ _,rfl⟩) he exact ⟨P,hP0,hPL,P.vertices_in_block b hPE⟩
endend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536import Mathlib
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.ForestTraversalopen Classical SimpleGraphnoncomputable sectionvariable {V : Type*} {G : SimpleGraph V}
lemma walk_between_support {s t u v : V} (p : G.Walk s t) (hu : u ∈ p.support) (hv : v ∈ p.support) : ∃ q : G.Walk u v,q.length ≤ p.length := by obtain ⟨p₁,p₂,hp⟩ := Walk.mem_support_iff_exists_append.mp hu have hlen : p₁.length+p₂.length=p.length := by rw [hp,Walk.length_append] rw [hp,Walk.mem_support_append_iff] at hv rcases hv with hv | hv · refine ⟨(p₁.dropUntil v hv).reverse,?_⟩ rw [Walk.length_reverse,Walk.length_dropUntil] omega · refine ⟨p₂.takeUntil v hv,?_⟩ exact (Walk.length_le_of_isSubwalk (p₂.isSubwalk_takeUntil hv)).trans (by omega)
endend OrdinaryCorrelations.ForestTraversal
end
end OAI12345678910111213141516171819202122232425262728293031323334import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ConnectedSet
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.Rerootingopen Classical Finset SimpleGraphnoncomputable sectionvariable {V : Type*} [DecidableEq V] {G : SimpleGraph V}
lemma walk_support_connected {x y : V} (p : G.Walk x y) : ConnectedSet G p.support.toFinset := by intro u hu v hv have hu' := List.mem_toFinset.mp hu have hv' := List.mem_toFinset.mp hv refine ⟨(p.takeUntil u hu').reverse.append (p.takeUntil v hv'),?_⟩ intro z hz apply List.mem_toFinset.mpr rw [Walk.mem_support_append_iff] at hz rcases hz with hz|hz · exact p.support_takeUntil_subset_support hu' (by simpa using hz) · exact p.support_takeUntil_subset_support hv' hzendend OrdinaryCorrelations.Rerooting
end
end OAI12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.UncutTreeEdges
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen Finset Classical SimpleGraphnoncomputable sectionvariable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L : ℕ}
lemma walk_vertices (w : ClosedLine h ℓ) (hh : 0<h) {E : Finset (Fin ℓ)} {u v : ℤ} (p : (edgeGraph w hh E).Walk u v) (hu : u ∈ treeVertices w) : ∀ z ∈ p.support,z ∈ treeVertices w := by induction p with | nil => 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<h) {E : Finset (Fin ℓ)} (hE : E ⊆ w.line.treeSteps) {u v : ℤ} (q : (edgeGraph w.line hh E).Walk u v) (hlen : q.length ≤ L) (hu : u ∈ treeVertices w.line) (hne : u≠v) : ∃ P : TreePath w L,P.vertex 0=u ∧ P.vertex (Fin.last P.length)=v ∧ ∀ i,P.edge i ∈ E := by let p := q.bypass have hp : p.IsPath := q.bypass_isPath have hpL : p.length ≤ L := q.length_bypass_le_length.trans hlen have hp0 : 0<p.length := by by_contra hn exact hne (Walk.eq_of_length_eq_zero (Nat.eq_zero_of_not_pos hn)) have hedge : ∀ i : Fin p.length,∃ e ∈ E, (p.getVert i.val=w.line.offset e.castSucc ∧ p.getVert (i.val+1)=w.line.offset e.succ) ∨ (p.getVert (i.val+1)=w.line.offset e.castSucc ∧ p.getVert i.val=w.line.offset e.succ) := fun i => 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⟩
endend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.BoundedLists
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.SourceCylinderopen Finset Classicalvariable {α ι : 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 α] inlemma 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 α] inlemma 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 α] inlemma 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 α] inlemma 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 α] inlemma 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SourceWitnessBasicScalesimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.PackedGapPrefactorimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.ComponentBoundAfterGap
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.FiniteIntegrationopen OrdinaryCorrelations.NumericalSubtrees Finset Classical Filternoncomputable 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 nlinarithlemma 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 NumericalLinelemma 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<epsilon/4)).tendsto_div_nhds_zero filter_upwards [source_witness_entropy_scales C₀ hC₀, hlim.eventually (eventually_le_nhds (by norm_num : (0:ℝ)<1/6)), eventually_ge_atTop (2:ℝ)] with B hs hlog hB have hB1 : 1≤B := by linarith have hB0 : 0<B := by linarith let M := sourceListSlotBudget C₀ B let ℓ := sourceLength B let L := pathLength B let J := ⌈C₀*Real.log B⌉₊ let t := listCutoff B have hbase0 : 0≤witnessEntropyBase (sourceSystem B) M ℓ (L+L) J t := by unfold witnessEntropyBase have := A_pos positivity have hbase : witnessEntropyBase (sourceSystem B) M ℓ (L+L) J t ≤ B^3 := by calc _ ≤ 2*witnessEntropyBase (sourceSystem B) M ℓ L J t := witness_base_double_path .. _ ≤ 2*(B^2) := mul_le_mul_of_nonneg_left hs.2 (by norm_num) _ ≤ B^3 := by nlinarith [sq_nonneg B] have hdegree : (witnessEntropyDegree M ℓ (L+L) J t:ℝ) ≤ 2*B^(1+epsilon/4) := by calc _ ≤ ((2*witnessEntropyDegree M ℓ L J t:ℕ):ℝ) := Nat.cast_le.mpr (witness_degree_double_path ..) _ ≤ _ := by push_cast; exact mul_le_mul_of_nonneg_left hs.1 (by norm_num) apply (packed_gap_polynomial_bound (sourceSystem B) M ℓ (L+L) J t).trans apply (pow_le_pow_left₀ hbase0 hbase _).trans rw [←Real.rpow_natCast,Real.rpow_def_of_pos (pow_pos hB0 3),Real.log_pow] apply Real.exp_le_exp.mpr have hlog0 := Real.log_nonneg hB1 have hl := (div_le_iff₀ (Real.rpow_pos_of_pos hB0 (epsilon/4))).mp hlog have hd := mul_le_mul hdegree hl hlog0 (by positivity : 0≤2*B^(1+epsilon/4)) have hid' : (2*B^(1+epsilon/4))*((1/6)*B^(epsilon/4))=(1/3)*B^(1+epsilon/2) := by calc _ = (1/3)*(B^(1+epsilon/4)*B^(epsilon/4)) := by ring _ = _ := by rw [←Real.rpow_add hB0]; congr 2; ring rw [hid'] at hd norm_num only [Nat.cast_ofNat] at * nlinarith
lemma source_disconnected_threshold (C₀ : ℝ) (hC₀ : 0≤C₀) : ∀ᶠ B : ℝ in atTop, (((((2*sourceLength B)/pathLength B+6*listCutoff B+1)^2)* ((2*⌈C₀*Real.log B⌉₊+1)*listCutoff B)^8:ℕ):ℝ) ≤ B^(1-2*rho) := by filter_upwards [source_component_budget,source_witness_basic_scales C₀ hC₀, eventually_const_mul_rpow_le (2*rho+8*(epsilon/8+4*epsilon)) (1-2*rho) (32^2*6^8) (by norm_num [rho,epsilon])] with B hcomp hs hdom obtain ⟨hB,hM,htL,ht,hJ,hH⟩ := hs have hB0 : 0<B := zero_lt_one.trans_le hB have ht' := ceil_rpow_le_two B (4*epsilon) hB (by norm_num [epsilon]) have hJ1 : 1≤B^(epsilon/8) := Real.one_le_rpow hB (by norm_num [epsilon]) have hn : (((2*⌈C₀*Real.log B⌉₊+1)*listCutoff B:ℕ):ℝ) ≤ 6*B^(epsilon/8+4*epsilon) := by push_cast calc _ ≤ (3*B^(epsilon/8))*(2*B^(4*epsilon)) := mul_le_mul (by linarith) ht' (Nat.cast_nonneg _) (by positivity) _ = _ := by rw [Real.rpow_add hB0]; ring have hq := pow_le_pow_left₀ (Nat.cast_nonneg (α:=ℝ) _) hcomp.2 2 have hn8 := pow_le_pow_left₀ (Nat.cast_nonneg (α:=ℝ) _) hn 8 have hmul := mul_le_mul hq hn8 (by positivity) (by positivity) have he : (32*B^rho)^2*(6*B^(epsilon/8+4*epsilon))^8 = (32^2*6^8)*B^(2*rho+8*(epsilon/8+4*epsilon)) := by have hp2 : (B^rho)^2 = B^(rho*2) := by rw [Real.rpow_mul hB0.le] norm_num have hp8 : (B^(epsilon/8+4*epsilon))^8 = B^((epsilon/8+4*epsilon)*8) := by rw [Real.rpow_mul hB0.le] norm_num rw [mul_pow,mul_pow,hp2,hp8] calc _ = (32^2*6^8)*(B^(rho*2)*B^((epsilon/8+4*epsilon)*8)) := by ring _ = _ := by rw [←Real.rpow_add hB0]; congr 2; ring rw [he] at hmul exact le_trans (by simpa only [Nat.cast_mul,Nat.cast_pow] using hmul) hdom
end NumericalLineendend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.GlobalRecordimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.DataInjectiveimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.LinePrimeMemFullUsed
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen Finset Classicalvariable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L t : ℕ}
structure WitnessConfiguration (D : S.DivisorFamily B τ C₀) (h ℓ L t : ℕ) where line : ClosedLine h ℓ labels : ∀ i, line.label i ∈ D.members primitives : List (AttachedSpec line D L) length_le : primitives.length ≤ t family : PrivateFamily line D L t
abbrev WitnessCodeSlot (ℓ L J t : ℕ) := (Fin ℓ × Fin J) ⊕ (ListCodeSlot L J t ⊕ ((Fin t × SpecCodeSlot L J) ⊕ Fin t))
abbrev WitnessMetadata (ℓ L t : ℕ) := (Fin ℓ → Bool) × ListMetadata ℓ L t × (Fin t → AttachedMetadata ℓ L)
namespace WitnessConfigurationvariable (x : WitnessConfiguration D h ℓ L t)
noncomputable def metadata : WitnessMetadata ℓ L t := (signBit x.line,listMetadata x.line x.primitives t x.length_le, fun j => 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 WitnessConfigurationend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.CylinderBudgetimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessSlotCount
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTraceopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.UnselectedCardimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessTestDescriptor
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SharedSlotPatternsopen 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessTestShapeimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.OfRelabel
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SharedSlotPatternsopen Finset Classical
abbrev WitnessTestDescriptor (ℓ L t m : ℕ) := WitnessTestShape ℓ L t × Fin m × Fin m × Boolabbrev 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 WitnessTemplateCodevariable {ℓ L J t m : ℕ}noncomputable def rank (d : WitnessTemplateCode ℓ L J t m) : ℕ := d.2.2.1.valnoncomputable def selected (d : WitnessTemplateCode ℓ L J t m) (i : Fin d.rank) : Fin m := (d.2.2.2 i).2.1noncomputable def modulus (d : WitnessTemplateCode ℓ L J t m) (i : Fin d.rank) : Fin m := (d.2.2.2 i).2.2.1noncomputable def linear (d : WitnessTemplateCode ℓ L J t m) (i : Fin d.rank) : Bool := (d.2.2.2 i).2.2.2noncomputable 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<j → d.selected j ∉ insert (d.modulus i) (d.expression h i).support)
noncomputable def embedding (d : WitnessTemplateCode ℓ L J t m) (h : ℕ) (hd : d.WellFormed h) : Fin d.rank ↪ Fin m := ⟨d.selected,hd.1⟩noncomputable def system (d : WitnessTemplateCode ℓ L J t m) (h : ℕ) (hd : d.WellFormed h) : TriangularExpressions (d.embedding h hd) ((ℓ+L)+L) where expression := d.expression h modulus := d.modulus linear := d.linear divisor_modulus := hd.2.1 divisor_own_absent := hd.2.2.1 linear_modulus_ne := hd.2.2.2.1 future_absent := hd.2.2.2.2
lemma wellFormed_of_relabel (d : WitnessTemplateCode ℓ L J t m) (h : ℕ) {α : Type*} [DecidableEq α] (v : Fin m ↪ α) (e : Fin d.rank ↪ α) (q : TriangularExpressions e ((ℓ+L)+L)) (hs : ∀ i, v (d.selected i)=e i) (he : ∀ i, (d.expression h i).relabel v=q.expression i) (hm : ∀ i, v (d.modulus i)=q.modulus i) (hl : ∀ i, d.linear i=q.linear i) : d.WellFormed h := by have hinj : Function.Injective d.selected := by intro i j hij apply e.injective rw [←hs i,←hs j,hij] let e' : Fin d.rank ↪ Fin m := ⟨d.selected,hinj⟩ let c := q.ofRelabel v e' hs (d.expression h) d.modulus he hm refine ⟨hinj,?_,?_,?_,?_⟩ · intro i hi exact c.divisor_modulus i (by simpa only [c,TriangularExpressions.ofRelabel,←hl] using hi) · intro i hi exact c.divisor_own_absent i (by simpa only [c,TriangularExpressions.ofRelabel,←hl] using hi) · intro i hi exact c.linear_modulus_ne i (by simpa only [c,TriangularExpressions.ofRelabel,←hl] using hi) · exact c.future_absent
lemma system_admissible_of_relabel (d : WitnessTemplateCode ℓ L J t m) (h : ℕ) (hd : d.WellFormed h) {α : Type*} [DecidableEq α] (v : Fin m ↪ α) (e : Fin d.rank ↪ α) (q : TriangularExpressions e ((ℓ+L)+L)) (hs : ∀ i, v (d.selected i)=e i) (he : ∀ i, (d.expression h i).relabel v=q.expression i) (hm : ∀ i, v (d.modulus i)=q.modulus i) (hl : ∀ i, d.linear i=q.linear i) (P K : ℝ) (x : α → ℕ) (hx : q.Admissible P K x) : (d.system h hd).Admissible P K (fun a => 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 WitnessTemplateCodeend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.Symbolicimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.WitnessConfigurationimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SpecSegmentimport OAI.NumberTheory.OrdinaryCorrelations.HighTrace.RelabelAppend
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.GraphKernel.PrimeSystemopen OrdinaryCorrelations.SignedTrace OrdinaryCorrelations.NumericalSubtreesopen OrdinaryCorrelations.ArithmeticSaving OrdinaryCorrelations.SharedSlotPatternsopen 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 WitnessTestShapenoncomputable 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] ringend WitnessTestShape
variable {S : PrimeSystem} {B τ C₀ : ℝ} {D : S.DivisorFamily B τ C₀} {h ℓ L t : ℕ}namespace WitnessConfigurationvariable (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 WitnessConfigurationend OrdinaryCorrelations.GraphKernel.PrimeSystem
end
end OAI1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495import OAI.NumberTheory.OrdinaryCorrelations.HighTrace.SquarefreeExpression
namespace OAI
noncomputable sectionopen scoped BigOperatorsopen Finsetopen Finset Classicalopen Filteropen Finset Classical Filteropen scoped Topology
namespace OrdinaryCorrelations.ArithmeticSaving.SquarefreeExpressionopen Finset Classicalvariable {ι : 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 OAI123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternNormRateimport OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticSlotProductsimport OAI.NumberTheory.Ostmann.Arithmetic.BulkKernelCellErrorimport OAI.NumberTheory.Ostmann.Arithmetic.BulkLogPairComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.BulkLogWeightedCellComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.BulkPageProjectionimport OAI.NumberTheory.Ostmann.Arithmetic.BulkStatisticBoundimport OAI.NumberTheory.Ostmann.Arithmetic.CRTInternalLinesimport OAI.NumberTheory.Ostmann.Arithmetic.CRTLineProbabilitiesimport OAI.NumberTheory.Ostmann.Arithmetic.CompensatedHistoryRateimport OAI.NumberTheory.Ostmann.Arithmetic.ForwardHistoryRateimport OAI.NumberTheory.Ostmann.Arithmetic.GlobalHistoryPairDecayimport OAI.NumberTheory.Ostmann.Arithmetic.HarmonicGraphCancellationimport OAI.NumberTheory.Ostmann.Arithmetic.IdealSmoothHistoryNormimport OAI.NumberTheory.Ostmann.Arithmetic.JointLineComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.LeafFrequencySupportimport OAI.NumberTheory.Ostmann.Arithmetic.LeafModulusRangesimport OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeFullHarmonicCostimport OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeStepimport OAI.NumberTheory.Ostmann.Arithmetic.MovingArithmeticPageDeletionimport OAI.NumberTheory.Ostmann.Arithmetic.MovingArithmeticScaleimport OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkLogVariationimport OAI.NumberTheory.Ostmann.Arithmetic.MovingBulkSupportimport OAI.NumberTheory.Ostmann.Arithmetic.MovingCompleteIntegerCellsimport OAI.NumberTheory.Ostmann.Arithmetic.MovingConstructedProductStepimport OAI.NumberTheory.Ostmann.Arithmetic.MovingEarlyTemplateCapsimport OAI.NumberTheory.Ostmann.Arithmetic.MovingFieldBulkComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.MovingFirstNodeWindowsimport OAI.NumberTheory.Ostmann.Arithmetic.MovingFrequencyEnergyimport OAI.NumberTheory.Ostmann.Arithmetic.MovingFullPairimport OAI.NumberTheory.Ostmann.Arithmetic.MovingJointSquareLossimport OAI.NumberTheory.Ostmann.Arithmetic.MovingMixedResidueRateimport OAI.NumberTheory.Ostmann.Arithmetic.MovingNormalizedEnergyBoundimport OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalEnergyBoundimport OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalGiantComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalLogGiantWeightimport OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalPairimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPairAdaptiveSupportimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternGoodMaskedPriorsimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternHalfLogTwoPrimeIntegratedRateimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternLinesimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternLogLeafBridgeimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternLogTwoPrimeIntegratedRateimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternMainGainimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternSameNormArithmeticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternSignedArithmeticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternSignedMajorantimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWholeShellArithmeticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWindowWeightedWholeShellimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWindowWholeShellArithmeticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternWordArithmeticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPrimeInternalNormimport OAI.NumberTheory.Ostmann.Arithmetic.MovingPrimeResidueRateimport OAI.NumberTheory.Ostmann.Arithmetic.MovingRealWeightimport OAI.NumberTheory.Ostmann.Arithmetic.MovingRegularOuterComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSampleDiagonalRateimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedDiagonalDecayimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedEarlyDiagonalDecayimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedPhaseStatisticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedPrimeEnergyimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedPrimeStatisticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSelectedStatisticimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSeparatedOuterComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSmoothPrimeComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSpectatorRangeUnitsimport OAI.NumberTheory.Ostmann.Arithmetic.MovingSupportedOuterComparisonimport OAI.NumberTheory.Ostmann.Arithmetic.MovingTaggedPrimeCoreimport OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateMatchedBoundimport OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateNormalizerimport OAI.NumberTheory.Ostmann.Arithmetic.NaturalScheduleEnergyimport OAI.NumberTheory.Ostmann.Arithmetic.PeriodicGraphCancellationimport OAI.NumberTheory.Ostmann.Arithmetic.PrimeIntegerTransferimport OAI.NumberTheory.Ostmann.Arithmetic.RangedPairAdmissibilityimport OAI.NumberTheory.Ostmann.Arithmetic.RecursiveArchimedeanCutoffimport OAI.NumberTheory.Ostmann.Arithmetic.ReducedCoefficientLiftimport OAI.NumberTheory.Ostmann.Arithmetic.ResidueProductSupportimport OAI.NumberTheory.Ostmann.Arithmetic.SmoothCellRateimport OAI.NumberTheory.Ostmann.Characters.AnchorDiagonalTotalimport OAI.NumberTheory.Ostmann.Characters.CharacterCompletedOrderOneimport OAI.NumberTheory.Ostmann.Characters.CharacterFinalTopimport OAI.NumberTheory.Ostmann.Characters.MixedGiantIdealizationimport OAI.NumberTheory.Ostmann.Characters.PrimeCorrelationBoundsimport OAI.NumberTheory.Ostmann.Characters.QuartetAllMajorantsimport OAI.NumberTheory.Ostmann.Characters.QuartetFriendlyBoundimport OAI.NumberTheory.Ostmann.Construction.BalancedHalfInitialAmplitudeimport OAI.NumberTheory.Ostmann.Construction.ConstituentFinalComparisonimport OAI.NumberTheory.Ostmann.Construction.ConstituentFourierBridgeimport OAI.NumberTheory.Ostmann.Construction.ConstituentMatchingRateimport OAI.NumberTheory.Ostmann.Construction.ConstituentOriginalPairimport OAI.NumberTheory.Ostmann.Construction.ConstituentSelectedProductsimport OAI.NumberTheory.Ostmann.Construction.DiagonalRegularLiftimport OAI.NumberTheory.Ostmann.Construction.DyadicGraphHistoryimport OAI.NumberTheory.Ostmann.Construction.FinalArithmeticContradictionimport OAI.NumberTheory.Ostmann.Construction.FinalAsymptoticComparisonimport OAI.NumberTheory.Ostmann.Construction.FinalEnergyCutoffimport OAI.NumberTheory.Ostmann.Construction.FinalOneSidedFactorimport OAI.NumberTheory.Ostmann.Construction.FiniteMatchedFubiniimport OAI.NumberTheory.Ostmann.Construction.FiniteScheduledTemplateimport OAI.NumberTheory.Ostmann.Construction.FormulaHistoryGraphBoundimport OAI.NumberTheory.Ostmann.Construction.FrozenOriginalBulkimport OAI.NumberTheory.Ostmann.Construction.FullPrimeRatioPairimport OAI.NumberTheory.Ostmann.Construction.HarmonicMatchedEnergyimport OAI.NumberTheory.Ostmann.Construction.HistoryLineComparisonimport OAI.NumberTheory.Ostmann.Construction.HistoryResidueDataimport OAI.NumberTheory.Ostmann.Construction.InitialOutsideTransformimport OAI.NumberTheory.Ostmann.Construction.InitialProductSizeimport OAI.NumberTheory.Ostmann.Construction.InitialWordSupportimport OAI.NumberTheory.Ostmann.Construction.IntegerGridSupportimport OAI.NumberTheory.Ostmann.Construction.NaturalBadDiagonalimport OAI.NumberTheory.Ostmann.Construction.OriginalKernelComparisonimport OAI.NumberTheory.Ostmann.Construction.OriginalPrimeRestorationimport OAI.NumberTheory.Ostmann.Construction.PhaseGiantInitialStatisticimport OAI.NumberTheory.Ostmann.Construction.PrimeCutoffFactorsimport OAI.NumberTheory.Ostmann.Construction.PrimeTupleDiagonalimport OAI.NumberTheory.Ostmann.Construction.RepeatedPivotPhaseimport OAI.NumberTheory.Ostmann.Construction.ScheduledAnchorDiagonalSplitimport OAI.NumberTheory.Ostmann.Construction.ScheduledAnchorEnergyBoundimport OAI.NumberTheory.Ostmann.Construction.ScheduledDistinctSourcesimport OAI.NumberTheory.Ostmann.Construction.ScheduledFinalBoundimport OAI.NumberTheory.Ostmann.Construction.ScheduledFinalPrimeComparisonimport OAI.NumberTheory.Ostmann.Construction.ScheduledIntervalStepimport OAI.NumberTheory.Ostmann.Construction.ScheduledNonanchorDecayimport OAI.NumberTheory.Ostmann.Construction.ScheduledSpectatorComparisonimport OAI.NumberTheory.Ostmann.Construction.ScheduledSpectatorProductsimport OAI.NumberTheory.Ostmann.Construction.SelectedAnchorEnergyBoundimport OAI.NumberTheory.Ostmann.Construction.SelectedAnchorSupportedEnergyimport OAI.NumberTheory.Ostmann.Construction.SelectedCutoffDataimport OAI.NumberTheory.Ostmann.Construction.SelectedFinalNaturalPrimeComparisonimport OAI.NumberTheory.Ostmann.Construction.SelectedFinalPrimeComparisonimport OAI.NumberTheory.Ostmann.Construction.SelectedNodeSourcesimport OAI.NumberTheory.Ostmann.Construction.SelectedNonanchorDecayimport OAI.NumberTheory.Ostmann.Construction.SmoothGiantLossBudgetimport OAI.NumberTheory.Ostmann.Construction.SmoothMatchedPriorimport OAI.NumberTheory.Ostmann.Construction.UniformInitialAmplitudeimport OAI.NumberTheory.Ostmann.Construction.WeightedRegularNormimport OAI.NumberTheory.Ostmann.PaperMainimport OAI.NumberTheory.Ostmann.Preliminaries.Reductionimport OAI.NumberTheory.Ostmann.Quadratic.CommonCenterFromApproximationimport OAI.NumberTheory.Ostmann.Quadratic.KernelPopulationDiscardimport OAI.NumberTheory.Ostmann.Quadratic.QuadraticIntervalInverseimport OAI.NumberTheory.Ostmann.Quadratic.QuadraticNegligibleErrorimport OAI.NumberTheory.Ostmann.Quadratic.QuadraticSecondCorrectionsimport OAI.NumberTheory.Ostmann.Quadratic.QuadraticVaryingSmoothimport OAI.NumberTheory.Ostmann.Quadratic.QuadraticWholeDivisorBoundimport OAI.NumberTheory.Ostmann.QuadraticCenter.RootSeparationimport OAI.NumberTheory.Ostmann.Tree.PairMomentimport OAI.NumberTheory.Ostmann.ZeroDensity.ActualPrincipalPNTimport OAI.NumberTheory.Ostmann.ZeroDensity.ArithmeticProgressionRowsimport OAI.NumberTheory.Ostmann.ZeroDensity.BulkAbsoluteDensityimport OAI.NumberTheory.Ostmann.ZeroDensity.CharacterContourHeightsimport OAI.NumberTheory.Ostmann.ZeroDensity.DensityFiniteIntegralEnergyimport OAI.NumberTheory.Ostmann.ZeroDensity.NonexceptionalRieszDecay1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465import Mathlib
namespace OAI
noncomputable sectionnamespace Ostmann.Arithmetic.AccidentalDivisibilityopen 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 OAIlean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SumPeriodBlocks.leanAdded+77
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Support.leanAdded+90
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportEqUsed.leanAdded+107
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/SupportIffExtraOrLabel.leanAdded+107
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Symbolic.leanAdded+154
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedEdgeProduct.leanAdded+96
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShape.leanAdded+106
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TaggedShapeMap.leanAdded+111
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Test.leanAdded+163
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TestVacuous.leanAdded+108
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TiltedListLocalMean.leanAdded+99
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TokenSlot.leanAdded+212
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Topology.leanAdded+135
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TopologyTreeSteps.leanAdded+133
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalCodeMass.leanAdded+54
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TotalUnlitCountEqSubtype.leanAdded+58
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeBlocksWithEdges.leanAdded+77
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeDestinationInjective.leanAdded+112
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdge.leanAdded+137
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeEdgeInjective.leanAdded+95
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeOccurrences.leanAdded+232
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeOccurrencesEmptyOfFree.leanAdded+155
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreePrimeSupport.leanAdded+131
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TreeVertices.leanAdded+134
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoBlockRerooting.leanAdded+101
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/TwoTermBinomial.leanAdded+164
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UncutTreeEdges.leanAdded+163
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UnlitPolynomialBound.leanAdded+125
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Unselected.leanAdded+92
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UnselectedCard.leanAdded+24
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedEdgeCode.leanAdded+87
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UntaggedReferenceWeight.leanAdded+104
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/UsedPrimeReciprocal.leanAdded+133
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexAt.leanAdded+89
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexIndex.leanAdded+128
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VertexWeight.leanAdded+62
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/VerticesInBlock.leanAdded+90
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WalkBetweenSupport.leanAdded+36
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WalkSupportConnected.leanAdded+34
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WalkVertices.leanAdded+88
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/Witness.leanAdded+110
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessBaseDoublePath.leanAdded+124
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessConfiguration.leanAdded+149
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessEntropyBase.leanAdded+117
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessSlotCount.leanAdded+100
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestDescriptor.leanAdded+139
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/WitnessTestShape.leanAdded+130
lean/OAI/NumberTheory/OrdinaryCorrelations/HighTrace/ZeroExpression.leanAdded+95
lean/OAI/NumberTheory/Ostmann/All.leanAdded+152
lean/OAI/NumberTheory/Ostmann/Arithmetic/AccidentalDivisibility.leanAdded+65