namespace Green39Submission abbrev PrimeIndex := {p : ℕ // p.Prime} end Green39Submission section PrimeNonzero variable [primeNonzero : ∀ p : Green39Submission.PrimeIndex, NeZero (p : ℕ)] /- Deterministic development assembly. No submission-readiness claim. -/ /- Source: Green39Submission.Definitions; SHA256 a1749b0be3c7a3e555ec52daedd29e35c843a382292a058a1582536218ebde1f -/ section Green39AssemblyScope_a6f04a854f1bd118 /-! Shared finite definitions for the Green39 formalization. Input probabilities are exact finite counts, including on the exact-cardinality slice. The auxiliary Bernoulli definitions below concern source thinning only. No assertion about the principal covering theorem is made in this module. -/ namespace Green39Submission open scoped BigOperators Pointwise universe u v /-- Uniform probability on a finite sample space. The empty-space value is zero. -/ noncomputable def uniformProb {α : Type u} (sample : Finset α) (event : α → Prop) : ℝ := by classical exact ((sample.filter event).card : ℝ) / (sample.card : ℝ) /-- Exact finite mean. The empty-space value is zero. -/ noncomputable def uniformMean {α : Type u} (sample : Finset α) (f : α → ℝ) : ℝ := (∑ a ∈ sample, f a) / (sample.card : ℝ) /-- The finite sample space of all `k`-element subsets of `universe`. -/ def exactSlice {α : Type u} (U : Finset α) (k : ℕ) : Finset (Finset α) := U.powersetCard k /-- Number of representations of `x` as an element of `A` plus an element of `T`. -/ def representationCount {G : Type v} [AddCommGroup G] [DecidableEq G] (A T : Finset G) (x : G) : ℕ := (T.filter (fun t => x - t ∈ A)).card /-- Targets left uncovered by the translating set `T`. -/ def holeSet {G : Type v} [AddCommGroup G] [DecidableEq G] [Fintype G] (A T : Finset G) : Finset G := Finset.univ \ (A + T) /-- Coverability with at most the literal number `c` of distinct translates. -/ def coverable {G : Type v} [AddCommGroup G] [DecidableEq G] [Fintype G] (A : Finset G) (c : ℕ) : Prop := ∃ T : Finset G, T.card ≤ c ∧ A + T = Finset.univ /-- Source-thinning weight; used for `selected ⊆ universe`. -/ noncomputable def bernoulliWeight {α : Type u} [DecidableEq α] (U selected : Finset α) (θ : ℝ) : ℝ := θ ^ selected.card * (1 - θ) ^ (U \ selected).card /-- Finite source-thinning mean, summed over every subset of the fixed universe. -/ noncomputable def bernoulliMean {α : Type u} [DecidableEq α] (U : Finset α) (θ : ℝ) (f : Finset α → ℝ) : ℝ := ∑ selected ∈ U.powerset, bernoulliWeight U selected θ * f selected /-- Inputs protected by an exceptional set or by a selected ordinary alias. -/ def protectedInputs {G : Type v} [AddCommGroup G] [DecidableEq G] (A E0 S D : Finset G) : Finset G := E0 ∪ (A ∩ (S - D)) /-- A finite nonnegative-containment polynomial when its supplied weights are nonnegative. The definition itself permits arbitrary real weights and retains repeated support labels. -/ noncomputable def containmentSum {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (B : Finset α) : ℝ := by classical exact ∑ i ∈ I, if support i ⊆ B then weight i else 0 theorem mem_exactSlice {α : Type u} {U A : Finset α} {k : ℕ} : A ∈ exactSlice U k ↔ A ⊆ U ∧ A.card = k := by exact Finset.mem_powersetCard theorem card_exactSlice {α : Type u} (U : Finset α) (k : ℕ) : (exactSlice U k).card = U.card.choose k := by exact Finset.card_powersetCard k U theorem exactSlice_nonempty {α : Type u} {U : Finset α} {k : ℕ} : (exactSlice U k).Nonempty ↔ k ≤ U.card := by exact Finset.powersetCard_nonempty theorem exactSlice_eq_empty_iff {α : Type u} {U : Finset α} {k : ℕ} : exactSlice U k = ∅ ↔ U.card < k := by exact Finset.powersetCard_eq_empty /-- Exact cardinality of the containing slice, with no independence approximation. -/ theorem card_exactSlice_filter_subset {α : Type u} [DecidableEq α] (U S : Finset α) (k : ℕ) (hSU : S ⊆ U) (hSk : S.card ≤ k) : ((exactSlice U k).filter (fun B => S ⊆ B)).card = (U.card - S.card).choose (k - S.card) := by exact Finset.card_filter_powersetCard_subset S U k hSU hSk theorem mem_holeSet {G : Type v} [AddCommGroup G] [DecidableEq G] [Fintype G] (A T : Finset G) (x : G) : x ∈ holeSet A T ↔ x ∉ A + T := by simp [holeSet] end Green39Submission end Green39AssemblyScope_a6f04a854f1bd118 /- Source: Green39Submission.Coverage; SHA256 2a772767667b5df7ba18196a4426499b07edd0fd21b8a1c61b1c59cac12add8e -/ section Green39AssemblyScope_e55302cfa6458e3c /-! Deterministic coverage identities used to connect the two probabilistic obstructions to the exact native cover event. No probabilistic conclusion is assumed or proved in this module. -/ namespace Green39Submission open scoped BigOperators Pointwise universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] theorem representationCount_pos_iff {A T : Finset G} {x : G} : 0 < representationCount A T x ↔ x ∈ A + T := by classical rw [representationCount, Finset.card_pos] constructor · rintro ⟨t, ht⟩ rcases Finset.mem_filter.mp ht with ⟨ht, hxt⟩ exact Finset.mem_add.mpr ⟨x - t, hxt, t, ht, sub_add_cancel x t⟩ · intro hx rcases Finset.mem_add.mp hx with ⟨a, ha, t, ht, rfl⟩ exact ⟨t, Finset.mem_filter.mpr ⟨ht, by simpa using ha⟩⟩ theorem representationCount_eq_zero_iff {A T : Finset G} {x : G} : representationCount A T x = 0 ↔ x ∉ A + T := by rw [← representationCount_pos_iff] omega theorem representationCount_le_card_right (A T : Finset G) (x : G) : representationCount A T x ≤ T.card := Finset.card_filter_le _ _ theorem representationCount_le_card_left (A T : Finset G) (x : G) : representationCount A T x ≤ A.card := by classical unfold representationCount apply Finset.card_le_card_of_injOn (fun t : G => x - t) · intro t ht exact (Finset.mem_filter.mp ht).2 · intro a ha b hb hab exact sub_right_inj.mp hab theorem representationCount_mono {A A' T T' : Finset G} (hA : A ⊆ A') (hT : T ⊆ T') (x : G) : representationCount A T x ≤ representationCount A' T' x := by apply Finset.card_le_card intro t ht rcases Finset.mem_filter.mp ht with ⟨ht, hxt⟩ exact Finset.mem_filter.mpr ⟨hT ht, hA hxt⟩ section Finite variable [Fintype G] theorem holeSet_eq_filter_zero (A T : Finset G) : holeSet A T = Finset.univ.filter (fun x => representationCount A T x = 0) := by ext x simp [mem_holeSet, representationCount_eq_zero_iff] theorem holeSet_eq_empty_iff (A T : Finset G) : holeSet A T = ∅ ↔ A + T = Finset.univ := by rw [holeSet, Finset.sdiff_eq_empty_iff_subset] exact ⟨fun h => Finset.Subset.antisymm (Finset.subset_univ _) h, fun h => h ▸ Finset.Subset.refl _⟩ theorem holeSet_card_eq_zero_iff (A T : Finset G) : (holeSet A T).card = 0 ↔ A + T = Finset.univ := by rw [Finset.card_eq_zero, holeSet_eq_empty_iff] theorem holeSet_card_add_covered_card (A T : Finset G) : (holeSet A T).card + (A + T).card = Fintype.card G := by simpa [holeSet] using Finset.card_sdiff_add_card_eq_card (Finset.subset_univ (A + T)) theorem holeSet_antitone {A A' T T' : Finset G} (hA : A ⊆ A') (hT : T ⊆ T') : holeSet A' T' ⊆ holeSet A T := by intro x hx apply (mem_holeSet A T x).2 intro hxt exact (mem_holeSet A' T' x).1 hx (Finset.add_subset_add hA hT hxt) theorem coverable_mono_budget {A : Finset G} {c c' : ℕ} (hcc' : c ≤ c') (h : coverable A c) : coverable A c' := by rcases h with ⟨T, hT, hcover⟩ exact ⟨T, hT.trans hcc', hcover⟩ theorem coverable_mono_input {A A' : Finset G} {c : ℕ} (hA : A ⊆ A') (h : coverable A c) : coverable A' c := by rcases h with ⟨T, hT, hcover⟩ refine ⟨T, hT, Finset.Subset.antisymm (Finset.subset_univ _) ?_⟩ rw [← hcover] exact Finset.add_subset_add hA (Finset.Subset.refl _) /-- Padding here preserves coverage and the rich-target lower profile. It does not assert the finer off-exception profile cap needed by the sparse theorem. -/ theorem exists_cover_exact_budget {A : Finset G} {c : ℕ} (hc : c ≤ Fintype.card G) (h : coverable A c) : ∃ T : Finset G, T.card = c ∧ A + T = Finset.univ := by rcases h with ⟨T, hT, hcover⟩ obtain ⟨T', hTT', _, hT'⟩ := Finset.exists_subsuperset_card_eq (Finset.subset_univ T) hT (by simpa using hc) refine ⟨T', hT', Finset.Subset.antisymm (Finset.subset_univ _) ?_⟩ rw [← hcover] exact Finset.add_subset_add (Finset.Subset.refl _) hTT' theorem not_coverable_of_positive_holes {A : Finset G} {c : ℕ} (h : ∀ T : Finset G, T.card ≤ c → 0 < (holeSet A T).card) : ¬ coverable A c := by rintro ⟨T, hT, hcover⟩ have hz := (holeSet_card_eq_zero_iff A T).2 hcover have hp := h T hT omega theorem not_coverable_of_linear_holes {A : Finset G} {c : ℕ} {γ : ℝ} (hγ : 0 < γ) (h : ∀ T : Finset G, T.card ≤ c → γ * (Fintype.card G : ℝ) ≤ ((holeSet A T).card : ℝ)) : ¬ coverable A c := by apply not_coverable_of_positive_holes intro T hT have hcard : (0 : ℝ) < Fintype.card G := by exact_mod_cast (Fintype.card_pos : 0 < Fintype.card G) have hpos : (0 : ℝ) < (holeSet A T).card := (mul_pos hγ hcard).trans_le (h T hT) exact_mod_cast hpos theorem card_targets_for_source (A : Finset G) (t : G) : (Finset.univ.filter (fun x : G => x - t ∈ A)).card = A.card := by have hset : Finset.univ.filter (fun x : G => x - t ∈ A) = A.image (fun a => a + t) := by ext x simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_image] constructor · intro hx exact ⟨x - t, hx, sub_add_cancel x t⟩ · rintro ⟨a, ha, rfl⟩ simpa using ha rw [hset] exact Finset.card_image_of_injective _ (fun a b h => add_right_cancel h) /-- The total representation mass is exact, without independence assumptions. -/ theorem sum_representationCount (A T : Finset G) : (∑ x : G, representationCount A T x) = A.card * T.card := by classical calc (∑ x : G, representationCount A T x) = ∑ x : G, ∑ t ∈ T, if x - t ∈ A then (1 : ℕ) else 0 := by simp only [representationCount, Finset.card_eq_sum_ones, Finset.sum_filter] _ = ∑ t ∈ T, ∑ x : G, if x - t ∈ A then (1 : ℕ) else 0 := Finset.sum_comm _ = ∑ _t ∈ T, A.card := by apply Finset.sum_congr rfl intro t ht rw [← Finset.sum_filter] simpa using card_targets_for_source A t _ = A.card * T.card := by simp [Nat.mul_comm] end Finite end Green39Submission end Green39AssemblyScope_e55302cfa6458e3c /- Source: Green39Submission.FiniteProbability; SHA256 a0b1fb70f16e5ba336854516633dcb7728e2957fcf2ee07e357f71d75fc10115 -/ section Green39AssemblyScope_610abb236bf2a449 /-! Exact finite probability and expectation. All results here are finite count identities or elementary inequalities. The principal zero-limit theorem is neither assumed nor proved in this module. This module is independent of the native conjecture and target bridge. -/ namespace Green39Submission open scoped BigOperators Pointwise universe u v variable {α : Type u} {ι : Type v} /-- Count form with any supplied decidability instance. -/ theorem uniformProb_eq_card_filter (sample : Finset α) (event : α → Prop) [DecidablePred event] : uniformProb sample event = ((sample.filter event).card : ℝ) / (sample.card : ℝ) := by unfold uniformProb congr theorem uniformProb_empty (event : α → Prop) : uniformProb (∅ : Finset α) event = 0 := by classical simp [uniformProb] theorem uniformProb_false (sample : Finset α) : uniformProb sample (fun _ => False) = 0 := by classical simp [uniformProb] theorem uniformProb_true (sample : Finset α) (hs : sample.Nonempty) : uniformProb sample (fun _ => True) = 1 := by classical have hc : (sample.card : ℝ) ≠ 0 := by exact_mod_cast hs.card_pos.ne' simp [uniformProb, hc] theorem uniformProb_nonneg (sample : Finset α) (event : α → Prop) : 0 ≤ uniformProb sample event := by classical unfold uniformProb positivity theorem uniformProb_le_one (sample : Finset α) (event : α → Prop) : uniformProb sample event ≤ 1 := by classical by_cases hs : sample = ∅ · simp [hs, uniformProb_empty] have hc : 0 < (sample.card : ℝ) := by exact_mod_cast (Finset.nonempty_iff_ne_empty.mpr hs).card_pos unfold uniformProb apply (div_le_one hc).2 exact_mod_cast Finset.card_filter_le sample event theorem uniformProb_congr (sample : Finset α) (P Q : α → Prop) (h : ∀ a ∈ sample, P a ↔ Q a) : uniformProb sample P = uniformProb sample Q := by classical have hf : sample.filter P = sample.filter Q := Finset.filter_congr h simp only [uniformProb, hf] theorem uniformProb_mono (sample : Finset α) (P Q : α → Prop) (h : ∀ a ∈ sample, P a → Q a) : uniformProb sample P ≤ uniformProb sample Q := by classical have hf : sample.filter P ⊆ sample.filter Q := by intro a ha rcases Finset.mem_filter.mp ha with ⟨has, hPa⟩ exact Finset.mem_filter.mpr ⟨has, h a has hPa⟩ unfold uniformProb apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg sample.card) exact_mod_cast Finset.card_le_card hf theorem uniformProb_or_le (sample : Finset α) (P Q : α → Prop) : uniformProb sample (fun a => P a ∨ Q a) ≤ uniformProb sample P + uniformProb sample Q := by classical have hf : sample.filter (fun a => P a ∨ Q a) ⊆ sample.filter P ∪ sample.filter Q := by intro a ha rcases Finset.mem_filter.mp ha with ⟨has, hPa | hQa⟩ · exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨has, hPa⟩) · exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨has, hQa⟩) have hc : (sample.filter (fun a => P a ∨ Q a)).card ≤ (sample.filter P).card + (sample.filter Q).card := (Finset.card_le_card hf).trans (Finset.card_union_le _ _) have hcr : ((sample.filter (fun a => P a ∨ Q a)).card : ℝ) ≤ ((sample.filter P).card : ℝ) + ((sample.filter Q).card : ℝ) := by exact_mod_cast hc simp only [uniformProb_eq_card_filter, ← add_div] apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg sample.card) convert hcr using 1 <;> congr theorem uniformProb_union_le (sample : Finset α) (P Q : α → Prop) : uniformProb sample (fun a => P a ∨ Q a) ≤ uniformProb sample P + uniformProb sample Q := uniformProb_or_le sample P Q theorem uniformProb_exists_mem_le_sum (sample : Finset α) (I : Finset ι) (event : ι → α → Prop) : uniformProb sample (fun a => ∃ i ∈ I, event i a) ≤ ∑ i ∈ I, uniformProb sample (event i) := by classical induction I using Finset.induction_on with | empty => simp [uniformProb] | @insert i I hi ih => calc uniformProb sample (fun a => ∃ j ∈ insert i I, event j a) = uniformProb sample (fun a => event i a ∨ ∃ j ∈ I, event j a) := by apply uniformProb_congr intro a ha simp _ ≤ uniformProb sample (event i) + uniformProb sample (fun a => ∃ j ∈ I, event j a) := uniformProb_or_le _ _ _ _ ≤ uniformProb sample (event i) + ∑ j ∈ I, uniformProb sample (event j) := add_le_add le_rfl ih _ = ∑ j ∈ insert i I, uniformProb sample (event j) := by simp [hi] theorem uniformProb_add_not (sample : Finset α) (P : α → Prop) (hs : sample.Nonempty) : uniformProb sample P + uniformProb sample (fun a => ¬ P a) = 1 := by classical have hc : (sample.card : ℝ) ≠ 0 := by exact_mod_cast hs.card_pos.ne' unfold uniformProb rw [← add_div, ← Nat.cast_add, Finset.card_filter_add_card_filter_not, div_self hc] theorem uniformProb_not (sample : Finset α) (P : α → Prop) (hs : sample.Nonempty) : uniformProb sample (fun a => ¬ P a) = 1 - uniformProb sample P := by have h := uniformProb_add_not sample P hs linarith theorem uniformMean_empty (f : α → ℝ) : uniformMean (∅ : Finset α) f = 0 := by simp [uniformMean] theorem uniformMean_zero (sample : Finset α) : uniformMean sample (fun _ => 0) = 0 := by simp [uniformMean] theorem uniformMean_nonneg (sample : Finset α) (f : α → ℝ) (hf : ∀ a ∈ sample, 0 ≤ f a) : 0 ≤ uniformMean sample f := by unfold uniformMean exact div_nonneg (Finset.sum_nonneg hf) (Nat.cast_nonneg sample.card) theorem uniformMean_mono (sample : Finset α) (f g : α → ℝ) (hfg : ∀ a ∈ sample, f a ≤ g a) : uniformMean sample f ≤ uniformMean sample g := by unfold uniformMean exact div_le_div_of_nonneg_right (Finset.sum_le_sum hfg) (Nat.cast_nonneg sample.card) theorem uniformMean_add (sample : Finset α) (f g : α → ℝ) : uniformMean sample (fun a => f a + g a) = uniformMean sample f + uniformMean sample g := by simp only [uniformMean, Finset.sum_add_distrib, add_div] theorem uniformMean_const_mul (sample : Finset α) (c : ℝ) (f : α → ℝ) : uniformMean sample (fun a => c * f a) = c * uniformMean sample f := by unfold uniformMean rw [← Finset.mul_sum, mul_div_assoc] theorem uniformMean_const (sample : Finset α) (hs : sample.Nonempty) (c : ℝ) : uniformMean sample (fun _ => c) = c := by have hc : (sample.card : ℝ) ≠ 0 := by exact_mod_cast hs.card_pos.ne' simp [uniformMean, nsmul_eq_mul, hc] theorem uniformProb_eq_uniformMean_indicator (sample : Finset α) (event : α → Prop) [DecidablePred event] : uniformProb sample event = uniformMean sample (fun a => if event a then 1 else 0) := by classical simp [uniformProb, uniformMean] congr theorem uniformMean_sum (sample : Finset α) (I : Finset ι) (f : ι → α → ℝ) : uniformMean sample (fun a => ∑ i ∈ I, f i a) = ∑ i ∈ I, uniformMean sample (f i) := by simp only [uniformMean, ← Finset.sum_div] rw [Finset.sum_comm] /-- Finite Markov inequality before division by the threshold. -/ theorem uniformProb_mul_le_uniformMean_of_nonneg (sample : Finset α) (f : α → ℝ) (t : ℝ) (hf : ∀ a ∈ sample, 0 ≤ f a) (_ht : 0 ≤ t) : t * uniformProb sample (fun a => t ≤ f a) ≤ uniformMean sample f := by classical have hsum : (∑ a ∈ sample, if t ≤ f a then t else 0) ≤ ∑ a ∈ sample, f a := by apply Finset.sum_le_sum intro a ha split_ifs with hta · exact hta · exact hf a ha have hi : (∑ a ∈ sample, if t ≤ f a then t else 0) = t * ((sample.filter (fun a => t ≤ f a)).card : ℝ) := by rw [← Finset.sum_filter] simp [mul_comm] rw [hi] at hsum unfold uniformProb uniformMean rw [← mul_div_assoc] exact div_le_div_of_nonneg_right hsum (Nat.cast_nonneg sample.card) theorem uniformProb_le_uniformMean_div (sample : Finset α) (f : α → ℝ) (t : ℝ) (hf : ∀ a ∈ sample, 0 ≤ f a) (ht : 0 < t) : uniformProb sample (fun a => t ≤ f a) ≤ uniformMean sample f / t := by apply (le_div_iff₀ ht).2 simpa only [mul_comm] using uniformProb_mul_le_uniformMean_of_nonneg sample f t hf ht.le theorem uniformProb_le_uniformMean_div_of_event (sample : Finset α) (event : α → Prop) (f : α → ℝ) (t : ℝ) (hf : ∀ a ∈ sample, 0 ≤ f a) (ht : 0 < t) (hevent : ∀ a ∈ sample, event a → t ≤ f a) : uniformProb sample event ≤ uniformMean sample f / t := (uniformProb_mono sample event (fun a => t ≤ f a) hevent).trans (uniformProb_le_uniformMean_div sample f t hf ht) /-- The exact containing-slice probability, including zero denominators by convention. -/ theorem uniformProb_exactSlice_contains [DecidableEq α] (U S : Finset α) (k : ℕ) (hSU : S ⊆ U) (hSk : S.card ≤ k) : uniformProb (exactSlice U k) (fun B => S ⊆ B) = (((U.card - S.card).choose (k - S.card) : ℕ) : ℝ) / (U.card.choose k : ℝ) := by classical rw [uniformProb_eq_card_filter] have hc := card_exactSlice_filter_subset U S k hSU hSk have hc' : ((exactSlice U k).filter (fun B => S ⊆ B)).card = (U.card - S.card).choose (k - S.card) := by convert hc using 1 <;> congr rw [hc', card_exactSlice] theorem uniformProb_exactSlice_zero (U : Finset α) (k : ℕ) (hk : U.card < k) (event : Finset α → Prop) : uniformProb (exactSlice U k) event = 0 := by rw [exactSlice_eq_empty_iff.mpr hk] exact uniformProb_empty event end Green39Submission end Green39AssemblyScope_610abb236bf2a449 /- Source: Green39Submission.TargetBridge; SHA256 7a853801f7d264b6a30fcb1524dbc767dae5d1b0ab9e3b87b313e50b71f9968a -/ section Green39AssemblyScope_34f8d3a672f819a5 /-! Development bridge only. This file does not establish the zero-limit premise and does not declare Bounty.target. The complete manuscript still needs to be formalized to supply that premise. -/ namespace Green39Submission open Filter Topology noncomputable def coverProbability (p : PrimeIndex) : ℝ := (Green39.proportionCoverable p (Nat.sqrt p) (100 * Nat.sqrt p) : ℝ) theorem not_tendsto_one_of_tendsto_zero (h0 : Tendsto coverProbability atTop (𝓝 (0 : ℝ))) : ¬ Tendsto coverProbability atTop (𝓝 (1 : ℝ)) := by let : Nonempty PrimeIndex := ⟨⟨2, Nat.prime_two⟩⟩ intro h1 have h01 : (0 : ℝ) = 1 := tendsto_nhds_unique h0 h1 exact zero_ne_one h01 theorem native_refutation_of_zero_limit (h0 : Tendsto coverProbability atTop (𝓝 (0 : ℝ))) : ¬ (fcTypeOfName% "Green39.green_39") := by intro h apply not_tendsto_one_of_tendsto_zero h0 change Tendsto (fun p : {q : ℕ // q.Prime} => (Green39.proportionCoverable p (Nat.sqrt p) (100 * Nat.sqrt p) : ℝ)) atTop (𝓝 (1 : ℝ)) exact h.mp True.intro end Green39Submission end Green39AssemblyScope_34f8d3a672f819a5 /- Source: Green39Submission.ExactProbability; SHA256 6a59aa9db7aa2d56edee209fe1390ea5f8d51b65a897c250fd717bb2098cf604 -/ section Green39AssemblyScope_30d029d7f68f5419 /-! Exact connection between the shared finite probability and the native Green39 count. Only the count definition is unfolded; no source theorem proof is used. The principal zero-limit statement is not assumed or proved in this module. -/ namespace Green39Submission open scoped BigOperators Pointwise /-- The real count probability agrees exactly with the native rational definition. -/ theorem proportionCoverable_eq_uniformProb (p k c : ℕ) [NeZero p] (hk : k ≤ p) : (Green39.proportionCoverable p k c : ℝ) = uniformProb (exactSlice (Finset.univ : Finset (ZMod p)) k) (fun A => coverable A c) := by classical have hp : p ≠ 0 := NeZero.ne p simp only [Green39.proportionCoverable, dif_neg hp, if_neg (not_lt.mpr hk)] simp [uniformProb, exactSlice, coverable] <;> congr /-- The native equality also includes the oversized-slice zero convention. -/ theorem proportionCoverable_eq_uniformProb_all (p k c : ℕ) [NeZero p] : (Green39.proportionCoverable p k c : ℝ) = uniformProb (exactSlice (Finset.univ : Finset (ZMod p)) k) (fun A => coverable A c) := by classical by_cases hk : k ≤ p · exact proportionCoverable_eq_uniformProb p k c hk have hkp : p < k := lt_of_not_ge hk have hcard : (Finset.univ : Finset (ZMod p)).card < k := by simpa only [Finset.card_univ, ZMod.card] using hkp have hp : p ≠ 0 := NeZero.ne p rw [uniformProb_exactSlice_zero _ _ hcard] simp [Green39.proportionCoverable, hp, hkp] theorem prime_exactSlice_nonempty (p : PrimeIndex) : (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt p)).Nonempty := by apply exactSlice_nonempty.mpr simpa only [Finset.card_univ, ZMod.card] using Nat.sqrt_le_self (p : ℕ) /-- Unconditional exact-count form of the protected bridge's probability function. -/ theorem coverProbability_eq_uniformProb (p : PrimeIndex) : coverProbability p = uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt p)) (fun A => coverable A (100 * Nat.sqrt p)) := by exact proportionCoverable_eq_uniformProb (p : ℕ) (Nat.sqrt p) (100 * Nat.sqrt p) (Nat.sqrt_le_self (p : ℕ)) end Green39Submission end Green39AssemblyScope_30d029d7f68f5419 /- Source: Green39Submission.Integration; SHA256 8124dc246f9a4847d60ef4ae5f481fba62171538c04f429c71fee2b9478428ae -/ section Green39AssemblyScope_96324d280987ac37 /-! Exact deterministic interfaces between the rich-target theorem and the sparse hole obstruction. The definitions below are not assumptions or axioms: their probability bounds remain separate formalization obligations. -/ namespace Green39Submission.Integration open scoped Pointwise open Filter Topology universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] noncomputable def richTargets (A T : Finset G) (M : ℝ) : Finset G := by classical exact Finset.univ.filter (fun x => M < (representationCount A T x : ℝ)) def FewRichTargets (A : Finset G) (c : ℕ) (M : ℝ) (N : ℕ) : Prop := ∀ T : Finset G, T.card ≤ c → (richTargets A T M).card < N def SparseHoleObstruction (A : Finset G) (c : ℕ) (M : ℝ) (e : ℕ) (γ : ℝ) : Prop := ∀ T : Finset G, T.card ≤ c → ∀ X : Finset G, X.card ≤ e → (∀ x : G, x ∉ X → (representationCount A T x : ℝ) ≤ M) → γ * (Fintype.card G : ℝ) ≤ ((holeSet A T).card : ℝ) theorem mem_richTargets (A T : Finset G) (M : ℝ) (x : G) : x ∈ richTargets A T M ↔ M < (representationCount A T x : ℝ) := by classical simp [richTargets] theorem profile_le_off_richTargets (A T : Finset G) (M : ℝ) (x : G) (hx : x ∉ richTargets A T M) : (representationCount A T x : ℝ) ≤ M := by exact le_of_not_gt (fun h => hx ((mem_richTargets A T M x).2 h)) theorem richTargets_mono {A A' T T' : Finset G} {M : ℝ} (hA : A ⊆ A') (hT : T ⊆ T') : richTargets A T M ⊆ richTargets A' T' M := by intro x hx apply (mem_richTargets A' T' M x).2 apply ((mem_richTargets A T M x).1 hx).trans_le exact_mod_cast representationCount_mono hA hT x theorem linear_holes_of_few_rich_and_sparse {A : Finset G} {c N : ℕ} {M γ : ℝ} (hRich : FewRichTargets A c M N) (hSparse : SparseHoleObstruction A c M N γ) : ∀ T : Finset G, T.card ≤ c → γ * (Fintype.card G : ℝ) ≤ ((holeSet A T).card : ℝ) := by intro T hT exact hSparse T hT (richTargets A T M) (Nat.le_of_lt (hRich T hT)) (profile_le_off_richTargets A T M) theorem not_coverable_of_few_rich_and_sparse {A : Finset G} {c N : ℕ} {M γ : ℝ} (hγ : 0 < γ) (hRich : FewRichTargets A c M N) (hSparse : SparseHoleObstruction A c M N γ) : ¬ coverable A c := not_coverable_of_linear_holes hγ (linear_holes_of_few_rich_and_sparse hRich hSparse) /-- No independence is needed between the two good events. Both are properties of the same original input A, including when translates and masks are adaptive. -/ theorem coverable_implies_bad_event {A : Finset G} {c N : ℕ} {M γ : ℝ} (hγ : 0 < γ) (hcover : coverable A c) : ¬ FewRichTargets A c M N ∨ ¬ SparseHoleObstruction A c M N γ := by classical by_cases hRich : FewRichTargets A c M N · exact Or.inr (fun hSparse => not_coverable_of_few_rich_and_sparse hγ hRich hSparse hcover) · exact Or.inl hRich theorem coverable_probability_le_bad_event_sum (sample : Finset (Finset G)) (c : ℕ) (M : ℝ) (N : ℕ) (γ : ℝ) (hγ : 0 < γ) : uniformProb sample (fun A => coverable A c) ≤ uniformProb sample (fun A => ¬ FewRichTargets A c M N) + uniformProb sample (fun A => ¬ SparseHoleObstruction A c M N γ) := by exact (uniformProb_mono sample (fun A => coverable A c) (fun A => ¬ FewRichTargets A c M N ∨ ¬ SparseHoleObstruction A c M N γ) (fun A _ hcover => coverable_implies_bad_event hγ hcover)).trans (uniformProb_or_le sample (fun A => ¬ FewRichTargets A c M N) (fun A => ¬ SparseHoleObstruction A c M N γ)) noncomputable def richFailureProbability (M : PrimeIndex → ℝ) (N : PrimeIndex → ℕ) (p : PrimeIndex) : ℝ := uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt p)) (fun A => ¬ FewRichTargets A (100 * Nat.sqrt p) (M p) (N p)) noncomputable def sparseFailureProbability (M : PrimeIndex → ℝ) (N : PrimeIndex → ℕ) (γ : ℝ) (p : PrimeIndex) : ℝ := uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt p)) (fun A => ¬ SparseHoleObstruction A (100 * Nat.sqrt p) (M p) (N p) γ) theorem coverProbability_le_failures (M : PrimeIndex → ℝ) (N : PrimeIndex → ℕ) (γ : ℝ) (hγ : 0 < γ) (p : PrimeIndex) : coverProbability p ≤ richFailureProbability M N p + sparseFailureProbability M N γ p := by rw [coverProbability_eq_uniformProb] exact coverable_probability_le_bad_event_sum _ _ _ _ _ hγ /-- Development integration implication. Both probability-limit hypotheses are outstanding until the actual rich-star and sparse-obstruction proofs discharge them. This theorem is not the final native target. -/ theorem coverProbability_tendsto_zero_of_failure_limits (M : PrimeIndex → ℝ) (N : PrimeIndex → ℕ) (γ : ℝ) (hγ : 0 < γ) (hRich : Tendsto (richFailureProbability M N) atTop (𝓝 (0 : ℝ))) (hSparse : Tendsto (sparseFailureProbability M N γ) atTop (𝓝 (0 : ℝ))) : Tendsto coverProbability atTop (𝓝 (0 : ℝ)) := by apply squeeze_zero (fun p => by rw [coverProbability_eq_uniformProb]; exact uniformProb_nonneg _ _) (coverProbability_le_failures M N γ hγ) simpa only [zero_add] using hRich.add hSparse end Green39Submission.Integration end Green39AssemblyScope_96324d280987ac37 /- Source: Green39Submission.RichStarGeometry; SHA256 88a35401ba3b4a3b2a7a488c5da1348c84c9172ebbcae03427cdad1889c0f923 -/ section Green39AssemblyScope_3be08c912aa45457 /-! Deterministic ordinary-alias geometry used by both rich stars and protected Newton scores. The probability of the explicit codegree/multiplicity hypotheses is not assumed here; it belongs to CodegreeMultiplicity. -/ namespace Green39Submission.RichStarGeometry open scoped BigOperators Pointwise variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- Sources which can protect the input vertex `u`. -/ def ordinarySources (T D : Finset G) (u : G) : Finset G := T.filter (fun t => t - u ∈ D) /-- Two sources form an internal ordinary alias at their common target. -/ abbrev InternalAlias (D : Finset G) (x t q : G) : Prop := t + q - x ∈ D theorem internalAlias_comm (D : Finset G) (x t q : G) : InternalAlias D x t q ↔ InternalAlias D x q t := by simp [InternalAlias, add_comm] /-- A representation count can equivalently count its input coordinates. -/ theorem representationCount_comm (A D : Finset G) (t : G) : representationCount A D t = representationCount D A t := by classical unfold representationCount apply Finset.card_bij (fun d _hd => t - d) · intro d hd rcases Finset.mem_filter.mp hd with ⟨hdD, htdA⟩ exact Finset.mem_filter.mpr ⟨htdA, by simpa using hdD⟩ · intro d hd e he hde exact sub_right_inj.mp hde · intro u hu rcases Finset.mem_filter.mp hu with ⟨huA, htuD⟩ refine ⟨t - u, Finset.mem_filter.mpr ⟨htuD, ?_⟩, ?_⟩ · simpa using huA · simp /-- Exact double counting of all ordinary incidences, with no original-input law assigned to the cleaned input set. -/ theorem sum_card_ordinarySources (A T D : Finset G) : (∑ u ∈ A, (ordinarySources T D u).card) = ∑ t ∈ T, representationCount A D t := by classical calc _ = ∑ u ∈ A, ∑ t ∈ T, if t - u ∈ D then (1 : ℕ) else 0 := by simp only [ordinarySources, Finset.card_eq_sum_ones, Finset.sum_filter] _ = ∑ t ∈ T, ∑ u ∈ A, if t - u ∈ D then (1 : ℕ) else 0 := Finset.sum_comm _ = ∑ t ∈ T, representationCount D A t := by simp only [representationCount, Finset.card_eq_sum_ones, Finset.sum_filter] _ = _ := by apply Finset.sum_congr rfl intro t _ht exact representationCount_comm D A t theorem sum_card_ordinarySources_le {A T D : Finset G} {K : ℕ} (hK : ∀ t ∈ T, representationCount A D t ≤ K) : (∑ u ∈ A, (ordinarySources T D u).card) ≤ T.card * K := by rw [sum_card_ordinarySources] calc _ ≤ ∑ _t ∈ T, K := Finset.sum_le_sum hK _ = _ := by simp variable [Fintype G] /-- Targets containing an internal loop. -/ def loopTargets (A T D : Finset G) : Finset G := Finset.univ.filter (fun x => ∃ t ∈ T, x - t ∈ A ∧ InternalAlias D x t t) /-- A deterministic cover of every loop target by ordinary incidences. -/ def loopCover (A T D : Finset G) : Finset G := T.biUnion (fun t => (D.filter (fun d => t - d ∈ A)).image (fun d => t + t - d)) theorem loopTargets_subset_cover (A T D : Finset G) : loopTargets A T D ⊆ loopCover A T D := by intro x hx rcases (Finset.mem_filter.mp hx).2 with ⟨t, ht, hxt, halias⟩ apply Finset.mem_biUnion.mpr refine ⟨t, ht, Finset.mem_image.mpr ?_⟩ refine ⟨t + t - x, Finset.mem_filter.mpr ⟨halias, ?_⟩, ?_⟩ · have heq : t - (t + t - x) = x - t := by abel rwa [heq] · abel theorem card_loopTargets_le {A T D : Finset G} {K : ℕ} (hK : ∀ t ∈ T, representationCount A D t ≤ K) : (loopTargets A T D).card ≤ T.card * K := by calc _ ≤ (loopCover A T D).card := Finset.card_le_card (loopTargets_subset_cover A T D) _ ≤ ∑ t ∈ T, ((D.filter (fun d => t - d ∈ A)).image (fun d => t + t - d)).card := Finset.card_biUnion_le _ ≤ ∑ t ∈ T, representationCount A D t := by apply Finset.sum_le_sum intro t _ht exact Finset.card_image_le _ ≤ ∑ _t ∈ T, K := Finset.sum_le_sum hK _ = _ := by simp /-- Potential hub sources at two distinct ordinary centers. -/ def commonSources (A T : Finset G) (d₁ d₂ : G) : Finset G := T.filter (fun q => q - d₁ ∈ A ∧ q - d₂ ∈ A) /-- The bad rows have two distinct internal neighbors of one hub. Counting also rows with a loop only enlarges the bad set and simplifies its description. -/ def wedgeTargets (A T D : Finset G) : Finset G := Finset.univ.filter (fun x => ∃ q ∈ T, x - q ∈ A ∧ ∃ t₁ ∈ T, x - t₁ ∈ A ∧ ∃ t₂ ∈ T, x - t₂ ∈ A ∧ t₁ ≠ t₂ ∧ InternalAlias D x t₁ q ∧ InternalAlias D x t₂ q) /-- A finite witness cover of wedge targets. The second leaf's incidence condition is deliberately dropped, producing a valid upper count. -/ def wedgeCover (A T D : Finset G) : Finset G := A.biUnion (fun v => (ordinarySources T D v).biUnion (fun t => (D.erase (t - v)).biUnion (fun d => (commonSources A T (t - v) d).image (fun q => v + q)))) theorem wedgeTargets_subset_cover (A T D : Finset G) : wedgeTargets A T D ⊆ wedgeCover A T D := by intro x hx rcases (Finset.mem_filter.mp hx).2 with ⟨q, hq, hxq, t₁, ht₁, hxt₁, t₂, ht₂, hxt₂, hne, h₁, h₂⟩ let v := x - q have hv : v ∈ A := hxq have hc₁ : t₁ - v ∈ D := by have heq : t₁ - v = t₁ + q - x := by dsimp [v]; abel rw [heq] exact h₁ have hc₂ : t₂ - v ∈ D := by have heq : t₂ - v = t₂ + q - x := by dsimp [v]; abel rw [heq] exact h₂ have hcenters : t₂ - v ≠ t₁ - v := by intro heq apply hne have hadd := congrArg (fun z : G => z + v) heq.symm simpa only [sub_add_cancel] using hadd apply Finset.mem_biUnion.mpr refine ⟨v, hv, Finset.mem_biUnion.mpr ?_⟩ refine ⟨t₁, Finset.mem_filter.mpr ⟨ht₁, hc₁⟩, Finset.mem_biUnion.mpr ?_⟩ refine ⟨t₂ - v, Finset.mem_erase.mpr ⟨hcenters, hc₂⟩, Finset.mem_image.mpr ?_⟩ refine ⟨q, Finset.mem_filter.mpr ⟨hq, ?_⟩, ?_⟩ · constructor · have heq : q - (t₁ - v) = x - t₁ := by dsimp [v]; abel rwa [heq] · have heq : q - (t₂ - v) = x - t₂ := by dsimp [v]; abel rwa [heq] · dsimp [v] exact sub_add_cancel x q /-- A common-source cardinality hypothesis is exactly the place where the input's nonzero codegree bound is used. -/ theorem card_wedgeTargets_le {A T D : Finset G} {K J : ℕ} (hK : ∀ t ∈ T, representationCount A D t ≤ K) (hJ : ∀ d₁ ∈ D, ∀ d₂ ∈ D, d₁ ≠ d₂ → (commonSources A T d₁ d₂).card ≤ J) : (wedgeTargets A T D).card ≤ (T.card * K) * (D.card * J) := by have hinner (v t : G) (ht : t ∈ ordinarySources T D v) : ((D.erase (t - v)).biUnion (fun d => (commonSources A T (t - v) d).image (fun q => v + q))).card ≤ D.card * J := by have htv : t - v ∈ D := (Finset.mem_filter.mp ht).2 calc _ ≤ ∑ d ∈ D.erase (t - v), ((commonSources A T (t - v) d).image (fun q => v + q)).card := Finset.card_biUnion_le _ ≤ ∑ _d ∈ D.erase (t - v), J := by apply Finset.sum_le_sum intro d hd have hd' := Finset.mem_erase.mp hd exact le_trans Finset.card_image_le (hJ (t - v) htv d hd'.2 (Ne.symm hd'.1)) _ = (D.erase (t - v)).card * J := by simp _ ≤ D.card * J := Nat.mul_le_mul_right J Finset.card_erase_le have hrow (v : G) : ((ordinarySources T D v).biUnion (fun t => (D.erase (t - v)).biUnion (fun d => (commonSources A T (t - v) d).image (fun q => v + q)))).card ≤ (ordinarySources T D v).card * (D.card * J) := by calc _ ≤ ∑ t ∈ ordinarySources T D v, ((D.erase (t - v)).biUnion (fun d => (commonSources A T (t - v) d).image (fun q => v + q))).card := Finset.card_biUnion_le _ ≤ ∑ _t ∈ ordinarySources T D v, D.card * J := Finset.sum_le_sum (hinner v) _ = _ := by simp calc _ ≤ (wedgeCover A T D).card := Finset.card_le_card (wedgeTargets_subset_cover A T D) _ ≤ ∑ v ∈ A, ((ordinarySources T D v).biUnion (fun t => (D.erase (t - v)).biUnion (fun d => (commonSources A T (t - v) d).image (fun q => v + q)))).card := Finset.card_biUnion_le _ ≤ ∑ v ∈ A, (ordinarySources T D v).card * (D.card * J) := Finset.sum_le_sum (fun v _hv => hrow v) _ = (∑ v ∈ A, (ordinarySources T D v).card) * (D.card * J) := by rw [Finset.sum_mul] _ ≤ _ := Nat.mul_le_mul_right _ (sum_card_ordinarySources_le hK) theorem no_loop_of_not_mem {A T D : Finset G} {x t : G} (hx : x ∉ loopTargets A T D) (ht : t ∈ T) (hxt : x - t ∈ A) : ¬ InternalAlias D x t t := by intro h apply hx exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, hxt, h⟩ theorem unique_neighbor_of_not_mem {A T D : Finset G} {x q t₁ t₂ : G} (hx : x ∉ wedgeTargets A T D) (hq : q ∈ T) (hxq : x - q ∈ A) (ht₁ : t₁ ∈ T) (hxt₁ : x - t₁ ∈ A) (ht₂ : t₂ ∈ T) (hxt₂ : x - t₂ ∈ A) (h₁ : InternalAlias D x t₁ q) (h₂ : InternalAlias D x t₂ q) : t₁ = t₂ := by by_contra hne apply hx exact Finset.mem_filter.mpr ⟨Finset.mem_univ _, q, hq, hxq, t₁, ht₁, hxt₁, t₂, ht₂, hxt₂, hne, h₁, h₂⟩ /-- An explicit PS19 bad-target budget. This uses ordered center pairs, so its harmless absolute factor is larger than the optimized manuscript count. -/ theorem card_badAliasTargets_le {A T D : Finset G} {K J : ℕ} (hK : ∀ t ∈ T, representationCount A D t ≤ K) (hJ : ∀ d₁ ∈ D, ∀ d₂ ∈ D, d₁ ≠ d₂ → (commonSources A T d₁ d₂).card ≤ J) : (loopTargets A T D ∪ wedgeTargets A T D).card ≤ (T.card * K) * (1 + D.card * J) := by calc _ ≤ (loopTargets A T D).card + (wedgeTargets A T D).card := Finset.card_union_le _ _ _ ≤ T.card * K + (T.card * K) * (D.card * J) := Nat.add_le_add (card_loopTargets_le hK) (card_wedgeTargets_le hK hJ) _ = _ := by ring end Green39Submission.RichStarGeometry end Green39AssemblyScope_3be08c912aa45457 /- Source: Green39Submission.SourceProbability; SHA256 dda70dc88a84f358b3ec06f164d5d08d9c9a1e50d98cd2120e586456c970cabf -/ section Green39AssemblyScope_0da8d2c053c21215 /-! Exact finite Bernoulli source laws. No source-extraction or main theorem is assumed. -/ namespace Green39Submission.SourceProbability open scoped BigOperators Pointwise Classical universe u v w section SourceLaw variable {α : Type u} [DecidableEq α] theorem bernoulliWeight_nonneg (T S : Finset α) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) : 0 ≤ bernoulliWeight T S θ := by exact mul_nonneg (pow_nonneg hθ _) (pow_nonneg (sub_nonneg.mpr hθ1) _) /-- Normalization is an exact finite product expansion, for every real parameter. -/ theorem bernoulliWeight_sum (T : Finset α) (θ : ℝ) : (∑ S ∈ T.powerset, bernoulliWeight T S θ) = 1 := by have hθ : θ + (1 - θ) = 1 := by ring simpa [bernoulliWeight, Finset.prod_const, hθ] using (Finset.prod_add (fun _ : α => θ) (fun _ : α => 1 - θ) T).symm theorem bernoulliMean_one (T : Finset α) (θ : ℝ) : bernoulliMean T θ (fun _ => 1) = 1 := by simpa [bernoulliMean] using bernoulliWeight_sum T θ theorem bernoulliMean_zero (T : Finset α) (θ : ℝ) : bernoulliMean T θ (fun _ => 0) = 0 := by simp [bernoulliMean] theorem bernoulliMean_const (T : Finset α) (θ c : ℝ) : bernoulliMean T θ (fun _ => c) = c := by unfold bernoulliMean rw [← Finset.sum_mul, bernoulliWeight_sum, one_mul] theorem bernoulliMean_congr (T : Finset α) (θ : ℝ) {f g : Finset α → ℝ} (h : ∀ S, S ⊆ T → f S = g S) : bernoulliMean T θ f = bernoulliMean T θ g := by apply Finset.sum_congr rfl intro S hS rw [h S (Finset.mem_powerset.mp hS)] theorem bernoulliMean_add (T : Finset α) (θ : ℝ) (f g : Finset α → ℝ) : bernoulliMean T θ (fun S => f S + g S) = bernoulliMean T θ f + bernoulliMean T θ g := by simp only [bernoulliMean, mul_add, Finset.sum_add_distrib] theorem bernoulliMean_const_mul (T : Finset α) (θ c : ℝ) (f : Finset α → ℝ) : bernoulliMean T θ (fun S => c * f S) = c * bernoulliMean T θ f := by simp only [bernoulliMean, Finset.mul_sum] apply Finset.sum_congr rfl intro S _ ring theorem bernoulliMean_sum {ι : Type v} (T : Finset α) (θ : ℝ) (I : Finset ι) (f : ι → Finset α → ℝ) : bernoulliMean T θ (fun S => ∑ i ∈ I, f i S) = ∑ i ∈ I, bernoulliMean T θ (f i) := by simp only [bernoulliMean, Finset.mul_sum] rw [Finset.sum_comm] theorem bernoulliMean_nonneg (T : Finset α) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) {f : Finset α → ℝ} (hf : ∀ S, S ⊆ T → 0 ≤ f S) : 0 ≤ bernoulliMean T θ f := by apply Finset.sum_nonneg intro S hS exact mul_nonneg (bernoulliWeight_nonneg T S hθ hθ1) (hf S (Finset.mem_powerset.mp hS)) theorem bernoulliMean_mono (T : Finset α) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) {f g : Finset α → ℝ} (hfg : ∀ S, S ⊆ T → f S ≤ g S) : bernoulliMean T θ f ≤ bernoulliMean T θ g := by apply Finset.sum_le_sum intro S hS exact mul_le_mul_of_nonneg_left (hfg S (Finset.mem_powerset.mp hS)) (bernoulliWeight_nonneg T S hθ hθ1) theorem powerset_filter_disjoint (T V : Finset α) : T.powerset.filter (fun S => Disjoint V S) = (T \ V).powerset := by ext S simp only [Finset.mem_filter, Finset.mem_powerset] constructor · rintro ⟨hST, hVS⟩ x hx exact Finset.mem_sdiff.mpr ⟨hST hx, fun hxV => Finset.disjoint_left.mp hVS hxV hx⟩ · intro hS refine ⟨?_, Finset.disjoint_left.mpr ?_⟩ · intro x hx exact (Finset.mem_sdiff.mp (hS hx)).1 · intro x hxV hxS exact (Finset.mem_sdiff.mp (hS hxS)).2 hxV theorem bernoulliWeight_of_avoid {T V S : Finset α} (hVT : V ⊆ T) (hS : S ⊆ T \ V) (θ : ℝ) : bernoulliWeight T S θ = (1 - θ) ^ V.card * bernoulliWeight (T \ V) S θ := by have hp : T \ S = V ∪ ((T \ V) \ S) := by ext x constructor · intro hx rcases Finset.mem_sdiff.mp hx with ⟨hxT, hxS⟩ by_cases hxV : x ∈ V · exact Finset.mem_union_left _ hxV · exact Finset.mem_union_right _ (Finset.mem_sdiff.mpr ⟨Finset.mem_sdiff.mpr ⟨hxT, hxV⟩, hxS⟩) · intro hx rcases Finset.mem_union.mp hx with hxV | hxF · exact Finset.mem_sdiff.mpr ⟨hVT hxV, fun hxS => (Finset.mem_sdiff.mp (hS hxS)).2 hxV⟩ · rcases Finset.mem_sdiff.mp hxF with ⟨hxTV, hxS⟩ exact Finset.mem_sdiff.mpr ⟨(Finset.mem_sdiff.mp hxTV).1, hxS⟩ have hd : Disjoint V ((T \ V) \ S) := by apply Finset.disjoint_left.mpr intro x hxV hxF exact (Finset.mem_sdiff.mp (Finset.mem_sdiff.mp hxF).1).2 hxV unfold bernoulliWeight rw [hp, Finset.card_union_of_disjoint hd, pow_add] ring /-- Conditioning explicit source bits to be absent leaves the same finite Bernoulli law on the remaining universe. No division by its probability is used. -/ theorem bernoulliMean_avoid {T V : Finset α} (hVT : V ⊆ T) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean T θ (fun S => if Disjoint V S then f S else 0) = (1 - θ) ^ V.card * bernoulliMean (T \ V) θ f := by simp only [bernoulliMean, mul_ite, mul_zero] rw [← Finset.sum_filter, powerset_filter_disjoint, Finset.mul_sum] apply Finset.sum_congr rfl intro S hS rw [bernoulliWeight_of_avoid hVT (Finset.mem_powerset.mp hS) θ] ring theorem bernoulliMean_complement (T : Finset α) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean T θ f = bernoulliMean T (1 - θ) (fun S => f (T \ S)) := by unfold bernoulliMean refine Finset.sum_bij' (fun S _ => T \ S) (fun S _ => T \ S) ?_ ?_ ?_ ?_ ?_ · intro S _ exact Finset.mem_powerset.mpr Finset.sdiff_subset · intro S _ exact Finset.mem_powerset.mpr Finset.sdiff_subset · intro S hS exact Finset.sdiff_sdiff_eq_self (Finset.mem_powerset.mp hS) · intro S hS exact Finset.sdiff_sdiff_eq_self (Finset.mem_powerset.mp hS) · intro S hS have hsub := Finset.mem_powerset.mp hS have hθ : 1 - (1 - θ) = θ := by ring simp only [bernoulliWeight, Finset.sdiff_sdiff_eq_self hsub, hθ] ring theorem subset_sdiff_iff_disjoint {Q T S : Finset α} (hQT : Q ⊆ T) : Q ⊆ T \ S ↔ Disjoint Q S := by constructor · intro h apply Finset.disjoint_left.mpr intro x hxQ hxS exact (Finset.mem_sdiff.mp (h hxQ)).2 hxS · intro h x hxQ exact Finset.mem_sdiff.mpr ⟨hQT hxQ, fun hxS => Finset.disjoint_left.mp h hxQ hxS⟩ theorem bernoulliMean_selected {T Q : Finset α} (hQT : Q ⊆ T) (θ : ℝ) : bernoulliMean T θ (fun S => if Q ⊆ S then 1 else 0) = θ ^ Q.card := by calc bernoulliMean T θ (fun S => if Q ⊆ S then 1 else 0) = bernoulliMean T (1 - θ) (fun S => if Q ⊆ T \ S then 1 else 0) := bernoulliMean_complement T θ _ _ = bernoulliMean T (1 - θ) (fun S => if Disjoint Q S then 1 else 0) := by apply bernoulliMean_congr intro S _ simp only [subset_sdiff_iff_disjoint hQT] _ = (1 - (1 - θ)) ^ Q.card * bernoulliMean (T \ Q) (1 - θ) (fun _ => 1) := bernoulliMean_avoid hQT (1 - θ) (fun _ => 1) _ = θ ^ Q.card := by have hθ : 1 - (1 - θ) = θ := by ring rw [hθ, bernoulliMean_one, mul_one] /-- Exact selected/forbidden-bit probability. This includes the joint event, not a posterior law for any adaptive descriptor. -/ theorem bernoulliMean_selected_absent {T Q V : Finset α} (hQT : Q ⊆ T) (hVT : V ⊆ T) (hQV : Disjoint Q V) (θ : ℝ) : bernoulliMean T θ (fun S => if Q ⊆ S ∧ Disjoint V S then 1 else 0) = θ ^ Q.card * (1 - θ) ^ V.card := by have hQ : Q ⊆ T \ V := (subset_sdiff_iff_disjoint hQT).mpr hQV calc bernoulliMean T θ (fun S => if Q ⊆ S ∧ Disjoint V S then 1 else 0) = bernoulliMean T θ (fun S => if Disjoint V S then (if Q ⊆ S then 1 else 0) else 0) := by apply bernoulliMean_congr intro S _ by_cases h₁ : Q ⊆ S <;> by_cases h₂ : Disjoint V S <;> simp [h₁, h₂] _ = (1 - θ) ^ V.card * bernoulliMean (T \ V) θ (fun S => if Q ⊆ S then 1 else 0) := bernoulliMean_avoid hVT θ _ _ = θ ^ Q.card * (1 - θ) ^ V.card := by rw [bernoulliMean_selected hQ θ, mul_comm] end SourceLaw /- Coordinate-removal and forced-present proofs contributed by worker05; moved upstream by agreement to avoid a source/cleanup import cycle. -/ section CoordinateIndependence variable {α : Type u} [DecidableEq α] /-- A finite atom law for removing a prescribed coordinate set. -/ theorem bernoulliMean_removed_atom (U S C : Finset α) (hC : C ⊆ U \ S) (θ : ℝ) : bernoulliMean U θ (fun B => if B \ S = C then 1 else 0) = bernoulliWeight (U \ S) C θ := by have hCU : C ⊆ U := hC.trans Finset.sdiff_subset have hVU : (U \ S) \ C ⊆ U := Finset.sdiff_subset.trans Finset.sdiff_subset have hCV : Disjoint C ((U \ S) \ C) := by apply Finset.disjoint_left.mpr intro a haC haV exact (Finset.mem_sdiff.mp haV).2 haC have hiff (B : Finset α) (hBU : B ⊆ U) : B \ S = C ↔ C ⊆ B ∧ Disjoint ((U \ S) \ C) B := by constructor · intro hBC refine ⟨?_, Finset.disjoint_left.mpr ?_⟩ · rw [← hBC] exact Finset.sdiff_subset · intro a haV haB rcases Finset.mem_sdiff.mp haV with ⟨haUS, haC⟩ have haBS : a ∈ B \ S := Finset.mem_sdiff.mpr ⟨haB, (Finset.mem_sdiff.mp haUS).2⟩ exact haC (hBC ▸ haBS) · rintro ⟨hCB, hVB⟩ ext a constructor · intro haBS rcases Finset.mem_sdiff.mp haBS with ⟨haB, haS⟩ by_contra haC exact Finset.disjoint_left.mp hVB (Finset.mem_sdiff.mpr ⟨Finset.mem_sdiff.mpr ⟨hBU haB, haS⟩, haC⟩) haB · intro haC exact Finset.mem_sdiff.mpr ⟨hCB haC, (Finset.mem_sdiff.mp (hC haC)).2⟩ calc _ = bernoulliMean U θ (fun B => if C ⊆ B ∧ Disjoint ((U \ S) \ C) B then 1 else 0) := by apply bernoulliMean_congr intro B hBU simp only [hiff B hBU] _ = _ := by exact bernoulliMean_selected_absent hCU hVU hCV θ /-- Removing deterministic coordinates leaves precisely the product law on the remaining universe, for an arbitrary real-valued finite function. -/ theorem bernoulliMean_remove (U S : Finset α) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean U θ (fun B => f (B \ S)) = bernoulliMean (U \ S) θ f := by classical calc _ = bernoulliMean U θ (fun B => ∑ C ∈ (U \ S).powerset, if B \ S = C then f C else 0) := by apply bernoulliMean_congr intro B hBU have hmem : B \ S ∈ (U \ S).powerset := by apply Finset.mem_powerset.mpr intro a ha rcases Finset.mem_sdiff.mp ha with ⟨haB, haS⟩ exact Finset.mem_sdiff.mpr ⟨hBU haB, haS⟩ simp [hmem] _ = ∑ C ∈ (U \ S).powerset, bernoulliMean U θ (fun B => if B \ S = C then f C else 0) := bernoulliMean_sum U θ _ _ _ = ∑ C ∈ (U \ S).powerset, bernoulliWeight (U \ S) C θ * f C := by apply Finset.sum_congr rfl intro C hC calc _ = bernoulliMean U θ (fun B => f C * (if B \ S = C then 1 else 0)) := by apply bernoulliMean_congr intro B _ split_ifs <;> simp _ = f C * bernoulliMean U θ (fun B => if B \ S = C then 1 else 0) := bernoulliMean_const_mul U θ (f C) _ _ = _ := by rw [bernoulliMean_removed_atom U S C (Finset.mem_powerset.mp hC), mul_comm] _ = _ := rfl /-- Forcing all prescribed coordinates present leaves the same independent law on the rest. The formula avoids division, so it includes zero-probability cases. -/ theorem bernoulliMean_containing {U S : Finset α} (hSU : S ⊆ U) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean U θ (fun B => if S ⊆ B then f (B \ S) else 0) = θ ^ S.card * bernoulliMean (U \ S) θ f := by have hcomm (B : Finset α) : (U \ B) \ S = (U \ S) \ B := by ext a simp only [Finset.mem_sdiff] tauto have hθ : 1 - (1 - θ) = θ := by ring calc _ = bernoulliMean U (1 - θ) (fun B => if S ⊆ U \ B then f ((U \ B) \ S) else 0) := bernoulliMean_complement U θ _ _ = bernoulliMean U (1 - θ) (fun B => if Disjoint S B then f ((U \ S) \ B) else 0) := by apply bernoulliMean_congr intro B _ simp only [subset_sdiff_iff_disjoint hSU, hcomm] _ = (1 - (1 - θ)) ^ S.card * bernoulliMean (U \ S) (1 - θ) (fun B => f ((U \ S) \ B)) := bernoulliMean_avoid hSU (1 - θ) _ _ = _ := by rw [hθ, ← bernoulliMean_complement (U \ S) θ f] /-- Independence of a containment event from every function of disjoint bits. -/ theorem bernoulliMean_containing_independent {U S : Finset α} (hSU : S ⊆ U) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean U θ (fun B => (if S ⊆ B then 1 else 0) * f (B \ S)) = θ ^ S.card * bernoulliMean U θ (fun B => f (B \ S)) := by calc _ = bernoulliMean U θ (fun B => if S ⊆ B then f (B \ S) else 0) := by apply bernoulliMean_congr intro B _ split_ifs <;> simp _ = θ ^ S.card * bernoulliMean (U \ S) θ f := bernoulliMean_containing hSU θ f _ = _ := by rw [bernoulliMean_remove] end CoordinateIndependence end Green39Submission.SourceProbability end Green39AssemblyScope_0da8d2c053c21215 /- Source: Green39Submission.RawMoments; SHA256 5ea40600af24dbe8a01812fbbecc8fa3e982daa00944887eb81f8566327cb9b3 -/ section Green39AssemblyScope_283ef9b12e52d688 /-! Finite nonnegative source-polynomial raw moments, with repeated labelled supports. -/ namespace Green39Submission.RawMoments open scoped BigOperators Pointwise Classical open Green39Submission.SourceProbability universe u v w section SourceExtension variable {α : Type u} {ι : Type v} [DecidableEq α] /-- Derivative mean indexed by an explicitly prescribed source support. -/ noncomputable def sourceDerivative (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (θ : ℝ) (B : Finset α) : ℝ := by classical exact ∑ i ∈ I, if B ⊆ support i then weight i * θ ^ (support i \ B).card else 0 /-- Sum of one-step conditional monomial extensions after source support W. -/ noncomputable def sourceExtension (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (θ : ℝ) (W : Finset α) : ℝ := ∑ i ∈ I, weight i * θ ^ (support i \ W).card theorem sourceDerivative_nonneg (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) {θ : ℝ} (hθ : 0 ≤ θ) (hw : ∀ i ∈ I, 0 ≤ weight i) (B : Finset α) : 0 ≤ sourceDerivative I support weight θ B := by classical unfold sourceDerivative apply Finset.sum_nonneg intro i hi split_ifs · exact mul_nonneg (hw i hi) (pow_nonneg hθ _) · exact le_rfl /-- The first-collision extension bound in PS11. Each next monomial is charged to its actual intersection with W, then exact intersection is relaxed. -/ theorem sourceExtension_le_powerset_derivative (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) {θ : ℝ} (hθ : 0 ≤ θ) (hw : ∀ i ∈ I, 0 ≤ weight i) (W : Finset α) : sourceExtension I support weight θ W ≤ ∑ B ∈ W.powerset, sourceDerivative I support weight θ B := by classical unfold sourceExtension sourceDerivative rw [Finset.sum_comm] apply Finset.sum_le_sum intro i hi have hmem : support i ∩ W ∈ W.powerset := Finset.mem_powerset.mpr Finset.inter_subset_right have hn (B : Finset α) (_ : B ∈ W.powerset) : 0 ≤ (if B ⊆ support i then weight i * θ ^ (support i \ B).card else 0) := by split_ifs · exact mul_nonneg (hw i hi) (pow_nonneg hθ _) · exact le_rfl simpa only [if_pos Finset.inter_subset_left, Finset.sdiff_inter_self_left] using (Finset.single_le_sum (f := fun B : Finset α => if B ⊆ support i then weight i * θ ^ (support i \ B).card else 0) hn hmem) /-- Group the extension bound by the size of the prescribed source support. -/ theorem sourceExtension_le_binomial_sum (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) {θ : ℝ} (hθ : 0 ≤ θ) (hw : ∀ i ∈ I, 0 ≤ weight i) (W : Finset α) (μ : ℕ → ℝ) (hμ : ∀ B ∈ W.powerset, sourceDerivative I support weight θ B ≤ μ B.card) : sourceExtension I support weight θ W ≤ ∑ j ∈ Finset.range (W.card + 1), (W.card.choose j : ℝ) * μ j := by calc sourceExtension I support weight θ W ≤ ∑ B ∈ W.powerset, sourceDerivative I support weight θ B := sourceExtension_le_powerset_derivative I support weight hθ hw W _ ≤ ∑ B ∈ W.powerset, μ B.card := Finset.sum_le_sum hμ _ = ∑ j ∈ Finset.range (W.card + 1), (W.card.choose j : ℝ) * μ j := by rw [Finset.sum_powerset] apply Finset.sum_congr rfl intro j _ rw [Finset.sum_powersetCard] simp [nsmul_eq_mul] theorem sourceExtension_le_uniform_binomial_sum (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) {θ : ℝ} (hθ : 0 ≤ θ) (hw : ∀ i ∈ I, 0 ≤ weight i) (W : Finset α) (N : ℕ) (hWN : W.card ≤ N) (μ : ℕ → ℝ) (hμ0 : ∀ j, 0 ≤ μ j) (hμ : ∀ B, sourceDerivative I support weight θ B ≤ μ B.card) : sourceExtension I support weight θ W ≤ ∑ j ∈ Finset.range (N + 1), (N.choose j : ℝ) * μ j := by calc sourceExtension I support weight θ W ≤ ∑ j ∈ Finset.range (W.card + 1), (W.card.choose j : ℝ) * μ j := sourceExtension_le_binomial_sum I support weight hθ hw W μ (fun B _ => hμ B) _ ≤ ∑ j ∈ Finset.range (W.card + 1), (N.choose j : ℝ) * μ j := by apply Finset.sum_le_sum intro j _ apply mul_le_mul_of_nonneg_right _ (hμ0 j) exact_mod_cast Nat.choose_le_choose j hWN _ ≤ ∑ j ∈ Finset.range (N + 1), (N.choose j : ℝ) * μ j := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.range_mono (Nat.succ_le_succ hWN)) intro j _ _ exact mul_nonneg (Nat.cast_nonneg _) (hμ0 j) /-- The recursion obtained by expanding an ordered monomial tuple. At every step only genuinely new source bits contribute another power of theta. -/ noncomputable def sourceMoment (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (θ : ℝ) : ℕ → Finset α → ℝ | 0, _ => 1 | q + 1, W => ∑ i ∈ I, weight i * θ ^ (support i \ W).card * sourceMoment I support weight θ q (W ∪ support i) theorem selected_containment_pow_succ (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (W S : Finset α) (q : ℕ) : (if W ⊆ S then (containmentSum I support weight S) ^ (q + 1) else 0) = ∑ i ∈ I, weight i * (if W ∪ support i ⊆ S then (containmentSum I support weight S) ^ q else 0) := by classical by_cases hW : W ⊆ S · rw [if_pos hW] simp only [Finset.union_subset_iff, hW, true_and, pow_succ] simp only [containmentSum] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _ by_cases hi : support i ⊆ S <;> simp [hi, mul_comm] · simp [hW, Finset.union_subset_iff] theorem bernoulliMean_selected_containment_pow (T : Finset α) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hIT : ∀ i ∈ I, support i ⊆ T) (θ : ℝ) (q : ℕ) (W : Finset α) (hWT : W ⊆ T) : bernoulliMean T θ (fun S => if W ⊆ S then (containmentSum I support weight S) ^ q else 0) = θ ^ W.card * sourceMoment I support weight θ q W := by classical induction q generalizing W with | zero => simpa [sourceMoment] using bernoulliMean_selected hWT θ | succ q ih => calc bernoulliMean T θ (fun S => if W ⊆ S then (containmentSum I support weight S) ^ (q + 1) else 0) = bernoulliMean T θ (fun S => ∑ i ∈ I, weight i * (if W ∪ support i ⊆ S then (containmentSum I support weight S) ^ q else 0)) := by apply bernoulliMean_congr intro S _ exact selected_containment_pow_succ I support weight W S q _ = ∑ i ∈ I, weight i * bernoulliMean T θ (fun S => if W ∪ support i ⊆ S then (containmentSum I support weight S) ^ q else 0) := by rw [bernoulliMean_sum] apply Finset.sum_congr rfl intro i _ exact bernoulliMean_const_mul T θ (weight i) _ _ = θ ^ W.card * sourceMoment I support weight θ (q + 1) W := by rw [sourceMoment, Finset.mul_sum] apply Finset.sum_congr rfl intro i hi rw [ih (W ∪ support i) (Finset.union_subset hWT (hIT i hi))] have hc : (W ∪ support i).card = W.card + (support i \ W).card := by simpa [Finset.union_comm, Nat.add_comm] using (Finset.card_sdiff_add_card (support i) W).symm rw [hc, pow_add] ring theorem bernoulliMean_containment_pow (T : Finset α) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hIT : ∀ i ∈ I, support i ⊆ T) (θ : ℝ) (q : ℕ) : bernoulliMean T θ (fun S => (containmentSum I support weight S) ^ q) = sourceMoment I support weight θ q ∅ := by simpa using bernoulliMean_selected_containment_pow T I support weight hIT θ q ∅ (Finset.empty_subset T) /-- Ordered tuple growth under a finite support-room bound. This is the induction behind the raw source moment inequality, not a probabilistic premise. -/ theorem sourceMoment_le_pow (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hw : ∀ i ∈ I, 0 ≤ weight i) (L N : ℕ) (hsize : ∀ i ∈ I, (support i).card ≤ L) (hext : ∀ W : Finset α, W.card ≤ N → sourceExtension I support weight θ W ≤ K) (q : ℕ) (W : Finset α) (hroom : W.card + L * q ≤ N) : sourceMoment I support weight θ q W ≤ K ^ q := by induction q generalizing W with | zero => simp [sourceMoment] | succ q ih => have hW : W.card ≤ N := by omega calc sourceMoment I support weight θ (q + 1) W = ∑ i ∈ I, weight i * θ ^ (support i \ W).card * sourceMoment I support weight θ q (W ∪ support i) := rfl _ ≤ ∑ i ∈ I, weight i * θ ^ (support i \ W).card * K ^ q := by apply Finset.sum_le_sum intro i hi apply mul_le_mul_of_nonneg_left · apply ih have hu := Finset.card_union_le W (support i) have hs := hsize i hi rw [Nat.mul_succ] at hroom omega · exact mul_nonneg (hw i hi) (pow_nonneg hθ _) _ = sourceExtension I support weight θ W * K ^ q := by rw [← Finset.sum_mul] rfl _ ≤ K * K ^ q := mul_le_mul_of_nonneg_right (hext W hW) (pow_nonneg hK q) _ = K ^ (q + 1) := by rw [pow_succ]; ring /-- A finite raw-moment theorem with a directly checkable extension majorant. -/ theorem bernoulliMean_containment_pow_le (T : Finset α) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hIT : ∀ i ∈ I, support i ⊆ T) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hw : ∀ i ∈ I, 0 ≤ weight i) (L q : ℕ) (hsize : ∀ i ∈ I, (support i).card ≤ L) (hext : ∀ W : Finset α, W.card ≤ L * q → sourceExtension I support weight θ W ≤ K) : bernoulliMean T θ (fun S => (containmentSum I support weight S) ^ q) ≤ K ^ q := by rw [bernoulliMean_containment_pow T I support weight hIT θ q] exact sourceMoment_le_pow I support weight hθ hK hw L (L * q) hsize hext q ∅ (by simp) /-- PS11 in finite form, including repeated monomial labels and diagonal tuple terms. The derivative majorant is zero beyond the fixed support degree L. -/ theorem rawMoment_le_binomial (T : Finset α) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hIT : ∀ i ∈ I, support i ⊆ T) {θ : ℝ} (hθ : 0 ≤ θ) (hw : ∀ i ∈ I, 0 ≤ weight i) (L q : ℕ) (hq : 1 ≤ q) (hsize : ∀ i ∈ I, (support i).card ≤ L) (μ : ℕ → ℝ) (hμ0 : ∀ j, 0 ≤ μ j) (hμzero : ∀ j, L < j → μ j = 0) (hμ : ∀ B, sourceDerivative I support weight θ B ≤ μ B.card) : bernoulliMean T θ (fun S => (containmentSum I support weight S) ^ q) ≤ (∑ j ∈ Finset.range (L + 1), ((L * q).choose j : ℝ) * μ j) ^ q := by have hLq : L ≤ L * q := by nlinarith have hsum : (∑ j ∈ Finset.range (L * q + 1), ((L * q).choose j : ℝ) * μ j) = ∑ j ∈ Finset.range (L + 1), ((L * q).choose j : ℝ) * μ j := by symm apply Finset.sum_subset (Finset.range_mono (Nat.succ_le_succ hLq)) intro j _ hj have hjL : L < j := by have hn : ¬j < L + 1 := fun h => hj (Finset.mem_range.mpr h) omega rw [hμzero j hjL, mul_zero] refine bernoulliMean_containment_pow_le T I support weight hIT hθ ?_ hw L q hsize ?_ · apply Finset.sum_nonneg intro j _ exact mul_nonneg (Nat.cast_nonneg _) (hμ0 j) · intro W hW rw [← hsum] exact sourceExtension_le_uniform_binomial_sum I support weight hθ hw W (L * q) hW μ hμ0 hμ end SourceExtension end Green39Submission.RawMoments end Green39AssemblyScope_283ef9b12e52d688 /- Source: Green39Submission.DisjointSupport; SHA256 a97f19a9a2dae78f9f6162336e12d6e0c4ebef9c38e18ec76790da14dc620c00 -/ section Green39AssemblyScope_1b8e8ecb5c014f0d /-! Exact-slice negative correlation and ordered disjoint-support moments. The support family is indexed: different labels with equal physical supports remain different summands. All weights, size bounds and sample spaces are explicit. This file does not assume any covering theorem. -/ namespace Green39Submission.DisjointSupport open scoped BigOperators universe u v w /-- Exact inclusion ratio. Natural subtraction/factorials give zero when too many sample vertices are requested. -/ noncomputable def fallingRatio (N n j : ℕ) : ℝ := (n.descFactorial j : ℝ) / (N.descFactorial j : ℝ) theorem fallingRatio_zero (N n : ℕ) : fallingRatio N n 0 = 1 := by simp [fallingRatio] theorem fallingRatio_nonneg (N n j : ℕ) : 0 ≤ fallingRatio N n j := by unfold fallingRatio positivity theorem fallingRatio_eq_zero_of_lt {N n j : ℕ} (h : n < j) : fallingRatio N n j = 0 := by simp [fallingRatio, Nat.descFactorial_eq_zero_iff_lt.mpr h] theorem fallingRatio_succ (N n j : ℕ) : fallingRatio N n (j + 1) = ((n - j : ℕ) : ℝ) / ((N - j : ℕ) : ℝ) * fallingRatio N n j := by simp only [fallingRatio, Nat.descFactorial_succ, Nat.cast_mul] exact mul_div_mul_comm _ _ _ _ /-- Removing equally many previously forced vertices decreases the next inclusion probability; the zero-denominator cases are included. -/ theorem sub_ratio_le_ratio (N n s : ℕ) (hnN : n ≤ N) : ((n - s : ℕ) : ℝ) / ((N - s : ℕ) : ℝ) ≤ (n : ℝ) / (N : ℝ) := by by_cases hsn : s ≤ n · by_cases hsN : s < N · have hN : (0 : ℝ) < N := by exact_mod_cast (Nat.zero_le s).trans_lt hsN have hNs : (0 : ℝ) < (N - s : ℕ) := by exact_mod_cast Nat.sub_pos_of_lt hsN rw [div_le_div_iff₀ hNs hN] rw [Nat.cast_sub hsn, Nat.cast_sub hsN.le] have hnN' : (n : ℝ) ≤ N := by exact_mod_cast hnN have hs : (0 : ℝ) ≤ s := by positivity nlinarith · have hEq : s = N := le_antisymm (hsn.trans hnN) (by omega) subst s simp only [Nat.sub_self, Nat.cast_zero, div_zero] positivity · have hns : n ≤ s := by omega simp only [Nat.sub_eq_zero_of_le hns, Nat.cast_zero, zero_div] positivity theorem fallingRatio_shift_le (N n s j : ℕ) (hnN : n ≤ N) : fallingRatio (N - s) (n - s) j ≤ fallingRatio N n j := by induction j with | zero => simp [fallingRatio_zero] | succ j ih => rw [fallingRatio_succ, fallingRatio_succ] have hfactor : (((n - s) - j : ℕ) : ℝ) / (((N - s) - j : ℕ) : ℝ) ≤ ((n - j : ℕ) : ℝ) / ((N - j : ℕ) : ℝ) := by simpa only [Nat.sub_sub, Nat.add_comm] using sub_ratio_le_ratio (N - j) (n - j) s (Nat.sub_le_sub_right hnN j) exact mul_le_mul hfactor ih (fallingRatio_nonneg _ _ _) (by positivity) theorem descFactorial_add (n a b : ℕ) : n.descFactorial (a + b) = n.descFactorial a * (n - a).descFactorial b := by induction b with | zero => simp | succ b ih => rw [Nat.add_succ, Nat.descFactorial_succ, ih, Nat.descFactorial_succ, Nat.sub_sub] ring theorem fallingRatio_add (N n a b : ℕ) : fallingRatio N n (a + b) = fallingRatio N n a * fallingRatio (N - a) (n - a) b := by simp only [fallingRatio, descFactorial_add, Nat.cast_mul] exact mul_div_mul_comm _ _ _ _ theorem fallingRatio_add_le (N n a b : ℕ) (hnN : n ≤ N) : fallingRatio N n (a + b) ≤ fallingRatio N n a * fallingRatio N n b := by rw [fallingRatio_add] exact mul_le_mul_of_nonneg_left (fallingRatio_shift_le N n a b hnN) (fallingRatio_nonneg _ _ _) theorem fallingRatio_le_pow (N n j : ℕ) (hnN : n ≤ N) : fallingRatio N n j ≤ ((n : ℝ) / (N : ℝ)) ^ j := by induction j with | zero => simp [fallingRatio_zero] | succ j ih => rw [fallingRatio_succ, pow_succ'] exact mul_le_mul (sub_ratio_le_ratio N n j hnN) ih (fallingRatio_nonneg _ _ _) (by positivity) theorem fallingRatio_sum_le_prod {κ : Type w} (J : Finset κ) (size : κ → ℕ) (N n : ℕ) (hnN : n ≤ N) : fallingRatio N n (∑ j ∈ J, size j) ≤ ∏ j ∈ J, fallingRatio N n (size j) := by classical induction J using Finset.induction_on with | empty => simp [fallingRatio_zero] | @insert a J ha ih => rw [Finset.sum_insert ha, Finset.prod_insert ha] exact (fallingRatio_add_le N n (size a) (∑ j ∈ J, size j) hnN).trans (mul_le_mul_of_nonneg_left ih (fallingRatio_nonneg _ _ _)) theorem fallingRatio_eq_choose (N n j : ℕ) : fallingRatio N n j = (n.choose j : ℝ) / (N.choose j : ℝ) := by have hj : (j.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero j simp only [fallingRatio, Nat.descFactorial_eq_factorial_mul_choose, Nat.cast_mul] exact mul_div_mul_left _ _ hj theorem choose_containment_ratio (N n j : ℕ) (hnN : n ≤ N) (hjn : j ≤ n) : ((N - j).choose (n - j) : ℝ) / (N.choose n : ℝ) = fallingRatio N n j := by rw [fallingRatio_eq_choose] have hNn : (N.choose n : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hnN).ne' have hNj : (N.choose j : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos (hjn.trans hnN)).ne' apply (div_eq_div_iff hNn hNj).mpr have h : (N.choose n : ℝ) * (n.choose j : ℝ) = (N.choose j : ℝ) * ((N - j).choose (n - j) : ℝ) := by exact_mod_cast Nat.choose_mul (n := N) (k := n) hjn nlinarith /-- The exact fixed-support containment formula, without Bernoulli sampling. -/ theorem exactSlice_containment_eq_fallingRatio {α : Type u} (U S : Finset α) (k : ℕ) (hSU : S ⊆ U) (hk : k ≤ U.card) : uniformProb (exactSlice U k) (fun B => S ⊆ B) = fallingRatio U.card k S.card := by classical by_cases hSk : S.card ≤ k · rw [uniformProb_exactSlice_contains U S k hSU hSk] exact choose_containment_ratio U.card k S.card hk hSk · have hzero : uniformProb (exactSlice U k) (fun B => S ⊆ B) = uniformProb (exactSlice U k) (fun _ => False) := by apply uniformProb_congr intro B hB constructor · intro hSB have hBcard : B.card = k := (mem_exactSlice.mp hB).2 exact hSk (hBcard ▸ Finset.card_le_card hSB) · exact False.elim rw [hzero, uniformProb_false] exact (fallingRatio_eq_zero_of_lt (N := U.card) (by omega)).symm theorem exactSlice_containment_le_pow {α : Type u} (U S : Finset α) (k : ℕ) (hSU : S ⊆ U) (hk : k ≤ U.card) : uniformProb (exactSlice U k) (fun B => S ⊆ B) ≤ ((k : ℝ) / (U.card : ℝ)) ^ S.card := by rw [exactSlice_containment_eq_fallingRatio U S k hSU hk] exact fallingRatio_le_pow U.card k S.card hk /-- Joint containment of pairwise disjoint fixed supports is negatively correlated on an exact-cardinality slice. -/ theorem exactSlice_disjoint_containment_le_prod {α : Type u} {κ : Type w} [DecidableEq α] (U : Finset α) (k : ℕ) (J : Finset κ) (support : κ → Finset α) (hk : k ≤ U.card) (hsub : ∀ j ∈ J, support j ⊆ U) (hdis : (J : Set κ).PairwiseDisjoint support) : uniformProb (exactSlice U k) (fun B => J.biUnion support ⊆ B) ≤ ∏ j ∈ J, uniformProb (exactSlice U k) (fun B => support j ⊆ B) := by classical have hUnion : J.biUnion support ⊆ U := Finset.biUnion_subset.mpr hsub rw [exactSlice_containment_eq_fallingRatio U _ k hUnion hk, Finset.card_biUnion hdis] calc fallingRatio U.card k (∑ j ∈ J, (support j).card) ≤ ∏ j ∈ J, fallingRatio U.card k (support j).card := fallingRatio_sum_le_prod J (fun j => (support j).card) U.card k hk _ = ∏ j ∈ J, uniformProb (exactSlice U k) (fun B => support j ⊆ B) := by apply Finset.prod_congr rfl intro j hj exact (exactSlice_containment_eq_fallingRatio U _ k (hsub j hj) hk).symm theorem containmentSum_nonneg {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) (B : Finset α) : 0 ≤ containmentSum I support weight B := by classical apply Finset.sum_nonneg intro i hi split_ifs <;> simp_all theorem containmentSum_mono {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) {B C : Finset α} (hBC : B ⊆ C) : containmentSum I support weight B ≤ containmentSum I support weight C := by classical unfold containmentSum apply Finset.sum_le_sum intro i hi by_cases hiB : support i ⊆ B · simp [hiB, hiB.trans hBC] · simp only [hiB, ↓reduceIte] split_ifs <;> simp_all theorem containmentSum_mono_weight {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight₁ weight₂ : ι → ℝ) (hw : ∀ i ∈ I, weight₁ i ≤ weight₂ i) (B : Finset α) : containmentSum I support weight₁ B ≤ containmentSum I support weight₂ B := by classical unfold containmentSum apply Finset.sum_le_sum intro i hi split_ifs · exact hw i hi · exact le_rfl /-- Positive total weight supplies an actual retained support with positive weight. In particular, zero-weight labels cannot witness this conclusion. -/ theorem exists_retained_of_containmentSum_pos {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (B : Finset α) (hpos : 0 < containmentSum I support weight B) : ∃ i ∈ I, support i ⊆ B ∧ 0 < weight i := by classical unfold containmentSum at hpos have hsum : (∑ i ∈ I, (0 : ℝ)) < ∑ i ∈ I, if support i ⊆ B then weight i else 0 := by simpa using hpos obtain ⟨i, hi, hterm⟩ := Finset.exists_lt_of_sum_lt hsum by_cases hsub : support i ⊆ B · exact ⟨i, hi, hsub, by simpa only [hsub, ↓reduceIte] using hterm⟩ · simp only [hsub, ↓reduceIte, lt_self_iff_false] at hterm theorem uniformMean_indicator_mul {α : Type u} (sample : Finset α) (event : α → Prop) [DecidablePred event] (c : ℝ) : uniformMean sample (fun a => if event a then c else 0) = c * uniformProb sample event := by classical have hf : (fun a => if event a then c else (0 : ℝ)) = (fun a => c * (if event a then 1 else 0)) := by funext a split_ifs <;> simp rw [hf, uniformMean_const_mul, ← uniformProb_eq_uniformMean_indicator] /-- Exact linearity for an indexed containment polynomial, preserving all labels even when their supports agree. -/ theorem uniformMean_containmentSum {α : Type u} {ι : Type v} (sample : Finset (Finset α)) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) : uniformMean sample (containmentSum I support weight) = ∑ i ∈ I, weight i * uniformProb sample (fun B => support i ⊆ B) := by classical unfold containmentSum rw [uniformMean_sum] apply Finset.sum_congr rfl intro i hi exact uniformMean_indicator_mul sample (fun B => support i ⊆ B) (weight i) /-- Union of the physical supports in an ordered tuple of labels. -/ noncomputable def tupleSupport {α : Type u} {ι : Type v} {κ : Type w} [Fintype κ] (support : ι → Finset α) (f : κ → ι) : Finset α := by classical exact Finset.univ.biUnion (fun j => support (f j)) theorem tupleSupport_eq_biUnion {α : Type u} {ι : Type v} {κ : Type w} [DecidableEq α] [Fintype κ] (support : ι → Finset α) (f : κ → ι) : tupleSupport support f = Finset.univ.biUnion (fun j => support (f j)) := by classical ext x simp [tupleSupport] /-- Pairwise physical disjointness, as opposed to merely distinct labels. -/ def tupleDisjoint {α : Type u} {ι : Type v} {κ : Type w} (support : ι → Finset α) (f : κ → ι) : Prop := Pairwise (fun a b => Disjoint (support (f a)) (support (f b))) /-- Ordered disjoint-support moment. The label subtype preserves indices even if several labels have the same support. -/ noncomputable def orderedMoment {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (r : ℕ) (B : Finset α) : ℝ := by classical exact ∑ f : Fin r → I, if tupleDisjoint (fun i : I => support i) f ∧ tupleSupport (fun i : I => support i) f ⊆ B then ∏ j, weight (f j) else 0 theorem orderedMoment_nonneg {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) (r : ℕ) (B : Finset α) : 0 ≤ orderedMoment I support weight r B := by classical unfold orderedMoment apply Finset.sum_nonneg intro f hf split_ifs · exact Finset.prod_nonneg (fun j _ => hw (f j) (f j).property) · exact le_rfl theorem orderedMoment_mono_weight {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight₁ weight₂ : ι → ℝ) (h₁ : ∀ i ∈ I, 0 ≤ weight₁ i) (h₁₂ : ∀ i ∈ I, weight₁ i ≤ weight₂ i) (r : ℕ) (B : Finset α) : orderedMoment I support weight₁ r B ≤ orderedMoment I support weight₂ r B := by classical unfold orderedMoment apply Finset.sum_le_sum intro f hf split_ifs · exact Finset.prod_le_prod (fun j _ => h₁ (f j) (f j).property) (fun j _ => h₁₂ (f j) (f j).property) · exact le_rfl theorem tupleSupport_cons {α : Type u} {ι : Type v} [DecidableEq α] (support : ι → Finset α) {r : ℕ} (i : ι) (f : Fin r → ι) : tupleSupport support (Fin.cons i f) = support i ∪ tupleSupport support f := by classical ext x simp [tupleSupport, Fin.exists_fin_succ] theorem tupleDisjoint_cons {α : Type u} {ι : Type v} (support : ι → Finset α) {r : ℕ} (i : ι) (f : Fin r → ι) : tupleDisjoint support (Fin.cons i f) ↔ (∀ j, Disjoint (support i) (support (f j))) ∧ tupleDisjoint support f := by constructor · intro h constructor · intro j exact h (by intro heq have hv := congrArg Fin.val heq simp only [Fin.val_zero, Fin.val_succ] at hv omega : (0 : Fin (r + 1)) ≠ j.succ) · intro a b hab exact h (by simpa using hab : a.succ ≠ b.succ) · rintro ⟨hhead, htail⟩ a b hab cases a using Fin.cases <;> cases b using Fin.cases · exact (hab rfl).elim · simpa using hhead _ · simpa using (hhead _).symm · exact htail (by simpa using hab) theorem tuple_retained_cons {α : Type u} {ι : Type v} [DecidableEq α] (support : ι → Finset α) {r : ℕ} (i : ι) (f : Fin r → ι) (B : Finset α) : (tupleDisjoint support (Fin.cons i f) ∧ tupleSupport support (Fin.cons i f) ⊆ B) ↔ support i ⊆ B ∧ tupleDisjoint support f ∧ tupleSupport support f ⊆ B \ support i := by classical rw [tupleDisjoint_cons, tupleSupport_cons, Finset.union_subset_iff, Finset.subset_sdiff] have hdis : (∀ j, Disjoint (support i) (support (f j))) ↔ Disjoint (tupleSupport support f) (support i) := by simp only [tupleSupport, Finset.disjoint_biUnion_left, Finset.mem_univ, forall_const] simp only [disjoint_comm] rw [hdis] tauto theorem orderedMoment_zero {α : Type u} {ι : Type v} (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (B : Finset α) : orderedMoment I support weight 0 B = 1 := by classical simp [orderedMoment, tupleDisjoint, Pairwise, tupleSupport] /-- Removing the first physical support gives the exact ordered extension recurrence, before taking expectations or choosing any deletion. -/ theorem orderedMoment_succ {α : Type u} {ι : Type v} [DecidableEq α] (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (r : ℕ) (B : Finset α) : orderedMoment I support weight (r + 1) B = ∑ i ∈ I, if support i ⊆ B then weight i * orderedMoment I support weight r (B \ support i) else 0 := by classical rw [← Finset.sum_coe_sort I] unfold orderedMoment rw [← (Fin.consEquiv (fun _ : Fin (r + 1) => I)).sum_comp] rw [Fintype.sum_prod_type] apply Finset.sum_congr rfl intro i hi have hcons (f : Fin r → I) : (Fin.consEquiv (fun _ : Fin (r + 1) => I)) (i, f) = Fin.cons i f := rfl simp only [hcons, tuple_retained_cons] by_cases hiB : support i ⊆ B · simp only [hiB, true_and, ↓reduceIte] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro f hf rw [Fin.prod_univ_succ] simp only [Fin.cons_zero, Fin.cons_succ] split_ifs <;> simp_all · simp [hiB] /-- Deterministic ordered-extension bound. Each partial tuple deletes the union of its supports, within the explicit `d * r` budget. -/ theorem pow_le_orderedMoment_of_robust {α : Type u} {ι : Type v} [DecidableEq α] (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) (d : ℕ) (hd : ∀ i ∈ I, (support i).card ≤ d) (r : ℕ) (B : Finset α) (t : ℝ) (ht : 0 ≤ t) (hrob : ∀ E ⊆ B, E.card ≤ d * r → t ≤ containmentSum I support weight (B \ E)) : t ^ r ≤ orderedMoment I support weight r B := by classical induction r generalizing B with | zero => simp [orderedMoment_zero] | succ r ih => have hbase : t ≤ containmentSum I support weight B := by simpa using hrob ∅ (Finset.empty_subset B) (by simp) rw [orderedMoment_succ] calc t ^ (r + 1) = t * t ^ r := pow_succ' _ _ _ ≤ containmentSum I support weight B * t ^ r := mul_le_mul_of_nonneg_right hbase (pow_nonneg ht _) _ = ∑ i ∈ I, if support i ⊆ B then weight i * t ^ r else 0 := by unfold containmentSum rw [Finset.sum_mul] apply Finset.sum_congr rfl intro i hi split_ifs <;> simp _ ≤ ∑ i ∈ I, if support i ⊆ B then weight i * orderedMoment I support weight r (B \ support i) else 0 := by apply Finset.sum_le_sum intro i hi by_cases hiB : support i ⊆ B · simp only [hiB, ↓reduceIte] apply mul_le_mul_of_nonneg_left _ (hw i hi) apply ih (B := B \ support i) intro E hE hcardE have hUnion : support i ∪ E ⊆ B := Finset.union_subset hiB (hE.trans Finset.sdiff_subset) have hcardUnion : (support i ∪ E).card ≤ d * (r + 1) := by calc (support i ∪ E).card ≤ (support i).card + E.card := Finset.card_union_le _ _ _ ≤ d + d * r := Nat.add_le_add (hd i hi) hcardE _ = d * (r + 1) := by ring have hremove : (B \ support i) \ E = B \ (support i ∪ E) := by ext x simp only [Finset.mem_sdiff, Finset.mem_union] tauto rw [hremove] exact hrob (support i ∪ E) hUnion hcardUnion · simp [hiB] /-- The exact-slice expected ordered disjoint-support moment is at most the ordinary mean to the same power. No independence hypothesis is used. -/ theorem orderedMoment_mean_le {α : Type u} {ι : Type v} [DecidableEq α] (U : Finset α) (k : ℕ) (hk : k ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (r : ℕ) : uniformMean (exactSlice U k) (orderedMoment I support weight r) ≤ (uniformMean (exactSlice U k) (containmentSum I support weight)) ^ r := by classical have hmean : uniformMean (exactSlice U k) (containmentSum I support weight) = ∑ i : I, weight i * uniformProb (exactSlice U k) (fun B => support i ⊆ B) := by rw [uniformMean_containmentSum] exact (Finset.sum_coe_sort I (fun i => weight i * uniformProb (exactSlice U k) (fun B => support i ⊆ B))).symm rw [hmean, Fintype.sum_pow] unfold orderedMoment rw [uniformMean_sum] apply Finset.sum_le_sum intro f hf have hwprod : 0 ≤ ∏ j : Fin r, weight (f j) := Finset.prod_nonneg (fun j _ => hw (f j) (f j).property) by_cases hdis : tupleDisjoint (fun i : I => support i) f · simp only [hdis, true_and] rw [uniformMean_indicator_mul] have hprob : uniformProb (exactSlice U k) (fun B => tupleSupport (fun i : I => support i) f ⊆ B) ≤ ∏ j : Fin r, uniformProb (exactSlice U k) (fun B => support (f j) ⊆ B) := by rw [tupleSupport_eq_biUnion] apply exactSlice_disjoint_containment_le_prod U k Finset.univ (fun j : Fin r => support (f j)) hk · intro j hj exact hsub (f j) (f j).property · intro a ha b hb hab exact hdis hab calc (∏ j : Fin r, weight (f j)) * uniformProb (exactSlice U k) (fun B => tupleSupport (fun i : I => support i) f ⊆ B) ≤ (∏ j : Fin r, weight (f j)) * ∏ j : Fin r, uniformProb (exactSlice U k) (fun B => support (f j) ⊆ B) := mul_le_mul_of_nonneg_left hprob hwprod _ = ∏ j : Fin r, weight (f j) * uniformProb (exactSlice U k) (fun B => support (f j) ⊆ B) := by rw [Finset.prod_mul_distrib] · simp only [hdis, false_and, ↓reduceIte, uniformMean_zero] exact Finset.prod_nonneg (fun j _ => mul_nonneg (hw (f j) (f j).property) (uniformProb_nonneg _ _)) /-- Weighted positive-threshold deletion bound on the exact slice. This holds for every positive threshold; the useful range is above the mean. There is no factorial improvement for arbitrary real weights. -/ theorem weighted_deletion_bound {α : Type u} {ι : Type v} [DecidableEq α] (U : Finset α) (k : ℕ) (hk : k ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (d : ℕ) (hd : ∀ i ∈ I, (support i).card ≤ d) (r : ℕ) (t : ℝ) (ht : 0 < t) : uniformProb (exactSlice U k) (fun B => ∀ E ⊆ B, E.card ≤ d * r → t < containmentSum I support weight (B \ E)) ≤ (uniformMean (exactSlice U k) (containmentSum I support weight) / t) ^ r := by classical calc uniformProb (exactSlice U k) (fun B => ∀ E ⊆ B, E.card ≤ d * r → t < containmentSum I support weight (B \ E)) ≤ uniformMean (exactSlice U k) (orderedMoment I support weight r) / t ^ r := by apply uniformProb_le_uniformMean_div_of_event · intro B hB exact orderedMoment_nonneg I support weight hw r B · exact pow_pos ht r · intro B hB hrob apply pow_le_orderedMoment_of_robust I support weight hw d hd r B t ht.le intro E hE hcard exact (hrob E hE hcard).le _ ≤ (uniformMean (exactSlice U k) (containmentSum I support weight)) ^ r / t ^ r := div_le_div_of_nonneg_right (orderedMoment_mean_le U k hk I support weight hsub hw r) (pow_nonneg ht.le r) _ = (uniformMean (exactSlice U k) (containmentSum I support weight) / t) ^ r := (div_pow _ _ _).symm end Green39Submission.DisjointSupport end Green39AssemblyScope_1b8e8ecb5c014f0d /- Source: Green39Submission.CodegreeMultiplicity; SHA256 37614e7182d2525ee333c1e74a77d76f624ec6152a7adb2648627366519fbb90 -/ section Green39AssemblyScope_21553c5430eafa8d /-! Finite support geometry for the codegree and uniform multiplicity estimates. The probability estimates are to be derived from the exact finite probability API and the disjoint-support moment lemmas. This file does not assume either the random covering theorem or its proposed probabilistic conclusions. -/ namespace Green39Submission.CodegreeMultiplicity open scoped BigOperators Pointwise universe u v section SupportPacking variable {α : Type u} {ι : Type v} [DecidableEq α] /-- If every permitted input deletion leaves a support, there are `r` pairwise-disjoint retained supports. Labels are never identified merely because they happen to have the same physical support. -/ theorem disjointPacking_of_robustDeletion (A : Finset α) (I : Finset ι) (support : ι → Finset α) (j r : ℕ) (hnonempty : ∀ i ∈ I, (support i).Nonempty) (hrank : ∀ i ∈ I, (support i).card ≤ j) (hrobust : ∀ E : Finset α, E ⊆ A → E.card ≤ j * r → ∃ i ∈ I, support i ⊆ A \ E) : ∃ Q : Finset ι, Q ⊆ I ∧ Q.card = r ∧ (∀ i ∈ Q, support i ⊆ A) ∧ (Q : Set ι).PairwiseDisjoint support := by classical revert hrobust induction r with | zero => intro hrobust refine ⟨∅, Finset.empty_subset I, Finset.card_empty, ?_, ?_⟩ · simp · simp | succ r ih => intro hrobust have hbudget : j * r ≤ j * (r + 1) := Nat.mul_le_mul_left j (Nat.le_succ r) obtain ⟨Q, hQI, hQr, hQA, hQdis⟩ := ih (fun E hEA hEcard => hrobust E hEA (hEcard.trans hbudget)) let E := Q.biUnion support have hEA : E ⊆ A := Finset.biUnion_subset.mpr hQA have hEcard : E.card ≤ j * r := by calc E.card ≤ ∑ i ∈ Q, (support i).card := Finset.card_biUnion_le _ ≤ ∑ i ∈ Q, j := Finset.sum_le_sum (fun i hi => hrank i (hQI hi)) _ = j * r := by simp [hQr, Nat.mul_comm] obtain ⟨i, hiI, hiRetained⟩ := hrobust E hEA (hEcard.trans hbudget) have hnewDisjoint : ∀ a ∈ Q, Disjoint (support i) (support a) := by intro a ha apply Finset.disjoint_left.mpr intro x hxi hxa have hxnot : x ∉ E := (Finset.mem_sdiff.mp (hiRetained hxi)).2 exact hxnot (Finset.mem_biUnion.mpr ⟨a, ha, hxa⟩) have hiQ : i ∉ Q := by intro hi obtain ⟨x, hx⟩ := hnonempty i hiI exact Finset.disjoint_left.mp (hnewDisjoint i hi) hx hx refine ⟨insert i Q, ?_, ?_, ?_, ?_⟩ · intro a ha rcases Finset.mem_insert.mp ha with rfl | ha · exact hiI · exact hQI ha · simp [hiQ, hQr] · intro a ha rcases Finset.mem_insert.mp ha with rfl | ha · intro x hx exact (Finset.mem_sdiff.mp (hiRetained hx)).1 · exact hQA a ha · intro a ha b hb hab rcases Finset.mem_insert.mp ha with hai | haQ · subst a rcases Finset.mem_insert.mp hb with hbi | hbQ · subst b exact (hab rfl).elim · exact hnewDisjoint b hbQ · rcases Finset.mem_insert.mp hb with hbi | hbQ · subst b exact (hnewDisjoint a haQ).symm · exact hQdis haQ hbQ hab /-- Every ordering of a fixed disjoint packing contributes one to the weight-one ordered moment. The proof injects actual permutations into the retained labelled tuples. -/ theorem factorial_le_orderedMoment_of_packing (A : Finset α) (I Q : Finset ι) (support : ι → Finset α) (r : ℕ) (hQI : Q ⊆ I) (hQr : Q.card = r) (hQA : ∀ i ∈ Q, support i ⊆ A) (hQdis : (Q : Set ι).PairwiseDisjoint support) : (r.factorial : ℝ) ≤ DisjointSupport.orderedMoment I support (fun _ => 1) r A := by classical let e : Fin r ≃ Q := (Finset.equivFinOfCardEq hQr).symm let embed : Q → I := fun i => ⟨i.val, hQI i.property⟩ have hembed : Function.Injective embed := by intro a b h exact Subtype.ext (congrArg (fun z : I => z.val) h) let tuple : Equiv.Perm (Fin r) → (Fin r → I) := fun σ a => embed (e (σ a)) have htuple : Function.Injective tuple := by intro σ τ h apply Equiv.ext intro a apply e.injective apply hembed exact congrFun h a let good : Finset (Fin r → I) := Finset.univ.filter (fun f => DisjointSupport.tupleDisjoint (fun i : I => support i) f ∧ DisjointSupport.tupleSupport (fun i : I => support i) f ⊆ A) have hgood : ∀ σ : Equiv.Perm (Fin r), tuple σ ∈ good := by intro σ apply Finset.mem_filter.mpr refine ⟨Finset.mem_univ _, ?_, ?_⟩ · intro a b hab change Disjoint (support (e (σ a)).val) (support (e (σ b)).val) apply hQdis (e (σ a)).property (e (σ b)).property intro h exact hab (σ.injective (e.injective (Subtype.ext h))) · rw [DisjointSupport.tupleSupport_eq_biUnion] apply Finset.biUnion_subset.mpr intro a ha change support (e (σ a)).val ⊆ A exact hQA _ (e (σ a)).property have hcount : r.factorial ≤ good.card := by calc r.factorial = (Finset.univ : Finset (Equiv.Perm (Fin r))).card := by simp only [Finset.card_univ, Fintype.card_perm, Fintype.card_fin] _ ≤ good.card := Finset.card_le_card_of_injOn tuple (fun σ _ => hgood σ) (fun σ _ τ _ h => htuple h) have hmoment : DisjointSupport.orderedMoment I support (fun _ => 1) r A = (good.card : ℝ) := by simp [DisjointSupport.orderedMoment, good] rw [hmoment] exact_mod_cast hcount /-- The deterministic factorial amplification behind integer zero-count deletion. No probabilistic conclusion is included as a hypothesis. -/ theorem factorial_le_orderedMoment_of_robustDeletion (A : Finset α) (I : Finset ι) (support : ι → Finset α) (j r : ℕ) (hnonempty : ∀ i ∈ I, (support i).Nonempty) (hrank : ∀ i ∈ I, (support i).card ≤ j) (hrobust : ∀ E : Finset α, E ⊆ A → E.card ≤ j * r → ∃ i ∈ I, support i ⊆ A \ E) : (r.factorial : ℝ) ≤ DisjointSupport.orderedMoment I support (fun _ => 1) r A := by obtain ⟨Q, hQI, hQr, hQA, hQdis⟩ := disjointPacking_of_robustDeletion A I support j r hnonempty hrank hrobust exact factorial_le_orderedMoment_of_packing A I Q support r hQI hQr hQA hQdis /-- Integer zero-count deletion for unit-weight labelled supports. Positive integer multiplicities can be represented by retaining separate labels. -/ theorem unitWeight_deletion_bound (U : Finset α) (k : ℕ) (hk : k ≤ U.card) (I : Finset ι) (support : ι → Finset α) (hsub : ∀ i ∈ I, support i ⊆ U) (hnonempty : ∀ i ∈ I, (support i).Nonempty) (j : ℕ) (hrank : ∀ i ∈ I, (support i).card ≤ j) (r : ℕ) : uniformProb (exactSlice U k) (fun A => ∀ E : Finset α, E ⊆ A → E.card ≤ j * r → ∃ i ∈ I, support i ⊆ A \ E) ≤ (uniformMean (exactSlice U k) (containmentSum I support (fun _ => 1))) ^ r / (r.factorial : ℝ) := by classical calc uniformProb (exactSlice U k) (fun A => ∀ E : Finset α, E ⊆ A → E.card ≤ j * r → ∃ i ∈ I, support i ⊆ A \ E) ≤ uniformMean (exactSlice U k) (DisjointSupport.orderedMoment I support (fun _ => 1) r) / (r.factorial : ℝ) := by apply uniformProb_le_uniformMean_div_of_event · intro A hA exact DisjointSupport.orderedMoment_nonneg I support (fun _ => 1) (fun _ _ => zero_le_one) r A · exact_mod_cast Nat.factorial_pos r · intro A hA hrobust exact factorial_le_orderedMoment_of_robustDeletion A I support j r hnonempty hrank hrobust _ ≤ (uniformMean (exactSlice U k) (containmentSum I support (fun _ => 1))) ^ r / (r.factorial : ℝ) := div_le_div_of_nonneg_right (DisjointSupport.orderedMoment_mean_le U k hk I support (fun _ => 1) hsub (fun _ _ => zero_le_one) r) (Nat.cast_nonneg r.factorial) /-- Positive weights at least one satisfy the same zero-count factorial bound. In particular this includes every positive integer-weight family. -/ theorem weightAtLeastOne_deletion_bound (U : Finset α) (k : ℕ) (hk : k ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hnonempty : ∀ i ∈ I, (support i).Nonempty) (hw : ∀ i ∈ I, 1 ≤ weight i) (j : ℕ) (hrank : ∀ i ∈ I, (support i).card ≤ j) (r : ℕ) : uniformProb (exactSlice U k) (fun A => ∀ E : Finset α, E ⊆ A → E.card ≤ j * r → 0 < containmentSum I support weight (A \ E)) ≤ (uniformMean (exactSlice U k) (containmentSum I support weight)) ^ r / (r.factorial : ℝ) := by classical have hmean : uniformMean (exactSlice U k) (containmentSum I support (fun _ => 1)) ≤ uniformMean (exactSlice U k) (containmentSum I support weight) := by apply uniformMean_mono intro A hA exact DisjointSupport.containmentSum_mono_weight I support (fun _ => 1) weight hw A calc uniformProb (exactSlice U k) (fun A => ∀ E : Finset α, E ⊆ A → E.card ≤ j * r → 0 < containmentSum I support weight (A \ E)) ≤ uniformProb (exactSlice U k) (fun A => ∀ E : Finset α, E ⊆ A → E.card ≤ j * r → ∃ i ∈ I, support i ⊆ A \ E) := by apply uniformProb_mono intro A hA hrob E hEA hEcard obtain ⟨i, hi, hret, hwpos⟩ := DisjointSupport.exists_retained_of_containmentSum_pos I support weight (A \ E) (hrob E hEA hEcard) exact ⟨i, hi, hret⟩ _ ≤ (uniformMean (exactSlice U k) (containmentSum I support (fun _ => 1))) ^ r / (r.factorial : ℝ) := unitWeight_deletion_bound U k hk I support hsub hnonempty j hrank r _ ≤ (uniformMean (exactSlice U k) (containmentSum I support weight)) ^ r / (r.factorial : ℝ) := by apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg r.factorial) apply pow_le_pow_left₀ _ hmean apply uniformMean_nonneg intro A hA exact DisjointSupport.containmentSum_nonneg I support (fun _ => 1) (fun _ _ => zero_le_one) A end SupportPacking /-- The rank-six exact-slice inclusion factor in the square-root range. -/ theorem rankSixMeanFactor_le (N k : ℕ) (hkpos : 0 < k) (hk : k ≤ N) (hksq : k ^ 2 ≤ N) : (N : ℝ) * DisjointSupport.fallingRatio N k 6 ≤ 1 / (k : ℝ) ^ 4 := by have hkR : (0 : ℝ) < k := by exact_mod_cast hkpos have hNR : (0 : ℝ) < N := by exact_mod_cast hkpos.trans_le hk have hsq : (k : ℝ) ^ 2 ≤ N := by exact_mod_cast hksq have hratio : (k : ℝ) / (N : ℝ) ≤ 1 / (k : ℝ) := by apply (div_le_div_iff₀ hNR hkR).mpr simpa only [pow_two, one_mul] using hsq have hquad : (k : ℝ) ^ 2 / (N : ℝ) ≤ 1 := (div_le_one hNR).mpr hsq calc (N : ℝ) * DisjointSupport.fallingRatio N k 6 ≤ (N : ℝ) * ((k : ℝ) / (N : ℝ)) ^ 6 := mul_le_mul_of_nonneg_left (DisjointSupport.fallingRatio_le_pow N k 6 hk) hNR.le _ = ((k : ℝ) ^ 2 / (N : ℝ)) * ((k : ℝ) / (N : ℝ)) ^ 4 := by field_simp [hNR.ne'] _ ≤ 1 * (1 / (k : ℝ)) ^ 4 := mul_le_mul hquad (pow_le_pow_left₀ (div_nonneg hkR.le hNR.le) hratio 4) (by positivity) (by positivity) _ = 1 / (k : ℝ) ^ 4 := by simp /-- A coarse rank-six mean estimate, avoiding all asymptotic approximations. -/ theorem multiplicityMean_six_le (N k H : ℕ) (hkpos : 0 < k) (hk : k ≤ N) (hksq : k ^ 2 ≤ N) : (N : ℝ) * (H.choose 6 : ℝ) * DisjointSupport.fallingRatio N k 6 ≤ (H : ℝ) ^ 6 / (k : ℝ) ^ 4 := by have hchoose : (H.choose 6 : ℝ) ≤ (H : ℝ) ^ 6 := by exact_mod_cast Nat.choose_le_pow H 6 calc (N : ℝ) * (H.choose 6 : ℝ) * DisjointSupport.fallingRatio N k 6 = ((N : ℝ) * DisjointSupport.fallingRatio N k 6) * (H.choose 6 : ℝ) := by ring _ ≤ (1 / (k : ℝ) ^ 4) * (H : ℝ) ^ 6 := mul_le_mul (rankSixMeanFactor_le N k hkpos hk hksq) hchoose (Nat.cast_nonneg _) (by positivity) _ = (H : ℝ) ^ 6 / (k : ℝ) ^ 4 := by ring /-- Retaining only the factor two from `6!` is enough for the sharp finite rank-six cleanup estimate. -/ theorem multiplicityMean_six_le_half (N k H : ℕ) (hkpos : 0 < k) (hk : k ≤ N) (hksq : k ^ 2 ≤ N) : (N : ℝ) * (H.choose 6 : ℝ) * DisjointSupport.fallingRatio N k 6 ≤ (H : ℝ) ^ 6 / (2 * (k : ℝ) ^ 4) := by have hkR : (0 : ℝ) < k := by exact_mod_cast hkpos have hchoose : (H.choose 6 : ℝ) ≤ (H : ℝ) ^ 6 / 2 := by calc (H.choose 6 : ℝ) ≤ (H : ℝ) ^ 6 / ((6 : ℕ).factorial : ℝ) := Nat.choose_le_pow_div 6 H _ ≤ (H : ℝ) ^ 6 / 2 := div_le_div_of_nonneg_left (by positivity) (by norm_num) (by norm_num) calc (N : ℝ) * (H.choose 6 : ℝ) * DisjointSupport.fallingRatio N k 6 = ((N : ℝ) * DisjointSupport.fallingRatio N k 6) * (H.choose 6 : ℝ) := by ring _ ≤ (1 / (k : ℝ) ^ 4) * ((H : ℝ) ^ 6 / 2) := mul_le_mul (rankSixMeanFactor_le N k hkpos hk hksq) hchoose (Nat.cast_nonneg _) (by positivity) _ = (H : ℝ) ^ 6 / (2 * (k : ℝ) ^ 4) := by field_simp [hkR.ne'] /-- Elementary count bound for every possible descriptor size. -/ theorem centerDescriptorCount_le (N H : ℕ) (hN : 0 < N) : (∑ h ∈ Finset.range (H + 1), (N.choose h : ℝ)) ≤ ((2 : ℝ) * (N : ℝ)) ^ H := by have hN1 : (1 : ℝ) ≤ N := by exact_mod_cast Nat.succ_le_of_lt hN have hH : ((H + 1 : ℕ) : ℝ) ≤ (2 : ℝ) ^ H := by exact_mod_cast Nat.succ_le_of_lt (show H < 2 ^ H from Nat.lt_two_pow_self) calc (∑ h ∈ Finset.range (H + 1), (N.choose h : ℝ)) ≤ ∑ h ∈ Finset.range (H + 1), (N : ℝ) ^ H := by apply Finset.sum_le_sum intro h hh calc (N.choose h : ℝ) ≤ (N : ℝ) ^ h := by exact_mod_cast Nat.choose_le_pow N h _ ≤ (N : ℝ) ^ H := pow_le_pow_right₀ hN1 (Nat.lt_succ_iff.mp (Finset.mem_range.mp hh)) _ = ((H + 1 : ℕ) : ℝ) * (N : ℝ) ^ H := by simp [nsmul_eq_mul] _ ≤ (2 : ℝ) ^ H * (N : ℝ) ^ H := mul_le_mul_of_nonneg_right hH (by positivity) _ = ((2 : ℝ) * (N : ℝ)) ^ H := (mul_pow _ _ _).symm section Additive variable {G : Type u} [AddCommGroup G] [DecidableEq G] /-- Input vertices required by a fixed target and a set of source labels. -/ def preimageSupport (x : G) (Q : Finset G) : Finset G := Q.image (fun d => x - d) theorem preimage_map_injective (x : G) : Function.Injective (fun d : G => x - d) := by intro a b h apply neg_injective exact add_left_cancel (by simpa only [sub_eq_add_neg] using h) theorem card_preimageSupport (x : G) (Q : Finset G) : (preimageSupport x Q).card = Q.card := by exact Finset.card_image_of_injective Q (preimage_map_injective x) theorem preimageSupport_nonempty (x : G) (Q : Finset G) : (preimageSupport x Q).Nonempty ↔ Q.Nonempty := by simp [preimageSupport] theorem preimageSupport_subset_iff (x : G) (Q A : Finset G) : preimageSupport x Q ⊆ A ↔ ∀ d ∈ Q, x - d ∈ A := by constructor · intro h d hd exact h (Finset.mem_image.mpr ⟨d, hd, rfl⟩) · intro h a ha rcases Finset.mem_image.mp ha with ⟨d, hd, rfl⟩ exact h d hd theorem representationCount_mono_input {A B D : Finset G} (hAB : A ⊆ B) (x : G) : representationCount A D x ≤ representationCount B D x := by apply Finset.card_le_card intro d hd rcases Finset.mem_filter.mp hd with ⟨hdD, hdA⟩ exact Finset.mem_filter.mpr ⟨hdD, hAB hdA⟩ theorem representationCount_mono_sources {A D E : Finset G} (hDE : D ⊆ E) (x : G) : representationCount A D x ≤ representationCount A E x := by apply Finset.card_le_card intro d hd rcases Finset.mem_filter.mp hd with ⟨hdD, hdA⟩ exact Finset.mem_filter.mpr ⟨hDE hdD, hdA⟩ theorem representationCount_le_card_sources (A D : Finset G) (x : G) : representationCount A D x ≤ D.card := by exact Finset.card_filter_le D (fun d => x - d ∈ A) /-- The fixed-rank source subsets at a row are exactly the retained supports. -/ theorem powersetCard_representation_filter (A D : Finset G) (x : G) (j : ℕ) : (D.filter (fun d => x - d ∈ A)).powersetCard j = (D.powersetCard j).filter (fun Q => preimageSupport x Q ⊆ A) := by classical ext Q simp only [Finset.mem_powersetCard, Finset.mem_filter] constructor · rintro ⟨hQ, hcard⟩ refine ⟨⟨?_, hcard⟩, ?_⟩ · intro d hd exact (Finset.mem_filter.mp (hQ hd)).1 · apply (preimageSupport_subset_iff x Q A).2 intro d hd exact (Finset.mem_filter.mp (hQ hd)).2 · rintro ⟨⟨hQD, hcard⟩, hsupport⟩ refine ⟨?_, hcard⟩ intro d hd exact Finset.mem_filter.mpr ⟨hQD hd, (preimageSupport_subset_iff x Q A).1 hsupport d hd⟩ theorem representationCount_choose_eq_card_supports (A D : Finset G) (x : G) (j : ℕ) : (representationCount A D x).choose j = ((D.powersetCard j).filter (fun Q => preimageSupport x Q ⊆ A)).card := by classical rw [representationCount, ← Finset.card_powersetCard, powersetCard_representation_filter] theorem preimageSupport_card_of_mem_powersetCard {D Q : Finset G} {j : ℕ} (hQ : Q ∈ D.powersetCard j) (x : G) : (preimageSupport x Q).card = j := by rw [card_preimageSupport] exact (Finset.mem_powersetCard.mp hQ).2 theorem preimageSupport_nonempty_of_mem_powersetCard {D Q : Finset G} {j : ℕ} (hj : 0 < j) (hQ : Q ∈ D.powersetCard j) (x : G) : (preimageSupport x Q).Nonempty := by apply Finset.card_pos.mp rw [preimageSupport_card_of_mem_powersetCard hQ] exact hj /-- The nonzero difference codegree condition used by D2. -/ def NonzeroCodegreeBound (A : Finset G) (J : ℕ) : Prop := ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J theorem nonzeroCodegreeBound_mono_input {A B : Finset G} {J : ℕ} (hAB : A ⊆ B) (hB : NonzeroCodegreeBound B J) : NonzeroCodegreeBound A J := by intro d hd apply le_trans (Finset.card_le_card ?_) (hB d hd) intro a ha rcases Finset.mem_filter.mp ha with ⟨haA, hadA⟩ exact Finset.mem_filter.mpr ⟨hAB haA, hAB hadA⟩ section Finite variable [Fintype G] /-- Nonnegative integer polynomial from Appendix B, with target labels retained. -/ def multiplicityCount (A D : Finset G) (j : ℕ) : ℕ := ∑ x : G, (representationCount A D x).choose j /-- Fixed target/source-subset labels; duplicate physical supports remain different labels in this finite family. -/ def multiplicityLabels (D : Finset G) (j : ℕ) : Finset (G × Finset G) := Finset.univ.product (D.powersetCard j) def multiplicitySupport (i : G × Finset G) : Finset G := preimageSupport i.1 i.2 theorem multiplicitySupport_card {D : Finset G} {j : ℕ} {i : G × Finset G} (hi : i ∈ multiplicityLabels D j) : (multiplicitySupport i).card = j := by exact preimageSupport_card_of_mem_powersetCard (Finset.mem_product.mp hi).2 i.1 theorem multiplicitySupport_nonempty {D : Finset G} {j : ℕ} (hj : 0 < j) {i : G × Finset G} (hi : i ∈ multiplicityLabels D j) : (multiplicitySupport i).Nonempty := by apply Finset.card_pos.mp rw [multiplicitySupport_card hi] exact hj theorem multiplicityCount_cast_eq_containmentSum (A D : Finset G) (j : ℕ) : (multiplicityCount A D j : ℝ) = containmentSum (multiplicityLabels D j) multiplicitySupport (fun _ => 1) A := by classical unfold containmentSum multiplicityLabels rw [Finset.product_eq_sprod, Finset.sum_product] simp only [multiplicityCount, Nat.cast_sum, multiplicitySupport] apply Finset.sum_congr rfl intro x hx rw [representationCount_choose_eq_card_supports A D x j] refine (Finset.natCast_card_filter (R := ℝ) (fun Q : Finset G => preimageSupport x Q ⊆ A) (D.powersetCard j)).trans ?_ apply Finset.sum_congr rfl intro Q hQ by_cases hret : preimageSupport x Q ⊆ A <;> simp only [hret, ↓reduceIte] theorem multiplicityCount_pos_iff (A D : Finset G) (j : ℕ) : 0 < multiplicityCount A D j ↔ ∃ i ∈ multiplicityLabels D j, multiplicitySupport i ⊆ A := by classical rw [multiplicityCount, Finset.sum_pos_iff] constructor · rintro ⟨x, hx, hpos⟩ rw [representationCount_choose_eq_card_supports A D x j] at hpos obtain ⟨Q, hQ⟩ := Finset.card_pos.mp hpos rcases Finset.mem_filter.mp hQ with ⟨hQD, hret⟩ exact ⟨(x, Q), Finset.mem_product.mpr ⟨Finset.mem_univ x, hQD⟩, hret⟩ · rintro ⟨⟨x, Q⟩, hi, hret⟩ refine ⟨x, Finset.mem_univ x, ?_⟩ rw [representationCount_choose_eq_card_supports A D x j] exact Finset.card_pos.mpr ⟨Q, Finset.mem_filter.mpr ⟨(Finset.mem_product.mp hi).2, hret⟩⟩ /-- The exact mean in MP6 on the original fixed-cardinality sample space. -/ theorem uniformMean_multiplicitySupports (D : Finset G) (k j : ℕ) (hk : k ≤ Fintype.card G) : uniformMean (exactSlice (Finset.univ : Finset G) k) (containmentSum (multiplicityLabels D j) multiplicitySupport (fun _ => 1)) = (Fintype.card G : ℝ) * (D.card.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j := by classical rw [DisjointSupport.uniformMean_containmentSum] calc (∑ i ∈ multiplicityLabels D j, (1 : ℝ) * uniformProb (exactSlice (Finset.univ : Finset G) k) (fun B => multiplicitySupport i ⊆ B)) = ∑ i ∈ multiplicityLabels D j, DisjointSupport.fallingRatio (Fintype.card G) k j := by apply Finset.sum_congr rfl intro i hi rw [one_mul, DisjointSupport.exactSlice_containment_eq_fallingRatio Finset.univ (multiplicitySupport i) k (Finset.subset_univ _) (by simpa only [Finset.card_univ] using hk)] rw [Finset.card_univ, multiplicitySupport_card hi] _ = (Fintype.card G : ℝ) * (D.card.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j := by simp [multiplicityLabels, Finset.card_product, Finset.card_powersetCard, nsmul_eq_mul, mul_assoc] theorem uniformMean_multiplicityCount (D : Finset G) (k j : ℕ) (hk : k ≤ Fintype.card G) : uniformMean (exactSlice (Finset.univ : Finset G) k) (fun A => (multiplicityCount A D j : ℝ)) = (Fintype.card G : ℝ) * (D.card.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j := by have hfun : (fun A : Finset G => (multiplicityCount A D j : ℝ)) = containmentSum (multiplicityLabels D j) multiplicitySupport (fun _ => 1) := by funext A exact multiplicityCount_cast_eq_containmentSum A D j rw [hfun] exact uniformMean_multiplicitySupports D k j hk /-- A deterministic deletion certificate; the probability of uniform existence is a separate theorem, not a field or premise hidden inside this definition. -/ def MultiplicityCleanup (A D : Finset G) (j b : ℕ) : Prop := ∃ E : Finset G, E ⊆ A ∧ E.card ≤ b ∧ ∀ x : G, representationCount (A \ E) D x < j theorem multiplicityCleanup_mono_budget {A D : Finset G} {j b c : ℕ} (hbc : b ≤ c) (h : MultiplicityCleanup A D j b) : MultiplicityCleanup A D j c := by rcases h with ⟨E, hEA, hEb, hE⟩ exact ⟨E, hEA, hEb.trans hbc, hE⟩ /-- Further input deletion preserves a cleanup certificate; the new exceptional set is the old exceptional set intersected with the input. -/ theorem multiplicityCleanup_mono_input {A B D : Finset G} {j b : ℕ} (hBA : B ⊆ A) (h : MultiplicityCleanup A D j b) : MultiplicityCleanup B D j b := by rcases h with ⟨E, hEA, hEb, hE⟩ refine ⟨E ∩ B, Finset.inter_subset_right, (Finset.card_le_card Finset.inter_subset_left).trans hEb, ?_⟩ have hclean : B \ (E ∩ B) ⊆ A \ E := by intro x hx rcases Finset.mem_sdiff.mp hx with ⟨hxB, hxnot⟩ apply Finset.mem_sdiff.mpr refine ⟨hBA hxB, ?_⟩ intro hxE exact hxnot (Finset.mem_inter.mpr ⟨hxE, hxB⟩) intro x exact (representationCount_mono_input hclean x).trans_lt (hE x) theorem sum_representationCount_le {A D : Finset G} {K : ℕ} (hcap : ∀ x : G, representationCount A D x ≤ K) (T : Finset G) : (∑ x ∈ T, representationCount A D x) ≤ K * T.card := by calc (∑ x ∈ T, representationCount A D x) ≤ ∑ x ∈ T, K := Finset.sum_le_sum (fun x hx => hcap x) _ = K * T.card := by simp [Nat.mul_comm] /-- MP14 applies to the cleaned input, uniformly in every later source set. -/ theorem multiplicityCleanup_incidence_certificate {A D : Finset G} {K b : ℕ} (h : MultiplicityCleanup A D (K + 1) b) : ∃ E : Finset G, E ⊆ A ∧ E.card ≤ b ∧ ∀ T : Finset G, (∑ x ∈ T, representationCount (A \ E) D x) ≤ K * T.card := by rcases h with ⟨E, hEA, hEb, hE⟩ refine ⟨E, hEA, hEb, ?_⟩ intro T exact sum_representationCount_le (fun x => Nat.le_of_lt_succ (hE x)) T theorem multiplicityCount_eq_zero_iff (A D : Finset G) (j : ℕ) : multiplicityCount A D j = 0 ↔ ∀ x : G, representationCount A D x < j := by constructor · intro h x apply Nat.choose_eq_zero_iff.mp apply Nat.eq_zero_of_le_zero calc (representationCount A D x).choose j ≤ multiplicityCount A D j := by unfold multiplicityCount exact Finset.single_le_sum (fun y _ => Nat.zero_le ((representationCount A D y).choose j)) (Finset.mem_univ x) _ = 0 := h · intro h apply Finset.sum_eq_zero intro x hx exact Nat.choose_eq_zero_of_lt (h x) theorem multiplicityCleanup_iff_zero_count (A D : Finset G) (j b : ℕ) : MultiplicityCleanup A D j b ↔ ∃ E : Finset G, E ⊆ A ∧ E.card ≤ b ∧ multiplicityCount (A \ E) D j = 0 := by simp only [MultiplicityCleanup, multiplicityCount_eq_zero_iff] theorem not_multiplicityCleanup_iff_robust_supports (A D : Finset G) (j b : ℕ) : ¬ MultiplicityCleanup A D j b ↔ ∀ E : Finset G, E ⊆ A → E.card ≤ b → ∃ i ∈ multiplicityLabels D j, multiplicitySupport i ⊆ A \ E := by rw [multiplicityCleanup_iff_zero_count] constructor · intro h E hEA hEb apply (multiplicityCount_pos_iff (A \ E) D j).mp exact Nat.pos_of_ne_zero (fun hz => h ⟨E, hEA, hEb, hz⟩) · rintro h ⟨E, hEA, hEb, hz⟩ have hp := (multiplicityCount_pos_iff (A \ E) D j).mpr (h E hEA hEb) exact (Nat.ne_of_gt hp) hz /-- Fixed-descriptor zero-multiplicity cleanup, with the factorial improvement and exact fixed-cardinality mean. -/ theorem multiplicityCleanup_failure_le (D : Finset G) (k j r : ℕ) (hk : k ≤ Fintype.card G) (hj : 0 < j) : uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ MultiplicityCleanup A D j (j * r)) ≤ ((Fintype.card G : ℝ) * (D.card.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j) ^ r / (r.factorial : ℝ) := by classical calc uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ MultiplicityCleanup A D j (j * r)) = uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ∀ E : Finset G, E ⊆ A → E.card ≤ j * r → ∃ i ∈ multiplicityLabels D j, multiplicitySupport i ⊆ A \ E) := by apply uniformProb_congr intro A hA exact not_multiplicityCleanup_iff_robust_supports A D j (j * r) _ ≤ (uniformMean (exactSlice (Finset.univ : Finset G) k) (containmentSum (multiplicityLabels D j) multiplicitySupport (fun _ => 1))) ^ r / (r.factorial : ℝ) := by apply unitWeight_deletion_bound Finset.univ k (by simpa only [Finset.card_univ] using hk) (multiplicityLabels D j) multiplicitySupport · intro i hi exact Finset.subset_univ _ · intro i hi exact multiplicitySupport_nonempty hj hi · intro i hi exact (multiplicitySupport_card hi).le _ = ((Fintype.card G : ℝ) * (D.card.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j) ^ r / (r.factorial : ℝ) := by rw [uniformMean_multiplicitySupports D k j hk] /-- All potential center descriptors of the permitted size, chosen before the random input is sampled. -/ def smallCenterSets (H : ℕ) : Finset (Finset G) := Finset.univ.powerset.filter (fun D => D.card ≤ H) theorem mem_smallCenterSets (D : Finset G) (H : ℕ) : D ∈ smallCenterSets (G := G) H ↔ D.card ≤ H := by simp [smallCenterSets] theorem smallCenterSets_eq_biUnion (H : ℕ) : smallCenterSets (G := G) H = (Finset.range (H + 1)).biUnion (fun h => (Finset.univ : Finset G).powersetCard h) := by classical ext D constructor · intro hD apply Finset.mem_biUnion.mpr exact ⟨D.card, Finset.mem_range.mpr (Nat.lt_succ_of_le ((mem_smallCenterSets D H).mp hD)), Finset.mem_powersetCard.mpr ⟨Finset.subset_univ D, rfl⟩⟩ · intro hD rcases Finset.mem_biUnion.mp hD with ⟨h, hh, hDh⟩ apply (mem_smallCenterSets D H).mpr rw [(Finset.mem_powersetCard.mp hDh).2] exact Nat.lt_succ_iff.mp (Finset.mem_range.mp hh) theorem card_smallCenterSets (H : ℕ) : (smallCenterSets (G := G) H).card = ∑ h ∈ Finset.range (H + 1), (Fintype.card G).choose h := by classical rw [smallCenterSets_eq_biUnion] have hdis : (Finset.range (H + 1) : Set ℕ).PairwiseDisjoint (fun h => (Finset.univ : Finset G).powersetCard h) := by intro a ha b hb hab apply Finset.disjoint_left.mpr intro D hDa hDb exact hab ((Finset.mem_powersetCard.mp hDa).2.symm.trans (Finset.mem_powersetCard.mp hDb).2) rw [Finset.card_biUnion hdis] simp only [Finset.card_powersetCard, Finset.card_univ] /-- The successful common event. Each descriptor has its own deletion. -/ def UniformMultiplicityCleanup (A : Finset G) (j b H : ℕ) : Prop := ∀ D : Finset G, D.card ≤ H → MultiplicityCleanup A D j b theorem uniformMultiplicityCleanup_mono_input {A B : Finset G} {j b H : ℕ} (hBA : B ⊆ A) (h : UniformMultiplicityCleanup A j b H) : UniformMultiplicityCleanup B j b H := by intro D hD exact multiplicityCleanup_mono_input hBA (h D hD) theorem not_uniformMultiplicityCleanup_iff (A : Finset G) (j b H : ℕ) : ¬ UniformMultiplicityCleanup A j b H ↔ ∃ D ∈ smallCenterSets (G := G) H, ¬ MultiplicityCleanup A D j b := by classical constructor · intro h by_contra hnone apply h intro D hD by_contra hbad exact hnone ⟨D, (mem_smallCenterSets D H).mpr hD, hbad⟩ · rintro ⟨D, hD, hbad⟩ hgood exact hbad (hgood D ((mem_smallCenterSets D H).mp hD)) /-- The exact finite descriptor-union estimate MP11. The event is on the original exact slice and is uniform before any descriptor is selected. -/ theorem uniformMultiplicityCleanup_failure_le (k j r H : ℕ) (hk : k ≤ Fintype.card G) (hj : 0 < j) : uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ UniformMultiplicityCleanup A j (j * r) H) ≤ (∑ h ∈ Finset.range (H + 1), ((Fintype.card G).choose h : ℝ)) * ((Fintype.card G : ℝ) * (H.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j) ^ r / (r.factorial : ℝ) := by classical let bound : ℝ := ((Fintype.card G : ℝ) * (H.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j) ^ r / (r.factorial : ℝ) have hfixed : ∀ D ∈ smallCenterSets (G := G) H, uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ MultiplicityCleanup A D j (j * r)) ≤ bound := by intro D hD apply (multiplicityCleanup_failure_le D k j r hk hj).trans apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg r.factorial) apply pow_le_pow_left₀ · exact mul_nonneg (by positivity) (DisjointSupport.fallingRatio_nonneg _ _ _) · apply mul_le_mul_of_nonneg_right _ (DisjointSupport.fallingRatio_nonneg _ _ _) apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg (Fintype.card G)) exact_mod_cast Nat.choose_le_choose j ((mem_smallCenterSets D H).mp hD) calc uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ UniformMultiplicityCleanup A j (j * r) H) = uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ∃ D ∈ smallCenterSets (G := G) H, ¬ MultiplicityCleanup A D j (j * r)) := by apply uniformProb_congr intro A hA exact not_uniformMultiplicityCleanup_iff A j (j * r) H _ ≤ ∑ D ∈ smallCenterSets (G := G) H, uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ MultiplicityCleanup A D j (j * r)) := uniformProb_exists_mem_le_sum _ _ _ _ ≤ ∑ D ∈ smallCenterSets (G := G) H, bound := Finset.sum_le_sum hfixed _ = (∑ h ∈ Finset.range (H + 1), ((Fintype.card G).choose h : ℝ)) * ((Fintype.card G : ℝ) * (H.choose j : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k j) ^ r / (r.factorial : ℝ) := by simp only [Finset.sum_const, nsmul_eq_mul, card_smallCenterSets, Nat.cast_sum] exact (mul_div_assoc _ _ _).symm theorem multiplicityCount_eq_zero_of_card_lt (A D : Finset G) (j : ℕ) (hDj : D.card < j) : multiplicityCount A D j = 0 := by apply (multiplicityCount_eq_zero_iff A D j).2 intro x exact lt_of_le_of_lt (representationCount_le_card_sources A D x) hDj theorem multiplicityCount_eq_zero_iff_le_five (A D : Finset G) : multiplicityCount A D 6 = 0 ↔ ∀ x : G, representationCount A D x ≤ 5 := by rw [multiplicityCount_eq_zero_iff] simp only [Nat.lt_succ_iff] theorem multiplicityCleanup_six_certificate {A D : Finset G} {b : ℕ} (h : MultiplicityCleanup A D 6 b) : ∃ E : Finset G, E ⊆ A ∧ E.card ≤ b ∧ ∀ x : G, representationCount (A \ E) D x ≤ 5 := by rcases h with ⟨E, hEA, hEb, hE⟩ exact ⟨E, hEA, hEb, fun x => Nat.le_of_lt_succ (hE x)⟩ theorem common_target_card_le_codegree {A : Finset G} {J : ℕ} (hA : NonzeroCodegreeBound A J) {s t : G} (hst : s ≠ t) : (Finset.univ.filter (fun x : G => x - s ∈ A ∧ x - t ∈ A)).card ≤ J := by classical let sources := Finset.univ.filter (fun x : G => x - s ∈ A ∧ x - t ∈ A) let images := A.filter (fun a => a + (s - t) ∈ A) have hcard : sources.card ≤ images.card := by apply Finset.card_le_card_of_injOn (fun x : G => x - s) · intro x hx have hx' := (Finset.mem_filter.mp hx).2 apply Finset.mem_filter.mpr refine ⟨hx'.1, ?_⟩ have heq : (x - s) + (s - t) = x - t := by abel rw [heq] exact hx'.2 · intro x hx y hy hxy have heq := congrArg (fun z : G => z + s) hxy simpa only [sub_add_cancel] using heq exact le_trans hcard (hA (s - t) (sub_ne_zero.mpr hst)) /-- The same codegree cap after restricting target/source labels to any finite set, including an adaptively chosen set. -/ theorem filtered_common_target_card_le_codegree {A : Finset G} {J : ℕ} (hA : NonzeroCodegreeBound A J) (T : Finset G) {s t : G} (hst : s ≠ t) : (T.filter (fun x => x - s ∈ A ∧ x - t ∈ A)).card ≤ J := by apply le_trans (Finset.card_le_card ?_) (common_target_card_le_codegree hA hst) intro x hx exact Finset.mem_filter.mpr ⟨Finset.mem_univ x, (Finset.mem_filter.mp hx).2⟩ /-- Directed shift-edge count, equal to the codegree used in D2. -/ def codegreeCount (A : Finset G) (d : G) : ℕ := (A.filter (fun a => a + d ∈ A)).card def edgeSupport (d x : G) : Finset G := {x, x + d} theorem edgeSupport_subset_iff (d x : G) (A : Finset G) : edgeSupport d x ⊆ A ↔ x ∈ A ∧ x + d ∈ A := by simp only [edgeSupport, Finset.insert_subset_iff, Finset.singleton_subset_iff] theorem edgeSupport_nonempty (d x : G) : (edgeSupport d x).Nonempty := by exact ⟨x, by simp [edgeSupport]⟩ theorem edgeSupport_card (d x : G) (hd : d ≠ 0) : (edgeSupport d x).card = 2 := by have hne : x ≠ x + d := by intro h apply hd simpa using congrArg (fun z : G => z - x) h.symm simp [edgeSupport, hne] theorem codegreeCount_pos_iff (A : Finset G) (d : G) : 0 < codegreeCount A d ↔ ∃ x : G, edgeSupport d x ⊆ A := by constructor · intro h obtain ⟨x, hx⟩ := Finset.card_pos.mp h exact ⟨x, (edgeSupport_subset_iff d x A).mpr (Finset.mem_filter.mp hx)⟩ · rintro ⟨x, hx⟩ exact Finset.card_pos.mpr ⟨x, Finset.mem_filter.mpr ((edgeSupport_subset_iff d x A).mp hx)⟩ theorem codegreeCount_cast_eq_containmentSum (A : Finset G) (d : G) : (codegreeCount A d : ℝ) = containmentSum (Finset.univ : Finset G) (edgeSupport d) (fun _ => 1) A := by classical have hsets : (Finset.univ.filter (fun x : G => edgeSupport d x ⊆ A)) = A.filter (fun x => x + d ∈ A) := by ext x simp only [Finset.mem_filter, Finset.mem_univ, true_and, edgeSupport_subset_iff] calc (codegreeCount A d : ℝ) = ((Finset.univ.filter (fun x : G => edgeSupport d x ⊆ A)).card : ℝ) := by rw [hsets] rfl _ = containmentSum (Finset.univ : Finset G) (edgeSupport d) (fun _ => 1) A := by unfold containmentSum refine (Finset.natCast_card_filter (R := ℝ) (fun x : G => edgeSupport d x ⊆ A) (Finset.univ : Finset G)).trans ?_ apply Finset.sum_congr rfl intro x hx by_cases hret : edgeSupport d x ⊆ A <;> simp only [hret, ↓reduceIte] /-- An input deletion destroys at most two directed shift-edge labels per deleted vertex. This also allows shifts of order two. -/ theorem codegreeCount_deletion (A E : Finset G) (d : G) : codegreeCount A d ≤ codegreeCount (A \ E) d + 2 * E.card := by classical let original := A.filter (fun a => a + d ∈ A) let retained := (A \ E).filter (fun a => a + d ∈ A \ E) let otherEndpoints := E.image (fun e => e - d) have hsub : original ⊆ retained ∪ (E ∪ otherEndpoints) := by intro x hx rcases Finset.mem_filter.mp hx with ⟨hxA, hxdA⟩ by_cases hxE : x ∈ E · exact Finset.mem_union_right _ (Finset.mem_union_left _ hxE) · by_cases hxdE : x + d ∈ E · apply Finset.mem_union_right apply Finset.mem_union_right exact Finset.mem_image.mpr ⟨x + d, hxdE, by simp⟩ · apply Finset.mem_union_left exact Finset.mem_filter.mpr ⟨Finset.mem_sdiff.mpr ⟨hxA, hxE⟩, Finset.mem_sdiff.mpr ⟨hxdA, hxdE⟩⟩ calc codegreeCount A d = original.card := rfl _ ≤ (retained ∪ (E ∪ otherEndpoints)).card := Finset.card_le_card hsub _ ≤ retained.card + (E ∪ otherEndpoints).card := Finset.card_union_le _ _ _ ≤ retained.card + (E.card + otherEndpoints.card) := Nat.add_le_add_left (Finset.card_union_le _ _) _ _ ≤ retained.card + (E.card + E.card) := Nat.add_le_add_left (Nat.add_le_add_left Finset.card_image_le _) _ _ = codegreeCount (A \ E) d + 2 * E.card := by change retained.card + (E.card + E.card) = retained.card + 2 * E.card omega theorem codegree_robust_of_large (A : Finset G) (d : G) (J r : ℕ) (hJ : 4 * r ≤ J) (hlarge : J < codegreeCount A d) : ∀ E : Finset G, E ⊆ A → E.card ≤ 2 * r → ∃ x ∈ (Finset.univ : Finset G), edgeSupport d x ⊆ A \ E := by intro E hEA hEcard have hloss := codegreeCount_deletion A E d have hpos : 0 < codegreeCount (A \ E) d := by omega obtain ⟨x, hx⟩ := (codegreeCount_pos_iff (A \ E) d).mp hpos exact ⟨x, Finset.mem_univ x, hx⟩ theorem uniformMean_edgeSupports (d : G) (hd : d ≠ 0) (k : ℕ) (hk : k ≤ Fintype.card G) : uniformMean (exactSlice (Finset.univ : Finset G) k) (containmentSum Finset.univ (edgeSupport d) (fun _ => 1)) = (Fintype.card G : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 2 := by classical rw [DisjointSupport.uniformMean_containmentSum] calc (∑ x : G, (1 : ℝ) * uniformProb (exactSlice (Finset.univ : Finset G) k) (fun B => edgeSupport d x ⊆ B)) = ∑ x : G, DisjointSupport.fallingRatio (Fintype.card G) k 2 := by apply Finset.sum_congr rfl intro x hx rw [one_mul, DisjointSupport.exactSlice_containment_eq_fallingRatio Finset.univ (edgeSupport d x) k (Finset.subset_univ _) (by simpa only [Finset.card_univ] using hk)] rw [Finset.card_univ, edgeSupport_card d x hd] _ = (Fintype.card G : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 2 := by simp [nsmul_eq_mul] /-- A fixed nonzero shift has a factorial tail, obtained on the exact slice from edge deletion, support packing, and negative correlation. -/ theorem fixed_codegree_failure_le (d : G) (hd : d ≠ 0) (k J r : ℕ) (hk : k ≤ Fintype.card G) (hJ : 4 * r ≤ J) : uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => J < codegreeCount A d) ≤ ((Fintype.card G : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 2) ^ r / (r.factorial : ℝ) := by classical calc uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => J < codegreeCount A d) ≤ uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ∀ E : Finset G, E ⊆ A → E.card ≤ 2 * r → ∃ x ∈ (Finset.univ : Finset G), edgeSupport d x ⊆ A \ E) := by apply uniformProb_mono intro A hA hlarge exact codegree_robust_of_large A d J r hJ hlarge _ ≤ (uniformMean (exactSlice (Finset.univ : Finset G) k) (containmentSum Finset.univ (edgeSupport d) (fun _ => 1))) ^ r / (r.factorial : ℝ) := by apply unitWeight_deletion_bound Finset.univ k (by simpa only [Finset.card_univ] using hk) Finset.univ (edgeSupport d) · intro x hx exact Finset.subset_univ _ · intro x hx exact edgeSupport_nonempty d x · intro x hx exact (edgeSupport_card d x hd).le _ = ((Fintype.card G : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 2) ^ r / (r.factorial : ℝ) := by rw [uniformMean_edgeSupports d hd k hk] theorem codegreeMean_le_one (k : ℕ) (hk : k ≤ Fintype.card G) (hksq : k ^ 2 ≤ Fintype.card G) : (Fintype.card G : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 2 ≤ 1 := by have hp : (0 : ℝ) < Fintype.card G := by exact_mod_cast (Fintype.card_pos (α := G)) have hsq : (k : ℝ) ^ 2 ≤ Fintype.card G := by exact_mod_cast hksq calc (Fintype.card G : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 2 ≤ (Fintype.card G : ℝ) * ((k : ℝ) / (Fintype.card G : ℝ)) ^ 2 := mul_le_mul_of_nonneg_left (DisjointSupport.fallingRatio_le_pow _ _ 2 hk) hp.le _ = (k : ℝ) ^ 2 / (Fintype.card G : ℝ) := by field_simp [hp.ne'] _ ≤ 1 := (div_le_one hp).mpr hsq theorem fixed_codegree_failure_le_inv_factorial (d : G) (hd : d ≠ 0) (k J r : ℕ) (hk : k ≤ Fintype.card G) (hksq : k ^ 2 ≤ Fintype.card G) (hJ : 4 * r ≤ J) : uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => J < codegreeCount A d) ≤ 1 / (r.factorial : ℝ) := by apply (fixed_codegree_failure_le d hd k J r hk hJ).trans apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg r.factorial) calc ((Fintype.card G : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 2) ^ r ≤ (1 : ℝ) ^ r := pow_le_pow_left₀ (mul_nonneg (Nat.cast_nonneg _) (DisjointSupport.fallingRatio_nonneg _ _ _)) (codegreeMean_le_one k hk hksq) r _ = 1 := one_pow r /-- The unconditional common codegree failure bound, valid for every finite additive group once the two elementary size inequalities are supplied. -/ theorem nonzeroCodegreeBound_failure_le (k J r : ℕ) (hk : k ≤ Fintype.card G) (hksq : k ^ 2 ≤ Fintype.card G) (hJ : 4 * r ≤ J) : uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ NonzeroCodegreeBound A J) ≤ (Fintype.card G : ℝ) / (r.factorial : ℝ) := by classical let shifts : Finset G := Finset.univ.filter (fun d => d ≠ 0) have hevent : ∀ A : Finset G, (¬ NonzeroCodegreeBound A J) ↔ ∃ d ∈ shifts, J < codegreeCount A d := by intro A constructor · intro h by_contra hnone apply h intro d hd by_contra hbad exact hnone ⟨d, Finset.mem_filter.mpr ⟨Finset.mem_univ d, hd⟩, Nat.lt_of_not_ge hbad⟩ · rintro ⟨d, hd, hlarge⟩ hgood exact (Nat.not_lt_of_ge (hgood d (Finset.mem_filter.mp hd).2)) hlarge have hcard : (shifts.card : ℝ) ≤ (Fintype.card G : ℝ) := by have hnat : shifts.card ≤ Fintype.card G := by simpa only [Finset.card_univ] using (Finset.card_filter_le Finset.univ (fun d : G => d ≠ 0)) exact_mod_cast hnat calc uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ NonzeroCodegreeBound A J) = uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ∃ d ∈ shifts, J < codegreeCount A d) := by apply uniformProb_congr intro A hA exact hevent A _ ≤ ∑ d ∈ shifts, uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => J < codegreeCount A d) := uniformProb_exists_mem_le_sum _ _ _ _ ≤ ∑ d ∈ shifts, (1 : ℝ) / (r.factorial : ℝ) := by apply Finset.sum_le_sum intro d hd exact fixed_codegree_failure_le_inv_factorial d (Finset.mem_filter.mp hd).2 k J r hk hksq hJ _ = (shifts.card : ℝ) * ((1 : ℝ) / (r.factorial : ℝ)) := by simp only [Finset.sum_const, nsmul_eq_mul] _ ≤ (Fintype.card G : ℝ) * ((1 : ℝ) / (r.factorial : ℝ)) := mul_le_mul_of_nonneg_right hcard (by positivity) _ = (Fintype.card G : ℝ) / (r.factorial : ℝ) := by rw [← mul_div_assoc, mul_one] end Finite end Additive end Green39Submission.CodegreeMultiplicity end Green39AssemblyScope_21553c5430eafa8d /- Source: Green39Submission.ChosenStars; SHA256 b1ad644e55fbbffa40664d91442194f5882e0a463340734a09b3d5866df9dd4c -/ section Green39AssemblyScope_f3be25744abbd963 /-! Shared labelled chosen-row stars and their exact source extension counts. This leaf is imported by both RichStar and RootedDerivativeBounds, so the rooted influence proof does not depend on full rich-star extraction. -/ namespace Green39Submission.RichStar open scoped BigOperators Pointwise section NormalizedSourceDerivative variable {V ι : Type*} [DecidableEq V] [DecidableEq ι] /-- For uniform-degree normalized stars, every derivative mean reduces to an exact extension count times `θ^(-|B|)`. This is the finite algebra behind the rooted counting estimates in ST15 and ST20. -/ theorem normalized_sourceDerivative_eq_count (I : Finset ι) (support : ι → Finset V) (d : ℕ) (θ : ℝ) (hdegree : ∀ i ∈ I, (support i).card = d) (hθ : θ ≠ 0) (B : Finset V) : RawMoments.sourceDerivative I support (fun _ => (θ ^ d)⁻¹) θ B = (θ ^ B.card)⁻¹ * ((I.filter (fun i => B ⊆ support i)).card : ℝ) := by classical unfold RawMoments.sourceDerivative have hterm (i : ι) (hi : i ∈ I) : (if B ⊆ support i then (θ ^ d)⁻¹ * θ ^ (support i \ B).card else 0) = (if B ⊆ support i then (θ ^ B.card)⁻¹ else 0) := by by_cases hB : B ⊆ support i · simp only [if_pos hB] have hcard : B.card + (support i \ B).card = d := by rw [Nat.add_comm, Finset.card_sdiff_add_card_eq_card hB, hdegree i hi] have hp : θ ^ d = θ ^ B.card * θ ^ (support i \ B).card := by rw [← pow_add, hcard] rw [hp] have h₁ : θ ^ B.card ≠ 0 := pow_ne_zero _ hθ have h₂ : θ ^ (support i \ B).card ≠ 0 := pow_ne_zero _ hθ field_simp · simp only [if_neg hB] calc _ = ∑ i ∈ I, if B ⊆ support i then (θ ^ B.card)⁻¹ else 0 := Finset.sum_congr rfl hterm _ = ∑ _i ∈ I.filter (fun i => B ⊆ support i), (θ ^ B.card)⁻¹ := by rw [Finset.sum_filter] _ = ((I.filter (fun i => B ⊆ support i)).card : ℝ) * (θ ^ B.card)⁻¹ := by simp [nsmul_eq_mul] _ = _ := mul_comm _ _ end NormalizedSourceDerivative section ChosenRowStars variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- A disjoint union of row-labelled objects; equal physical objects in different rows remain distinct labels. -/ def labelledRows (X : Finset G) (rows : G → Finset (Finset G)) : Finset (G × Finset G) := X.biUnion (fun x => (rows x).image (fun Q => (x, Q))) theorem mem_labelledRows {X : Finset G} {rows : G → Finset (Finset G)} {x : G} {Q : Finset G} : (x, Q) ∈ labelledRows X rows ↔ x ∈ X ∧ Q ∈ rows x := by constructor · intro h rcases Finset.mem_biUnion.mp h with ⟨y, hy, hQ⟩ rcases Finset.mem_image.mp hQ with ⟨R, hR, heq⟩ cases heq exact ⟨hy, hR⟩ · rintro ⟨hx, hQ⟩ exact Finset.mem_biUnion.mpr ⟨x, hx, Finset.mem_image.mpr ⟨Q, hQ, rfl⟩⟩ theorem card_labelledRows (X : Finset G) (rows : G → Finset (Finset G)) : (labelledRows X rows).card = ∑ x ∈ X, (rows x).card := by have hdisj : (X : Set G).PairwiseDisjoint (fun x => (rows x).image (fun Q => (x, Q))) := by intro x _hx y _hy hxy apply Finset.disjoint_left.mpr intro p hpx hpy rcases Finset.mem_image.mp hpx with ⟨Q, _hQ, hQp⟩ rcases Finset.mem_image.mp hpy with ⟨R, _hR, hRp⟩ exact hxy (congrArg Prod.fst (hQp.trans hRp.symm)) rw [labelledRows, Finset.card_biUnion hdisj] apply Finset.sum_congr rfl intro x _hx exact Finset.card_image_of_injective _ (fun Q R h => (Prod.mk.inj h).2) theorem filter_labelledRows (X : Finset G) (rows : G → Finset (Finset G)) (P : G × Finset G → Prop) [DecidablePred P] : (labelledRows X rows).filter P = labelledRows X (fun x => (rows x).filter (fun Q => P (x, Q))) := by ext ⟨x, Q⟩ simp [mem_labelledRows, and_assoc] /-- The deterministic witness family fixed before source thinning. -/ def chosenStars (X : Finset G) (W : G → Finset G) (d : ℕ) : Finset (G × Finset G) := labelledRows X (fun x => (W x).powersetCard d) theorem mem_chosenStars {X : Finset G} {W : G → Finset G} {d : ℕ} {i : G × Finset G} : i ∈ chosenStars X W d ↔ i.1 ∈ X ∧ i.2 ⊆ W i.1 ∧ i.2.card = d := by rcases i with ⟨x, Q⟩ simp [chosenStars, mem_labelledRows] theorem card_chosenStars {X : Finset G} {W : G → Finset G} {d M : ℕ} (hM : ∀ x ∈ X, (W x).card = M) : (chosenStars X W d).card = X.card * M.choose d := by rw [chosenStars, card_labelledRows] calc _ = ∑ _x ∈ X, M.choose d := by apply Finset.sum_congr rfl intro x hx rw [Finset.card_powersetCard, hM x hx] _ = _ := by simp /-- Exact number of fixed-degree extensions of a prescribed source set in one row, including the zero count when the prescribed set leaves the row. -/ theorem card_row_extensions (W B : Finset G) (d : ℕ) (hBd : B.card ≤ d) : ((W.powersetCard d).filter (fun Q => B ⊆ Q)).card = if B ⊆ W then (W.card - B.card).choose (d - B.card) else 0 := by by_cases hBW : B ⊆ W · rw [if_pos hBW] exact Finset.card_filter_powersetCard_subset B W d hBW hBd · rw [if_neg hBW] apply Finset.card_eq_zero.mpr apply Finset.eq_empty_iff_forall_notMem.mpr intro Q hQ obtain ⟨hQW, hBQ⟩ := Finset.mem_filter.mp hQ exact hBW (hBQ.trans (Finset.mem_powersetCard.mp hQW).1) /-- All labelled extension counts reduce to the number of eligible rows. -/ theorem card_chosenStars_extensions {X : Finset G} {W : G → Finset G} {d M : ℕ} (hM : ∀ x ∈ X, (W x).card = M) (B : Finset G) (hBd : B.card ≤ d) : ((chosenStars X W d).filter (fun i => B ⊆ i.2)).card = (X.filter (fun x => B ⊆ W x)).card * (M - B.card).choose (d - B.card) := by rw [chosenStars, filter_labelledRows, card_labelledRows] calc _ = ∑ x ∈ X, if B ⊆ W x then (M - B.card).choose (d - B.card) else 0 := by apply Finset.sum_congr rfl intro x hx rw [card_row_extensions (W x) B d hBd, hM x hx] _ = ∑ _x ∈ X.filter (fun x => B ⊆ W x), (M - B.card).choose (d - B.card) := by rw [Finset.sum_filter] _ = _ := by simp theorem card_rows_containing_source_le {A X B : Finset G} {W : G → Finset G} (hA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) {t : G} (ht : t ∈ B) : (X.filter (fun x => B ⊆ W x)).card ≤ A.card := by apply Finset.card_le_card_of_injOn (fun x => x - t) · intro x hx obtain ⟨hxX, hBW⟩ := Finset.mem_filter.mp hx exact hA x hxX t (hBW ht) · intro x _hx y _hy hxy exact sub_left_inj.mp hxy theorem card_rows_containing_pair_le {A X B : Finset G} {W : G → Finset G} {J : ℕ} (hA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (hJ : ∀ t q : G, t ≠ q → (X.filter (fun x => x - t ∈ A ∧ x - q ∈ A)).card ≤ J) (hB : 2 ≤ B.card) : (X.filter (fun x => B ⊆ W x)).card ≤ J := by obtain ⟨t, ht, q, hq, htq⟩ := Finset.one_lt_card.mp (by omega : 1 < B.card) calc _ ≤ (X.filter (fun x => x - t ∈ A ∧ x - q ∈ A)).card := by apply Finset.card_le_card intro x hx obtain ⟨hxX, hBW⟩ := Finset.mem_filter.mp hx exact Finset.mem_filter.mpr ⟨hxX, hA x hxX t (hBW ht), hA x hxX q (hBW hq)⟩ _ ≤ _ := hJ t q htq /-- Uniform-degree normalized derivatives of any labelled subfamily of the chosen rows; filtering to valid stars cannot enlarge the extension count. -/ theorem sourceDerivative_subfamily_le_extension {A X : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {d M : ℕ} (hI : I ⊆ chosenStars X W d) (hM : ∀ x ∈ X, (W x).card = M) (hA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (B : Finset G) (hB : B.Nonempty) (hBd : B.card ≤ d) {θ : ℝ} (hθ : 0 < θ) : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) θ B ≤ (θ ^ B.card)⁻¹ * ((A.card * (M - B.card).choose (d - B.card) : ℕ) : ℝ) := by rw [normalized_sourceDerivative_eq_count I (fun i => i.2) d θ (fun i hi => (mem_chosenStars.mp (hI hi)).2.2) (ne_of_gt hθ)] have hc : (I.filter (fun i => B ⊆ i.2)).card ≤ A.card * (M - B.card).choose (d - B.card) := by calc _ ≤ ((chosenStars X W d).filter (fun i => B ⊆ i.2)).card := by apply Finset.card_le_card intro i hi obtain ⟨hiI, hBi⟩ := Finset.mem_filter.mp hi exact Finset.mem_filter.mpr ⟨hI hiI, hBi⟩ _ = _ := card_chosenStars_extensions hM B hBd _ ≤ _ := by obtain ⟨t, ht⟩ := hB exact Nat.mul_le_mul_right _ (card_rows_containing_source_le hA ht) apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (pow_nonneg hθ.le _)) exact_mod_cast hc theorem sourceDerivative_subfamily_le_codegree {A X : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {d M J : ℕ} (hI : I ⊆ chosenStars X W d) (hM : ∀ x ∈ X, (W x).card = M) (hA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (hJ : ∀ t q : G, t ≠ q → (X.filter (fun x => x - t ∈ A ∧ x - q ∈ A)).card ≤ J) (B : Finset G) (hB : 2 ≤ B.card) (hBd : B.card ≤ d) {θ : ℝ} (hθ : 0 < θ) : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) θ B ≤ (θ ^ B.card)⁻¹ * ((J * (M - B.card).choose (d - B.card) : ℕ) : ℝ) := by rw [normalized_sourceDerivative_eq_count I (fun i => i.2) d θ (fun i hi => (mem_chosenStars.mp (hI hi)).2.2) (ne_of_gt hθ)] have hc : (I.filter (fun i => B ⊆ i.2)).card ≤ J * (M - B.card).choose (d - B.card) := by calc _ ≤ ((chosenStars X W d).filter (fun i => B ⊆ i.2)).card := by apply Finset.card_le_card intro i hi obtain ⟨hiI, hBi⟩ := Finset.mem_filter.mp hi exact Finset.mem_filter.mpr ⟨hI hiI, hBi⟩ _ = _ := card_chosenStars_extensions hM B hBd _ ≤ _ := Nat.mul_le_mul_right _ (card_rows_containing_pair_le hA hJ hB) apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (pow_nonneg hθ.le _)) exact_mod_cast hc /-- The actual finite ST15 derivative majorant, using exact binomial extension counts rather than an unspecified constant depending on the star degree. -/ noncomputable def chosenStarDerivativeBound (a J M d nValid : ℕ) (θ : ℝ) (j : ℕ) : ℝ := if j = 0 then nValid else if j ≤ d then (θ ^ j)⁻¹ * (((if j = 1 then a else J) * (M - j).choose (d - j) : ℕ) : ℝ) else 0 theorem chosenStarDerivativeBound_nonneg (a J M d nValid j : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : 0 ≤ chosenStarDerivativeBound a J M d nValid θ j := by unfold chosenStarDerivativeBound split_ifs <;> positivity theorem chosenStarDerivativeBound_eq_zero (a J M d nValid j : ℕ) (θ : ℝ) (hj : d < j) : chosenStarDerivativeBound a J M d nValid θ j = 0 := by simp [chosenStarDerivativeBound, show j ≠ 0 by omega, show ¬ j ≤ d by omega] /-- The complete finite derivative profile for every chosen-row subfamily. No source-derivative estimate is an assumed premise here. -/ theorem sourceDerivative_subfamily_le_profile [Fintype G] {A X : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {d M J : ℕ} (hI : I ⊆ chosenStars X W d) (hM : ∀ x ∈ X, (W x).card = M) (hA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (B : Finset G) {θ : ℝ} (hθ : 0 < θ) : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) θ B ≤ chosenStarDerivativeBound A.card J M d I.card θ B.card := by have hdegree : ∀ i ∈ I, i.2.card = d := fun i hi => (mem_chosenStars.mp (hI hi)).2.2 by_cases hB0 : B.card = 0 · have hBempty : B = ∅ := Finset.card_eq_zero.mp hB0 rw [normalized_sourceDerivative_eq_count I (fun i => i.2) d θ hdegree (ne_of_gt hθ)] simp [chosenStarDerivativeBound, hBempty] · by_cases hBd : B.card ≤ d · by_cases hB1 : B.card = 1 · simpa only [chosenStarDerivativeBound, if_neg hB0, if_pos hBd, if_pos hB1] using sourceDerivative_subfamily_le_extension hI hM hA B (Finset.card_pos.mp (by omega)) hBd hθ · have hB2 : 2 ≤ B.card := by omega have hpair : ∀ t q : G, t ≠ q → (X.filter (fun x => x - t ∈ A ∧ x - q ∈ A)).card ≤ J := by intro t q htq exact CodegreeMultiplicity.filtered_common_target_card_le_codegree hJ X htq simpa only [chosenStarDerivativeBound, if_neg hB0, if_pos hBd, if_neg hB1] using sourceDerivative_subfamily_le_codegree hI hM hA hpair B hB2 hBd hθ · have hzero : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) θ B = 0 := by unfold RawMoments.sourceDerivative apply Finset.sum_eq_zero intro i hi have hnot : ¬ B ⊆ i.2 := by intro hsub have hc := Finset.card_le_card hsub rw [hdegree i hi] at hc exact hBd hc simp [hnot] rw [hzero] simp [chosenStarDerivativeBound, hB0, hBd] end ChosenRowStars end Green39Submission.RichStar end Green39AssemblyScope_f3be25744abbd963 /- Source: Green39Submission.RichStar; SHA256 7fb9af9fe40329a3f0ddb91492809eb8940f0ce08f5a87e1fd3c9cff2779cacb -/ section Green39AssemblyScope_30e29b4e2ae6d578 /-! Protected rich stars, from Part I of the frozen Green39 manuscript. This module starts with deterministic support identities and deletion retention. Source concentration and the unconditional rich-target event are separate proof obligations, not assumptions hidden in the declarations below. -/ namespace Green39Submission.RichStar open scoped BigOperators Pointwise section AdditiveSupports variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- The distinct input vertices represented by a source star at target `x`. -/ def inputSupport (x : G) (Q : Finset G) : Finset G := Q.image (fun t => x - t) theorem mem_inputSupport {x u : G} {Q : Finset G} : u ∈ inputSupport x Q ↔ ∃ t ∈ Q, x - t = u := by simp [inputSupport] theorem mem_inputSupport_iff_rooted {x u : G} {Q : Finset G} : u ∈ inputSupport x Q ↔ x - u ∈ Q := by rw [mem_inputSupport] constructor · rintro ⟨t, ht, rfl⟩ simpa using ht · intro ht exact ⟨x - u, ht, by simp⟩ theorem inputSupport_subset_iff {x : G} {Q B : Finset G} : inputSupport x Q ⊆ B ↔ ∀ t ∈ Q, x - t ∈ B := by exact Finset.image_subset_iff theorem card_inputSupport (x : G) (Q : Finset G) : (inputSupport x Q).card = Q.card := by apply Finset.card_image_of_injective intro a b hab exact sub_right_inj.mp hab theorem inputSupport_subset_sdiff_iff {x : G} {Q B E : Finset G} : inputSupport x Q ⊆ B \ E ↔ inputSupport x Q ⊆ B ∧ Disjoint (inputSupport x Q) E := by constructor · intro h refine ⟨?_, Finset.disjoint_left.mpr ?_⟩ · intro u hu exact (Finset.mem_sdiff.mp (h hu)).1 · intro u hu huE exact (Finset.mem_sdiff.mp (h hu)).2 huE · rintro ⟨hB, hE⟩ u hu exact Finset.mem_sdiff.mpr ⟨hB hu, fun huE => Finset.disjoint_left.mp hE hu huE⟩ /-- Every source bit which would protect an input of this star. External source bits are included, not only sources in the selected row. -/ def forbiddenSources (T D : Finset G) (x : G) (Q : Finset G) : Finset G := T.filter (fun v => ∃ t ∈ Q, v - (x - t) ∈ D) theorem mem_forbiddenSources {T D Q : Finset G} {x v : G} : v ∈ forbiddenSources T D x Q ↔ v ∈ T ∧ ∃ t ∈ Q, v - (x - t) ∈ D := by simp [forbiddenSources] theorem forbiddenSources_subset (T D : Finset G) (x : G) (Q : Finset G) : forbiddenSources T D x Q ⊆ T := by exact Finset.filter_subset _ _ theorem forbiddenSources_eq_biUnion (T D : Finset G) (x : G) (Q : Finset G) : forbiddenSources T D x Q = Q.biUnion (fun t => T.filter (fun v => v - (x - t) ∈ D)) := by ext v simp only [mem_forbiddenSources, Finset.mem_biUnion, Finset.mem_filter] aesop /-- The forbidden-bit bound in ST10, with the per-input ordinary incidence bound stated explicitly. No random sampling assertion is used. -/ theorem card_forbiddenSources_le {T D Q : Finset G} {x : G} {R : ℕ} (hR : ∀ t ∈ Q, (T.filter (fun v => v - (x - t) ∈ D)).card ≤ R) : (forbiddenSources T D x Q).card ≤ Q.card * R := by rw [forbiddenSources_eq_biUnion] calc _ ≤ ∑ t ∈ Q, (T.filter (fun v => v - (x - t) ∈ D)).card := Finset.card_biUnion_le _ ≤ ∑ _t ∈ Q, R := Finset.sum_le_sum hR _ = Q.card * R := by simp theorem card_forbiddenSources_le_real {T D Q : Finset G} {x : G} {R : ℝ} (hR : ∀ t ∈ Q, ((T.filter (fun v => v - (x - t) ∈ D)).card : ℝ) ≤ R) : ((forbiddenSources T D x Q).card : ℝ) ≤ (Q.card : ℝ) * R := by rw [forbiddenSources_eq_biUnion] have hcard := Finset.card_biUnion_le (s := Q) (t := fun t => T.filter (fun v => v - (x - t) ∈ D)) have hcast : ((Q.biUnion (fun t => T.filter (fun v => v - (x - t) ∈ D))).card : ℝ) ≤ ∑ t ∈ Q, ((T.filter (fun v => v - (x - t) ∈ D)).card : ℝ) := by exact_mod_cast hcard calc _ ≤ ∑ t ∈ Q, ((T.filter (fun v => v - (x - t) ∈ D)).card : ℝ) := hcast _ ≤ ∑ _t ∈ Q, R := Finset.sum_le_sum hR _ = _ := by simp [nsmul_eq_mul] /-- The exact selected/absent-bit equivalence in ST9--ST10. The protected set is characterized explicitly, so this theorem does not assume a uniform law for an adaptively protected input. -/ theorem selectedAbsent_iff_free {A E0 P T S D Q : Finset G} {x : G} (hST : S ⊆ T) (hA : inputSupport x Q ⊆ A) (hE0 : Disjoint (inputSupport x Q) E0) (hP : ∀ u ∈ A, u ∈ P ↔ u ∈ E0 ∨ ∃ s ∈ S, s - u ∈ D) : (Q ⊆ S ∧ Disjoint (forbiddenSources T D x Q) S) ↔ (Q ⊆ S ∧ inputSupport x Q ⊆ A \ P) := by constructor · rintro ⟨hQS, hVS⟩ refine ⟨hQS, inputSupport_subset_iff.mpr ?_⟩ intro t ht have hu : x - t ∈ inputSupport x Q := Finset.mem_image_of_mem (fun v => x - v) ht refine Finset.mem_sdiff.mpr ⟨hA hu, ?_⟩ intro huP rcases (hP (x - t) (hA hu)).mp huP with huE0 | ⟨s, hs, hsD⟩ · exact Finset.disjoint_left.mp hE0 hu huE0 · have hsV : s ∈ forbiddenSources T D x Q := mem_forbiddenSources.mpr ⟨hST hs, t, ht, hsD⟩ exact Finset.disjoint_left.mp hVS hsV hs · rintro ⟨hQS, hfree⟩ refine ⟨hQS, Finset.disjoint_left.mpr ?_⟩ intro s hsV hsS rcases mem_forbiddenSources.mp hsV with ⟨_, t, ht, hsD⟩ have hu : x - t ∈ inputSupport x Q := Finset.mem_image_of_mem (fun v => x - v) ht have huP : x - t ∈ P := (hP (x - t) (hA hu)).mpr (Or.inr ⟨s, hsS, hsD⟩) exact (Finset.mem_sdiff.mp (hfree hu)).2 huP theorem valid_of_selectedAbsent {T D S Q : Finset G} {x : G} (hQS : Q ⊆ S) (hVS : Disjoint (forbiddenSources T D x Q) S) : Disjoint Q (forbiddenSources T D x Q) := by apply Finset.disjoint_left.mpr intro t htQ htV exact Finset.disjoint_left.mp hVS htV (hQS htQ) theorem mem_protectedInputs_iff_of_mem {A E0 S D : Finset G} {u : G} (hu : u ∈ A) : u ∈ protectedInputs A E0 S D ↔ u ∈ E0 ∨ ∃ s ∈ S, s - u ∈ D := by constructor · intro h rcases Finset.mem_union.mp h with hE0 | hAS · exact Or.inl hE0 · rcases Finset.mem_sub.mp (Finset.mem_inter.mp hAS).2 with ⟨s, hs, d, hd, heq⟩ refine Or.inr ⟨s, hs, ?_⟩ have hsd : s - u = d := by rw [← heq]; abel simpa only [hsd] using hd · rintro (hE0 | ⟨s, hs, hsD⟩) · exact Finset.mem_union.mpr (Or.inl hE0) · apply Finset.mem_union.mpr apply Or.inr exact Finset.mem_inter.mpr ⟨hu, Finset.mem_sub.mpr ⟨s, hs, s - u, hsD, by abel⟩⟩ /-- ST10 specialized to the actual shared protected-input definition. -/ theorem selectedAbsent_iff_actual_free {A E0 T S D Q : Finset G} {x : G} (hST : S ⊆ T) (hA : inputSupport x Q ⊆ A) (hE0 : Disjoint (inputSupport x Q) E0) : (Q ⊆ S ∧ Disjoint (forbiddenSources T D x Q) S) ↔ (Q ⊆ S ∧ inputSupport x Q ⊆ A \ protectedInputs A E0 S D) := by apply selectedAbsent_iff_free hST hA hE0 intro u hu exact mem_protectedInputs_iff_of_mem hu /-- For one genuine input outside E0, being free is exactly avoidance of its ordinary alias source bits. This is only an identity in the source law. -/ theorem free_input_iff_ordinary_absent {A E0 T S D : Finset G} {u : G} (hST : S ⊆ T) (huA : u ∈ A) (huE0 : u ∉ E0) : u ∉ protectedInputs A E0 S D ↔ Disjoint (RichStarGeometry.ordinarySources T D u) S := by constructor · intro hfree apply Finset.disjoint_left.mpr intro q hqV hqS apply hfree apply (mem_protectedInputs_iff_of_mem huA).mpr exact Or.inr ⟨q, hqS, (Finset.mem_filter.mp hqV).2⟩ · intro hdisj huP rcases (mem_protectedInputs_iff_of_mem huA).mp huP with huE | ⟨q, hqS, hqu⟩ · exact huE0 huE · have hqV : q ∈ RichStarGeometry.ordinarySources T D u := Finset.mem_filter.mpr ⟨hST hqS, hqu⟩ exact Finset.disjoint_left.mp hdisj hqV hqS theorem selectedAbsent_impossible_of_invalid {T D S Q : Finset G} {x : G} (hbad : ¬ Disjoint Q (forbiddenSources T D x Q)) : ¬ (Q ⊆ S ∧ Disjoint (forbiddenSources T D x Q) S) := by rintro ⟨hQS, hVS⟩ exact hbad (valid_of_selectedAbsent hQS hVS) /-- All surviving source stars in one row are exactly the subsets of the available source neighborhood. This preserves their source labels. -/ theorem rowStars_filter_eq (B S : Finset G) (x : G) (d : ℕ) : (S.powersetCard d).filter (fun Q => inputSupport x Q ⊆ B) = (S.filter (fun t => x - t ∈ B)).powersetCard d := by ext Q simp only [Finset.mem_filter, Finset.mem_powersetCard] constructor · rintro ⟨⟨hQS, hcard⟩, hB⟩ refine ⟨?_, hcard⟩ intro t ht exact Finset.mem_filter.mpr ⟨hQS ht, inputSupport_subset_iff.mp hB t ht⟩ · rintro ⟨hQ, hcard⟩ refine ⟨⟨?_, hcard⟩, inputSupport_subset_iff.mpr ?_⟩ · intro t ht exact (Finset.mem_filter.mp (hQ ht)).1 · intro t ht exact (Finset.mem_filter.mp (hQ ht)).2 theorem card_rowStars (B S : Finset G) (x : G) (d : ℕ) : ((S.powersetCard d).filter (fun Q => inputSupport x Q ⊆ B)).card = (representationCount B S x).choose d := by rw [rowStars_filter_eq, Finset.card_powersetCard] rfl variable [Fintype G] /-- The full observable family in ST24. Different target labels remain different indices even when they have equal physical input supports. -/ def fullStarFamily (S : Finset G) (d : ℕ) : Finset (G × Finset G) := Finset.univ ×ˢ (S.powersetCard d) theorem mem_fullStarFamily {S Q : Finset G} {d : ℕ} {x : G} : (x, Q) ∈ fullStarFamily S d ↔ Q ⊆ S ∧ Q.card = d := by simp [fullStarFamily] theorem fullStar_support_card {S : Finset G} {d : ℕ} {i : G × Finset G} (hi : i ∈ fullStarFamily S d) : (inputSupport i.1 i.2).card = d := by rw [card_inputSupport] exact (mem_fullStarFamily.mp hi).2 theorem card_fullStarFamily (S : Finset G) (d : ℕ) : (fullStarFamily S d).card = Fintype.card G * S.card.choose d := by simp [fullStarFamily] /-- The labelled containment polynomial is exactly the binomial star count at every target. No quotient by equal physical supports is taken. -/ theorem fullStar_containmentSum (B S : Finset G) (d : ℕ) (w : ℝ) : containmentSum (fullStarFamily S d) (fun i => inputSupport i.1 i.2) (fun _ => w) B = w * ∑ x : G, ((representationCount B S x).choose d : ℝ) := by classical have hrow (x : G) : (∑ Q ∈ S.powersetCard d, if inputSupport x Q ⊆ B then w else 0) = ((representationCount B S x).choose d : ℝ) * w := by calc _ = ∑ _Q ∈ (S.powersetCard d).filter (fun Q => inputSupport x Q ⊆ B), w := by rw [Finset.sum_filter] _ = (((S.powersetCard d).filter (fun Q => inputSupport x Q ⊆ B)).card : ℝ) * w := by simp [nsmul_eq_mul] _ = _ := by rw [card_rowStars] unfold containmentSum fullStarFamily rw [Finset.sum_product] simp_rw [hrow] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro x _hx exact mul_comm _ _ end AdditiveSupports section SourceStarMean variable {V ι : Type*} [DecidableEq V] [DecidableEq ι] /-- One normalized all-free star, written entirely in its selected and absent source bits. -/ noncomputable def selectedAbsentTerm (θ : ℝ) (d : ℕ) (Q absent S : Finset V) : ℝ := if Q ⊆ S ∧ Disjoint absent S then (θ ^ d)⁻¹ else 0 /-- The labelled free-star score in the auxiliary source law. -/ noncomputable def selectedAbsentSum (I : Finset ι) (positive absent : ι → Finset V) (d : ℕ) (θ : ℝ) (S : Finset V) : ℝ := ∑ i ∈ I, selectedAbsentTerm θ d (positive i) (absent i) S theorem mean_selectedAbsentTerm {T Q absent : Finset V} {d : ℕ} {θ : ℝ} (hQT : Q ⊆ T) (hVT : absent ⊆ T) (hQV : Disjoint Q absent) (hcard : Q.card = d) (hθ : θ ≠ 0) : bernoulliMean T θ (selectedAbsentTerm θ d Q absent) = (1 - θ) ^ absent.card := by calc _ = (θ ^ d)⁻¹ * bernoulliMean T θ (fun S => if Q ⊆ S ∧ Disjoint absent S then 1 else 0) := by rw [← SourceProbability.bernoulliMean_const_mul] apply SourceProbability.bernoulliMean_congr intro S _hST by_cases h : Q ⊆ S ∧ Disjoint absent S <;> simp [selectedAbsentTerm, h] _ = (θ ^ d)⁻¹ * (θ ^ Q.card * (1 - θ) ^ absent.card) := by rw [SourceProbability.bernoulliMean_selected_absent hQT hVT hQV] _ = _ := by rw [hcard, ← mul_assoc] simp [pow_ne_zero d hθ] /-- The exact first moment of any labelled valid-star family. -/ theorem mean_selectedAbsentSum (T : Finset V) (I : Finset ι) (positive absent : ι → Finset V) (d : ℕ) (θ : ℝ) (hvalid : ∀ i ∈ I, positive i ⊆ T ∧ absent i ⊆ T ∧ Disjoint (positive i) (absent i) ∧ (positive i).card = d) (hθ : θ ≠ 0) : bernoulliMean T θ (fun S => ∑ i ∈ I, selectedAbsentTerm θ d (positive i) (absent i) S) = ∑ i ∈ I, (1 - θ) ^ (absent i).card := by rw [SourceProbability.bernoulliMean_sum] apply Finset.sum_congr rfl intro i hi obtain ⟨hp, ha, hpa, hd⟩ := hvalid i hi exact mean_selectedAbsentTerm hp ha hpa hd hθ /-- A finite quantitative lower mean before any asymptotic specialization. The factor `1 - R*θ` accounts for every external forbidden source bit. -/ theorem mean_selectedAbsentSum_lower (T : Finset V) (I : Finset ι) (positive absent : ι → Finset V) (d R : ℕ) (θ : ℝ) (hvalid : ∀ i ∈ I, positive i ⊆ T ∧ absent i ⊆ T ∧ Disjoint (positive i) (absent i) ∧ (positive i).card = d) (hR : ∀ i ∈ I, (absent i).card ≤ R) (hθ : 0 < θ) (hθ1 : θ ≤ 1) : (I.card : ℝ) * (1 - (R : ℝ) * θ) ≤ bernoulliMean T θ (fun S => ∑ i ∈ I, selectedAbsentTerm θ d (positive i) (absent i) S) := by rw [mean_selectedAbsentSum T I positive absent d θ hvalid (ne_of_gt hθ)] have hp : 1 - (R : ℝ) * θ ≤ (1 - θ) ^ R := by have h := one_add_mul_le_pow (a := -θ) (by linarith) R simpa only [mul_neg, sub_eq_add_neg] using h calc _ = ∑ _i ∈ I, (1 - (R : ℝ) * θ) := by simp [nsmul_eq_mul, mul_sub] _ ≤ ∑ i ∈ I, (1 - θ) ^ (absent i).card := by apply Finset.sum_le_sum intro i hi exact le_trans hp (pow_le_pow_of_le_one (by linarith) (by linarith) (hR i hi)) /-- The same first-moment lower bound with a real forbidden-bit budget, as in the manuscript's `ell * k^delta` estimate. -/ theorem mean_selectedAbsentSum_lower_real (T : Finset V) (I : Finset ι) (positive absent : ι → Finset V) (d : ℕ) (R θ : ℝ) (hvalid : ∀ i ∈ I, positive i ⊆ T ∧ absent i ⊆ T ∧ Disjoint (positive i) (absent i) ∧ (positive i).card = d) (hR : ∀ i ∈ I, ((absent i).card : ℝ) ≤ R) (hθ : 0 < θ) (hθ1 : θ ≤ 1) : (I.card : ℝ) * (1 - R * θ) ≤ bernoulliMean T θ (fun S => ∑ i ∈ I, selectedAbsentTerm θ d (positive i) (absent i) S) := by rw [mean_selectedAbsentSum T I positive absent d θ hvalid (ne_of_gt hθ)] calc _ = ∑ _i ∈ I, (1 - R * θ) := by simp [nsmul_eq_mul, mul_sub] _ ≤ ∑ i ∈ I, (1 - θ) ^ (absent i).card := by apply Finset.sum_le_sum intro i hi have hp : 1 - ((absent i).card : ℝ) * θ ≤ (1 - θ) ^ (absent i).card := by have h := one_add_mul_le_pow (a := -θ) (by linarith) (absent i).card simpa only [mul_neg, sub_eq_add_neg] using h have hprod := mul_le_mul_of_nonneg_right (hR i hi) (le_of_lt hθ) linarith end SourceStarMean section SourceStarConcentration variable {V ι : Type*} [DecidableEq V] [DecidableEq ι] open SourceProbability RawMoments open scoped Classical theorem selectedAbsentSum_nonneg (I : Finset ι) (positive absent : ι → Finset V) (d : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (S : Finset V) : 0 ≤ selectedAbsentSum I positive absent d θ S := by apply Finset.sum_nonneg intro i _hi unfold selectedAbsentTerm split_ifs · exact inv_nonneg.mpr (pow_nonneg hθ d) · exact le_rfl /-- Dropping every absent-bit requirement increases the free-star score. This gives a direct route from the nonnegative raw moments to concentration. -/ theorem selectedAbsentSum_le_containmentSum (I : Finset ι) (positive absent : ι → Finset V) (d : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (S : Finset V) : selectedAbsentSum I positive absent d θ S ≤ containmentSum I positive (fun _ => (θ ^ d)⁻¹) S := by classical unfold selectedAbsentSum containmentSum apply Finset.sum_le_sum intro i _hi by_cases hp : positive i ⊆ S · by_cases ha : Disjoint (absent i) S · simp [selectedAbsentTerm, hp, ha] · simp [selectedAbsentTerm, hp, ha, inv_nonneg.mpr (pow_nonneg hθ d)] · simp [selectedAbsentTerm, hp] /-- An explicit second moment from source derivative bounds. The absent-bit dependence is handled by a pointwise inequality, without any covariance premise. -/ theorem mean_selectedAbsentSum_sq_le (T : Finset V) (I : Finset ι) (positive absent : ι → Finset V) (d : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (hIT : ∀ i ∈ I, positive i ⊆ T) (hdegree : ∀ i ∈ I, (positive i).card ≤ d) (μ : ℕ → ℝ) (hμ0 : ∀ j, 0 ≤ μ j) (hμzero : ∀ j, d < j → μ j = 0) (hμ : ∀ B, sourceDerivative I positive (fun _ => (θ ^ d)⁻¹) θ B ≤ μ B.card) : bernoulliMean T θ (fun S => (selectedAbsentSum I positive absent d θ S) ^ 2) ≤ (∑ j ∈ Finset.range (d + 1), ((d * 2).choose j : ℝ) * μ j) ^ 2 := by calc _ ≤ bernoulliMean T θ (fun S => (containmentSum I positive (fun _ => (θ ^ d)⁻¹) S) ^ 2) := by apply bernoulliMean_mono T hθ hθ1 intro S _hS exact pow_le_pow_left₀ (selectedAbsentSum_nonneg I positive absent d hθ S) (selectedAbsentSum_le_containmentSum I positive absent d hθ S) 2 _ ≤ _ := rawMoment_le_binomial T I positive (fun _ => (θ ^ d)⁻¹) hIT hθ (fun _i _hi => inv_nonneg.mpr (pow_nonneg hθ d)) d 2 (by omega) hdegree μ hμ0 hμzero hμ /-- Centering a finite source second moment is an exact algebraic identity. -/ theorem mean_centered_square (T : Finset V) (θ a : ℝ) (f : Finset V → ℝ) : bernoulliMean T θ (fun S => (f S - a) ^ 2) = bernoulliMean T θ (fun S => (f S) ^ 2) - 2 * a * bernoulliMean T θ f + a ^ 2 := by calc _ = bernoulliMean T θ (fun S => (f S) ^ 2 + (-2 * a) * f S + a ^ 2) := by apply bernoulliMean_congr intro S _hS ring _ = _ := by rw [bernoulliMean_add, bernoulliMean_add, bernoulliMean_const_mul, bernoulliMean_const] ring /-- Finite quantitative ST17 bound. All analytic inputs are explicit finite derivative counts and a forbidden-bit budget. -/ theorem mean_selectedAbsentSum_centered_le (T : Finset V) (I : Finset ι) (positive absent : ι → Finset V) (d : ℕ) (R : ℝ) {θ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hvalid : ∀ i ∈ I, positive i ⊆ T ∧ absent i ⊆ T ∧ Disjoint (positive i) (absent i) ∧ (positive i).card = d) (hR : ∀ i ∈ I, ((absent i).card : ℝ) ≤ R) (μ : ℕ → ℝ) (hμ0 : ∀ j, 0 ≤ μ j) (hμzero : ∀ j, d < j → μ j = 0) (hμ : ∀ B, sourceDerivative I positive (fun _ => (θ ^ d)⁻¹) θ B ≤ μ B.card) : bernoulliMean T θ (fun S => (selectedAbsentSum I positive absent d θ S - (I.card : ℝ)) ^ 2) ≤ (∑ j ∈ Finset.range (d + 1), ((d * 2).choose j : ℝ) * μ j) ^ 2 - (I.card : ℝ) ^ 2 + 2 * (I.card : ℝ) ^ 2 * R * θ := by have hfirst : (I.card : ℝ) * (1 - R * θ) ≤ bernoulliMean T θ (selectedAbsentSum I positive absent d θ) := mean_selectedAbsentSum_lower_real T I positive absent d R θ hvalid hR hθ hθ1 have hsecond := mean_selectedAbsentSum_sq_le T I positive absent d (le_of_lt hθ) hθ1 (fun i hi => (hvalid i hi).1) (fun i hi => le_of_eq (hvalid i hi).2.2.2) μ hμ0 hμzero hμ rw [mean_centered_square] have hcard : (0 : ℝ) ≤ I.card := Nat.cast_nonneg _ have hfirst' := mul_le_mul_of_nonneg_left hfirst (by positivity : 0 ≤ 2 * (I.card : ℝ)) nlinarith /-- Markov's inequality in the actual finite source law. -/ theorem source_markov (T : Finset V) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (f : Finset V → ℝ) (t : ℝ) (hf : ∀ S, S ⊆ T → 0 ≤ f S) : t * bernoulliMean T θ (fun S => if t < f S then 1 else 0) ≤ bernoulliMean T θ f := by have hpoint : ∀ S, S ⊆ T → t * (if t < f S then 1 else 0) ≤ f S := by intro S hS by_cases ht : t < f S · simpa only [if_pos ht, mul_one] using le_of_lt ht · simpa only [if_neg ht, mul_zero] using hf S hS have hm := bernoulliMean_mono T hθ hθ1 hpoint rwa [bernoulliMean_const_mul] at hm /-- Raw-moment Markov bound, used for each rooted influence polynomial. -/ theorem source_raw_moment_tail (T : Finset V) (I : Finset ι) (support : ι → Finset V) (weight : ι → ℝ) {θ t : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ht : 0 < t) (hIT : ∀ i ∈ I, support i ⊆ T) (hw : ∀ i ∈ I, 0 ≤ weight i) (d q : ℕ) (hq : 1 ≤ q) (hd : ∀ i ∈ I, (support i).card ≤ d) (μ : ℕ → ℝ) (hμ0 : ∀ j, 0 ≤ μ j) (hμzero : ∀ j, d < j → μ j = 0) (hμ : ∀ B, sourceDerivative I support weight θ B ≤ μ B.card) : bernoulliMean T θ (fun S => if t < containmentSum I support weight S then 1 else 0) ≤ ((∑ j ∈ Finset.range (d + 1), ((d * q).choose j : ℝ) * μ j) / t) ^ q := by have hnonneg (S : Finset V) : 0 ≤ containmentSum I support weight S := by unfold containmentSum apply Finset.sum_nonneg intro i hi split_ifs · exact hw i hi · exact le_rfl have hpoint : ∀ S, S ⊆ T → t ^ q * (if t < containmentSum I support weight S then 1 else 0) ≤ (containmentSum I support weight S) ^ q := by intro S _hS by_cases h : t < containmentSum I support weight S · simpa only [if_pos h, mul_one] using pow_le_pow_left₀ ht.le h.le q · simpa only [if_neg h, mul_zero] using pow_nonneg (hnonneg S) q have hm := bernoulliMean_mono T hθ hθ1 hpoint rw [bernoulliMean_const_mul] at hm have hr := rawMoment_le_binomial T I support weight hIT hθ hw d q hq hd μ hμ0 hμzero hμ have hm' := le_trans hm hr rw [div_pow] apply (le_div_iff₀ (pow_pos ht q)).mpr simpa only [mul_comm] using hm' /-- The exact source-size mean, derived from singleton inclusion indicators. -/ theorem mean_source_card (T : Finset V) (θ : ℝ) : bernoulliMean T θ (fun S => (S.card : ℝ)) = (T.card : ℝ) * θ := by have hcard (S : Finset V) (hST : S ⊆ T) : (S.card : ℝ) = ∑ t ∈ T, if ({t} : Finset V) ⊆ S then 1 else 0 := by have hfilter : T.filter (fun t => t ∈ S) = S := by ext t simp only [Finset.mem_filter] exact ⟨fun h => h.2, fun h => ⟨hST h, h⟩⟩ symm simp only [Finset.singleton_subset_iff] rw [← Finset.sum_filter, hfilter] simp calc _ = bernoulliMean T θ (fun S => ∑ t ∈ T, if ({t} : Finset V) ⊆ S then 1 else 0) := bernoulliMean_congr T θ hcard _ = ∑ t ∈ T, bernoulliMean T θ (fun S => if ({t} : Finset V) ⊆ S then 1 else 0) := bernoulliMean_sum T θ T _ _ = ∑ _t ∈ T, θ := by apply Finset.sum_congr rfl intro t ht simpa using bernoulliMean_selected (Finset.singleton_subset_iff.mpr ht) θ _ = _ := by simp [nsmul_eq_mul] /-- A probability-one-half size window suffices for existence of the common rich-star seed; the other source failures tend to zero. -/ theorem source_size_tail_le_half (T : Finset V) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (hmass : 0 < (T.card : ℝ) * θ) : bernoulliMean T θ (fun S => if 2 * (T.card : ℝ) * θ < (S.card : ℝ) then 1 else 0) ≤ 1 / 2 := by have h := source_markov T hθ hθ1 (fun S => (S.card : ℝ)) (2 * (T.card : ℝ) * θ) (fun S _hS => Nat.cast_nonneg _) rw [mean_source_card] at h nlinarith /-- A lower-tail estimate centered at any nonnegative deterministic scale. -/ theorem source_lower_tail_square (T : Finset V) {θ a : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 ≤ a) (f : Finset V → ℝ) : a ^ 2 * bernoulliMean T θ (fun S => if f S < a / 2 then 1 else 0) ≤ 4 * bernoulliMean T θ (fun S => (f S - a) ^ 2) := by have hpoint : ∀ S, S ⊆ T → a ^ 2 * (if f S < a / 2 then 1 else 0) ≤ 4 * (f S - a) ^ 2 := by intro S _hS by_cases h : f S < a / 2 · rw [if_pos h, mul_one] have hm : 0 ≤ a * (a / 2 - f S) := mul_nonneg ha (by linarith) nlinarith [sq_nonneg (f S - a / 2)] · rw [if_neg h, mul_zero] positivity have hm := bernoulliMean_mono T hθ hθ1 hpoint simpa only [bernoulliMean_const_mul] using hm /-- The flexible threshold form keeps the valid-family cardinality separate from the manuscript's total star scale `A_*`. -/ theorem source_lower_tail_gap (T : Finset V) {θ a t : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (hta : t ≤ a) (f : Finset V → ℝ) : (a - t) ^ 2 * bernoulliMean T θ (fun S => if f S < t then 1 else 0) ≤ bernoulliMean T θ (fun S => (f S - a) ^ 2) := by have hpoint : ∀ S, S ⊆ T → (a - t) ^ 2 * (if f S < t then 1 else 0) ≤ (f S - a) ^ 2 := by intro S _hS by_cases h : f S < t · rw [if_pos h, mul_one] have hgap : 0 ≤ a - t := sub_nonneg.mpr hta have hdist : a - t ≤ a - f S := by linarith have hp := pow_le_pow_left₀ hgap hdist 2 nlinarith · rw [if_neg h, mul_zero] exact sq_nonneg _ have hm := bernoulliMean_mono T hθ hθ1 hpoint simpa only [bernoulliMean_const_mul] using hm /-- A source sample exists as soon as the total expected number of violated requirements is below one. The choices remain local to the fixed parent. -/ theorem exists_source_sample_of_bad_sum_lt_one {κ : Type*} (T : Finset V) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (J : Finset κ) (good : κ → Finset V → Prop) (hsmall : (∑ j ∈ J, bernoulliMean T θ (fun S => if good j S then 0 else 1)) < 1) : ∃ S ⊆ T, ∀ j ∈ J, good j S := by classical by_contra hnone have hpoint : ∀ S, S ⊆ T → (1 : ℝ) ≤ ∑ j ∈ J, if good j S then 0 else 1 := by intro S hST have hbad : ∃ j ∈ J, ¬ good j S := by by_contra h apply hnone refine ⟨S, hST, ?_⟩ intro j hj by_contra hgj exact h ⟨j, hj, hgj⟩ obtain ⟨j, hj, hgj⟩ := hbad have hn (i : κ) (_hi : i ∈ J) : (0 : ℝ) ≤ if good i S then 0 else 1 := by split_ifs <;> norm_num simpa only [if_neg hgj] using Finset.single_le_sum hn hj have hm := bernoulliMean_mono T hθ hθ1 hpoint rw [bernoulliMean_one, bernoulliMean_sum] at hm linarith end SourceStarConcentration section MatchingStarCount variable {V : Type*} [DecidableEq V] /-- A star is invalid when it contains an internal alias edge. -/ def invalidStars (W : Finset V) (edges : Finset (Finset V)) (d : ℕ) : Finset (Finset V) := (W.powersetCard d).filter (fun Q => ∃ e ∈ edges, e ⊆ Q) theorem invalidStars_eq_biUnion (W : Finset V) (edges : Finset (Finset V)) (d : ℕ) : invalidStars W edges d = edges.biUnion (fun e => (W.powersetCard d).filter (fun Q => e ⊆ Q)) := by ext Q simp only [invalidStars, Finset.mem_filter, Finset.mem_biUnion] aesop /-- The bad-star numerator in ST11. Pairwise disjointness of edges is not needed for this union bound, only the two-vertex support of each edge. -/ theorem card_invalidStars_le {W : Finset V} {edges : Finset (Finset V)} {d : ℕ} (hd : 2 ≤ d) (hedges : ∀ e ∈ edges, e ⊆ W ∧ e.card = 2) : (invalidStars W edges d).card ≤ edges.card * (W.card - 2).choose (d - 2) := by rw [invalidStars_eq_biUnion] calc _ ≤ ∑ e ∈ edges, ((W.powersetCard d).filter (fun Q => e ⊆ Q)).card := Finset.card_biUnion_le _ = ∑ _e ∈ edges, (W.card - 2).choose (d - 2) := by apply Finset.sum_congr rfl intro e he obtain ⟨heW, hecard⟩ := hedges e he have hed : e.card ≤ d := by omega rw [Finset.card_filter_powersetCard_subset e W d heW hed, hecard] _ = _ := by simp /-- A matching uses two distinct vertices per edge. This supplies the `M/2` edge-count bound in ST11 without selecting any random objects. -/ theorem matching_edges_card_bound {W : Finset V} {edges : Finset (Finset V)} (hedges : ∀ e ∈ edges, e ⊆ W ∧ e.card = 2) (hdisj : (edges : Set (Finset V)).PairwiseDisjoint id) : edges.card * 2 ≤ W.card := by have hsub : edges.biUnion id ⊆ W := by intro u hu rcases Finset.mem_biUnion.mp hu with ⟨e, he, hue⟩ exact (hedges e he).1 hue have hcard := Finset.card_le_card hsub rw [Finset.card_biUnion hdisj] at hcard have hsum : (∑ e ∈ edges, (id e).card) = edges.card * 2 := by apply Finset.sum_const_nat intro e he exact (hedges e he).2 rwa [hsum] at hcard end MatchingStarCount section ActualAliasStars variable {G : Type*} [AddCommGroup G] [DecidableEq G] open RichStarGeometry /-- The unordered, two-source internal alias edges in a selected row. -/ def aliasEdges (W D : Finset G) (x : G) : Finset (Finset G) := ((W ×ˢ W).filter (fun tq => tq.1 ≠ tq.2 ∧ InternalAlias D x tq.1 tq.2)).image (fun tq => {tq.1, tq.2}) theorem mem_aliasEdges_iff {W D e : Finset G} {x : G} : e ∈ aliasEdges W D x ↔ ∃ t ∈ W, ∃ q ∈ W, t ≠ q ∧ InternalAlias D x t q ∧ e = {t, q} := by simp only [aliasEdges, Finset.mem_image, Finset.mem_filter, Finset.mem_product] constructor · rintro ⟨⟨t, q⟩, ⟨⟨ht, hq⟩, hne, halias⟩, heq⟩ exact ⟨t, ht, q, hq, hne, halias, heq.symm⟩ · rintro ⟨t, ht, q, hq, hne, halias, rfl⟩ exact ⟨(t, q), ⟨⟨ht, hq⟩, hne, halias⟩, rfl⟩ theorem aliasEdges_support {W D e : Finset G} {x : G} (he : e ∈ aliasEdges W D x) : e ⊆ W ∧ e.card = 2 := by rcases mem_aliasEdges_iff.mp he with ⟨t, ht, q, hq, hne, _halias, rfl⟩ constructor · simpa only [Finset.insert_subset_iff, Finset.singleton_subset_iff] using And.intro ht hq · simp [hne] /-- An edge incident to `u` can be oriented with `u` as its first endpoint. -/ theorem aliasEdges_orient {W D e : Finset G} {x u : G} (he : e ∈ aliasEdges W D x) (hu : u ∈ e) : ∃ v ∈ W, u ≠ v ∧ InternalAlias D x u v ∧ e = {u, v} := by rcases mem_aliasEdges_iff.mp he with ⟨t, ht, q, hq, hne, halias, rfl⟩ rcases Finset.mem_insert.mp hu with hut | huq · subst u exact ⟨q, hq, hne, halias, rfl⟩ · have huq' : u = q := Finset.mem_singleton.mp huq subst u exact ⟨t, ht, hne.symm, (internalAlias_comm D x t q).mp halias, Finset.pair_comm t q⟩ theorem aliasEdges_pairwiseDisjoint {W D : Finset G} {x : G} (hunique : ∀ u ∈ W, ∀ v ∈ W, ∀ w ∈ W, InternalAlias D x u v → InternalAlias D x u w → v = w) : (aliasEdges W D x : Set (Finset G)).PairwiseDisjoint id := by intro e he f hf hne apply Finset.disjoint_left.mpr intro u hue huf rcases aliasEdges_orient he hue with ⟨v, hv, _huv, huv, hev⟩ rcases aliasEdges_orient hf huf with ⟨w, hw, _huw, huw, hfw⟩ have hu : u ∈ W := (aliasEdges_support he).1 hue have hvw := hunique u hu v hv w hw huv huw apply hne rw [hev, hfw, hvw] /-- With no loop, forbidden-source invalidity is exactly containment of one of the two-source internal alias edges. External activators do not change validity; they remain present in the absent-bit event. -/ theorem invalidForbidden_eq_invalidStars {W T D : Finset G} {x : G} (hWT : W ⊆ T) (hloop : ∀ t ∈ W, ¬ InternalAlias D x t t) (d : ℕ) : (W.powersetCard d).filter (fun Q => ¬ Disjoint Q (forbiddenSources T D x Q)) = invalidStars W (aliasEdges W D x) d := by ext Q simp only [Finset.mem_filter, invalidStars] constructor · rintro ⟨hQ, hbad⟩ have hQW := (Finset.mem_powersetCard.mp hQ).1 rcases Finset.not_disjoint_iff.mp hbad with ⟨q, hqQ, hqV⟩ rcases mem_forbiddenSources.mp hqV with ⟨_hqT, t, htQ, halias⟩ have hqt : InternalAlias D x q t := by have heq : q - (x - t) = q + t - x := by abel simpa only [InternalAlias, heq] using halias have hne : q ≠ t := by intro heq subst t exact hloop q (hQW hqQ) hqt refine ⟨hQ, {q, t}, mem_aliasEdges_iff.mpr ⟨q, hQW hqQ, t, hQW htQ, hne, hqt, rfl⟩, ?_⟩ simpa only [Finset.insert_subset_iff, Finset.singleton_subset_iff] using And.intro hqQ htQ · rintro ⟨hQ, e, he, heQ⟩ rcases mem_aliasEdges_iff.mp he with ⟨t, htW, q, _hqW, _hne, halias, rfl⟩ have htQ : t ∈ Q := heQ (by simp) have hqQ : q ∈ Q := heQ (by simp) refine ⟨hQ, Finset.not_disjoint_iff.mpr ⟨t, htQ, ?_⟩⟩ apply mem_forbiddenSources.mpr refine ⟨hWT htW, q, hqQ, ?_⟩ have heq : t - (x - q) = t + q - x := by abel simpa only [InternalAlias, heq] using halias /-- The exact matching count for genuinely invalid protected stars. -/ theorem twice_card_invalidForbidden_le {W T D : Finset G} {x : G} {d : ℕ} (hd : 2 ≤ d) (hWT : W ⊆ T) (hloop : ∀ t ∈ W, ¬ InternalAlias D x t t) (hunique : ∀ u ∈ W, ∀ v ∈ W, ∀ w ∈ W, InternalAlias D x u v → InternalAlias D x u w → v = w) : 2 * ((W.powersetCard d).filter (fun Q => ¬ Disjoint Q (forbiddenSources T D x Q))).card ≤ W.card * (W.card - 2).choose (d - 2) := by rw [invalidForbidden_eq_invalidStars hWT hloop] have hbad := card_invalidStars_le hd (fun e he => aliasEdges_support (W := W) (D := D) (x := x) he) have hmatch := matching_edges_card_bound (fun e he => aliasEdges_support (W := W) (D := D) (x := x) he) (aliasEdges_pairwiseDisjoint hunique) nlinarith /-- PS19 supplies the matching hypotheses in every retained row. -/ theorem twice_card_invalidForbidden_le_of_good_target [Fintype G] {A W T D : Finset G} {x : G} {d : ℕ} (hd : 2 ≤ d) (hWT : W ⊆ T) (hWA : ∀ t ∈ W, x - t ∈ A) (hxloop : x ∉ loopTargets A T D) (hxwedge : x ∉ wedgeTargets A T D) : 2 * ((W.powersetCard d).filter (fun Q => ¬ Disjoint Q (forbiddenSources T D x Q))).card ≤ W.card * (W.card - 2).choose (d - 2) := by apply twice_card_invalidForbidden_le hd hWT · intro t ht exact no_loop_of_not_mem hxloop (hWT ht) (hWA t ht) · intro u hu v hv w hw huv huw exact unique_neighbor_of_not_mem hxwedge (hWT hu) (hWA u hu) (hWT hv) (hWA v hv) (hWT hw) (hWA w hw) ((internalAlias_comm D x u v).mp huv) ((internalAlias_comm D x u w).mp huw) end ActualAliasStars section ValidChosenStars variable {G : Type*} [AddCommGroup G] [DecidableEq G] open RichStarGeometry /-- The valid subfamily of the rows fixed before source thinning. -/ def validChosenStars (T D X : Finset G) (W : G → Finset G) (d : ℕ) : Finset (G × Finset G) := (chosenStars X W d).filter (fun i => Disjoint i.2 (forbiddenSources T D i.1 i.2)) theorem mem_validChosenStars {T D X : Finset G} {W : G → Finset G} {d : ℕ} {i : G × Finset G} : i ∈ validChosenStars T D X W d ↔ i ∈ chosenStars X W d ∧ Disjoint i.2 (forbiddenSources T D i.1 i.2) := by exact Finset.mem_filter theorem validChosenStars_subset (T D X : Finset G) (W : G → Finset G) (d : ℕ) : validChosenStars T D X W d ⊆ chosenStars X W d := Finset.filter_subset _ _ theorem validChosenStars_source_data {T D X : Finset G} {W : G → Finset G} {d : ℕ} (hWT : ∀ x ∈ X, W x ⊆ T) : ∀ i ∈ validChosenStars T D X W d, i.2 ⊆ T ∧ forbiddenSources T D i.1 i.2 ⊆ T ∧ Disjoint i.2 (forbiddenSources T D i.1 i.2) ∧ i.2.card = d := by intro i hi have hi' := mem_validChosenStars.mp hi have hrow := mem_chosenStars.mp hi'.1 exact ⟨hrow.2.1.trans (hWT i.1 hrow.1), forbiddenSources_subset T D i.1 i.2, hi'.2, hrow.2.2⟩ theorem validChosenStars_forbidden_bound {T D X : Finset G} {W : G → Finset G} {d : ℕ} {R : ℝ} (hR : ∀ x ∈ X, ∀ t ∈ W x, ((ordinarySources T D (x - t)).card : ℝ) ≤ R) : ∀ i ∈ validChosenStars T D X W d, ((forbiddenSources T D i.1 i.2).card : ℝ) ≤ (d : ℝ) * R := by intro i hi have hrow := mem_chosenStars.mp (mem_validChosenStars.mp hi).1 have hb := card_forbiddenSources_le_real (T := T) (D := D) (Q := i.2) (x := i.1) (fun t ht => hR i.1 hrow.1 t (hrow.2.1 ht)) simpa only [hrow.2.2] using hb variable [Fintype G] /-- Summing the exact matching invalid-star bound across the labelled rows. -/ theorem twice_card_invalidChosenStars_le {A T D X : Finset G} {W : G → Finset G} {d M : ℕ} (hd : 2 ≤ d) (hM : ∀ x ∈ X, (W x).card = M) (hWT : ∀ x ∈ X, W x ⊆ T) (hWA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (hloop : ∀ x ∈ X, x ∉ loopTargets A T D) (hwedge : ∀ x ∈ X, x ∉ wedgeTargets A T D) : 2 * ((chosenStars X W d).filter (fun i => ¬ Disjoint i.2 (forbiddenSources T D i.1 i.2))).card ≤ X.card * M * (M - 2).choose (d - 2) := by rw [chosenStars, filter_labelledRows, card_labelledRows, Finset.mul_sum] calc _ ≤ ∑ _x ∈ X, M * (M - 2).choose (d - 2) := by apply Finset.sum_le_sum intro x hx have h := twice_card_invalidForbidden_le_of_good_target hd (hWT x hx) (hWA x hx) (hloop x hx) (hwedge x hx) simpa only [hM x hx] using h _ = _ := by simp [Nat.mul_assoc] /-- The finite valid-family loss bound behind ST11, retaining the exact normalization by the total labelled star scale. -/ theorem validChosenStars_card_loss_bound {A T D X : Finset G} {W : G → Finset G} {d M : ℕ} (hd : 2 ≤ d) (hM : ∀ x ∈ X, (W x).card = M) (hWT : ∀ x ∈ X, W x ⊆ T) (hWA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (hloop : ∀ x ∈ X, x ∉ loopTargets A T D) (hwedge : ∀ x ∈ X, x ∉ wedgeTargets A T D) : 2 * (X.card * M.choose d) ≤ 2 * (validChosenStars T D X W d).card + X.card * M * (M - 2).choose (d - 2) := by have hpart := Finset.card_filter_add_card_filter_not (s := chosenStars X W d) (fun i => Disjoint i.2 (forbiddenSources T D i.1 i.2)) have hbad := twice_card_invalidChosenStars_le hd hM hWT hWA hloop hwedge have htotal := card_chosenStars (d := d) hM change (validChosenStars T D X W d).card + ((chosenStars X W d).filter (fun i => ¬ Disjoint i.2 (forbiddenSources T D i.1 i.2))).card = (chosenStars X W d).card at hpart nlinarith theorem validChosenStars_card_three_quarters {A T D X : Finset G} {W : G → Finset G} {d M : ℕ} (hd : 2 ≤ d) (hM : ∀ x ∈ X, (W x).card = M) (hWT : ∀ x ∈ X, W x ⊆ T) (hWA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (hloop : ∀ x ∈ X, x ∉ loopTargets A T D) (hwedge : ∀ x ∈ X, x ∉ wedgeTargets A T D) (hsmall : 2 * M * (M - 2).choose (d - 2) ≤ M.choose d) : 3 * (X.card * M.choose d) ≤ 4 * (validChosenStars T D X W d).card := by have hbound := validChosenStars_card_loss_bound hd hM hWT hWA hloop hwedge have hsmall' := Nat.mul_le_mul_left X.card hsmall nlinarith /-- Concrete finite source concentration for the genuine valid-star family. The only probabilistic estimates used are the proved selected/absent law and the proved raw moments, with the exact ST15 count profile substituted. -/ theorem validChosenStars_centered_square_le {A T D X : Finset G} {W : G → Finset G} {d M J : ℕ} {R θ : ℝ} (hM : ∀ x ∈ X, (W x).card = M) (hWT : ∀ x ∈ X, W x ⊆ T) (hWA : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hR : ∀ x ∈ X, ∀ t ∈ W x, ((ordinarySources T D (x - t)).card : ℝ) ≤ R) (hθ : 0 < θ) (hθ1 : θ ≤ 1) : let I := validChosenStars T D X W d let μ := chosenStarDerivativeBound A.card J M d I.card θ bernoulliMean T θ (fun S => (selectedAbsentSum I (fun i => i.2) (fun i => forbiddenSources T D i.1 i.2) d θ S - (I.card : ℝ)) ^ 2) ≤ (∑ j ∈ Finset.range (d + 1), ((d * 2).choose j : ℝ) * μ j) ^ 2 - (I.card : ℝ) ^ 2 + 2 * (I.card : ℝ) ^ 2 * ((d : ℝ) * R) * θ := by dsimp only apply mean_selectedAbsentSum_centered_le T (validChosenStars T D X W d) (fun i => i.2) (fun i => forbiddenSources T D i.1 i.2) d ((d : ℝ) * R) hθ hθ1 (validChosenStars_source_data hWT) (validChosenStars_forbidden_bound hR) · intro j exact chosenStarDerivativeBound_nonneg _ _ _ _ _ _ hθ.le · intro j hj exact chosenStarDerivativeBound_eq_zero _ _ _ _ _ _ _ hj · intro B exact sourceDerivative_subfamily_le_profile (validChosenStars_subset T D X W d) hM hWA hJ B hθ end ValidChosenStars section SelectedFreeStars variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- The actual selected all-free labels for one fixed source sample. -/ def selectedFreeStars (T D X : Finset G) (W : G → Finset G) (d : ℕ) (S : Finset G) : Finset (G × Finset G) := (validChosenStars T D X W d).filter (fun i => i.2 ⊆ S ∧ Disjoint (forbiddenSources T D i.1 i.2) S) theorem mem_selectedFreeStars {T D X S : Finset G} {W : G → Finset G} {d : ℕ} {i : G × Finset G} : i ∈ selectedFreeStars T D X W d S ↔ i ∈ validChosenStars T D X W d ∧ i.2 ⊆ S ∧ Disjoint (forbiddenSources T D i.1 i.2) S := by exact Finset.mem_filter theorem selectedFreeStars_inputSupport_free {A E0 T D X S : Finset G} {W : G → Finset G} {d : ℕ} (hST : S ⊆ T) (hinput : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A \ E0) : ∀ i ∈ selectedFreeStars T D X W d S, inputSupport i.1 i.2 ⊆ A \ protectedInputs A E0 S D := by intro i hi have hi' := mem_selectedFreeStars.mp hi have hrow := mem_chosenStars.mp (mem_validChosenStars.mp hi'.1).1 have hpre : inputSupport i.1 i.2 ⊆ A \ E0 := by apply inputSupport_subset_iff.mpr intro t ht exact hinput i.1 hrow.1 t (hrow.2.1 ht) have hsplit := inputSupport_subset_sdiff_iff.mp hpre exact ((selectedAbsent_iff_actual_free hST hsplit.1 hsplit.2).mp hi'.2).2 /-- The selected/absent score is exactly the containment score of the actual free labelled stars on the actual free input remainder. -/ theorem selectedFreeStars_score_eq_containment {A E0 T D X S : Finset G} {W : G → Finset G} {d : ℕ} (hST : S ⊆ T) (hinput : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A \ E0) (θ : ℝ) : selectedAbsentSum (validChosenStars T D X W d) (fun i => i.2) (fun i => forbiddenSources T D i.1 i.2) d θ S = containmentSum (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) (A \ protectedInputs A E0 S D) := by classical calc _ = ∑ _i ∈ selectedFreeStars T D X W d S, (θ ^ d)⁻¹ := by unfold selectedAbsentSum selectedFreeStars rw [Finset.sum_filter] rfl _ = _ := by unfold containmentSum apply Finset.sum_congr rfl intro i hi exact (if_pos (selectedFreeStars_inputSupport_free hST hinput i hi)).symm theorem selectedFreeStars_subset_full [Fintype G] (T D X S : Finset G) (W : G → Finset G) (d : ℕ) : selectedFreeStars T D X W d S ⊆ fullStarFamily S d := by intro i hi have hi' := mem_selectedFreeStars.mp hi have hrow := mem_chosenStars.mp (mem_validChosenStars.mp hi'.1).1 exact mem_fullStarFamily.mpr ⟨hi'.2.1, hrow.2.2⟩ end SelectedFreeStars section RetainedRows variable {G : Type*} [AddCommGroup G] [DecidableEq G] open RichStarGeometry /-- The auxiliary high-incidence input deletion, used only for counting. -/ def countingHeavyInputs (A T D : Finset G) (R : ℕ) : Finset G := A.filter (fun u => R < (ordinarySources T D u).card) theorem card_countingHeavyInputs_mul_le {A T D : Finset G} {K R : ℕ} (hK : ∀ t ∈ T, representationCount A D t ≤ K) : (countingHeavyInputs A T D R).card * (R + 1) ≤ T.card * K := by calc _ = ∑ _u ∈ countingHeavyInputs A T D R, (R + 1) := by simp _ ≤ ∑ u ∈ countingHeavyInputs A T D R, (ordinarySources T D u).card := by apply Finset.sum_le_sum intro u hu have h := (Finset.mem_filter.mp hu).2 omega _ ≤ ∑ u ∈ A, (ordinarySources T D u).card := Finset.sum_le_sum_of_subset (Finset.filter_subset _ _) _ ≤ _ := sum_card_ordinarySources_le hK theorem ordinarySources_card_le_of_not_heavy {A T D : Finset G} {R : ℕ} {u : G} (huA : u ∈ A) (hu : u ∉ countingHeavyInputs A T D R) : (ordinarySources T D u).card ≤ R := by by_contra h apply hu exact Finset.mem_filter.mpr ⟨huA, by omega⟩ /-- Removing input vertices loses at most their own representation count. -/ theorem representationCount_le_after_deletion (A E T : Finset G) (x : G) : representationCount A T x ≤ representationCount (A \ E) T x + representationCount E T x := by have hsub : T.filter (fun t => x - t ∈ A) ⊆ T.filter (fun t => x - t ∈ A \ E) ∪ T.filter (fun t => x - t ∈ E) := by intro t ht obtain ⟨htT, hxtA⟩ := Finset.mem_filter.mp ht by_cases hxtE : x - t ∈ E · exact Finset.mem_union.mpr (Or.inr (Finset.mem_filter.mpr ⟨htT, hxtE⟩)) · exact Finset.mem_union.mpr (Or.inl (Finset.mem_filter.mpr ⟨htT, Finset.mem_sdiff.mpr ⟨hxtA, hxtE⟩⟩)) exact le_trans (Finset.card_le_card hsub) (Finset.card_union_le _ _) variable [Fintype G] /-- Each row falling from at least `2*M` representations below `M` spends at least `M` incidences from the deleted inputs. -/ theorem card_lostRows_mul_le {A E T X : Finset G} {M : ℕ} (hrich : ∀ x ∈ X, 2 * M ≤ representationCount A T x) : ((X.filter (fun x => representationCount (A \ E) T x < M)).card) * M ≤ E.card * T.card := by let bad := X.filter (fun x => representationCount (A \ E) T x < M) have hrow : ∀ x ∈ bad, M ≤ representationCount E T x := by intro x hx have hx' := Finset.mem_filter.mp hx have h₁ := hrich x hx'.1 have h₂ := representationCount_le_after_deletion A E T x omega calc _ = ∑ _x ∈ bad, M := by simp [bad] _ ≤ ∑ x ∈ bad, representationCount E T x := Finset.sum_le_sum hrow _ ≤ ∑ x : G, representationCount E T x := Finset.sum_le_sum_of_subset (Finset.subset_univ _) _ = _ := sum_representationCount E T /-- A fully finite retained-row extraction. Its numerical condition is the precise incidence budget paid by ST7 and the PS19 bad-target removal. -/ theorem exists_retained_rows (A E T X Bad : Finset G) (M n : ℕ) (hM : 0 < M) (hrich : ∀ x ∈ X, 2 * M ≤ representationCount A T x) (hroom : (n + Bad.card) * M + E.card * T.card ≤ X.card * M) : ∃ X' : Finset G, X' ⊆ X ∧ X'.card = n ∧ ∃ W : G → Finset G, ∀ x ∈ X', x ∉ Bad ∧ W x ⊆ T ∧ (∀ t ∈ W x, x - t ∈ A \ E) ∧ (W x).card = M := by classical let high := X.filter (fun x => M ≤ representationCount (A \ E) T x) let low := X.filter (fun x => representationCount (A \ E) T x < M) let good := high \ Bad have hpart : high.card + low.card = X.card := by simpa only [high, low, not_le] using Finset.card_filter_add_card_filter_not (s := X) (p := fun x => M ≤ representationCount (A \ E) T x) have hloss : low.card * M ≤ E.card * T.card := card_lostRows_mul_le hrich have hcover : high.card ≤ good.card + Bad.card := Finset.card_le_card_sdiff_add_card have hcover' := Nat.mul_le_mul_right M hcover have hng : n * M ≤ good.card * M := by nlinarith have hng' : n ≤ good.card := Nat.le_of_mul_le_mul_right hng hM obtain ⟨X', hX'good, hX'card⟩ := Finset.exists_subset_card_eq hng' have hX'X : X' ⊆ X := by intro x hx exact (Finset.mem_filter.mp (Finset.mem_sdiff.mp (hX'good hx)).1).1 have hrows : ∀ x : G, ∃ W : Finset G, x ∈ X' → W ⊆ T.filter (fun t => x - t ∈ A \ E) ∧ W.card = M := by intro x by_cases hx : x ∈ X' · have hh := (Finset.mem_filter.mp (Finset.mem_sdiff.mp (hX'good hx)).1).2 obtain ⟨W, hWsub, hWcard⟩ := Finset.exists_subset_card_eq hh exact ⟨W, fun _hx => ⟨hWsub, hWcard⟩⟩ · exact ⟨∅, fun hx' => False.elim (hx hx')⟩ choose W hW using hrows refine ⟨X', hX'X, hX'card, W, ?_⟩ intro x hx obtain ⟨hWsub, hWcard⟩ := hW x hx refine ⟨(Finset.mem_sdiff.mp (hX'good hx)).2, ?_, ?_, hWcard⟩ · intro t ht exact (Finset.mem_filter.mp (hWsub ht)).1 · intro t ht exact (Finset.mem_filter.mp (hWsub ht)).2 end RetainedRows section DeletionRetention variable {ι V : Type*} [DecidableEq ι] [DecidableEq V] /-- The labels retained after requiring their full support to lie in `B`. -/ def survivingFamily (I : Finset ι) (support : ι → Finset V) (B : Finset V) : Finset ι := I.filter (fun i => support i ⊆ B) /-- Labels containing a specified input vertex, with all repetitions kept. -/ def incidenceFamily (I : Finset ι) (support : ι → Finset V) (u : V) : Finset ι := I.filter (fun i => u ∈ support i) theorem mem_survivingFamily {I : Finset ι} {support : ι → Finset V} {B : Finset V} {i : ι} : i ∈ survivingFamily I support B ↔ i ∈ I ∧ support i ⊆ B := by simp [survivingFamily] theorem mem_incidenceFamily {I : Finset ι} {support : ι → Finset V} {u : V} {i : ι} : i ∈ incidenceFamily I support u ↔ i ∈ I ∧ u ∈ support i := by simp [incidenceFamily] /-- Restricting the label family to supports in `U` does not change its containment polynomial on subsets of `U`. -/ theorem containmentSum_survivingFamily_of_subset (I : Finset ι) (support : ι → Finset V) (weight : ι → ℝ) {B U : Finset V} (hBU : B ⊆ U) : containmentSum (survivingFamily I support U) support weight B = containmentSum I support weight B := by classical unfold survivingFamily containmentSum rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _hi by_cases hB : support i ⊆ B · have hU : support i ⊆ U := hB.trans hBU simp [hB, hU] · simp [hB] /-- Enlarging a nonnegative labelled family increases its containment score. -/ theorem containmentSum_mono_family {I J : Finset ι} (hIJ : I ⊆ J) (support : ι → Finset V) (weight : ι → ℝ) (hw : ∀ i ∈ J, 0 ≤ weight i) (B : Finset V) : containmentSum I support weight B ≤ containmentSum J support weight B := by classical unfold containmentSum apply Finset.sum_le_sum_of_subset_of_nonneg hIJ intro i hi _hnot split_ifs · exact hw i hi · exact le_rfl theorem family_subset_survivors_union_incidence {I : Finset ι} {support : ι → Finset V} {B E : Finset V} (hB : ∀ i ∈ I, support i ⊆ B) : I ⊆ survivingFamily I support (B \ E) ∪ E.biUnion (incidenceFamily I support) := by classical intro i hi by_cases hfree : support i ⊆ B \ E · exact Finset.mem_union.mpr (Or.inl (mem_survivingFamily.mpr ⟨hi, hfree⟩)) · have hex : ∃ u ∈ support i, u ∈ E := by by_contra hnone apply hfree intro u hu refine Finset.mem_sdiff.mpr ⟨hB i hi hu, ?_⟩ intro huE exact hnone ⟨u, hu, huE⟩ rcases hex with ⟨u, hu, huE⟩ exact Finset.mem_union.mpr (Or.inr (Finset.mem_biUnion.mpr ⟨u, huE, mem_incidenceFamily.mpr ⟨hi, hu⟩⟩)) /-- Every destroyed label is charged to one or more deleted input vertices. This is simultaneous over all choices of the deletion set. -/ theorem card_le_survivors_add_incidence {I : Finset ι} {support : ι → Finset V} {B E : Finset V} (hB : ∀ i ∈ I, support i ⊆ B) : I.card ≤ (survivingFamily I support (B \ E)).card + ∑ u ∈ E, (incidenceFamily I support u).card := by calc I.card ≤ (survivingFamily I support (B \ E) ∪ E.biUnion (incidenceFamily I support)).card := Finset.card_le_card (family_subset_survivors_union_incidence hB) _ ≤ (survivingFamily I support (B \ E)).card + (E.biUnion (incidenceFamily I support)).card := Finset.card_union_le _ _ _ ≤ (survivingFamily I support (B \ E)).card + ∑ u ∈ E, (incidenceFamily I support u).card := Nat.add_le_add_left Finset.card_biUnion_le _ theorem card_le_survivors_add_budget {I : Finset ι} {support : ι → Finset V} {B E : Finset V} {b D : ℕ} (hB : ∀ i ∈ I, support i ⊆ B) (hE : E.card ≤ b) (hD : ∀ u ∈ E, (incidenceFamily I support u).card ≤ D) : I.card ≤ (survivingFamily I support (B \ E)).card + b * D := by calc I.card ≤ (survivingFamily I support (B \ E)).card + ∑ u ∈ E, (incidenceFamily I support u).card := card_le_survivors_add_incidence hB _ ≤ (survivingFamily I support (B \ E)).card + ∑ _u ∈ E, D := Nat.add_le_add_left (Finset.sum_le_sum hD) _ _ = (survivingFamily I support (B \ E)).card + E.card * D := by simp _ ≤ (survivingFamily I support (B \ E)).card + b * D := Nat.add_le_add_left (Nat.mul_le_mul_right D hE) _ /-- A finite deterministic retention inequality for a common nonnegative star weight. Source expectation and influence bounds are not assumed proved. -/ theorem weighted_retention {I : Finset ι} {support : ι → Finset V} {B E : Finset V} {b D : ℕ} {w q : ℝ} (hw : 0 ≤ w) (hB : ∀ i ∈ I, support i ⊆ B) (hE : E.card ≤ b) (hD : ∀ u ∈ E, (incidenceFamily I support u).card ≤ D) (hmargin : q + w * ((b * D : ℕ) : ℝ) < w * (I.card : ℝ)) : q < w * ((survivingFamily I support (B \ E)).card : ℝ) := by have hcard := card_le_survivors_add_budget hB hE hD have hcast : (I.card : ℝ) ≤ ((survivingFamily I support (B \ E)).card : ℝ) + ((b * D : ℕ) : ℝ) := by exact_mod_cast hcard have hmul := mul_le_mul_of_nonneg_left hcast hw nlinarith /-- Total positive weight of all labels incident to one input vertex. -/ noncomputable def starInfluence (I : Finset ι) (support : ι → Finset V) (weight : ι → ℝ) (u : V) : ℝ := ∑ i ∈ I, if u ∈ support i then weight i else 0 /-- Weighted deletion loss, retaining repeated labels and allowing arbitrary nonnegative weights. No independence or probabilistic hypothesis occurs. -/ theorem containmentSum_le_deleted_add_influences (I : Finset ι) (support : ι → Finset V) (weight : ι → ℝ) (B E : Finset V) (hw : ∀ i ∈ I, 0 ≤ weight i) : containmentSum I support weight B ≤ containmentSum I support weight (B \ E) + ∑ u ∈ E, starInfluence I support weight u := by classical have hpoint (i : ι) (hi : i ∈ I) : (if support i ⊆ B then weight i else 0) ≤ (if support i ⊆ B \ E then weight i else 0) + ∑ u ∈ E, if u ∈ support i then weight i else 0 := by have hnonneg (u : V) : 0 ≤ (if u ∈ support i then weight i else 0) := by split_ifs · exact hw i hi · exact le_rfl have hsum : 0 ≤ ∑ u ∈ E, if u ∈ support i then weight i else 0 := Finset.sum_nonneg (fun u _hu => hnonneg u) by_cases hB : support i ⊆ B · by_cases hfree : support i ⊆ B \ E · simp only [if_pos hB, if_pos hfree] linarith · have hex : ∃ u ∈ E, u ∈ support i := by by_contra hnone apply hfree intro u hu refine Finset.mem_sdiff.mpr ⟨hB hu, ?_⟩ intro huE exact hnone ⟨u, huE, hu⟩ rcases hex with ⟨u, huE, hu⟩ have hone : weight i ≤ ∑ v ∈ E, if v ∈ support i then weight i else 0 := by simpa only [if_pos hu] using (Finset.single_le_sum (fun v _hv => hnonneg v) huE) simpa only [if_pos hB, if_neg hfree, zero_add] using hone · have hfree : ¬ support i ⊆ B \ E := by intro h apply hB intro u hu exact (Finset.mem_sdiff.mp (h hu)).1 simpa only [if_neg hB, if_neg hfree, zero_add] using hsum have hsum := Finset.sum_le_sum hpoint rw [Finset.sum_add_distrib] at hsum have hcomm : (∑ i ∈ I, ∑ u ∈ E, if u ∈ support i then weight i else 0) = ∑ u ∈ E, ∑ i ∈ I, if u ∈ support i then weight i else 0 := Finset.sum_comm rw [hcomm] at hsum have hc (C : Finset V) : containmentSum I support weight C = ∑ i ∈ I, if support i ⊆ C then weight i else 0 := by unfold containmentSum apply Finset.sum_congr rfl intro i _hi by_cases h : support i ⊆ C <;> simp [h] rw [hc B, hc (B \ E)] simpa only [starInfluence] using hsum /-- The all-deletion retention interface used in ST23, with the analytic lower-score and influence bounds displayed as explicit hypotheses. -/ theorem retention_after_every_deletion (I : Finset ι) (support : ι → Finset V) (weight : ι → ℝ) (B : Finset V) (b : ℕ) (a K : ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) (ha : 0 < a) (hstart : a / 2 ≤ containmentSum I support weight B) (hK : ∀ u ∈ B, starInfluence I support weight u ≤ K) (hbudget : (b : ℝ) * K ≤ a / 8) (hKnonneg : 0 ≤ K) : ∀ E ⊆ B, E.card ≤ b → a / 4 < containmentSum I support weight (B \ E) := by intro E hEB hEb have hsum : (∑ u ∈ E, starInfluence I support weight u) ≤ a / 8 := by calc _ ≤ ∑ _u ∈ E, K := Finset.sum_le_sum (fun u hu => hK u (hEB hu)) _ = (E.card : ℝ) * K := by simp [nsmul_eq_mul] _ ≤ (b : ℝ) * K := by apply mul_le_mul_of_nonneg_right _ hKnonneg exact_mod_cast hEb _ ≤ a / 8 := hbudget have hloss := containmentSum_le_deleted_add_influences I support weight B E hw linarith /-- The numerical separation used in ST22--ST23. -/ theorem retention_margin {a loss y z : ℝ} (ha : 0 < a) (hy : a / 2 ≤ y) (hloss : loss ≤ a / 8) (hz : y - loss ≤ z) : a / 4 < z := by linarith end DeletionRetention section ObservableRetention variable {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- A common source seed with the proved score and influence margins yields the full descriptor observable after every permitted deletion. The witness rows and the counting-only input deletion do not enter the observable. -/ theorem selectedFreeStars_retains_observable {A E0 T D X S : Finset G} {W : G → Finset G} {d b : ℕ} {θ a K : ℝ} (hST : S ⊆ T) (hinput : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A \ E0) (hθ : 0 ≤ θ) (ha : 0 < a) (hstart : a / 2 ≤ selectedAbsentSum (validChosenStars T D X W d) (fun i => i.2) (fun i => forbiddenSources T D i.1 i.2) d θ S) (hK : ∀ u ∈ A \ protectedInputs A E0 S D, starInfluence (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) u ≤ K) (hbudget : (b : ℝ) * K ≤ a / 8) (hKnonneg : 0 ≤ K) : ∀ E ⊆ A \ protectedInputs A E0 S D, E.card ≤ b → a / 4 < (θ ^ d)⁻¹ * ∑ x : G, ((representationCount ((A \ protectedInputs A E0 S D) \ E) S x).choose d : ℝ) := by have hw : 0 ≤ (θ ^ d)⁻¹ := inv_nonneg.mpr (pow_nonneg hθ d) have hstart' : a / 2 ≤ containmentSum (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) (A \ protectedInputs A E0 S D) := by rw [← selectedFreeStars_score_eq_containment hST hinput θ] exact hstart have hret := retention_after_every_deletion (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) (A \ protectedInputs A E0 S D) b a K (fun _i _hi => hw) ha hstart' hK hbudget hKnonneg intro E hE hEcard calc a / 4 < containmentSum (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) ((A \ protectedInputs A E0 S D) \ E) := hret E hE hEcard _ ≤ containmentSum (fullStarFamily S d) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) ((A \ protectedInputs A E0 S D) \ E) := containmentSum_mono_family (selectedFreeStars_subset_full T D X S W d) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) (fun _i _hi => hw) _ _ = _ := fullStar_containmentSum _ S d _ end ObservableRetention section ObservableSliceTail variable {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] open DisjointSupport /-- The full labelled star family whose physical supports lie in the fixed descriptor's free universe. It depends on no extracted witness rows. -/ def freeUniverseStars (U S : Finset G) (d : ℕ) : Finset (G × Finset G) := survivingFamily (fullStarFamily S d) (fun i => inputSupport i.1 i.2) U theorem mem_freeUniverseStars {U S : Finset G} {d : ℕ} {i : G × Finset G} : i ∈ freeUniverseStars U S d ↔ i ∈ fullStarFamily S d ∧ inputSupport i.1 i.2 ⊆ U := by exact mem_survivingFamily theorem freeUniverseStar_containmentSum {U B S : Finset G} (d : ℕ) (w : ℝ) (hBU : B ⊆ U) : containmentSum (freeUniverseStars U S d) (fun i => inputSupport i.1 i.2) (fun _ => w) B = w * ∑ x : G, ((representationCount B S x).choose d : ℝ) := by rw [freeUniverseStars, containmentSum_survivingFamily_of_subset (fullStarFamily S d) (fun i => inputSupport i.1 i.2) (fun _ => w) hBU] exact fullStar_containmentSum B S d w /-- Exact-slice mean bound for the full all-free observable star polynomial. Each support has exactly `d` distinct inputs; repeated labels are retained. -/ theorem mean_freeUniverseStars_le (U S : Finset G) (n d : ℕ) (hn : n ≤ U.card) (w : ℝ) (hw : 0 ≤ w) : uniformMean (exactSlice U n) (containmentSum (freeUniverseStars U S d) (fun i => inputSupport i.1 i.2) (fun _ => w)) ≤ (Fintype.card G : ℝ) * (S.card.choose d : ℝ) * w * ((n : ℝ) / (U.card : ℝ)) ^ d := by classical let I := freeUniverseStars U S d let ρ : ℝ := (n : ℝ) / (U.card : ℝ) have hρ : 0 ≤ ρ := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) have hterm (i : G × Finset G) (hi : i ∈ I) : uniformProb (exactSlice U n) (fun B => inputSupport i.1 i.2 ⊆ B) ≤ ρ ^ d := by have hi' := mem_freeUniverseStars.mp hi have hc := fullStar_support_card hi'.1 simpa only [hc] using exactSlice_containment_le_pow U (inputSupport i.1 i.2) n hi'.2 hn have hcard : I.card ≤ Fintype.card G * S.card.choose d := by calc I.card ≤ (fullStarFamily S d).card := Finset.card_filter_le _ _ _ = _ := card_fullStarFamily S d have hcard' : (I.card : ℝ) ≤ (Fintype.card G : ℝ) * (S.card.choose d : ℝ) := by exact_mod_cast hcard rw [uniformMean_containmentSum] calc _ ≤ ∑ _i ∈ I, w * ρ ^ d := by apply Finset.sum_le_sum intro i hi exact mul_le_mul_of_nonneg_left (hterm i hi) hw _ = (I.card : ℝ) * (w * ρ ^ d) := by simp [nsmul_eq_mul] _ ≤ ((Fintype.card G : ℝ) * (S.card.choose d : ℝ)) * (w * ρ ^ d) := mul_le_mul_of_nonneg_right hcard' (mul_nonneg hw (pow_nonneg hρ d)) _ = _ := by dsimp [ρ]; ring /-- ST27 in the actual finite exact-slice model, with arbitrary positive threshold, degree and deletion budget. The event is expressed using only the observable binomial representation counts. -/ theorem observable_star_deletion_tail (U S : Finset G) (n d b : ℕ) (hn : n ≤ U.card) (w q : ℝ) (hw : 0 ≤ w) (hq : 0 < q) : uniformProb (exactSlice U n) (fun B => ∀ E ⊆ B, E.card ≤ b → q < w * ∑ x : G, ((representationCount (B \ E) S x).choose d : ℝ)) ≤ (((Fintype.card G : ℝ) * (S.card.choose d : ℝ) * w * ((n : ℝ) / (U.card : ℝ)) ^ d) / q) ^ (b / d) := by classical let I := freeUniverseStars U S d let support : G × Finset G → Finset G := fun i => inputSupport i.1 i.2 have hsub : ∀ i ∈ I, support i ⊆ U := fun i hi => (mem_freeUniverseStars.mp hi).2 have hd : ∀ i ∈ I, (support i).card ≤ d := fun i hi => le_of_eq (fullStar_support_card (mem_freeUniverseStars.mp hi).1) have hbudget : d * (b / d) ≤ b := by simpa only [Nat.mul_comm] using Nat.div_mul_le_self b d have hmean0 : 0 ≤ uniformMean (exactSlice U n) (containmentSum I support (fun _ => w)) := by apply uniformMean_nonneg intro B _hB exact containmentSum_nonneg I support (fun _ => w) (fun _i _hi => hw) B calc _ ≤ uniformProb (exactSlice U n) (fun B => ∀ E ⊆ B, E.card ≤ d * (b / d) → q < containmentSum I support (fun _ => w) (B \ E)) := by apply uniformProb_mono intro B hB hrob E hEB hEcard have hBU := (mem_exactSlice.mp hB).1 have hfree : B \ E ⊆ U := Finset.sdiff_subset.trans hBU have heq := freeUniverseStar_containmentSum (S := S) d w hfree rw [heq] exact hrob E hEB (hEcard.trans hbudget) _ ≤ (uniformMean (exactSlice U n) (containmentSum I support (fun _ => w)) / q) ^ (b / d) := weighted_deletion_bound U n hn I support (fun _ => w) hsub (fun _i _hi => hw) d hd (b / d) q hq _ ≤ _ := by apply pow_le_pow_left₀ (div_nonneg hmean0 hq.le) exact div_le_div_of_nonneg_right (mean_freeUniverseStars_le U S n d hn w hw) hq.le end ObservableSliceTail end Green39Submission.RichStar end Green39AssemblyScope_30e29b4e2ae6d578 /- Source: Green39Submission.RootedDerivativeBounds; SHA256 13fd602e02ec6e5217adac0a27e08e85ab407b164393fa52da59e866e1115d34 -/ section Green39AssemblyScope_7c77ceab09437d0d /-! Rooted source-pattern counts for PS14 and ST20. A label is a distinguished source together with its full source support. Distinct distinguished sources remain distinct labels even when their physical supports coincide. The source universe `S` is the universe remaining after the caller's protection conditioning. -/ namespace Green39Submission.RootedDerivativeBounds open scoped BigOperators variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- Full-support rooted stars on the permitted source universe. -/ def rootedStars (S : Finset G) (W : G → Finset G) (d : ℕ) : Finset (G × Finset G) := (RichStar.chosenStars S (fun t => W t ∩ S) d).filter (fun i => i.1 ∈ i.2) theorem mem_rootedStars {S : Finset G} {W : G → Finset G} {d : ℕ} {i : G × Finset G} : i ∈ rootedStars S W d ↔ i.1 ∈ S ∧ i.2 ⊆ W i.1 ∩ S ∧ i.2.card = d ∧ i.1 ∈ i.2 := by simp only [rootedStars, Finset.mem_filter, RichStar.mem_chosenStars] tauto theorem rootedStars_subset_chosenStars (S : Finset G) (W : G → Finset G) (d : ℕ) : rootedStars S W d ⊆ RichStar.chosenStars S (fun t => W t ∩ S) d := Finset.filter_subset _ _ theorem rooted_support_subset {S : Finset G} {W : G → Finset G} {d : ℕ} {i : G × Finset G} (hi : i ∈ rootedStars S W d) : i.2 ⊆ S := (mem_rootedStars.mp hi).2.1.trans Finset.inter_subset_right /-- Rooted extensions are a sum of row extensions containing the root and the prescribed pattern. This is an equality of labelled families. -/ theorem card_rooted_extensions_eq_sum (S : Finset G) (W : G → Finset G) (d : ℕ) (B : Finset G) : ((rootedStars S W d).filter (fun i => B ⊆ i.2)).card = ∑ t ∈ S, (((W t ∩ S).powersetCard d).filter (fun Q => insert t B ⊆ Q)).card := by have heq : (rootedStars S W d).filter (fun i => B ⊆ i.2) = RichStar.labelledRows S (fun t => ((W t ∩ S).powersetCard d).filter (fun Q => insert t B ⊆ Q)) := by ext ⟨t, Q⟩ simp only [Finset.mem_filter, mem_rootedStars, RichStar.mem_labelledRows, Finset.mem_powersetCard, Finset.insert_subset_iff] tauto rw [heq, RichStar.card_labelledRows] theorem card_row_extensions_le {V B : Finset G} {d M : ℕ} (hV : V.card ≤ M) (hBd : B.card ≤ d) : ((V.powersetCard d).filter (fun Q => B ⊆ Q)).card ≤ (M - B.card).choose (d - B.card) := by rw [RichStar.card_row_extensions V B d hBd] split_ifs · exact Nat.choose_le_choose _ (Nat.sub_le_sub_right hV _) · exact Nat.zero_le _ theorem card_row_extensions_eq_zero_of_lt {V B : Finset G} {d : ℕ} (hBd : d < B.card) : ((V.powersetCard d).filter (fun Q => B ⊆ Q)).card = 0 := by apply Finset.card_eq_zero.mpr apply Finset.eq_empty_iff_forall_notMem.mpr intro Q hQ obtain ⟨hQV, hBQ⟩ := Finset.mem_filter.mp hQ have hc := Finset.card_le_card hBQ rw [(Finset.mem_powersetCard.mp hQV).2] at hc omega /-- The exact-binomial distinguished/ordinary split. The second term is absent at full degree, since a further distinguished source cannot fit. -/ theorem card_rooted_extensions_le {S : Finset G} {W : G → Finset G} {d M : ℕ} (hM : ∀ t ∈ S, (W t).card ≤ M) (B : Finset G) (hBd : B.card ≤ d) : ((rootedStars S W d).filter (fun i => B ⊆ i.2)).card ≤ B.card * (M - B.card).choose (d - B.card) + if B.card < d then (S.filter (fun t => B ⊆ W t)).card * (M - (B.card + 1)).choose (d - (B.card + 1)) else 0 := by classical let C₁ := (M - B.card).choose (d - B.card) let C₂ := (M - (B.card + 1)).choose (d - (B.card + 1)) have hrow (t : G) (ht : t ∈ S) : (((W t ∩ S).powersetCard d).filter (fun Q => insert t B ⊆ Q)).card ≤ (if t ∈ B then C₁ else 0) + (if B.card < d then (if B ⊆ W t then C₂ else 0) else 0) := by have hcap : (W t ∩ S).card ≤ M := (Finset.card_le_card Finset.inter_subset_left).trans (hM t ht) by_cases htB : t ∈ B · rw [if_pos htB, Finset.insert_eq_of_mem htB] exact (card_row_extensions_le hcap hBd).trans (Nat.le_add_right _ _) · rw [if_neg htB, Nat.zero_add] have hcard : (insert t B).card = B.card + 1 := Finset.card_insert_of_notMem htB by_cases hlt : B.card < d · rw [if_pos hlt] by_cases hBW : B ⊆ W t · rw [if_pos hBW] have hi : (insert t B).card ≤ d := by rw [hcard]; omega simpa only [hcard] using card_row_extensions_le hcap hi · rw [if_neg hBW] have hnot : ¬ insert t B ⊆ W t ∩ S := by intro h exact hBW ((Finset.subset_insert t B).trans (h.trans Finset.inter_subset_left)) have hi : (insert t B).card ≤ d := by rw [hcard]; omega rw [RichStar.card_row_extensions _ _ _ hi, if_neg hnot] · rw [if_neg hlt] have hi : d < (insert t B).card := by rw [hcard]; omega rw [card_row_extensions_eq_zero_of_lt hi] have hsum₁ : (∑ t ∈ S, if t ∈ B then C₁ else 0) = (S.filter (fun t => t ∈ B)).card * C₁ := by rw [← Finset.sum_filter] simp have hsum₂ : (∑ t ∈ S, if B.card < d then (if B ⊆ W t then C₂ else 0) else 0) = if B.card < d then (S.filter (fun t => B ⊆ W t)).card * C₂ else 0 := by by_cases hlt : B.card < d · simp only [if_pos hlt] rw [← Finset.sum_filter] simp · simp [hlt] have hroots : (S.filter (fun t => t ∈ B)).card ≤ B.card := by apply Finset.card_le_card intro t ht exact (Finset.mem_filter.mp ht).2 calc _ = ∑ t ∈ S, (((W t ∩ S).powersetCard d).filter (fun Q => insert t B ⊆ Q)).card := card_rooted_extensions_eq_sum S W d B _ ≤ ∑ t ∈ S, ((if t ∈ B then C₁ else 0) + (if B.card < d then (if B ⊆ W t then C₂ else 0) else 0)) := Finset.sum_le_sum hrow _ = (S.filter (fun t => t ∈ B)).card * C₁ + (if B.card < d then (S.filter (fun t => B ⊆ W t)).card * C₂ else 0) := by rw [Finset.sum_add_distrib, hsum₁, hsum₂] _ ≤ _ := Nat.add_le_add_right (Nat.mul_le_mul_right C₁ hroots) _ /-- The sharp zeroth-pattern binomial bound used in ST19 and PS14. -/ theorem card_rootedStars_le {S : Finset G} {W : G → Finset G} {d M : ℕ} (hM : ∀ t ∈ S, (W t).card ≤ M) : (rootedStars S W d).card ≤ S.card * (M - 1).choose (d - 1) := by have hc := card_rooted_extensions_le hM (∅ : Finset G) (Nat.zero_le d) by_cases hd : 0 < d · simpa [hd] using hc · have hz : (rootedStars S W d).card ≤ 0 := by simpa [hd] using hc exact hz.trans (Nat.zero_le _) theorem card_rooted_extensions_le_of_root_cap {S B : Finset G} {W : G → Finset G} {d M R : ℕ} (hM : ∀ t ∈ S, (W t).card ≤ M) (hBd : B.card ≤ d) (hR : (S.filter (fun t => B ⊆ W t)).card ≤ R) : ((rootedStars S W d).filter (fun i => B ⊆ i.2)).card ≤ B.card * (M - B.card).choose (d - B.card) + if B.card < d then R * (M - (B.card + 1)).choose (d - (B.card + 1)) else 0 := by apply (card_rooted_extensions_le hM B hBd).trans apply Nat.add_le_add_left split_ifs · exact Nat.mul_le_mul_right _ hR · exact le_rfl theorem card_eligible_roots_le_overlap {S T A B : Finset G} {W : G → Finset G} {u q : G} {R : ℕ} (hST : S ⊆ T) (hA : ∀ t ∈ S, ∀ q ∈ W t, u + t - q ∈ A) (hq : q ∈ B) (hR : (T.filter (fun t => u + t - q ∈ A)).card ≤ R) : (S.filter (fun t => B ⊆ W t)).card ≤ R := by apply le_trans (Finset.card_le_card ?_) hR intro t ht obtain ⟨htS, hBW⟩ := Finset.mem_filter.mp ht exact Finset.mem_filter.mpr ⟨hST htS, hA t htS q (hBW hq)⟩ /-- Two prescribed sources force the target into a genuine codegree fiber. The injection works in any additive commutative group, without a finite-group instance or an assumed derivative estimate. -/ theorem card_eligible_roots_le_codegree {S A B : Finset G} {W : G → Finset G} {u : G} {J : ℕ} (hA : ∀ t ∈ S, ∀ q ∈ W t, u + t - q ∈ A) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hB : 2 ≤ B.card) : (S.filter (fun t => B ⊆ W t)).card ≤ J := by obtain ⟨q₁, hq₁, q₂, hq₂, hne⟩ := Finset.one_lt_card.mp (by omega : 1 < B.card) have hc : (S.filter (fun t => B ⊆ W t)).card ≤ (A.filter (fun a => a + (q₁ - q₂) ∈ A)).card := by apply Finset.card_le_card_of_injOn (fun t => u + t - q₁) · intro t ht obtain ⟨htS, hBW⟩ := Finset.mem_filter.mp ht apply Finset.mem_filter.mpr refine ⟨hA t htS q₁ (hBW hq₁), ?_⟩ have heq : (u + t - q₁) + (q₁ - q₂) = u + t - q₂ := by abel rw [heq] exact hA t htS q₂ (hBW hq₂) · intro t _ht s _hs hts exact add_left_cancel (sub_left_inj.mp hts) exact hc.trans (hJ (q₁ - q₂) (sub_ne_zero.mpr hne)) theorem sub_choose_le_pow (M j r : ℕ) : (M - j).choose r ≤ M ^ r := by calc _ ≤ (M - j) ^ r := Nat.choose_le_pow _ _ _ ≤ M ^ r := Nat.pow_le_pow_left (Nat.sub_le M j) r theorem card_rooted_extensions_le_power_of_root_cap {S B : Finset G} {W : G → Finset G} {d M R : ℕ} (hM : ∀ t ∈ S, (W t).card ≤ M) (hBd : B.card ≤ d) (hR : (S.filter (fun t => B ⊆ W t)).card ≤ R) : ((rootedStars S W d).filter (fun i => B ⊆ i.2)).card ≤ B.card * M ^ (d - B.card) + if B.card < d then R * M ^ (d - 1 - B.card) else 0 := by apply (card_rooted_extensions_le_of_root_cap hM hBd hR).trans apply Nat.add_le_add · exact Nat.mul_le_mul_left _ (sub_choose_le_pow M B.card (d - B.card)) · split_ifs · have heq : d - (B.card + 1) = d - 1 - B.card := by omega rw [← heq] exact Nat.mul_le_mul_left _ (sub_choose_le_pow M (B.card + 1) _) · exact le_rfl /-- Complete binomial profile, retaining the distinguished labels and the missing ordinary term at the top derivative order. -/ def rootedExtensionBound (nRoots Q J M d j : ℕ) : ℕ := if j = 0 then nRoots * (M - 1).choose (d - 1) else if j ≤ d then j * (M - j).choose (d - j) + (if j < d then (if j = 1 then Q else J) * (M - (j + 1)).choose (d - (j + 1)) else 0) else 0 def rootedPowerExtensionBound (nRoots Q J M d j : ℕ) : ℕ := if j = 0 then nRoots * M ^ (d - 1) else if j ≤ d then j * M ^ (d - j) + (if j < d then (if j = 1 then Q else J) * M ^ (d - 1 - j) else 0) else 0 theorem rootedExtensionBound_le_power (nRoots Q J M d j : ℕ) : rootedExtensionBound nRoots Q J M d j ≤ rootedPowerExtensionBound nRoots Q J M d j := by unfold rootedExtensionBound rootedPowerExtensionBound by_cases hj : j = 0 · simp only [if_pos hj] exact Nat.mul_le_mul_left _ (sub_choose_le_pow M 1 (d - 1)) · simp only [if_neg hj] by_cases hjd : j ≤ d · simp only [if_pos hjd] apply Nat.add_le_add · exact Nat.mul_le_mul_left _ (sub_choose_le_pow M j (d - j)) · by_cases hlt : j < d · simp only [if_pos hlt] have heq : d - (j + 1) = d - 1 - j := by omega rw [← heq] exact Nat.mul_le_mul_left _ (sub_choose_le_pow M (j + 1) _) · simp only [if_neg hlt, le_refl] · simp only [if_neg hjd, le_refl] /-- The PS14/ST20 extension count from the actual ordinary-overlap and nonzero input-codegree events. Patterns outside `S` have zero extensions. -/ theorem card_subfamily_extensions_le_profile {S A : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {u : G} {d M Q J : ℕ} (hI : I ⊆ rootedStars S W d) (hM : ∀ t ∈ S, (W t).card ≤ M) (hA : ∀ t ∈ S, ∀ q ∈ W t, u + t - q ∈ A) (hQ : ∀ q ∈ S, (S.filter (fun t => u + t - q ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (B : Finset G) : (I.filter (fun i => B ⊆ i.2)).card ≤ rootedExtensionBound S.card Q J M d B.card := by classical have hsub : I.filter (fun i => B ⊆ i.2) ⊆ (rootedStars S W d).filter (fun i => B ⊆ i.2) := by intro i hi obtain ⟨hiI, hBi⟩ := Finset.mem_filter.mp hi exact Finset.mem_filter.mpr ⟨hI hiI, hBi⟩ by_cases hB0 : B.card = 0 · have hBempty : B = ∅ := Finset.card_eq_zero.mp hB0 simpa [hBempty, rootedExtensionBound] using (Finset.card_le_card hI).trans (card_rootedStars_le hM) · by_cases hBd : B.card ≤ d · by_cases hBS : B ⊆ S · have hcap : (S.filter (fun t => B ⊆ W t)).card ≤ if B.card = 1 then Q else J := by by_cases hB1 : B.card = 1 · rw [if_pos hB1] obtain ⟨q, hq⟩ := Finset.card_pos.mp (by omega : 0 < B.card) exact card_eligible_roots_le_overlap (Finset.Subset.refl S) hA hq (hQ q (hBS hq)) · rw [if_neg hB1] exact card_eligible_roots_le_codegree hA hJ (by omega) exact (Finset.card_le_card hsub).trans (by simpa only [rootedExtensionBound, if_neg hB0, if_pos hBd] using card_rooted_extensions_le_of_root_cap hM hBd hcap) · have hz : I.filter (fun i => B ⊆ i.2) = ∅ := by apply Finset.eq_empty_iff_forall_notMem.mpr intro i hi obtain ⟨hiI, hBi⟩ := Finset.mem_filter.mp hi exact hBS (hBi.trans (rooted_support_subset (hI hiI))) rw [hz, Finset.card_empty] exact Nat.zero_le _ · have hz : I.filter (fun i => B ⊆ i.2) = ∅ := by apply Finset.eq_empty_iff_forall_notMem.mpr intro i hi obtain ⟨hiI, hBi⟩ := Finset.mem_filter.mp hi have hc := Finset.card_le_card hBi rw [(mem_rootedStars.mp (hI hiI)).2.2.1] at hc exact hBd hc simp [hz, rootedExtensionBound, hB0, hBd] noncomputable def rootedDerivativeBound (nRoots Q J M d : ℕ) (θ : ℝ) (j : ℕ) : ℝ := (θ ^ j)⁻¹ * (rootedExtensionBound nRoots Q J M d j : ℝ) noncomputable def rootedPowerDerivativeBound (nRoots Q J M d : ℕ) (θ : ℝ) (j : ℕ) : ℝ := (θ ^ j)⁻¹ * (rootedPowerExtensionBound nRoots Q J M d j : ℝ) theorem sourceDerivative_subfamily_le_profile {S A : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {u : G} {d M Q J : ℕ} (hI : I ⊆ rootedStars S W d) (hM : ∀ t ∈ S, (W t).card ≤ M) (hA : ∀ t ∈ S, ∀ q ∈ W t, u + t - q ∈ A) (hQ : ∀ q ∈ S, (S.filter (fun t => u + t - q ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (B : Finset G) {θ : ℝ} (hθ : 0 < θ) : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) θ B ≤ rootedDerivativeBound S.card Q J M d θ B.card := by rw [RichStar.normalized_sourceDerivative_eq_count I (fun i => i.2) d θ (fun i hi => (mem_rootedStars.mp (hI hi)).2.2.1) (ne_of_gt hθ)] apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (pow_nonneg hθ.le _)) exact_mod_cast card_subfamily_extensions_le_profile hI hM hA hQ hJ B theorem sourceDerivative_subfamily_le_power_profile {S A : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {u : G} {d M Q J : ℕ} (hI : I ⊆ rootedStars S W d) (hM : ∀ t ∈ S, (W t).card ≤ M) (hA : ∀ t ∈ S, ∀ q ∈ W t, u + t - q ∈ A) (hQ : ∀ q ∈ S, (S.filter (fun t => u + t - q ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (B : Finset G) {θ : ℝ} (hθ : 0 < θ) : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) θ B ≤ rootedPowerDerivativeBound S.card Q J M d θ B.card := by apply (sourceDerivative_subfamily_le_profile hI hM hA hQ hJ B hθ).trans apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (pow_nonneg hθ.le _)) exact_mod_cast rootedExtensionBound_le_power S.card Q J M d B.card /-- Scalar coefficients commute with every nonnegative source derivative. -/ theorem sourceDerivative_const_mul {ι : Type*} [DecidableEq ι] (I : Finset ι) (support : ι → Finset G) (weight : ι → ℝ) (K θ : ℝ) (B : Finset G) : RawMoments.sourceDerivative I support (fun i => K * weight i) θ B = K * RawMoments.sourceDerivative I support weight θ B := by classical unfold RawMoments.sourceDerivative rw [Finset.mul_sum] apply Finset.sum_congr rfl intro i _hi split_ifs <;> simp [mul_assoc] theorem sourceDerivative_scaled_subfamily_le_profile {S A : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {u : G} {d M Q J : ℕ} (hI : I ⊆ rootedStars S W d) (hM : ∀ t ∈ S, (W t).card ≤ M) (hA : ∀ t ∈ S, ∀ q ∈ W t, u + t - q ∈ A) (hQ : ∀ q ∈ S, (S.filter (fun t => u + t - q ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (B : Finset G) {K θ : ℝ} (hK : 0 ≤ K) (hθ : 0 < θ) : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => K * (θ⁻¹) ^ d) θ B ≤ K * rootedDerivativeBound S.card Q J M d θ B.card := by rw [sourceDerivative_const_mul] simp only [inv_pow] exact mul_le_mul_of_nonneg_left (sourceDerivative_subfamily_le_profile hI hM hA hQ hJ B hθ) hK theorem sourceDerivative_scaled_subfamily_le_power_profile {S A : Finset G} {W : G → Finset G} {I : Finset (G × Finset G)} {u : G} {d M Q J : ℕ} (hI : I ⊆ rootedStars S W d) (hM : ∀ t ∈ S, (W t).card ≤ M) (hA : ∀ t ∈ S, ∀ q ∈ W t, u + t - q ∈ A) (hQ : ∀ q ∈ S, (S.filter (fun t => u + t - q ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (B : Finset G) {K θ : ℝ} (hK : 0 ≤ K) (hθ : 0 < θ) : RawMoments.sourceDerivative I (fun i => i.2) (fun _ => K * (θ⁻¹) ^ d) θ B ≤ K * rootedPowerDerivativeBound S.card Q J M d θ B.card := by rw [sourceDerivative_const_mul] simp only [inv_pow] exact mul_le_mul_of_nonneg_left (sourceDerivative_subfamily_le_power_profile hI hM hA hQ hJ B hθ) hK end Green39Submission.RootedDerivativeBounds end Green39AssemblyScope_7c77ceab09437d0d /- Source: Green39Submission.ProtectedScores; SHA256 7677468faf276ab375b0902062578ca44a85fbc6bb5d8c6a4b37308ab3f2c39c -/ section Green39AssemblyScope_1083fde9924c8be7 /-! Protected Newton scores, signed interpolation and conditional source guards for Green39. The base source laws and PS11 raw moments are in independent upstream modules. No principal asymptotic extraction theorem is assumed in this module. -/ namespace Green39Submission.ProtectedScores open scoped BigOperators Pointwise Classical open Green39Submission.SourceProbability Green39Submission.RawMoments universe u v w section Newton /-- Finite Newton-basis evaluation, with an arbitrary real coefficient function. -/ noncomputable def newtonValue (a : ℕ → ℝ) (L n : ℕ) : ℝ := ∑ j ∈ Finset.range (L + 1), a j * (n.choose j : ℝ) /-- The unclipped inverse thinning transform. -/ noncomputable def inverseNewton (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (n : ℕ) : ℝ := newtonValue (fun j => a j * (θ⁻¹) ^ j) L n /-- The bounded, zero-tail transform from PS3. -/ noncomputable def clippedInverseNewton (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (n : ℕ) : ℝ := if n ≤ L then inverseNewton a L θ n else 0 /-- WG1's shifted finite-difference coefficient, on its range `c+j ≤ L`. -/ noncomputable def shiftedCoeff (a : ℕ → ℝ) (θ : ℝ) (c j : ℕ) : ℝ := ∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ) noncomputable def shiftedInterpolation (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c n : ℕ) : ℝ := if c ≤ L then ∑ j ∈ Finset.range (L - c + 1), shiftedCoeff a θ c j * (n.choose j : ℝ) else 0 theorem newtonValue_zero (a : ℕ → ℝ) (L : ℕ) : newtonValue a L 0 = a 0 := by induction L with | zero => simp [newtonValue] | succ L ih => simpa [newtonValue, Finset.sum_range_succ] using ih theorem inverseNewton_zero (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) : inverseNewton a L θ 0 = a 0 := by simp [inverseNewton, newtonValue_zero] theorem clippedInverseNewton_zero (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) : clippedInverseNewton a L θ 0 = a 0 := by simp [clippedInverseNewton, inverseNewton_zero] theorem clippedInverseNewton_eq_zero (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) {n : ℕ} (h : L < n) : clippedInverseNewton a L θ n = 0 := by simp [clippedInverseNewton, Nat.not_le.mpr h] theorem inverseNewton_one (a : ℕ → ℝ) (L n : ℕ) : inverseNewton a L 1 n = newtonValue a L n := by simp [inverseNewton] theorem shiftedCoeff_zero (a : ℕ → ℝ) (θ : ℝ) (j : ℕ) : shiftedCoeff a θ 0 j = a j * (θ⁻¹) ^ j := by simp [shiftedCoeff] /-- Newton coefficients above the evaluation point contribute zero. -/ theorem newtonValue_truncate (a : ℕ → ℝ) {L n : ℕ} (hnL : n ≤ L) : newtonValue a L n = newtonValue a n n := by classical unfold newtonValue symm apply Finset.sum_subset (Finset.range_mono (Nat.succ_le_succ hnL)) intro j _ hj have hnj : n < j := by have hn : ¬j < n + 1 := fun h => hj (Finset.mem_range.mpr h) omega simp [Nat.choose_eq_zero_of_lt hnj] /-- A forward difference removes one Newton degree and shifts its coefficients. -/ theorem newtonValue_succ_sub (a : ℕ → ℝ) (L n : ℕ) : newtonValue a (L + 1) (n + 1) - newtonValue a (L + 1) n = newtonValue (fun j => a (j + 1)) L n := by have hf (m : ℕ) : newtonValue a (L + 1) m = (∑ j ∈ Finset.range (L + 1), a (j + 1) * (m.choose (j + 1) : ℝ)) + a 0 := by unfold newtonValue rw [Finset.sum_range_succ'] simp rw [hf (n + 1), hf n, add_sub_add_right_eq_sub] unfold newtonValue rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro j _ simp only [Nat.choose_succ_succ', Nat.cast_add] ring theorem fwdDiff_newtonValue (a : ℕ → ℝ) (L : ℕ) : fwdDiff (1 : ℕ) (fun n => newtonValue a (L + 1) n) = fun n => newtonValue (fun j => a (j + 1)) L n := by funext n exact newtonValue_succ_sub a L n /-- Iterated Newton differences, with the remaining degree written additively so no out-of-range natural subtraction is concealed. -/ theorem fwdDiff_iter_newtonValue (a : ℕ → ℝ) (L j : ℕ) : (fwdDiff (1 : ℕ))^[j] (fun n => newtonValue a (L + j) n) = fun n => newtonValue (fun r => a (j + r)) L n := by induction j generalizing a with | zero => simp | succ j ih => rw [show L + (j + 1) = (L + j) + 1 by omega, Function.iterate_succ_apply, fwdDiff_newtonValue, ih] simp only [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm] /-- The explicit shifted coefficient is the actual j-th forward difference at c whenever all evaluation points remain within the fixed degree. -/ theorem shiftedCoeff_eq_fwdDiff (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c j : ℕ) (hcj : c + j ≤ L) : shiftedCoeff a θ c j = ((fwdDiff (1 : ℕ))^[j] (fun n => inverseNewton a L θ n)) c := by have hjL : j ≤ L := by omega have hc : c ≤ L - j := by omega have hd := congrFun (fwdDiff_iter_newtonValue (fun r => a r * (θ⁻¹) ^ r) (L - j) j) c rw [Nat.sub_add_cancel hjL] at hd change shiftedCoeff a θ c j = ((fwdDiff (1 : ℕ))^[j] (fun n => newtonValue (fun r => a r * (θ⁻¹) ^ r) L n)) c rw [hd, newtonValue_truncate _ hc] rfl /-- Exact interpolation on the retained scalar range. Its later lower-tail extension is a separate sign argument, rather than an interpolation assumption. -/ theorem shiftedInterpolation_eq_inverseNewton (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c n : ℕ) (hcn : c + n ≤ L) : shiftedInterpolation a L θ c n = inverseNewton a L θ (c + n) := by classical have hc : c ≤ L := by omega have hn : n ≤ L - c := by omega unfold shiftedInterpolation rw [if_pos hc] have hs : (∑ j ∈ Finset.range (L - c + 1), shiftedCoeff a θ c j * (n.choose j : ℝ)) = ∑ j ∈ Finset.range (n + 1), shiftedCoeff a θ c j * (n.choose j : ℝ) := by symm apply Finset.sum_subset (Finset.range_mono (Nat.succ_le_succ hn)) intro j _ hj have hnj : n < j := by have hnot : ¬j < n + 1 := fun h => hj (Finset.mem_range.mpr h) omega simp [Nat.choose_eq_zero_of_lt hnj] rw [hs] have hg := shift_eq_sum_fwdDiff_iter (1 : ℕ) (fun m => inverseNewton a L θ m) n c have hg' : inverseNewton a L θ (c + n) = ∑ j ∈ Finset.range (n + 1), (n.choose j : ℝ) * ((fwdDiff (1 : ℕ))^[j] (fun m => inverseNewton a L θ m)) c := by simpa [nsmul_eq_mul] using hg rw [hg'] apply Finset.sum_congr rfl intro j hj have hjn : j ≤ n := by have := Finset.mem_range.mp hj omega rw [shiftedCoeff_eq_fwdDiff a L θ c j (by omega), mul_comm] /-- Every lower binomial is bounded by a constant multiple of the leading one once the count is beyond the interpolation degree. -/ theorem choose_le_choose_mul {j d n : ℕ} (hjd : j ≤ d) (hdn : d ≤ n) : (n.choose j : ℝ) ≤ (d.choose j : ℝ) * (n.choose d : ℝ) := by have hp : 1 ≤ (n - j).choose (d - j) := Nat.one_le_iff_ne_zero.mpr (Nat.choose_ne_zero (by omega)) have hm : n.choose j ≤ n.choose d * d.choose j := by rw [Nat.choose_mul hjd] exact Nat.le_mul_of_pos_right _ hp exact_mod_cast (by simpa [Nat.mul_comm] using hm : n.choose j ≤ d.choose j * n.choose d) /-- A finite, explicitly checkable leading-coefficient domination condition. -/ theorem newtonValue_nonpos_of_top_dominates (b : ℕ → ℝ) (d n : ℕ) (hdn : d ≤ n) (hdom : b d + ∑ j ∈ Finset.range d, |b j| * (d.choose j : ℝ) ≤ 0) : newtonValue b d n ≤ 0 := by unfold newtonValue rw [Finset.sum_range_succ] calc (∑ j ∈ Finset.range d, b j * (n.choose j : ℝ)) + b d * (n.choose d : ℝ) ≤ (∑ j ∈ Finset.range d, |b j| * ((d.choose j : ℝ) * (n.choose d : ℝ))) + b d * (n.choose d : ℝ) := by apply add_le_add _ le_rfl apply Finset.sum_le_sum intro j hj exact (mul_le_mul_of_nonneg_right (le_abs_self _) (Nat.cast_nonneg _)).trans (mul_le_mul_of_nonneg_left (choose_le_choose_mul (Nat.le_of_lt (Finset.mem_range.mp hj)) hdn) (abs_nonneg _)) _ = (b d + ∑ j ∈ Finset.range d, |b j| * (d.choose j : ℝ)) * (n.choose d : ℝ) := by rw [add_mul, Finset.sum_mul] simp only [mul_assoc, add_comm] _ ≤ 0 := mul_nonpos_of_nonpos_of_nonneg hdom (Nat.cast_nonneg _) /-- The exact leading-coefficient condition for the shifted interpolation. -/ noncomputable def shiftedTopExpression (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c : ℕ) : ℝ := shiftedCoeff a θ c (L - c) + ∑ j ∈ Finset.range (L - c), |shiftedCoeff a θ c j| * ((L - c).choose j : ℝ) /-- All-count interpolation minorant from the explicit leading-coefficient condition. The condition will be derived below for sufficiently small theta. -/ theorem shiftedInterpolation_le_clippedInverseNewton (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (hdom : ∀ c, c ≤ L → shiftedTopExpression a L θ c ≤ 0) (c n : ℕ) : shiftedInterpolation a L θ c n ≤ clippedInverseNewton a L θ (c + n) := by by_cases hcn : c + n ≤ L · rw [shiftedInterpolation_eq_inverseNewton a L θ c n hcn, clippedInverseNewton, if_pos hcn] · rw [clippedInverseNewton, if_neg hcn] by_cases hc : c ≤ L · rw [shiftedInterpolation, if_pos hc] exact newtonValue_nonpos_of_top_dominates (shiftedCoeff a θ c) (L - c) n (by omega) (hdom c hc) · simp [shiftedInterpolation, hc] /-- Polynomial form of a shifted coefficient after multiplication by theta^L. -/ noncomputable def scaledShiftedCoeff (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c j : ℕ) : ℝ := ∑ r ∈ Finset.range (c + 1), a (j + r) * θ ^ (L - (j + r)) * (c.choose r : ℝ) theorem pow_mul_inv_pow_of_le (θ : ℝ) (hθ : θ ≠ 0) {n L : ℕ} (hn : n ≤ L) : θ ^ L * (θ⁻¹) ^ n = θ ^ (L - n) := by have hpow : θ ^ L = θ ^ (L - n) * θ ^ n := by rw [← pow_add, Nat.sub_add_cancel hn] rw [hpow, mul_assoc, ← mul_pow, mul_inv_cancel₀ hθ, one_pow, mul_one] theorem scaledShiftedCoeff_eq (a : ℕ → ℝ) (L : ℕ) {θ : ℝ} (hθ : θ ≠ 0) (c j : ℕ) (hcj : c + j ≤ L) : θ ^ L * shiftedCoeff a θ c j = scaledShiftedCoeff a L θ c j := by unfold shiftedCoeff scaledShiftedCoeff rw [Finset.mul_sum] apply Finset.sum_congr rfl intro r hr have hrL : j + r ≤ L := by have := Finset.mem_range.mp hr omega calc θ ^ L * (a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) = a (j + r) * (θ ^ L * (θ⁻¹) ^ (j + r)) * (c.choose r : ℝ) := by ring _ = _ := by rw [pow_mul_inv_pow_of_le θ hθ hrL] /-- A polynomial with no constant term is uniformly O(theta) on [0,1], with the explicit absolute coefficient sum as its constant. -/ theorem abs_sum_mul_pow_le_theta {ι : Type u} (I : Finset ι) (b : ι → ℝ) (e : ι → ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (he : ∀ i ∈ I, e i ≠ 0) : |∑ i ∈ I, b i * θ ^ e i| ≤ θ * ∑ i ∈ I, |b i| := by calc |∑ i ∈ I, b i * θ ^ e i| ≤ ∑ i ∈ I, |b i * θ ^ e i| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ i ∈ I, θ * |b i| := by apply Finset.sum_le_sum intro i hi rw [abs_mul, abs_of_nonneg (pow_nonneg hθ _), mul_comm θ] exact mul_le_mul_of_nonneg_left (pow_le_of_le_one hθ hθ1 (he i hi)) (abs_nonneg _) _ = _ := (Finset.mul_sum ..).symm noncomputable def shiftedCoefficientMass (a : ℕ → ℝ) (c j : ℕ) : ℝ := ∑ r ∈ Finset.range (c + 1), |a (j + r) * (c.choose r : ℝ)| noncomputable def shiftedTopRemainderMass (a : ℕ → ℝ) (L c : ℕ) : ℝ := ∑ r ∈ Finset.range c, |a (L - c + r) * (c.choose r : ℝ)| noncomputable def shiftedDominanceRow (a : ℕ → ℝ) (L c : ℕ) : ℝ := shiftedTopRemainderMass a L c + ∑ j ∈ Finset.range (L - c), shiftedCoefficientMass a c j * ((L - c).choose j : ℝ) /-- One positive constant controls all finitely many possible forced counts. -/ noncomputable def shiftedDominanceBound (a : ℕ → ℝ) (L : ℕ) : ℝ := 1 + ∑ c ∈ Finset.range (L + 1), shiftedDominanceRow a L c theorem shiftedCoefficientMass_nonneg (a : ℕ → ℝ) (c j : ℕ) : 0 ≤ shiftedCoefficientMass a c j := Finset.sum_nonneg (fun _ _ => abs_nonneg _) /-- The shifted coefficient has exactly the forced-count scaling used in FG3. -/ theorem abs_shiftedCoeff_le (a : ℕ → ℝ) {θ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (c j : ℕ) : |shiftedCoeff a θ c j| ≤ (θ⁻¹) ^ (c + j) * shiftedCoefficientMass a c j := by have hi0 : 0 ≤ θ⁻¹ := inv_nonneg.mpr hθ.le have hi1 : 1 ≤ θ⁻¹ := by rw [← one_div] exact (le_div_iff₀ hθ).mpr (by simpa using hθ1) unfold shiftedCoeff shiftedCoefficientMass calc |∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)| ≤ ∑ r ∈ Finset.range (c + 1), |a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ r ∈ Finset.range (c + 1), (θ⁻¹) ^ (c + j) * |a (j + r) * (c.choose r : ℝ)| := by apply Finset.sum_le_sum intro r hr have her : j + r ≤ c + j := by have := Finset.mem_range.mp hr omega rw [abs_mul, abs_mul, abs_pow, abs_of_nonneg hi0, abs_mul] calc |a (j + r)| * (θ⁻¹) ^ (j + r) * |(c.choose r : ℝ)| = (θ⁻¹) ^ (j + r) * (|a (j + r)| * |(c.choose r : ℝ)|) := by ring _ ≤ (θ⁻¹) ^ (c + j) * (|a (j + r)| * |(c.choose r : ℝ)|) := mul_le_mul_of_nonneg_right (pow_le_pow_right₀ hi1 her) (mul_nonneg (abs_nonneg _) (abs_nonneg _)) _ = _ := (Finset.mul_sum ..).symm theorem shiftedCoefficientMass_le (a : ℕ → ℝ) {A : ℝ} (c j : ℕ) (ha : ∀ r, r ≤ c → |a (j + r)| ≤ A) : shiftedCoefficientMass a c j ≤ A * (2 : ℝ) ^ c := by have hsum : (∑ r ∈ Finset.range (c + 1), (c.choose r : ℝ)) = (2 : ℝ) ^ c := by exact_mod_cast Nat.sum_range_choose c unfold shiftedCoefficientMass calc (∑ r ∈ Finset.range (c + 1), |a (j + r) * (c.choose r : ℝ)|) ≤ ∑ r ∈ Finset.range (c + 1), A * (c.choose r : ℝ) := by apply Finset.sum_le_sum intro r hr rw [abs_mul, abs_of_nonneg (Nat.cast_nonneg (c.choose r) : (0 : ℝ) ≤ _)] exact mul_le_mul_of_nonneg_right (ha r (by have := Finset.mem_range.mp hr omega)) (Nat.cast_nonneg _) _ = _ := by rw [← Finset.mul_sum, hsum] theorem abs_shiftedCoeff_le_fixed_amplitude (a : ℕ → ℝ) (L : ℕ) {θ A : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hA : 0 ≤ A) (ha : ∀ i, i ≤ L → |a i| ≤ A) (c j : ℕ) (hcj : c + j ≤ L) : |shiftedCoeff a θ c j| ≤ (A * (2 : ℝ) ^ L) * (θ⁻¹) ^ (c + j) := by have hm : shiftedCoefficientMass a c j ≤ A * (2 : ℝ) ^ L := by calc shiftedCoefficientMass a c j ≤ A * (2 : ℝ) ^ c := shiftedCoefficientMass_le a c j (fun r hr => ha (j + r) (by omega)) _ ≤ A * (2 : ℝ) ^ L := mul_le_mul_of_nonneg_left (pow_le_pow_right₀ (by norm_num) (by omega)) hA exact (abs_shiftedCoeff_le a hθ hθ1 c j).trans (by simpa only [mul_comm] using mul_le_mul_of_nonneg_left hm (pow_nonneg (inv_nonneg.mpr hθ.le) (c + j))) theorem shiftedDominanceRow_nonneg (a : ℕ → ℝ) (L c : ℕ) : 0 ≤ shiftedDominanceRow a L c := by apply add_nonneg · exact Finset.sum_nonneg (fun _ _ => abs_nonneg _) · exact Finset.sum_nonneg (fun j _ => mul_nonneg (shiftedCoefficientMass_nonneg a c j) (Nat.cast_nonneg _)) theorem shiftedDominanceBound_pos (a : ℕ → ℝ) (L : ℕ) : 0 < shiftedDominanceBound a L := by exact add_pos_of_pos_of_nonneg zero_lt_one (Finset.sum_nonneg (fun c _ => shiftedDominanceRow_nonneg a L c)) theorem shiftedDominanceRow_le_bound (a : ℕ → ℝ) (L c : ℕ) (hc : c ≤ L) : shiftedDominanceRow a L c ≤ shiftedDominanceBound a L := by have h := Finset.single_le_sum (fun d (_ : d ∈ Finset.range (L + 1)) => shiftedDominanceRow_nonneg a L d) (Finset.mem_range.mpr (show c < L + 1 by omega)) exact h.trans (le_add_of_nonneg_left zero_le_one) theorem abs_scaledShiftedCoeff_le (a : ℕ → ℝ) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (c j : ℕ) (hcj : c + j < L) : |scaledShiftedCoeff a L θ c j| ≤ θ * shiftedCoefficientMass a c j := by have he : ∀ r ∈ Finset.range (c + 1), L - (j + r) ≠ 0 := by intro r hr have := Finset.mem_range.mp hr omega have h := abs_sum_mul_pow_le_theta (Finset.range (c + 1)) (fun r => a (j + r) * (c.choose r : ℝ)) (fun r => L - (j + r)) hθ hθ1 he simpa only [scaledShiftedCoeff, shiftedCoefficientMass, mul_right_comm] using h theorem abs_scaledShiftedCoeff_top_sub_le (a : ℕ → ℝ) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (c : ℕ) (hc : c ≤ L) : |scaledShiftedCoeff a L θ c (L - c) - a L| ≤ θ * shiftedTopRemainderMass a L c := by have he : ∀ r ∈ Finset.range c, L - (L - c + r) ≠ 0 := by intro r hr have := Finset.mem_range.mp hr omega have h := abs_sum_mul_pow_le_theta (Finset.range c) (fun r => a (L - c + r) * (c.choose r : ℝ)) (fun r => L - (L - c + r)) hθ hθ1 he have ht : scaledShiftedCoeff a L θ c (L - c) - a L = ∑ r ∈ Finset.range c, (a (L - c + r) * (c.choose r : ℝ)) * θ ^ (L - (L - c + r)) := by unfold scaledShiftedCoeff rw [Finset.sum_range_succ] simp only [Nat.sub_add_cancel hc, Nat.sub_self, pow_zero, Nat.choose_self, Nat.cast_one, mul_one, add_sub_cancel_right] apply Finset.sum_congr rfl intro r _ ring rw [ht] exact h theorem scaled_shiftedTopExpression_le (a : ℕ → ℝ) (L : ℕ) {θ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (c : ℕ) (hc : c ≤ L) : θ ^ L * shiftedTopExpression a L θ c ≤ a L + θ * shiftedDominanceRow a L c := by have hscaled : θ ^ L * shiftedTopExpression a L θ c = scaledShiftedCoeff a L θ c (L - c) + ∑ j ∈ Finset.range (L - c), |scaledShiftedCoeff a L θ c j| * ((L - c).choose j : ℝ) := by unfold shiftedTopExpression rw [mul_add, Finset.mul_sum, scaledShiftedCoeff_eq a L (ne_of_gt hθ) c (L - c) (by omega)] congr 1 apply Finset.sum_congr rfl intro j hj have hcj : c + j ≤ L := by have := Finset.mem_range.mp hj omega rw [← scaledShiftedCoeff_eq a L (ne_of_gt hθ) c j hcj, abs_mul, abs_of_nonneg (pow_nonneg hθ.le L)] ring rw [hscaled] have htop : scaledShiftedCoeff a L θ c (L - c) ≤ a L + θ * shiftedTopRemainderMass a L c := by have h := (abs_le.mp (abs_scaledShiftedCoeff_top_sub_le a L hθ.le hθ1 c hc)).2 linarith calc scaledShiftedCoeff a L θ c (L - c) + (∑ j ∈ Finset.range (L - c), |scaledShiftedCoeff a L θ c j| * ((L - c).choose j : ℝ)) ≤ a L + θ * shiftedTopRemainderMass a L c + ∑ j ∈ Finset.range (L - c), (θ * shiftedCoefficientMass a c j) * ((L - c).choose j : ℝ) := by apply add_le_add htop apply Finset.sum_le_sum intro j hj apply mul_le_mul_of_nonneg_right _ (Nat.cast_nonneg _) exact abs_scaledShiftedCoeff_le a L hθ.le hθ1 c j (by have := Finset.mem_range.mp hj omega) _ = _ := by unfold shiftedDominanceRow rw [mul_add, Finset.mul_sum] simp only [mul_assoc, add_assoc] theorem shiftedTopExpression_nonpos_of_small (a : ℕ → ℝ) (L : ℕ) {θ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hsmall : θ * shiftedDominanceBound a L ≤ -a L) (c : ℕ) (hc : c ≤ L) : shiftedTopExpression a L θ c ≤ 0 := by have hprod : θ ^ L * shiftedTopExpression a L θ c ≤ 0 := by calc θ ^ L * shiftedTopExpression a L θ c ≤ a L + θ * shiftedDominanceRow a L c := scaled_shiftedTopExpression_le a L hθ hθ1 c hc _ ≤ a L + θ * shiftedDominanceBound a L := add_le_add le_rfl (mul_le_mul_of_nonneg_left (shiftedDominanceRow_le_bound a L c hc) hθ.le) _ ≤ 0 := by linarith exact nonpos_of_mul_nonpos_right hprod (pow_pos hθ L) /-- A negative leading coefficient alone gives a genuine positive radius on which every shifted polynomial is a minorant at every natural count. -/ theorem exists_shiftedInterpolation_minorant_radius (a : ℕ → ℝ) (L : ℕ) (haL : a L < 0) : ∃ δ : ℝ, 0 < δ ∧ ∀ θ : ℝ, 0 < θ → θ ≤ δ → ∀ c n : ℕ, shiftedInterpolation a L θ c n ≤ clippedInverseNewton a L θ (c + n) := by let δ := min 1 (-a L / shiftedDominanceBound a L) have hB := shiftedDominanceBound_pos a L have hδ : 0 < δ := lt_min zero_lt_one (div_pos (neg_pos.mpr haL) hB) refine ⟨δ, hδ, ?_⟩ intro θ hθ hθδ have hθ1 : θ ≤ 1 := hθδ.trans (min_le_left _ _) have hsmall : θ * shiftedDominanceBound a L ≤ -a L := (le_div_iff₀ hB).mp (hθδ.trans (min_le_right _ _)) exact shiftedInterpolation_le_clippedInverseNewton a L θ (shiftedTopExpression_nonpos_of_small a L hθ hθ1 hsmall) /-- A uniform absolute bound for the finite clipped inverse transform. -/ noncomputable def inverseNewtonBound (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) : ℝ := ∑ j ∈ Finset.range (L + 1), |a j| * |θ⁻¹| ^ j * (L.choose j : ℝ) theorem inverseNewtonBound_nonneg (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) : 0 ≤ inverseNewtonBound a L θ := by exact Finset.sum_nonneg (fun j _ => mul_nonneg (mul_nonneg (abs_nonneg _) (pow_nonneg (abs_nonneg _) _)) (Nat.cast_nonneg _)) theorem abs_clippedInverseNewton_le (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (n : ℕ) : |clippedInverseNewton a L θ n| ≤ inverseNewtonBound a L θ := by by_cases hn : n ≤ L · rw [clippedInverseNewton, if_pos hn] unfold inverseNewton newtonValue inverseNewtonBound calc |∑ j ∈ Finset.range (L + 1), a j * (θ⁻¹) ^ j * (n.choose j : ℝ)| ≤ ∑ j ∈ Finset.range (L + 1), |a j * (θ⁻¹) ^ j * (n.choose j : ℝ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ _ := by apply Finset.sum_le_sum intro j _ rw [abs_mul, abs_mul, abs_pow, abs_of_nonneg (Nat.cast_nonneg (n.choose j) : (0 : ℝ) ≤ (n.choose j : ℝ))] apply mul_le_mul_of_nonneg_left _ (mul_nonneg (abs_nonneg _) (pow_nonneg (abs_nonneg _) _)) exact_mod_cast Nat.choose_le_choose j hn · rw [clippedInverseNewton, if_neg hn, abs_zero] exact inverseNewtonBound_nonneg a L θ theorem abs_clippedInverseNewton_sub_le (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (m n : ℕ) : |clippedInverseNewton a L θ m - clippedInverseNewton a L θ n| ≤ 2 * inverseNewtonBound a L θ := by exact (abs_sub _ _).trans (by have hm := abs_clippedInverseNewton_le a L θ m have hn := abs_clippedInverseNewton_le a L θ n linarith) /-- The actual finite scalar bound has the required theta^(-L) growth, with a constant depending only on the fixed coefficients and degree. -/ theorem inverseNewtonBound_le (a : ℕ → ℝ) (L : ℕ) {θ A : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hA : 0 ≤ A) (ha : ∀ j, j ≤ L → |a j| ≤ A) : inverseNewtonBound a L θ ≤ A * (2 : ℝ) ^ L * (θ⁻¹) ^ L := by have hinv : 1 ≤ θ⁻¹ := by rw [← one_div] exact (le_div_iff₀ hθ).mpr (by simpa using hθ1) have hi0 : 0 ≤ θ⁻¹ := inv_nonneg.mpr hθ.le have hsum : (∑ j ∈ Finset.range (L + 1), (L.choose j : ℝ)) = (2 : ℝ) ^ L := by exact_mod_cast Nat.sum_range_choose L unfold inverseNewtonBound simp only [abs_of_nonneg hi0] calc (∑ j ∈ Finset.range (L + 1), |a j| * (θ⁻¹) ^ j * (L.choose j : ℝ)) ≤ ∑ j ∈ Finset.range (L + 1), (A * (θ⁻¹) ^ L) * (L.choose j : ℝ) := by apply Finset.sum_le_sum intro j hj have hjL : j ≤ L := by have := Finset.mem_range.mp hj omega apply mul_le_mul_of_nonneg_right _ (Nat.cast_nonneg _) exact mul_le_mul (ha j hjL) (pow_le_pow_right₀ hinv hjL) (pow_nonneg hi0 j) hA _ = (A * (θ⁻¹) ^ L) * (2 : ℝ) ^ L := by rw [← Finset.mul_sum, hsum] _ = _ := by ring /-- A monotone polynomial envelope for a scalar jump after deletion. Its input is the number of other representations, excluding the distinguished source. -/ noncomputable def jumpEnvelope (L : ℕ) (θ K : ℝ) (n : ℕ) : ℝ := K * θ⁻¹ * ∑ j ∈ Finset.range L, (θ⁻¹) ^ j * (n.choose j : ℝ) theorem jumpEnvelope_nonneg (L : ℕ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (n : ℕ) : 0 ≤ jumpEnvelope L θ K n := by apply mul_nonneg (mul_nonneg hK (inv_nonneg.mpr hθ)) exact Finset.sum_nonneg (fun j _ => mul_nonneg (pow_nonneg (inv_nonneg.mpr hθ) j) (Nat.cast_nonneg _)) theorem jumpEnvelope_mono (L : ℕ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) {m n : ℕ} (hmn : m ≤ n) : jumpEnvelope L θ K m ≤ jumpEnvelope L θ K n := by apply mul_le_mul_of_nonneg_left _ (mul_nonneg hK (inv_nonneg.mpr hθ)) apply Finset.sum_le_sum intro j _ apply mul_le_mul_of_nonneg_left _ (pow_nonneg (inv_nonneg.mpr hθ) j) exact_mod_cast Nat.choose_le_choose j hmn theorem inverseNewton_succ_sub (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (n : ℕ) : inverseNewton a (L + 1) θ (n + 1) - inverseNewton a (L + 1) θ n = θ⁻¹ * ∑ j ∈ Finset.range (L + 1), a (j + 1) * (θ⁻¹) ^ j * (n.choose j : ℝ) := by unfold inverseNewton rw [newtonValue_succ_sub] unfold newtonValue rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _ dsimp only rw [pow_succ] ring /-- The extra jump at the clipping boundary is paid by the same monotone envelope as all ordinary Newton differences. -/ theorem inverseNewtonBound_boundary_le (a : ℕ → ℝ) (L : ℕ) {θ A : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hA : 0 ≤ A) (ha : ∀ j, j ≤ L + 1 → |a j| ≤ A) : inverseNewtonBound a (L + 1) θ ≤ jumpEnvelope (L + 1) θ (2 * A) (L + 1) := by let F : ℝ := ∑ j ∈ Finset.range (L + 1), (θ⁻¹) ^ j * ((L + 1).choose j : ℝ) have hi0 : 0 ≤ θ⁻¹ := inv_nonneg.mpr hθ.le have hi1 : 1 ≤ θ⁻¹ := by rw [← one_div] exact (le_div_iff₀ hθ).mpr (by simpa using hθ1) have hF : 0 ≤ F := Finset.sum_nonneg (fun j _ => mul_nonneg (pow_nonneg hi0 j) (Nat.cast_nonneg _)) have hsingle : (θ⁻¹) ^ L ≤ F := by have hc : (1 : ℝ) ≤ ((L + 1).choose L : ℝ) := by exact_mod_cast (Nat.choose_pos (show L ≤ L + 1 by omega)) have hterm : (θ⁻¹) ^ L ≤ (θ⁻¹) ^ L * ((L + 1).choose L : ℝ) := by nlinarith [pow_nonneg hi0 L] exact hterm.trans (Finset.single_le_sum (fun j (_ : j ∈ Finset.range (L + 1)) => mul_nonneg (pow_nonneg hi0 j) (Nat.cast_nonneg _)) (Finset.mem_range.mpr (Nat.lt_succ_self L))) have htop : (θ⁻¹) ^ (L + 1) ≤ θ⁻¹ * F := by simpa only [pow_succ, mul_comm] using mul_le_mul_of_nonneg_left hsingle hi0 have hF' : F ≤ θ⁻¹ * F := by nlinarith have hbound : inverseNewtonBound a (L + 1) θ ≤ A * (F + (θ⁻¹) ^ (L + 1)) := by unfold inverseNewtonBound simp only [abs_of_nonneg hi0] rw [Finset.sum_range_succ] calc (∑ j ∈ Finset.range (L + 1), |a j| * (θ⁻¹) ^ j * ((L + 1).choose j : ℝ)) + |a (L + 1)| * (θ⁻¹) ^ (L + 1) * ((L + 1).choose (L + 1) : ℝ) ≤ (∑ j ∈ Finset.range (L + 1), A * (θ⁻¹) ^ j * ((L + 1).choose j : ℝ)) + A * (θ⁻¹) ^ (L + 1) := by apply add_le_add · apply Finset.sum_le_sum intro j hj exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (ha j (by have := Finset.mem_range.mp hj omega)) (pow_nonneg hi0 j)) (Nat.cast_nonneg _) · simp only [Nat.choose_self, Nat.cast_one, mul_one] exact mul_le_mul_of_nonneg_right (ha (L + 1) le_rfl) (pow_nonneg hi0 _) _ = A * (F + (θ⁻¹) ^ (L + 1)) := by dsimp [F] rw [mul_add, Finset.mul_sum] simp only [mul_assoc] unfold jumpEnvelope change inverseNewtonBound a (L + 1) θ ≤ (2 * A) * θ⁻¹ * F exact hbound.trans (by nlinarith) theorem abs_clippedInverseNewton_succ_sub_le (a : ℕ → ℝ) (L : ℕ) {θ A : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hA : 0 ≤ A) (ha : ∀ j, j ≤ L + 1 → |a j| ≤ A) (n : ℕ) : |clippedInverseNewton a (L + 1) θ (n + 1) - clippedInverseNewton a (L + 1) θ n| ≤ jumpEnvelope (L + 1) θ (2 * A) n := by have hi0 : 0 ≤ θ⁻¹ := inv_nonneg.mpr hθ.le by_cases hn : n + 1 ≤ L + 1 · rw [clippedInverseNewton, if_pos hn, clippedInverseNewton, if_pos (show n ≤ L + 1 by omega), inverseNewton_succ_sub, abs_mul, abs_of_nonneg hi0] have hs : |∑ j ∈ Finset.range (L + 1), a (j + 1) * (θ⁻¹) ^ j * (n.choose j : ℝ)| ≤ A * ∑ j ∈ Finset.range (L + 1), (θ⁻¹) ^ j * (n.choose j : ℝ) := by calc _ ≤ ∑ j ∈ Finset.range (L + 1), |a (j + 1) * (θ⁻¹) ^ j * (n.choose j : ℝ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ j ∈ Finset.range (L + 1), A * ((θ⁻¹) ^ j * (n.choose j : ℝ)) := by apply Finset.sum_le_sum intro j hj rw [abs_mul, abs_mul, abs_pow, abs_of_nonneg hi0, abs_of_nonneg (Nat.cast_nonneg (n.choose j) : (0 : ℝ) ≤ _)] rw [mul_assoc] exact mul_le_mul_of_nonneg_right (ha (j + 1) (by have := Finset.mem_range.mp hj omega)) (mul_nonneg (pow_nonneg hi0 j) (Nat.cast_nonneg _)) _ = _ := (Finset.mul_sum ..).symm have hsum : 0 ≤ ∑ j ∈ Finset.range (L + 1), (θ⁻¹) ^ j * (n.choose j : ℝ) := Finset.sum_nonneg (fun j _ => mul_nonneg (pow_nonneg hi0 j) (Nat.cast_nonneg _)) have hprod : 0 ≤ A * θ⁻¹ * ∑ j ∈ Finset.range (L + 1), (θ⁻¹) ^ j * (n.choose j : ℝ) := mul_nonneg (mul_nonneg hA hi0) hsum unfold jumpEnvelope exact (mul_le_mul_of_nonneg_left hs hi0).trans (by nlinarith) · by_cases hnL : n = L + 1 · subst n rw [clippedInverseNewton_eq_zero a (L + 1) θ (by omega), zero_sub, abs_neg] exact (abs_clippedInverseNewton_le a (L + 1) θ (L + 1)).trans (inverseNewtonBound_boundary_le a L hθ hθ1 hA ha) · have hL : L + 1 < n := by omega rw [clippedInverseNewton_eq_zero a (L + 1) θ (by omega), clippedInverseNewton_eq_zero a (L + 1) θ hL, sub_self, abs_zero] exact jumpEnvelope_nonneg (L + 1) hθ.le (mul_nonneg (by norm_num) hA) n /-- The exact two-source cancellation in EX8; the distinguished source has already been excluded from the binomial coefficient's first argument. -/ theorem external_weight_cancellation (θ : ℝ) (hθ : θ ≠ 0) (n L : ℕ) : θ ^ 2 * θ⁻¹ * (∑ i ∈ Finset.range L, (θ⁻¹) ^ i * (n.choose i : ℝ) * θ ^ i) = θ * (∑ i ∈ Finset.range L, (n.choose i : ℝ)) := by have hi (i : ℕ) : (θ⁻¹) ^ i * (n.choose i : ℝ) * θ ^ i = (n.choose i : ℝ) := by have hp : (θ⁻¹) ^ i * θ ^ i = 1 := by rw [← mul_pow, inv_mul_cancel₀ hθ, one_pow] calc (θ⁻¹) ^ i * (n.choose i : ℝ) * θ ^ i = ((θ⁻¹) ^ i * θ ^ i) * (n.choose i : ℝ) := by ring _ = (n.choose i : ℝ) := by rw [hp, one_mul] simp_rw [hi] have hp : θ ^ 2 * θ⁻¹ = θ := by calc θ ^ 2 * θ⁻¹ = θ * (θ * θ⁻¹) := by ring _ = θ := by rw [mul_inv_cancel₀ hθ, mul_one] rw [hp] end Newton section SourceVariance variable {α : Type u} [DecidableEq α] /-- Exact variance for the finite product law used only for auxiliary sources. -/ noncomputable def bernoulliVariance (T : Finset α) (θ : ℝ) (f : Finset α → ℝ) : ℝ := bernoulliMean T θ (fun S => (f S) ^ 2) - (bernoulliMean T θ f) ^ 2 theorem bernoulliMean_sub (T : Finset α) (θ : ℝ) (f g : Finset α → ℝ) : bernoulliMean T θ (fun S => f S - g S) = bernoulliMean T θ f - bernoulliMean T θ g := by simp only [bernoulliMean, mul_sub, Finset.sum_sub_distrib] /-- A pointwise jump bound is preserved by the exact finite source mean. -/ theorem abs_bernoulliMean_sub_le (T : Finset α) {θ K : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (f g : Finset α → ℝ) (hfg : ∀ S, S ⊆ T → |f S - g S| ≤ K) : |bernoulliMean T θ f - bernoulliMean T θ g| ≤ K := by apply abs_le.mpr constructor · have h := bernoulliMean_mono T hθ hθ1 (f := fun _ => -K) (g := fun S => f S - g S) (fun S hS => (abs_le.mp (hfg S hS)).1) simpa only [bernoulliMean_const, bernoulliMean_sub] using h · have h := bernoulliMean_mono T hθ hθ1 (f := fun S => f S - g S) (g := fun _ => K) (fun S hS => (abs_le.mp (hfg S hS)).2) simpa only [bernoulliMean_const, bernoulliMean_sub] using h /-- Exact two-point disintegration for one new independent source coordinate. -/ theorem bernoulliMean_insert {T : Finset α} {t : α} (ht : t ∉ T) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean (insert t T) θ f = (1 - θ) * bernoulliMean T θ f + θ * bernoulliMean T θ (fun S => f (insert t S)) := by unfold bernoulliMean rw [Finset.sum_powerset_insert ht] simp only [Finset.mul_sum] apply congrArg₂ (· + ·) · apply Finset.sum_congr rfl intro S hS have htS : t ∉ S := fun h => ht (Finset.mem_powerset.mp hS h) have htD : t ∉ T \ S := fun h => ht (Finset.mem_sdiff.mp h).1 rw [bernoulliWeight, Finset.insert_sdiff_of_notMem T htS, Finset.card_insert_of_notMem htD, pow_succ] unfold bernoulliWeight ring · apply Finset.sum_congr rfl intro S hS have htS : t ∉ S := fun h => ht (Finset.mem_powerset.mp hS h) have hD : insert t T \ insert t S = T \ S := by ext x by_cases hx : x = t · subst x simp [ht] · simp [hx] rw [bernoulliWeight, hD, Finset.card_insert_of_notMem htS, pow_succ] unfold bernoulliWeight ring /-- The elementary variance decomposition; no measure-space theorem is assumed. -/ theorem bernoulliVariance_insert {T : Finset α} {t : α} (ht : t ∉ T) (θ : ℝ) (f : Finset α → ℝ) : bernoulliVariance (insert t T) θ f = (1 - θ) * bernoulliVariance T θ f + θ * bernoulliVariance T θ (fun S => f (insert t S)) + θ * (1 - θ) * (bernoulliMean T θ (fun S => f (insert t S)) - bernoulliMean T θ f) ^ 2 := by unfold bernoulliVariance rw [bernoulliMean_insert ht, bernoulliMean_insert ht] ring /-- Tensorized source variance under a uniform single-coordinate jump bound. This supplies PS6 once the actual score jump is bounded by `k * scalarJump`. -/ theorem bernoulliVariance_le_card_mul (T : Finset α) {θ K : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (f : Finset α → ℝ) (hjump : ∀ t ∈ T, ∀ S : Finset α, S ⊆ T → t ∉ S → |f (insert t S) - f S| ≤ K) : bernoulliVariance T θ f ≤ (T.card : ℝ) * θ * (1 - θ) * K ^ 2 := by induction T using Finset.induction_on generalizing f with | empty => simp [bernoulliVariance, bernoulliMean, bernoulliWeight] | @insert t T ht ih => have h0 := ih f (by intro q hq S hS hqS exact hjump q (Finset.mem_insert_of_mem hq) S (hS.trans (Finset.subset_insert t T)) hqS) have h1 := ih (fun S => f (insert t S)) (by intro q hq S hS hqS have hqt : q ≠ t := fun h => ht (h ▸ hq) have hqSt : q ∉ insert t S := by simp [hqt, hqS] have h := hjump q (Finset.mem_insert_of_mem hq) (insert t S) (Finset.insert_subset_insert t hS) hqSt simpa only [Finset.insert_comm] using h) have hmean := abs_bernoulliMean_sub_le T hθ hθ1 (fun S => f (insert t S)) f (by intro S hS exact hjump t (Finset.mem_insert_self t T) S (hS.trans (Finset.subset_insert t T)) (fun h => ht (hS h))) have hsq : (bernoulliMean T θ (fun S => f (insert t S)) - bernoulliMean T θ f) ^ 2 ≤ K ^ 2 := by have ha := abs_le.mp hmean have hp := mul_nonneg (sub_nonneg.mpr ha.2) (show 0 ≤ K + (bernoulliMean T θ (fun S => f (insert t S)) - bernoulliMean T θ f) by linarith [ha.1]) nlinarith rw [bernoulliVariance_insert ht] calc (1 - θ) * bernoulliVariance T θ f + θ * bernoulliVariance T θ (fun S => f (insert t S)) + θ * (1 - θ) * (bernoulliMean T θ (fun S => f (insert t S)) - bernoulliMean T θ f) ^ 2 ≤ (1 - θ) * ((T.card : ℝ) * θ * (1 - θ) * K ^ 2) + θ * ((T.card : ℝ) * θ * (1 - θ) * K ^ 2) + θ * (1 - θ) * K ^ 2 := add_le_add (add_le_add (mul_le_mul_of_nonneg_left h0 (sub_nonneg.mpr hθ1)) (mul_le_mul_of_nonneg_left h1 hθ)) (mul_le_mul_of_nonneg_left hsq (mul_nonneg hθ (sub_nonneg.mpr hθ1))) _ = ((insert t T).card : ℝ) * θ * (1 - θ) * K ^ 2 := by rw [Finset.card_insert_of_notMem ht, Nat.cast_add, Nat.cast_one] ring /-- A single deterministic telescope controls all deletions from a fixed parent using its coordinate envelopes. The envelopes need not be recomputed from a random or adaptively cleaned input law. -/ theorem abs_delete_sub_le_sum (A E : Finset α) (f : Finset α → ℝ) (K : α → ℝ) (hjump : ∀ t ∈ A, ∀ B : Finset α, B ⊆ A → t ∉ B → |f (insert t B) - f B| ≤ K t) (hEA : E ⊆ A) : |f (A \ E) - f A| ≤ ∑ t ∈ E, K t := by revert hEA induction E using Finset.induction_on with | empty => intro _ simp | @insert t E ht ih => intro hEA have htA : t ∈ A := hEA (Finset.mem_insert_self _ _) have hEA' : E ⊆ A := fun x hx => hEA (Finset.mem_insert_of_mem hx) have hset : insert t (A \ insert t E) = A \ E := by ext x by_cases hx : x = t · subst x simp [htA, ht] · simp [hx] have hstep := hjump t htA (A \ insert t E) Finset.sdiff_subset (by simp) rw [hset] at hstep calc |f (A \ insert t E) - f A| ≤ |f (A \ insert t E) - f (A \ E)| + |f (A \ E) - f A| := abs_sub_le _ _ _ _ ≤ K t + ∑ s ∈ E, K s := add_le_add (by simpa only [abs_sub_comm] using hstep) (ih hEA') _ = ∑ s ∈ insert t E, K s := by rw [Finset.sum_insert ht] end SourceVariance section ForcedFree variable {G : Type v} [AddCommGroup G] [DecidableEq G] /-- The actual sum of clipped scores over all targets. -/ noncomputable def fullScore [Fintype G] (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A S : Finset G) : ℝ := ∑ x : G, clippedInverseNewton a L θ (representationCount A S x) theorem representationCount_insert_source (A S : Finset G) (t x : G) (ht : t ∉ S) : representationCount A (insert t S) x = if x - t ∈ A then representationCount A S x + 1 else representationCount A S x := by by_cases hx : x - t ∈ A <;> simp [representationCount, Finset.filter_insert, hx, ht] theorem fullScore_comm [Fintype G] (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A S : Finset G) : fullScore a L θ A S = fullScore a L θ S A := by unfold fullScore apply Finset.sum_congr rfl intro x _ rw [RichStarGeometry.representationCount_comm] /-- A source insertion changes only the translate of the actual input set. This proves the uniform coordinate bound needed by source variance. -/ theorem abs_fullScore_insert_source_sub_le [Fintype G] (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A S : Finset G) (t : G) (ht : t ∉ S) : |fullScore a L θ A (insert t S) - fullScore a L θ A S| ≤ (A.card : ℝ) * (2 * inverseNewtonBound a L θ) := by classical unfold fullScore rw [← Finset.sum_sub_distrib] calc |∑ x : G, (clippedInverseNewton a L θ (representationCount A (insert t S) x) - clippedInverseNewton a L θ (representationCount A S x))| ≤ ∑ x : G, |clippedInverseNewton a L θ (representationCount A (insert t S) x) - clippedInverseNewton a L θ (representationCount A S x)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x : G, if x - t ∈ A then 2 * inverseNewtonBound a L θ else 0 := by apply Finset.sum_le_sum intro x _ by_cases hx : x - t ∈ A · rw [if_pos hx] exact abs_clippedInverseNewton_sub_le a L θ _ _ · rw [representationCount_insert_source A S t x ht, if_neg hx, sub_self, abs_zero, if_neg hx] _ = (A.card : ℝ) * (2 * inverseNewtonBound a L θ) := by rw [← Finset.sum_filter] simp [card_targets_for_source] theorem abs_fullScore_insert_input_sub_le [Fintype G] (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A S : Finset G) (u : G) (hu : u ∉ A) : |fullScore a L θ (insert u A) S - fullScore a L θ A S| ≤ (S.card : ℝ) * (2 * inverseNewtonBound a L θ) := by rw [fullScore_comm a L θ (insert u A) S, fullScore_comm a L θ A S] exact abs_fullScore_insert_source_sub_le a L θ S A u hu /-- PS6 for the actual bounded score, with its complete explicit finite bound. -/ theorem fullScore_variance_le [Fintype G] (a : ℕ → ℝ) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (A T : Finset G) : bernoulliVariance T θ (fullScore a L θ A) ≤ (T.card : ℝ) * θ * (1 - θ) * ((A.card : ℝ) * (2 * inverseNewtonBound a L θ)) ^ 2 := by apply bernoulliVariance_le_card_mul T hθ hθ1 intro t _ S _ htS exact abs_fullScore_insert_source_sub_le a L θ A S t htS /-- PS9's actual-input comparison, with a finite coefficient-dependent bound. -/ theorem abs_fullScore_delete_sub_le [Fintype G] (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A E S : Finset G) (hEA : E ⊆ A) : |fullScore a L θ (A \ E) S - fullScore a L θ A S| ≤ (E.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound a L θ) := by have h := abs_delete_sub_le_sum A E (fun B => fullScore a L θ B S) (fun _ => (S.card : ℝ) * (2 * inverseNewtonBound a L θ)) (fun t _ B _ htB => abs_fullScore_insert_input_sub_le a L θ B S t htB) hEA simpa only [Finset.sum_const, nsmul_eq_mul, mul_assoc] using h theorem protectedInputs_subset {A E0 S D : Finset G} (hE0 : E0 ⊆ A) : protectedInputs A E0 S D ⊆ A := by exact Finset.union_subset hE0 Finset.inter_subset_left /-- Every protected ordinary alias is charged to a selected source. This is a union bound on actual input points, so repeated representations cause no issue. -/ theorem card_aliasInputs_le_sum (A S D : Finset G) : (A ∩ (S - D)).card ≤ ∑ s ∈ S, representationCount A D s := by classical let aliases (s : G) := (D.filter (fun d => s - d ∈ A)).image (fun d => s - d) have hsub : A ∩ (S - D) ⊆ S.biUnion aliases := by intro x hx rcases Finset.mem_inter.mp hx with ⟨hxA, hxSD⟩ rcases Finset.mem_sub.mp hxSD with ⟨s, hs, d, hd, hsd⟩ apply Finset.mem_biUnion.mpr refine ⟨s, hs, Finset.mem_image.mpr ⟨d, ?_, hsd⟩⟩ exact Finset.mem_filter.mpr ⟨hd, by simpa only [hsd] using hxA⟩ calc (A ∩ (S - D)).card ≤ (S.biUnion aliases).card := Finset.card_le_card hsub _ ≤ ∑ s ∈ S, (aliases s).card := Finset.card_biUnion_le _ ≤ ∑ s ∈ S, representationCount A D s := by apply Finset.sum_le_sum intro s _ exact Finset.card_image_le theorem protectedInputs_eq_clean_union (A E0 S D : Finset G) : protectedInputs A E0 S D = E0 ∪ ((A \ E0) ∩ (S - D)) := by ext x simp only [protectedInputs, Finset.mem_union, Finset.mem_inter, Finset.mem_sdiff] tauto /-- The exact PS8 protection bound. Only the cleaned-input multiplicity cap is used; no law of the adaptively cleaned input is asserted. -/ theorem card_protectedInputs_le (A E0 S D : Finset G) (K : ℕ) (hK : ∀ s ∈ S, representationCount (A \ E0) D s ≤ K) : (protectedInputs A E0 S D).card ≤ E0.card + K * S.card := by rw [protectedInputs_eq_clean_union] calc (E0 ∪ ((A \ E0) ∩ (S - D))).card ≤ E0.card + ((A \ E0) ∩ (S - D)).card := Finset.card_union_le _ _ _ ≤ E0.card + ∑ s ∈ S, representationCount (A \ E0) D s := Nat.add_le_add_left (card_aliasInputs_le_sum (A \ E0) S D) _ _ ≤ E0.card + ∑ _s ∈ S, K := Nat.add_le_add_left (Finset.sum_le_sum hK) _ _ = E0.card + K * S.card := by simp [Nat.mul_comm] /-- FG6: a source forced by a protected input cannot also represent a free input at the same target. The disjointness survives arbitrary adaptive choices of P,V. -/ theorem forced_free_sources_disjoint (P V S U : Finset G) (x : G) (hPV : Disjoint P V) (hUV : U ⊆ V) : Disjoint (S.filter (fun t => x - t ∈ P)) (U.image (fun u => x - u)) := by apply Finset.disjoint_left.mpr intro t htF htM rcases Finset.mem_image.mp htM with ⟨u, hu, rfl⟩ have huP : u ∈ P := by have hcancel : x - (x - u) = u := by abel simpa [hcancel] using (Finset.mem_filter.mp htF).2 exact Finset.disjoint_left.mp hPV huP (hUV hu) end ForcedFree end Green39Submission.ProtectedScores end Green39AssemblyScope_1083fde9924c8be7 /- Source: Green39Submission.DescriptorPrior; SHA256 57c2a3833379ae8566c1f51e8187bb7396ea11d5eabf6c4b02b6e50fe7d68542 -/ section Green39AssemblyScope_118da06890f643e9 /-! The exact necessary-constraint prior of a fixed protected descriptor. The constrained input family consists of exactly `k` points, contains the fixed protected set `P`, and has its remainder in the fixed free universe `U`. Under `Disjoint P U` and `P.card ≤ k`, adjoining `P` is a bijection from the uniform exact slice in `U`. All probability and mean identities are exact finite sums. These theorems do not identify the posterior law of an adaptively selected descriptor. The final joint-event inequality conditions only on the stated inclusion and avoidance constraints for one fixed descriptor. -/ namespace Green39Submission namespace DescriptorPrior open scoped BigOperators universe u variable {V : Type u} [DecidableEq V] /-- Exact full inputs obeying the necessary inclusion and free-universe constraints. -/ def constrainedSlice (P U : Finset V) (k : ℕ) : Finset (Finset V) := (exactSlice (P ∪ U) k).filter (fun A => P ⊆ A) theorem mem_constrainedSlice (P U A : Finset V) (k : ℕ) : A ∈ constrainedSlice P U k ↔ P ⊆ A ∧ A \ P ⊆ U ∧ A.card = k := by rw [constrainedSlice, Finset.mem_filter, mem_exactSlice] constructor · rintro ⟨⟨hAU, hcard⟩, hPA⟩ refine ⟨hPA, ?_, hcard⟩ intro x hx obtain ⟨hxA, hxP⟩ := Finset.mem_sdiff.mp hx rcases Finset.mem_union.mp (hAU hxA) with hp | hu · exact False.elim (hxP hp) · exact hu · rintro ⟨hPA, hrem, hcard⟩ refine ⟨⟨?_, hcard⟩, hPA⟩ intro x hx by_cases hp : x ∈ P · exact Finset.mem_union.mpr (Or.inl hp) · exact Finset.mem_union.mpr (Or.inr (hrem (Finset.mem_sdiff.mpr ⟨hx, hp⟩))) theorem remainder_mem_exactSlice (P U A : Finset V) (k : ℕ) (hA : A ∈ constrainedSlice P U k) : A \ P ∈ exactSlice U (k - P.card) := by obtain ⟨hPA, hrem, hcard⟩ := (mem_constrainedSlice P U A k).mp hA apply mem_exactSlice.mpr refine ⟨hrem, ?_⟩ rw [Finset.card_sdiff_of_subset hPA, hcard] theorem union_mem_constrainedSlice (P U B : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) (hB : B ∈ exactSlice U (k - P.card)) : P ∪ B ∈ constrainedSlice P U k := by obtain ⟨hBU, hcard⟩ := mem_exactSlice.mp hB have hPB : Disjoint P B := Finset.disjoint_of_subset_right hBU hdisjoint apply (mem_constrainedSlice P U (P ∪ B) k).mpr refine ⟨Finset.subset_union_left, ?_, ?_⟩ · rw [Finset.union_sdiff_cancel_left hPB] exact hBU · rw [Finset.card_union_of_disjoint hPB, hcard, Nat.add_sub_of_le hPk] theorem union_remainder_eq (P U B : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hB : B ∈ exactSlice U (k - P.card)) : (P ∪ B) \ P = B := Finset.union_sdiff_cancel_left (Finset.disjoint_of_subset_right (mem_exactSlice.mp hB).1 hdisjoint) theorem protected_union_remainder_eq (P U A : Finset V) (k : ℕ) (hA : A ∈ constrainedSlice P U k) : P ∪ (A \ P) = A := Finset.union_sdiff_of_subset ((mem_constrainedSlice P U A k).mp hA).1 /-- Deleting the initial protected exceptions and then free points leaves the forced/free split used by the conditional score polynomial. -/ theorem split_after_deletions (P B E₀ E : Finset V) (hPB : Disjoint P B) (hE₀ : E₀ ⊆ P) (hE : E ⊆ B) : ((P ∪ B) \ E₀) \ E = (P \ E₀) ∪ (B \ E) := by have hBE₀ : Disjoint B E₀ := Finset.disjoint_of_subset_right hE₀ hPB.symm have hPE : Disjoint P E := Finset.disjoint_of_subset_right hE hPB have hP₀E : Disjoint (P \ E₀) E := Finset.disjoint_of_subset_left Finset.sdiff_subset hPE rw [Finset.union_sdiff_distrib, Finset.sdiff_eq_self_of_disjoint hBE₀, Finset.union_sdiff_distrib, Finset.sdiff_eq_self_of_disjoint hP₀E] theorem constrained_input_after_deletions (P U A E₀ E : Finset V) (k : ℕ) (hA : A ∈ constrainedSlice P U k) (hE₀ : E₀ ⊆ P) (hE : E ⊆ A \ P) : (A \ E₀) \ E = (P \ E₀) ∪ ((A \ P) \ E) := by have hPB : Disjoint P (A \ P) := by apply Finset.disjoint_left.mpr intro x hxP hxA exact (Finset.mem_sdiff.mp hxA).2 hxP calc (A \ E₀) \ E = ((P ∪ (A \ P)) \ E₀) \ E := congrArg (fun C : Finset V => (C \ E₀) \ E) (protected_union_remainder_eq P U A k hA).symm _ = (P \ E₀) ∪ ((A \ P) \ E) := split_after_deletions _ _ _ _ hPB hE₀ hE /-- The actual finite bijection; its inverse is subtraction of the protected set. -/ def exactSliceEquiv (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) : {B : Finset V // B ∈ exactSlice U (k - P.card)} ≃ {A : Finset V // A ∈ constrainedSlice P U k} where toFun B := ⟨P ∪ B.val, union_mem_constrainedSlice P U B.val k hdisjoint hPk B.property⟩ invFun A := ⟨A.val \ P, remainder_mem_exactSlice P U A.val k A.property⟩ left_inv B := Subtype.ext (union_remainder_eq P U B.val k hdisjoint B.property) right_inv A := Subtype.ext (protected_union_remainder_eq P U A.val k A.property) theorem union_injective_on_slice (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) : Set.InjOn (fun B : Finset V => P ∪ B) (exactSlice U (k - P.card)) := by intro B₁ hB₁ B₂ hB₂ h have hr := congrArg (fun A : Finset V => A \ P) h rw [union_remainder_eq P U B₁ k hdisjoint hB₁, union_remainder_eq P U B₂ k hdisjoint hB₂] at hr exact hr theorem constrainedSlice_eq_image (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) : constrainedSlice P U k = (exactSlice U (k - P.card)).image (fun B => P ∪ B) := by ext A constructor · intro hA exact Finset.mem_image.mpr ⟨A \ P, remainder_mem_exactSlice P U A k hA, protected_union_remainder_eq P U A k hA⟩ · intro hA obtain ⟨B, hB, rfl⟩ := Finset.mem_image.mp hA exact union_mem_constrainedSlice P U B k hdisjoint hPk hB theorem card_constrainedSlice (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) : (constrainedSlice P U k).card = (exactSlice U (k - P.card)).card := by rw [constrainedSlice_eq_image P U k hdisjoint hPk] exact Finset.card_image_of_injOn (union_injective_on_slice P U k hdisjoint) theorem card_constrainedSlice_eq_choose (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) : (constrainedSlice P U k).card = U.card.choose (k - P.card) := by rw [card_constrainedSlice P U k hdisjoint hPk, card_exactSlice] theorem sum_constrainedSlice (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) (f : Finset V → ℝ) : (∑ A ∈ constrainedSlice P U k, f A) = ∑ B ∈ exactSlice U (k - P.card), f (P ∪ B) := by rw [constrainedSlice_eq_image P U k hdisjoint hPk] exact Finset.sum_image (union_injective_on_slice P U k hdisjoint) /-- The finite means agree, including the empty-slice convention. -/ theorem uniformMean_constrainedSlice (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) (f : Finset V → ℝ) : uniformMean (constrainedSlice P U k) f = uniformMean (exactSlice U (k - P.card)) (fun B => f (P ∪ B)) := by unfold uniformMean rw [sum_constrainedSlice P U k hdisjoint hPk f, card_constrainedSlice P U k hdisjoint hPk] theorem event_card_constrainedSlice (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) (event : Finset V → Prop) [DecidablePred event] : ((constrainedSlice P U k).filter event).card = ((exactSlice U (k - P.card)).filter (fun B => event (P ∪ B))).card := by rw [constrainedSlice_eq_image P U k hdisjoint hPk, Finset.filter_image] apply Finset.card_image_of_injOn intro B₁ hB₁ B₂ hB₂ h exact union_injective_on_slice P U k hdisjoint (Finset.mem_filter.mp hB₁).1 (Finset.mem_filter.mp hB₂).1 h /-- Exact count transport, with no approximation and no posterior assertion. -/ theorem uniformProb_constrainedSlice (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) (event : Finset V → Prop) : uniformProb (constrainedSlice P U k) event = uniformProb (exactSlice U (k - P.card)) (fun B => event (P ∪ B)) := by classical unfold uniformProb rw [event_card_constrainedSlice P U k hdisjoint hPk event, card_constrainedSlice P U k hdisjoint hPk] theorem uniformProb_remainder (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) (event : Finset V → Prop) : uniformProb (constrainedSlice P U k) (fun A => event (A \ P)) = uniformProb (exactSlice U (k - P.card)) event := by classical rw [uniformProb_constrainedSlice P U k hdisjoint hPk] have hf : (exactSlice U (k - P.card)).filter (fun B => event ((P ∪ B) \ P)) = (exactSlice U (k - P.card)).filter event := by apply Finset.filter_congr intro B hB rw [union_remainder_eq P U B k hdisjoint hB] simp only [uniformProb, hf] theorem uniformMean_remainder (P U : Finset V) (k : ℕ) (hdisjoint : Disjoint P U) (hPk : P.card ≤ k) (f : Finset V → ℝ) : uniformMean (constrainedSlice P U k) (fun A => f (A \ P)) = uniformMean (exactSlice U (k - P.card)) f := by rw [uniformMean_constrainedSlice P U k hdisjoint hPk] unfold uniformMean congr 1 apply Finset.sum_congr rfl intro B hB change f ((P ∪ B) \ P) = f B rw [union_remainder_eq P U B k hdisjoint hB] section ForbiddenUniverse /-- The free universe determined solely by inclusion and avoidance constraints. -/ def freeUniverse (ambient P forbidden : Finset V) : Finset V := ambient \ (P ∪ forbidden) theorem protected_disjoint_freeUniverse (ambient P forbidden : Finset V) : Disjoint P (freeUniverse ambient P forbidden) := by apply Finset.disjoint_left.mpr intro x hxP hxU exact (Finset.mem_sdiff.mp hxU).2 (Finset.mem_union.mpr (Or.inl hxP)) theorem remainder_subset_freeUniverse_iff (ambient P forbidden A : Finset V) (hA : A ⊆ ambient) : A \ P ⊆ freeUniverse ambient P forbidden ↔ Disjoint (A \ P) forbidden := by constructor · intro h apply Finset.disjoint_left.mpr intro x hxA hxF exact (Finset.mem_sdiff.mp (h hxA)).2 (Finset.mem_union.mpr (Or.inr hxF)) · intro h x hx refine Finset.mem_sdiff.mpr ⟨hA (Finset.mem_sdiff.mp hx).1, ?_⟩ intro hPF rcases Finset.mem_union.mp hPF with hp | hf · exact (Finset.mem_sdiff.mp hx).2 hp · exact Finset.disjoint_left.mp h hx hf theorem mem_constrainedSlice_forbidden_iff (ambient P forbidden A : Finset V) (k : ℕ) (hP : P ⊆ ambient) : A ∈ constrainedSlice P (freeUniverse ambient P forbidden) k ↔ A ∈ exactSlice ambient k ∧ P ⊆ A ∧ Disjoint (A \ P) forbidden := by constructor · intro h obtain ⟨hPA, hrem, hcard⟩ := (mem_constrainedSlice _ _ _ _).mp h have hA : A ⊆ ambient := by intro x hx by_cases hp : x ∈ P · exact hP hp · exact (Finset.mem_sdiff.mp (hrem (Finset.mem_sdiff.mpr ⟨hx, hp⟩))).1 exact ⟨mem_exactSlice.mpr ⟨hA, hcard⟩, hPA, (remainder_subset_freeUniverse_iff ambient P forbidden A hA).mp hrem⟩ · rintro ⟨hA, hPA, hdisjoint⟩ obtain ⟨hAU, hcard⟩ := mem_exactSlice.mp hA exact (mem_constrainedSlice _ _ _ _).mpr ⟨hPA, (remainder_subset_freeUniverse_iff ambient P forbidden A hAU).mpr hdisjoint, hcard⟩ theorem constrainedSlice_forbidden_eq (ambient P forbidden : Finset V) (k : ℕ) (hP : P ⊆ ambient) : constrainedSlice P (freeUniverse ambient P forbidden) k = (exactSlice ambient k).filter (fun A => P ⊆ A ∧ Disjoint (A \ P) forbidden) := by ext A rw [mem_constrainedSlice_forbidden_iff ambient P forbidden A k hP, Finset.mem_filter] end ForbiddenUniverse section JointProbability variable {Ω : Type u} /-- A joint bad-and-consistent event is no larger than its uniform restricted-prior probability. The proof includes empty sample and empty conditioning families. -/ theorem uniformProb_joint_le_filtered (sample : Finset Ω) (condition event : Ω → Prop) [DecidablePred condition] : uniformProb sample (fun a => condition a ∧ event a) ≤ uniformProb (sample.filter condition) event := by classical have hf : sample.filter (fun a => condition a ∧ event a) = (sample.filter condition).filter event := by ext a simp only [Finset.mem_filter, and_assoc] rw [uniformProb_eq_card_filter sample (fun a => condition a ∧ event a), uniformProb_eq_card_filter (sample.filter condition) event, hf] by_cases hc : sample.filter condition = ∅ · simp [hc] · have hpos : (0 : ℝ) < ((sample.filter condition).card : ℝ) := Nat.cast_pos.mpr (Finset.nonempty_iff_ne_empty.mpr hc).card_pos have hle : ((sample.filter condition).card : ℝ) ≤ (sample.card : ℝ) := Nat.cast_le.mpr (Finset.card_filter_le _ _) exact div_le_div_of_nonneg_left (Nat.cast_nonneg _) hpos hle /-- The fixed-descriptor necessary prior can bound a joint event on the original exact input slice. No event selecting an adaptive descriptor is conditioned on. -/ theorem uniformProb_joint_le_remainder (ambient P forbidden : Finset V) (k : ℕ) (hP : P ⊆ ambient) (hPk : P.card ≤ k) (event : Finset V → Prop) : uniformProb (exactSlice ambient k) (fun A => P ⊆ A ∧ Disjoint (A \ P) forbidden ∧ event (A \ P)) ≤ uniformProb (exactSlice (freeUniverse ambient P forbidden) (k - P.card)) event := by classical calc uniformProb (exactSlice ambient k) (fun A => P ⊆ A ∧ Disjoint (A \ P) forbidden ∧ event (A \ P)) ≤ uniformProb (constrainedSlice P (freeUniverse ambient P forbidden) k) (fun A => event (A \ P)) := by rw [constrainedSlice_forbidden_eq ambient P forbidden k hP] simpa only [and_assoc] using (uniformProb_joint_le_filtered (exactSlice ambient k) (fun A => P ⊆ A ∧ Disjoint (A \ P) forbidden) (fun A => event (A \ P))) _ = uniformProb (exactSlice (freeUniverse ambient P forbidden) (k - P.card)) event := uniformProb_remainder P (freeUniverse ambient P forbidden) k (protected_disjoint_freeUniverse ambient P forbidden) hPk event end JointProbability section SourceDescriptor open scoped Pointwise variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The descriptor order is `(D,E₀,P,S)`, as in DescriptorCounting. -/ def sourceForbidden (d : Finset G × Finset G × Finset G × Finset G) : Finset G := d.2.2.2 - d.1 def sourceFreeUniverse (d : Finset G × Finset G × Finset G × Finset G) : Finset G := freeUniverse Finset.univ d.2.2.1 (sourceForbidden d) /-- A concrete exact prior determined entirely by the four encoded sets. -/ def sourcePrior (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : Finset (Finset G) := exactSlice (sourceFreeUniverse d) (k - d.2.2.1.card) def sourceForcedSet (d : Finset G × Finset G × Finset G × Finset G) : Finset G := d.2.2.1 \ d.2.1 def sourceForcedCount (d : Finset G × Finset G × Finset G × Finset G) (x : G) : ℕ := representationCount (sourceForcedSet d) d.2.2.2 x /-- Only the original exact slice, necessary inclusion and necessary avoidance. This predicate contains no assertion that an extraction algorithm chose `d`. -/ def sourceConsistent (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (A : Finset G) : Prop := A ∈ exactSlice Finset.univ k ∧ d.2.2.1 ⊆ A ∧ Disjoint (A \ d.2.2.1) (sourceForbidden d) /-- The actual protected-input construction satisfies exactly the necessary descriptor constraints, without a law for the adaptively selected descriptor. -/ theorem sourceConsistent_protectedInputs (k : ℕ) (A E₀ S D : Finset G) (hcard : A.card = k) (hE₀ : E₀ ⊆ A) : sourceConsistent k (D, E₀, protectedInputs A E₀ S D, S) A := by refine ⟨mem_exactSlice.mpr ⟨Finset.subset_univ _, hcard⟩, ?_, ?_⟩ · exact Finset.union_subset hE₀ Finset.inter_subset_left · apply Finset.disjoint_left.mpr intro u hu hforbidden rcases Finset.mem_sdiff.mp hu with ⟨huA, huP⟩ exact huP (Finset.mem_union_right E₀ (Finset.mem_inter.mpr ⟨huA, hforbidden⟩)) theorem sourceForcedSet_protectedInputs (A E₀ S D : Finset G) : sourceForcedSet (D, E₀, protectedInputs A E₀ S D, S) = (A \ E₀) ∩ (S - D) := by ext u simp only [sourceForcedSet, protectedInputs, Finset.mem_sdiff, Finset.mem_union, Finset.mem_inter] tauto theorem sourceConsistent_iff (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (A : Finset G) : sourceConsistent k d A ↔ A ∈ constrainedSlice d.2.2.1 (sourceFreeUniverse d) k := by exact (mem_constrainedSlice_forbidden_iff Finset.univ d.2.2.1 (sourceForbidden d) A k (Finset.subset_univ _)).symm theorem sourceConsistent_remainder_mem (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (A : Finset G) (hA : sourceConsistent k d A) : A \ d.2.2.1 ∈ sourcePrior k d := by exact remainder_mem_exactSlice d.2.2.1 (sourceFreeUniverse d) A k ((sourceConsistent_iff k d A).mp hA) theorem sourceForced_disjoint_prior_input (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (B : Finset G) (hB : B ∈ sourcePrior k d) : Disjoint (sourceForcedSet d) B := by have hBU : B ⊆ sourceFreeUniverse d := (mem_exactSlice.mp hB).1 have hPB : Disjoint d.2.2.1 B := Finset.disjoint_of_subset_right hBU (protected_disjoint_freeUniverse Finset.univ d.2.2.1 (sourceForbidden d)) exact Finset.disjoint_of_subset_left Finset.sdiff_subset hPB theorem sourceConsistent_score_input_after_deletion (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (A E : Finset G) (hA : sourceConsistent k d A) (hE₀ : d.2.1 ⊆ d.2.2.1) (hE : E ⊆ A \ d.2.2.1) : (A \ d.2.1) \ E = sourceForcedSet d ∪ ((A \ d.2.2.1) \ E) := by exact constrained_input_after_deletions d.2.2.1 (sourceFreeUniverse d) A d.2.1 E k ((sourceConsistent_iff k d A).mp hA) hE₀ hE /-- Exact fixed-descriptor means may be evaluated on the concrete remainder prior. -/ theorem sourcePrior_uniformMean (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (hPk : d.2.2.1.card ≤ k) (f : Finset G → ℝ) : uniformMean (constrainedSlice d.2.2.1 (sourceFreeUniverse d) k) (fun A => f (A \ d.2.2.1)) = uniformMean (sourcePrior k d) f := by exact uniformMean_remainder d.2.2.1 (sourceFreeUniverse d) k (protected_disjoint_freeUniverse Finset.univ d.2.2.1 (sourceForbidden d)) hPk f /-- The concrete four-set descriptor prior bounds its joint original-input event. -/ theorem source_joint_probability_le (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (hPk : d.2.2.1.card ≤ k) (event : Finset G → Prop) : uniformProb (exactSlice Finset.univ k) (fun A => sourceConsistent k d A ∧ event (A \ d.2.2.1)) ≤ uniformProb (sourcePrior k d) event := by calc uniformProb (exactSlice Finset.univ k) (fun A => sourceConsistent k d A ∧ event (A \ d.2.2.1)) = uniformProb (exactSlice Finset.univ k) (fun A => d.2.2.1 ⊆ A ∧ Disjoint (A \ d.2.2.1) (sourceForbidden d) ∧ event (A \ d.2.2.1)) := by apply uniformProb_congr intro A hA simp only [sourceConsistent, hA, true_and, and_assoc] _ ≤ uniformProb (sourcePrior k d) event := uniformProb_joint_le_remainder Finset.univ d.2.2.1 (sourceForbidden d) k (Finset.subset_univ _) hPk event end SourceDescriptor end DescriptorPrior end Green39Submission end Green39AssemblyScope_118da06890f643e9 /- Source: Green39Submission.DescriptorUnion; SHA256 e1a79cf46b9440eca4c7928aeaa6a6b442389d93c36aed49fb6689875c7e079c -/ section Green39AssemblyScope_9ad5cc18c5495b46 /-! Finite descriptor transfer from an original exact input slice. A good bad input need only produce one consistent descriptor. For each fixed descriptor, the necessary inclusion and avoidance constraints induce the exact free prior proved in `DescriptorPrior`. A union bound therefore charges the gate-failure probability and one fixed-prior tail for each encoded descriptor. The extraction and fixed-prior tail estimates are explicit hypotheses of these finite connector lemmas. This module does not establish either Green 39 input event or their asymptotic rates. It never conditions on adaptive descriptor selection, and introduces no union over masks. Each observable is a fixed function of its descriptor and the free remainder for the whole input sample. -/ namespace Green39Submission namespace DescriptorUnion open scoped BigOperators universe u v section FiniteUnion variable {α : Type u} {δ : Type v} /-- A deterministic witness on the good-input gate yields a finite union bound. The sample and descriptor family may both be empty. -/ theorem probability_le_gate_failure_add_sum (sample : Finset α) (descriptors : Finset δ) (good bad : α → Prop) (jointEvent : δ → α → Prop) (tail : δ → ℝ) (hExtract : ∀ a ∈ sample, good a → bad a → ∃ d ∈ descriptors, jointEvent d a) (hJoint : ∀ d ∈ descriptors, uniformProb sample (jointEvent d) ≤ tail d) : uniformProb sample bad ≤ uniformProb sample (fun a => ¬ good a) + ∑ d ∈ descriptors, tail d := by classical calc uniformProb sample bad ≤ uniformProb sample (fun a => ¬ good a ∨ ∃ d ∈ descriptors, jointEvent d a) := by apply uniformProb_mono intro a ha hbad by_cases hgood : good a · exact Or.inr (hExtract a ha hgood hbad) · exact Or.inl hgood _ ≤ uniformProb sample (fun a => ¬ good a) + uniformProb sample (fun a => ∃ d ∈ descriptors, jointEvent d a) := uniformProb_or_le _ _ _ _ ≤ uniformProb sample (fun a => ¬ good a) + ∑ d ∈ descriptors, uniformProb sample (jointEvent d) := add_le_add le_rfl (uniformProb_exists_mem_le_sum sample descriptors jointEvent) _ ≤ uniformProb sample (fun a => ¬ good a) + ∑ d ∈ descriptors, tail d := add_le_add le_rfl (Finset.sum_le_sum hJoint) /-- A common tail charges precisely the number of encoded descriptors. -/ theorem probability_le_gate_failure_add_card_mul (sample : Finset α) (descriptors : Finset δ) (good bad : α → Prop) (jointEvent : δ → α → Prop) (tail : ℝ) (hExtract : ∀ a ∈ sample, good a → bad a → ∃ d ∈ descriptors, jointEvent d a) (hJoint : ∀ d ∈ descriptors, uniformProb sample (jointEvent d) ≤ tail) : uniformProb sample bad ≤ uniformProb sample (fun a => ¬ good a) + (descriptors.card : ℝ) * tail := by simpa only [Finset.sum_const, nsmul_eq_mul] using probability_le_gate_failure_add_sum sample descriptors good bad jointEvent (fun _ => tail) hExtract hJoint end FiniteUnion section ExactSlice variable {V : Type u} {δ : Type v} [DecidableEq V] /-- Necessary inclusion and avoidance constraints transfer every fixed joint event to the exact free prior before the descriptor union is taken. -/ theorem exactSlice_probability_le_gate_failure_add_sum (ambient : Finset V) (k : ℕ) (descriptors : Finset δ) (protectedSet forbidden : δ → Finset V) (good bad : Finset V → Prop) (observable : δ → Finset V → Prop) (hProtected : ∀ d ∈ descriptors, protectedSet d ⊆ ambient) (hCard : ∀ d ∈ descriptors, (protectedSet d).card ≤ k) (hExtract : ∀ A ∈ exactSlice ambient k, good A → bad A → ∃ d ∈ descriptors, protectedSet d ⊆ A ∧ Disjoint (A \ protectedSet d) (forbidden d) ∧ observable d (A \ protectedSet d)) : uniformProb (exactSlice ambient k) bad ≤ uniformProb (exactSlice ambient k) (fun A => ¬ good A) + ∑ d ∈ descriptors, uniformProb (exactSlice (DescriptorPrior.freeUniverse ambient (protectedSet d) (forbidden d)) (k - (protectedSet d).card)) (observable d) := by apply probability_le_gate_failure_add_sum (exactSlice ambient k) descriptors good bad (fun d A => protectedSet d ⊆ A ∧ Disjoint (A \ protectedSet d) (forbidden d) ∧ observable d (A \ protectedSet d)) · exact hExtract · intro d hd exact DescriptorPrior.uniformProb_joint_le_remainder ambient (protectedSet d) (forbidden d) k (hProtected d hd) (hCard d hd) (observable d) /-- Uniform fixed-prior tails give the gate-failure plus entropy-cost bound. -/ theorem exactSlice_probability_le_gate_failure_add_card_mul (ambient : Finset V) (k : ℕ) (descriptors : Finset δ) (protectedSet forbidden : δ → Finset V) (good bad : Finset V → Prop) (observable : δ → Finset V → Prop) (tail : ℝ) (hProtected : ∀ d ∈ descriptors, protectedSet d ⊆ ambient) (hCard : ∀ d ∈ descriptors, (protectedSet d).card ≤ k) (hExtract : ∀ A ∈ exactSlice ambient k, good A → bad A → ∃ d ∈ descriptors, protectedSet d ⊆ A ∧ Disjoint (A \ protectedSet d) (forbidden d) ∧ observable d (A \ protectedSet d)) (hTail : ∀ d ∈ descriptors, uniformProb (exactSlice (DescriptorPrior.freeUniverse ambient (protectedSet d) (forbidden d)) (k - (protectedSet d).card)) (observable d) ≤ tail) : uniformProb (exactSlice ambient k) bad ≤ uniformProb (exactSlice ambient k) (fun A => ¬ good A) + (descriptors.card : ℝ) * tail := by apply probability_le_gate_failure_add_card_mul (exactSlice ambient k) descriptors good bad (fun d A => protectedSet d ⊆ A ∧ Disjoint (A \ protectedSet d) (forbidden d) ∧ observable d (A \ protectedSet d)) tail hExtract intro d hd exact (DescriptorPrior.uniformProb_joint_le_remainder ambient (protectedSet d) (forbidden d) k (hProtected d hd) (hCard d hd) (observable d)).trans (hTail d hd) end ExactSlice section SourceDescriptor variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The concrete `(D,E₀,P,S)` descriptors use exactly their established source prior; the consistency event is a necessary-constraint event. -/ theorem source_probability_le_gate_failure_add_sum (k : ℕ) (descriptors : Finset (Finset G × Finset G × Finset G × Finset G)) (good bad : Finset G → Prop) (observable : (Finset G × Finset G × Finset G × Finset G) → Finset G → Prop) (hCard : ∀ d ∈ descriptors, d.2.2.1.card ≤ k) (hExtract : ∀ A ∈ exactSlice Finset.univ k, good A → bad A → ∃ d ∈ descriptors, DescriptorPrior.sourceConsistent k d A ∧ observable d (A \ d.2.2.1)) : uniformProb (exactSlice Finset.univ k) bad ≤ uniformProb (exactSlice Finset.univ k) (fun A => ¬ good A) + ∑ d ∈ descriptors, uniformProb (DescriptorPrior.sourcePrior k d) (observable d) := by apply probability_le_gate_failure_add_sum (exactSlice Finset.univ k) descriptors good bad (fun d A => DescriptorPrior.sourceConsistent k d A ∧ observable d (A \ d.2.2.1)) · exact hExtract · intro d hd exact DescriptorPrior.source_joint_probability_le k d (hCard d hd) (observable d) /-- Concrete source-descriptor transfer with a uniform fixed-prior tail. -/ theorem source_probability_le_gate_failure_add_card_mul (k : ℕ) (descriptors : Finset (Finset G × Finset G × Finset G × Finset G)) (good bad : Finset G → Prop) (observable : (Finset G × Finset G × Finset G × Finset G) → Finset G → Prop) (tail : ℝ) (hCard : ∀ d ∈ descriptors, d.2.2.1.card ≤ k) (hExtract : ∀ A ∈ exactSlice Finset.univ k, good A → bad A → ∃ d ∈ descriptors, DescriptorPrior.sourceConsistent k d A ∧ observable d (A \ d.2.2.1)) (hTail : ∀ d ∈ descriptors, uniformProb (DescriptorPrior.sourcePrior k d) (observable d) ≤ tail) : uniformProb (exactSlice Finset.univ k) bad ≤ uniformProb (exactSlice Finset.univ k) (fun A => ¬ good A) + (descriptors.card : ℝ) * tail := by apply probability_le_gate_failure_add_card_mul (exactSlice Finset.univ k) descriptors good bad (fun d A => DescriptorPrior.sourceConsistent k d A ∧ observable d (A \ d.2.2.1)) tail hExtract intro d hd exact (DescriptorPrior.source_joint_probability_le k d (hCard d hd) (observable d)).trans (hTail d hd) end SourceDescriptor end DescriptorUnion end Green39Submission end Green39AssemblyScope_9ad5cc18c5495b46 /- Source: Green39Submission.CanonicalMask; SHA256 84f87ff27f266469700a545efcda69194748e56835de0e871b53a010bf35908e -/ section Green39AssemblyScope_e7c437f7b1c07f3e /-! Finite canonical-mask and quantifier interfaces for Part II and Appendices G,H. The choice function below takes a descriptor and its fixed tests, never a realized free remainder or an adaptive parent. Classical choice supplies a fixed function; the manuscript's first-in-a-fixed-order convention has the same properties used here. A parent witness proves eligibility but does not enter the chosen value. For a probability application the concrete tests must be instantiated from fixed descriptor data; a generic function type alone cannot prohibit an outer closure from capturing the realized input. That instantiation remains an explicit task. This module does not prove the analytic extraction, weighted cleanup, or input failure estimates. Their exact local hypotheses are visible in the interfaces. -/ namespace Green39Submission namespace CanonicalMask open scoped BigOperators universe u v w section Selection variable {D : Type u} {G : Type v} [DecidableEq G] /-- All masks in the finite target ambient with the predetermined allowance. -/ def boundedMasks (ambient : Finset G) (allowance : ℕ) : Finset (Finset G) := ambient.powerset.filter (fun Y => Y.card ≤ allowance) theorem mem_boundedMasks (ambient Y : Finset G) (allowance : ℕ) : Y ∈ boundedMasks ambient allowance ↔ Y ⊆ ambient ∧ Y.card ≤ allowance := by simp [boundedMasks] /-- Eligibility is a property of fixed descriptor data and finite prior tests. -/ def Eligible (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (d : D) : Prop := ∃ Y ∈ masks, passes d Y /-- One fixed mask per descriptor; ineligible descriptors use an irrelevant default. -/ noncomputable def canonical (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (d : D) : Finset G := by classical exact if h : Eligible masks passes d then Classical.choose h else ∅ theorem canonical_spec (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (d : D) (h : Eligible masks passes d) : canonical masks passes d ∈ masks ∧ passes d (canonical masks passes d) := by classical unfold canonical rw [dif_pos h] exact Classical.choose_spec h theorem canonical_eq_empty_of_ineligible (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (d : D) (h : ¬ Eligible masks passes d) : canonical masks passes d = ∅ := by classical simp [canonical, h] theorem canonical_bounded (ambient : Finset G) (allowance : ℕ) (passes : D → Finset G → Prop) (d : D) (h : Eligible (boundedMasks ambient allowance) passes d) : canonical (boundedMasks ambient allowance) passes d ⊆ ambient ∧ (canonical (boundedMasks ambient allowance) passes d).card ≤ allowance := by exact (mem_boundedMasks _ _ _).mp (canonical_spec _ _ _ h).1 /-- The finite eligible descriptor subfamily. -/ noncomputable def eligibleDescriptors (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) : Finset D := by classical exact descriptors.filter (Eligible masks passes) theorem mem_eligibleDescriptors (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (d : D) : d ∈ eligibleDescriptors descriptors masks passes ↔ d ∈ descriptors ∧ Eligible masks passes d := by classical simp [eligibleDescriptors] theorem eligibleDescriptors_card_le (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) : (eligibleDescriptors descriptors masks passes).card ≤ descriptors.card := by classical exact Finset.card_filter_le _ _ /-- The family to be union-bounded contains only the chosen descriptor-mask pairs. -/ noncomputable def selectedPairs (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) : Finset (D × Finset G) := by classical exact (eligibleDescriptors descriptors masks passes).image (fun d => (d, canonical masks passes d)) theorem selectedPairs_card (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) : (selectedPairs descriptors masks passes).card = (eligibleDescriptors descriptors masks passes).card := by classical unfold selectedPairs apply Finset.card_image_of_injective intro d₁ d₂ h exact congrArg Prod.fst h /-- No factor for the number of candidate masks appears. -/ theorem selectedPairs_card_le (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) : (selectedPairs descriptors masks passes).card ≤ descriptors.card := by classical rw [selectedPairs_card] exact eligibleDescriptors_card_le _ _ _ theorem selected_pair_mem (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (d : D) (hd : d ∈ descriptors) (he : Eligible masks passes d) : (d, canonical masks passes d) ∈ selectedPairs descriptors masks passes := by classical exact Finset.mem_image.mpr ⟨d, (mem_eligibleDescriptors _ _ _ _).mpr ⟨hd, he⟩, rfl⟩ end Selection section FiniteFailureUnion variable {D : Type u} {G : Type v} {Ω : Type w} [DecidableEq G] [DecidableEq Ω] /-- Failures for the single chosen mask of one fixed descriptor, on the original sample space. Passing tests are fixed before the input event is formed. -/ noncomputable def canonicalBadInputsFor (sample : Finset Ω) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (bad : D → Finset G → Ω → Prop) (d : D) : Finset Ω := by classical exact sample.filter (bad d (canonical masks passes d)) theorem mem_canonicalBadInputsFor (sample : Finset Ω) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (bad : D → Finset G → Ω → Prop) (d : D) (a : Ω) : a ∈ canonicalBadInputsFor sample masks passes bad d ↔ a ∈ sample ∧ bad d (canonical masks passes d) a := by classical simp [canonicalBadInputsFor] noncomputable def canonicalBadInputs (sample : Finset Ω) (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (bad : D → Finset G → Ω → Prop) : Finset Ω := by classical exact (eligibleDescriptors descriptors masks passes).biUnion (canonicalBadInputsFor sample masks passes bad) theorem mem_canonicalBadInputs (sample : Finset Ω) (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (bad : D → Finset G → Ω → Prop) (a : Ω) : a ∈ canonicalBadInputs sample descriptors masks passes bad ↔ a ∈ sample ∧ ∃ d ∈ descriptors, Eligible masks passes d ∧ bad d (canonical masks passes d) a := by classical constructor · intro h obtain ⟨d, hd, ha⟩ := Finset.mem_biUnion.mp h obtain ⟨hd', he⟩ := (mem_eligibleDescriptors _ _ _ _).mp hd obtain ⟨has, hbad⟩ := (mem_canonicalBadInputsFor _ _ _ _ _ _).mp ha exact ⟨has, d, hd', he, hbad⟩ · rintro ⟨has, d, hd, he, hbad⟩ exact Finset.mem_biUnion.mpr ⟨d, (mem_eligibleDescriptors _ _ _ _).mpr ⟨hd, he⟩, (mem_canonicalBadInputsFor _ _ _ _ _ _).mpr ⟨has, hbad⟩⟩ theorem canonicalBadInputs_card_le_sum (sample : Finset Ω) (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (bad : D → Finset G → Ω → Prop) : (canonicalBadInputs sample descriptors masks passes bad).card ≤ ∑ d ∈ eligibleDescriptors descriptors masks passes, (canonicalBadInputsFor sample masks passes bad d).card := by classical exact Finset.card_biUnion_le /-- A uniform per-descriptor bad count incurs only the original descriptor count. No assertion about the needed analytic bound `hcount` is made here. -/ theorem canonicalBadInputs_card_le (sample : Finset Ω) (descriptors : Finset D) (masks : Finset (Finset G)) (passes : D → Finset G → Prop) (bad : D → Finset G → Ω → Prop) (countBound : ℕ) (hcount : ∀ d ∈ descriptors, Eligible masks passes d → (canonicalBadInputsFor sample masks passes bad d).card ≤ countBound) : (canonicalBadInputs sample descriptors masks passes bad).card ≤ descriptors.card * countBound := by classical calc (canonicalBadInputs sample descriptors masks passes bad).card ≤ (eligibleDescriptors descriptors masks passes).card * countBound := by apply Finset.card_biUnion_le_card_mul intro d hd obtain ⟨hd', he⟩ := (mem_eligibleDescriptors _ _ _ _).mp hd exact hcount d hd' he _ ≤ descriptors.card * countBound := Nat.mul_le_mul_right countBound (eligibleDescriptors_card_le _ _ _) end FiniteFailureUnion section PriorTests variable {D : Type u} {G : Type v} {V : Type w} [DecidableEq G] /-- SE11 and the observable guards, evaluated against a descriptor's fixed prior. There is deliberately no argument for the actual realized remainder. -/ def passesPriorTests (prior : D → Finset (Finset V)) (minorant : D → Finset G → Finset V → ℝ) (guards : D → Finset G → Prop) (meanFloor : ℝ) (d : D) (Y : Finset G) : Prop := meanFloor ≤ uniformMean (prior d) (minorant d Y) ∧ guards d Y theorem canonical_prior_tests (masks : Finset (Finset G)) (prior : D → Finset (Finset V)) (minorant : D → Finset G → Finset V → ℝ) (guards : D → Finset G → Prop) (meanFloor : ℝ) (d : D) (he : Eligible masks (passesPriorTests prior minorant guards meanFloor) d) : meanFloor ≤ uniformMean (prior d) (minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d)) ∧ guards d (canonical masks (passesPriorTests prior minorant guards meanFloor) d) := by exact (canonical_spec _ _ _ he).2 end PriorTests section PointwiseMinorant variable {G : Type v} [DecidableEq G] /-- The mask and loop/wedge targets are replaced by `-bound`. On external targets all positive terms, including a positive constant, are discarded. -/ def targetMinorant (masked external : Finset G) (bound C positive negative : ℝ) (x : G) : ℝ := if x ∈ masked then -bound else if x ∈ external then min C 0 - negative else C + positive - negative theorem targetMinorant_le (masked external : Finset G) (bound C positive negative scalar : ℝ) (x : G) (hbound : -bound ≤ scalar) (hpositive : 0 ≤ positive) (hraw : C + positive - negative ≤ scalar) : targetMinorant masked external bound C positive negative x ≤ scalar := by unfold targetMinorant split_ifs with hm he · exact hbound · have hC : min C 0 ≤ C := min_le_left _ _ linarith · exact hraw /-- This is pointwise in the remainder, so a different canonical mask is safe. -/ theorem sum_targetMinorant_le (ambient masked external : Finset G) (bound : ℝ) (C positive negative scalar : G → ℝ) (hbound : ∀ x ∈ ambient, -bound ≤ scalar x) (hpositive : ∀ x ∈ ambient, 0 ≤ positive x) (hraw : ∀ x ∈ ambient, C x + positive x - negative x ≤ scalar x) : (∑ x ∈ ambient, targetMinorant masked external bound (C x) (positive x) (negative x) x) ≤ ∑ x ∈ ambient, scalar x := by apply Finset.sum_le_sum intro x hx exact targetMinorant_le _ _ _ _ _ _ _ _ (hbound x hx) (hpositive x hx) (hraw x hx) end PointwiseMinorant section DeletionQuantifiers variable {V : Type w} [DecidableEq V] /-- The deletion provided by cleanup is allowed to depend on the descriptor. -/ theorem every_upper_contradicts_some_lower (B : Finset V) (budget : ℕ) (score : Finset V → ℝ) (upper lower : ℝ) (hgap : upper < lower) (hupper : ∀ E ⊆ B, E.card ≤ budget → score (B \ E) ≤ upper) (hlower : ∃ E ⊆ B, E.card ≤ budget ∧ lower ≤ score (B \ E)) : False := by obtain ⟨E, hEB, hcard, hlo⟩ := hlower exact (not_le_of_gt hgap) (hlo.trans (hupper E hEB hcard)) theorem green39_score_gap (scale : ℝ) (hscale : 0 < scale) : scale / 16 < 3 * scale / 16 := by linarith variable {D : Type u} {G : Type v} [DecidableEq G] /-- Convert the canonical minorant's cleanup result into a full-score lower bound. Only the chosen mask has a cleanup premise. There is no simultaneous cleanup assumption or probability union over all passing masks. -/ theorem canonical_cleanup_fullScore (masks : Finset (Finset G)) (prior : D → Finset (Finset V)) (minorant : D → Finset G → Finset V → ℝ) (guards : D → Finset G → Prop) (meanFloor margin : ℝ) (d : D) (B : Finset V) (budget : ℕ) (fullScore : Finset V → ℝ) (he : Eligible masks (passesPriorTests prior minorant guards meanFloor) d) (hminorant : ∀ Y ∈ masks, ∀ R : Finset V, minorant d Y R ≤ fullScore R) (hcleanup : ∃ E ⊆ B, E.card ≤ budget ∧ uniformMean (prior d) (minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d)) - margin ≤ minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d) (B \ E)) : ∃ E ⊆ B, E.card ≤ budget ∧ meanFloor - margin ≤ fullScore (B \ E) := by obtain ⟨E, hEB, hcard, hcleanupE⟩ := hcleanup have hmean := (canonical_prior_tests masks prior minorant guards meanFloor d he).1 have hmem := (canonical_spec masks (passesPriorTests prior minorant guards meanFloor) d he).1 refine ⟨E, hEB, hcard, ?_⟩ exact (sub_le_sub_right hmean margin).trans (hcleanupE.trans (hminorant _ hmem (B \ E))) /-- The concrete prior needs the minorant only on subsets of its free universe. Every cleanup deletion stays inside that domain. -/ theorem canonical_cleanup_fullScore_of_subset (masks : Finset (Finset G)) (prior : D → Finset (Finset V)) (minorant : D → Finset G → Finset V → ℝ) (guards : D → Finset G → Prop) (meanFloor margin : ℝ) (d : D) (U B : Finset V) (budget : ℕ) (fullScore : Finset V → ℝ) (hBU : B ⊆ U) (he : Eligible masks (passesPriorTests prior minorant guards meanFloor) d) (hminorant : ∀ Y ∈ masks, ∀ R ⊆ U, minorant d Y R ≤ fullScore R) (hcleanup : ∃ E ⊆ B, E.card ≤ budget ∧ uniformMean (prior d) (minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d)) - margin ≤ minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d) (B \ E)) : ∃ E ⊆ B, E.card ≤ budget ∧ meanFloor - margin ≤ fullScore (B \ E) := by obtain ⟨E, hEB, hcard, hcleanupE⟩ := hcleanup have hmean := (canonical_prior_tests masks prior minorant guards meanFloor d he).1 have hmem := (canonical_spec masks (passesPriorTests prior minorant guards meanFloor) d he).1 refine ⟨E, hEB, hcard, ?_⟩ exact (sub_le_sub_right hmean margin).trans (hcleanupE.trans (hminorant _ hmem (B \ E) (Finset.sdiff_subset.trans hBU))) /-- The actual adaptive mask supplies only existence of a passing candidate. The full-score upper bound is independent of which candidate is selected. -/ theorem canonical_mask_contradiction (masks : Finset (Finset G)) (prior : D → Finset (Finset V)) (minorant : D → Finset G → Finset V → ℝ) (guards : D → Finset G → Prop) (meanFloor margin upper : ℝ) (d : D) (B : Finset V) (budget : ℕ) (fullScore : Finset V → ℝ) (actualMask : Finset G) (hmask : actualMask ∈ masks) (hpasses : passesPriorTests prior minorant guards meanFloor d actualMask) (hgap : upper < meanFloor - margin) (hminorant : ∀ Y ∈ masks, ∀ R : Finset V, minorant d Y R ≤ fullScore R) (hupper : ∀ E ⊆ B, E.card ≤ budget → fullScore (B \ E) ≤ upper) (hcleanup : ∃ E ⊆ B, E.card ≤ budget ∧ uniformMean (prior d) (minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d)) - margin ≤ minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d) (B \ E)) : False := by have he : Eligible masks (passesPriorTests prior minorant guards meanFloor) d := ⟨actualMask, hmask, hpasses⟩ exact every_upper_contradicts_some_lower B budget fullScore upper (meanFloor - margin) hgap hupper (canonical_cleanup_fullScore masks prior minorant guards meanFloor margin d B budget fullScore he hminorant hcleanup) theorem canonical_mask_contradiction_of_subset (masks : Finset (Finset G)) (prior : D → Finset (Finset V)) (minorant : D → Finset G → Finset V → ℝ) (guards : D → Finset G → Prop) (meanFloor margin upper : ℝ) (d : D) (U B : Finset V) (budget : ℕ) (fullScore : Finset V → ℝ) (hBU : B ⊆ U) (actualMask : Finset G) (hmask : actualMask ∈ masks) (hpasses : passesPriorTests prior minorant guards meanFloor d actualMask) (hgap : upper < meanFloor - margin) (hminorant : ∀ Y ∈ masks, ∀ R ⊆ U, minorant d Y R ≤ fullScore R) (hupper : ∀ E ⊆ B, E.card ≤ budget → fullScore (B \ E) ≤ upper) (hcleanup : ∃ E ⊆ B, E.card ≤ budget ∧ uniformMean (prior d) (minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d)) - margin ≤ minorant d (canonical masks (passesPriorTests prior minorant guards meanFloor) d) (B \ E)) : False := by have he : Eligible masks (passesPriorTests prior minorant guards meanFloor) d := ⟨actualMask, hmask, hpasses⟩ exact every_upper_contradicts_some_lower B budget fullScore upper (meanFloor - margin) hgap hupper (canonical_cleanup_fullScore_of_subset masks prior minorant guards meanFloor margin d U B budget fullScore hBU he hminorant hcleanup) end DeletionQuantifiers section SparseTargets variable {G : Type v} [DecidableEq G] /-- A target bound outside a mask is exactly containment of the rich-target set. -/ theorem rich_filter_subset_iff (ambient X : Finset G) (profile : G → ℝ) (cap : ℝ) : ambient.filter (fun x => cap < profile x) ⊆ X ↔ ∀ x ∈ ambient, x ∉ X → profile x ≤ cap := by classical constructor · intro h x hx hX by_contra hcap exact hX (h (Finset.mem_filter.mpr ⟨hx, lt_of_not_ge hcap⟩)) · intro h x hx obtain ⟨hU, hcap⟩ := Finset.mem_filter.mp hx by_contra hX exact (not_lt_of_ge (h x hU hX)) hcap /-- Sparse exceptional witnesses can be replaced by the actual rich-target set. The witness may depend arbitrarily on the entire profile. -/ theorem exists_small_mask_iff_rich_card_le (ambient : Finset G) (profile : G → ℝ) (cap : ℝ) (allowance : ℕ) : (∃ X ⊆ ambient, X.card ≤ allowance ∧ ∀ x ∈ ambient, x ∉ X → profile x ≤ cap) ↔ (ambient.filter (fun x => cap < profile x)).card ≤ allowance := by classical constructor · rintro ⟨X, _, hcard, hcap⟩ exact (Finset.card_le_card ((rich_filter_subset_iff ambient X profile cap).mpr hcap)).trans hcard · intro hcard refine ⟨ambient.filter (fun x => cap < profile x), Finset.filter_subset _ _, hcard, ?_⟩ exact (rich_filter_subset_iff _ _ _ _).mp (Finset.Subset.refl _) /-- Padding with a uniformly bounded profile increment preserves the same mask. -/ theorem off_mask_bound_after_increment (ambient X : Finset G) (profile padded : G → ℝ) (cap increment paddedCap : ℝ) (hprofile : ∀ x ∈ ambient, x ∉ X → profile x ≤ cap) (hincrement : ∀ x ∈ ambient, padded x ≤ profile x + increment) (hcap : cap + increment ≤ paddedCap) : ∀ x ∈ ambient, x ∉ X → padded x ≤ paddedCap := by intro x hx hX have hpx := hprofile x hx hX have hinc := hincrement x hx linarith /-- The SE6 exceptional-target charge is paid once, at the two endpoints. No factor for the number of deleted input points occurs in this charge. -/ theorem full_sum_change_le (ambient X : Finset G) (hX : X ⊆ ambient) (before after : G → ℝ) (bound offMaskCost : ℝ) (hbefore : ∀ x ∈ X, |before x| ≤ bound) (hafter : ∀ x ∈ X, |after x| ≤ bound) (hoff : (∑ x ∈ ambient \ X, |after x - before x|) ≤ offMaskCost) : |(∑ x ∈ ambient, after x) - ∑ x ∈ ambient, before x| ≤ offMaskCost + 2 * bound * (X.card : ℝ) := by have hterm : ∀ x ∈ X, |after x - before x| ≤ 2 * bound := by intro x hx have ht : |after x - before x| ≤ |after x| + |before x| := by simpa using (abs_sub_le (after x) 0 (before x)) linarith [hbefore x hx, hafter x hx] calc |(∑ x ∈ ambient, after x) - ∑ x ∈ ambient, before x| = |∑ x ∈ ambient, (after x - before x)| := by rw [Finset.sum_sub_distrib] _ ≤ ∑ x ∈ ambient, |after x - before x| := Finset.abs_sum_le_sum_abs _ _ _ = (∑ x ∈ ambient \ X, |after x - before x|) + ∑ x ∈ X, |after x - before x| := (Finset.sum_sdiff hX).symm _ ≤ offMaskCost + ∑ _x ∈ X, 2 * bound := add_le_add hoff (Finset.sum_le_sum hterm) _ = offMaskCost + 2 * bound * (X.card : ℝ) := by simp [mul_comm] end SparseTargets section RepresentationProfile variable {G : Type v} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The sparse witness characterization uses the shared exact representation count. -/ theorem sparse_representation_iff_rich_card_le (A T : Finset G) (cap : ℝ) (allowance : ℕ) : (∃ X : Finset G, X.card ≤ allowance ∧ ∀ x, x ∉ X → (representationCount A T x : ℝ) ≤ cap) ↔ (Finset.univ.filter (fun x => cap < (representationCount A T x : ℝ))).card ≤ allowance := by simpa using exists_small_mask_iff_rich_card_le (Finset.univ : Finset G) (fun x => (representationCount A T x : ℝ)) cap allowance end RepresentationProfile end CanonicalMask end Green39Submission end Green39AssemblyScope_e7c437f7b1c07f3e /- Source: Green39Submission.DescriptorCounting; SHA256 6a7b6a9e97f99b40ff54dc78f3db89375e2701b032ba74942b2684cc4f7bceae -/ section Green39AssemblyScope_90effd92d23597c3 /-! Concrete finite counts for the four encoded descriptor sets `(D,E₀,P,S)`. The bounded-subset family is the one already defined in CanonicalMask. Counting by exact cardinality gives `(h+1) * max(1,n)^h`; absorbing `h+1` into `2^h` gives a convenient single-power bound. For caps `H,30H,30H+5s,s`, the total exponent is exactly `61H+6s`. No exceptional mask, retained row family, or unencoded input deletion is included in this descriptor family. All estimates here are finite. The asymptotic comparison with the cleanup or rich-star failure rate remains a separate parameter/asymptotic obligation. -/ namespace Green39Submission namespace DescriptorCounting open scoped BigOperators open CanonicalMask universe u v variable {G : Type u} [DecidableEq G] theorem boundedMasks_eq_biUnion (ambient : Finset G) (h : ℕ) : boundedMasks ambient h = (Finset.range (h + 1)).biUnion (fun j => ambient.powersetCard j) := by ext A constructor · intro hA obtain ⟨hAU, hcard⟩ := (mem_boundedMasks _ _ _).mp hA exact Finset.mem_biUnion.mpr ⟨A.card, Finset.mem_range.mpr (Nat.lt_succ_of_le hcard), Finset.mem_powersetCard.mpr ⟨hAU, rfl⟩⟩ · intro hA obtain ⟨j, hj, hAj⟩ := Finset.mem_biUnion.mp hA obtain ⟨hAU, hcard⟩ := Finset.mem_powersetCard.mp hAj apply (mem_boundedMasks _ _ _).mpr refine ⟨hAU, ?_⟩ rw [hcard] exact Nat.le_of_lt_succ (Finset.mem_range.mp hj) /-- Exact finite counting by the cardinality of the chosen subset. -/ theorem boundedMasks_card_eq_sum_choose (ambient : Finset G) (h : ℕ) : (boundedMasks ambient h).card = ∑ j ∈ Finset.range (h + 1), ambient.card.choose j := by rw [boundedMasks_eq_biUnion] rw [Finset.card_biUnion (ambient.pairwise_disjoint_powersetCard.set_pairwise _)] simp only [Finset.card_powersetCard] /-- A bound valid also for an empty ambient or a zero cap. -/ theorem boundedMasks_card_le (ambient : Finset G) (h : ℕ) : (boundedMasks ambient h).card ≤ (h + 1) * (max 1 ambient.card) ^ h := by rw [boundedMasks_card_eq_sum_choose] calc (∑ j ∈ Finset.range (h + 1), ambient.card.choose j) ≤ ∑ _j ∈ Finset.range (h + 1), (max 1 ambient.card) ^ h := by apply Finset.sum_le_sum intro j hj have hjh : j ≤ h := Nat.le_of_lt_succ (Finset.mem_range.mp hj) exact (Nat.choose_le_pow ambient.card j).trans ((pow_le_pow_left' (le_max_right 1 ambient.card) j).trans (pow_le_pow_right' (le_max_left 1 ambient.card) hjh)) _ = (h + 1) * (max 1 ambient.card) ^ h := by simp theorem cap_succ_le_two_pow (h : ℕ) : h + 1 ≤ 2 ^ h := by induction h with | zero => simp | succ h ih => calc h + 1 + 1 ≤ (h + 1) + (h + 1) := Nat.add_le_add_left (Nat.succ_le_succ (Nat.zero_le h)) (h + 1) _ ≤ 2 ^ h + 2 ^ h := Nat.add_le_add ih ih _ = 2 ^ (h + 1) := by simp [pow_succ, Nat.mul_two] theorem boundedMasks_card_le_power (ambient : Finset G) (h : ℕ) : (boundedMasks ambient h).card ≤ (2 * max 1 ambient.card) ^ h := by calc (boundedMasks ambient h).card ≤ (h + 1) * (max 1 ambient.card) ^ h := boundedMasks_card_le ambient h _ ≤ 2 ^ h * (max 1 ambient.card) ^ h := Nat.mul_le_mul_right _ (cap_succ_le_two_pow h) _ = (2 * max 1 ambient.card) ^ h := (mul_pow _ _ _).symm /-- The ordered encoded data are exactly `(D,E₀,P,S)`, represented as a nested tuple. -/ def descriptorFamily (ambient : Finset G) (dCap eCap pCap sCap : ℕ) : Finset (Finset G × Finset G × Finset G × Finset G) := (boundedMasks ambient dCap).product ((boundedMasks ambient eCap).product ((boundedMasks ambient pCap).product (boundedMasks ambient sCap))) theorem mem_descriptorFamily (ambient D E₀ P S : Finset G) (dCap eCap pCap sCap : ℕ) : (D, E₀, P, S) ∈ descriptorFamily ambient dCap eCap pCap sCap ↔ (D ⊆ ambient ∧ D.card ≤ dCap) ∧ (E₀ ⊆ ambient ∧ E₀.card ≤ eCap) ∧ (P ⊆ ambient ∧ P.card ≤ pCap) ∧ (S ⊆ ambient ∧ S.card ≤ sCap) := by simp [descriptorFamily, mem_boundedMasks] theorem descriptorFamily_card (ambient : Finset G) (dCap eCap pCap sCap : ℕ) : (descriptorFamily ambient dCap eCap pCap sCap).card = (boundedMasks ambient dCap).card * ((boundedMasks ambient eCap).card * ((boundedMasks ambient pCap).card * (boundedMasks ambient sCap).card)) := by simp [descriptorFamily] theorem descriptorFamily_nonempty (ambient : Finset G) (dCap eCap pCap sCap : ℕ) : (descriptorFamily ambient dCap eCap pCap sCap).Nonempty := by refine ⟨(∅, ∅, ∅, ∅), ?_⟩ simp [descriptorFamily, boundedMasks] /-- The product of the four sharp elementary subset bounds. -/ theorem descriptorFamily_card_le_product (ambient : Finset G) (dCap eCap pCap sCap : ℕ) : (descriptorFamily ambient dCap eCap pCap sCap).card ≤ ((dCap + 1) * (max 1 ambient.card) ^ dCap) * (((eCap + 1) * (max 1 ambient.card) ^ eCap) * (((pCap + 1) * (max 1 ambient.card) ^ pCap) * ((sCap + 1) * (max 1 ambient.card) ^ sCap))) := by rw [descriptorFamily_card] exact Nat.mul_le_mul (boundedMasks_card_le ambient dCap) (Nat.mul_le_mul (boundedMasks_card_le ambient eCap) (Nat.mul_le_mul (boundedMasks_card_le ambient pCap) (boundedMasks_card_le ambient sCap))) theorem descriptorFamily_card_le_power (ambient : Finset G) (dCap eCap pCap sCap : ℕ) : (descriptorFamily ambient dCap eCap pCap sCap).card ≤ (2 * max 1 ambient.card) ^ (dCap + eCap + pCap + sCap) := by rw [descriptorFamily_card] calc (boundedMasks ambient dCap).card * ((boundedMasks ambient eCap).card * ((boundedMasks ambient pCap).card * (boundedMasks ambient sCap).card)) ≤ (2 * max 1 ambient.card) ^ dCap * ((2 * max 1 ambient.card) ^ eCap * ((2 * max 1 ambient.card) ^ pCap * (2 * max 1 ambient.card) ^ sCap)) := Nat.mul_le_mul (boundedMasks_card_le_power ambient dCap) (Nat.mul_le_mul (boundedMasks_card_le_power ambient eCap) (Nat.mul_le_mul (boundedMasks_card_le_power ambient pCap) (boundedMasks_card_le_power ambient sCap))) _ = (2 * max 1 ambient.card) ^ (dCap + eCap + pCap + sCap) := by simp only [pow_add, mul_assoc] /-- The literal caps in both protected-descriptor arguments. -/ def protectedDescriptorFamily (ambient : Finset G) (H s : ℕ) : Finset (Finset G × Finset G × Finset G × Finset G) := descriptorFamily ambient H (30 * H) (30 * H + 5 * s) s /-- The source extraction's actual protection bound implies the encoded caps. -/ theorem mem_protectedDescriptorFamily_of_bounds (ambient D E₀ P S : Finset G) (H s : ℕ) (hDU : D ⊆ ambient) (hE₀U : E₀ ⊆ ambient) (hPU : P ⊆ ambient) (hSU : S ⊆ ambient) (hD : D.card ≤ H) (hE₀ : E₀.card ≤ 30 * H) (hP : P.card ≤ E₀.card + 5 * S.card) (hS : S.card ≤ s) : (D, E₀, P, S) ∈ protectedDescriptorFamily ambient H s := by apply (mem_descriptorFamily ambient D E₀ P S H (30 * H) (30 * H + 5 * s) s).mpr exact ⟨⟨hDU, hD⟩, ⟨hE₀U, hE₀⟩, ⟨hPU, hP.trans (Nat.add_le_add hE₀ (Nat.mul_le_mul_left 5 hS))⟩, ⟨hSU, hS⟩⟩ theorem protectedDescriptorFamily_card_le (ambient : Finset G) (H s : ℕ) : (protectedDescriptorFamily ambient H s).card ≤ (2 * max 1 ambient.card) ^ (61 * H + 6 * s) := by have hexponent : H + 30 * H + (30 * H + 5 * s) + s = 61 * H + 6 * s := by ring simpa only [protectedDescriptorFamily, hexponent] using descriptorFamily_card_le_power ambient H (30 * H) (30 * H + 5 * s) s /-- A pure ambient-size power, valid for every ambient with at least two points. -/ theorem protectedDescriptorFamily_card_le_ambient_power (ambient : Finset G) (H s : ℕ) (hn : 2 ≤ ambient.card) : (protectedDescriptorFamily ambient H s).card ≤ ambient.card ^ (122 * H + 12 * s) := by have hn1 : 1 ≤ ambient.card := (by decide : 1 ≤ 2).trans hn have hbase : 2 * ambient.card ≤ ambient.card ^ 2 := by simpa only [pow_two] using Nat.mul_le_mul_right ambient.card hn calc (protectedDescriptorFamily ambient H s).card ≤ (2 * max 1 ambient.card) ^ (61 * H + 6 * s) := protectedDescriptorFamily_card_le ambient H s _ = (2 * ambient.card) ^ (61 * H + 6 * s) := by rw [max_eq_right hn1] _ ≤ (ambient.card ^ 2) ^ (61 * H + 6 * s) := pow_le_pow_left' hbase _ _ = ambient.card ^ (2 * (61 * H + 6 * s)) := (pow_mul _ _ _).symm _ = ambient.card ^ (122 * H + 12 * s) := by congr 1 <;> ring theorem log_protectedDescriptorFamily_card_le (ambient : Finset G) (H s : ℕ) (hn : 2 ≤ ambient.card) : Real.log ((protectedDescriptorFamily ambient H s).card : ℝ) ≤ (122 * (H : ℝ) + 12 * (s : ℝ)) * Real.log (ambient.card : ℝ) := by have hpos : (0 : ℝ) < ((protectedDescriptorFamily ambient H s).card : ℝ) := Nat.cast_pos.mpr (descriptorFamily_nonempty ambient H (30 * H) (30 * H + 5 * s) s).card_pos have hbound : ((protectedDescriptorFamily ambient H s).card : ℝ) ≤ (ambient.card : ℝ) ^ (122 * H + 12 * s) := by simpa only [Nat.cast_pow] using (Nat.cast_le.mpr (protectedDescriptorFamily_card_le_ambient_power ambient H s hn) : ((protectedDescriptorFamily ambient H s).card : ℝ) ≤ ((ambient.card ^ (122 * H + 12 * s) : ℕ) : ℝ)) calc Real.log ((protectedDescriptorFamily ambient H s).card : ℝ) ≤ Real.log ((ambient.card : ℝ) ^ (122 * H + 12 * s)) := Real.log_le_log hpos hbound _ = (122 * (H : ℝ) + 12 * (s : ℝ)) * Real.log (ambient.card : ℝ) := by simp [Real.log_pow] /-- The requested finite form of the `O((H+s) log n)` entropy estimate. -/ theorem log_protectedDescriptorFamily_card_le_coarse (ambient : Finset G) (H s : ℕ) (hn : 2 ≤ ambient.card) : Real.log ((protectedDescriptorFamily ambient H s).card : ℝ) ≤ 122 * ((H : ℝ) + (s : ℝ)) * Real.log (ambient.card : ℝ) := by have hcoeff : 122 * (H : ℝ) + 12 * (s : ℝ) ≤ 122 * ((H : ℝ) + (s : ℝ)) := by have hs : (0 : ℝ) ≤ (s : ℝ) := Nat.cast_nonneg _ linarith exact (log_protectedDescriptorFamily_card_le ambient H s hn).trans (mul_le_mul_of_nonneg_right hcoeff (Real.log_natCast_nonneg _)) /-- Consistency and eligibility predicates only shrink the encoded family. -/ theorem subfamily_card_le (ambient : Finset G) (H s : ℕ) (family : Finset (Finset G × Finset G × Finset G × Finset G)) (hfamily : family ⊆ protectedDescriptorFamily ambient H s) : family.card ≤ (2 * max 1 ambient.card) ^ (61 * H + 6 * s) := (Finset.card_le_card hfamily).trans (protectedDescriptorFamily_card_le ambient H s) /-- Appending the single fixed canonical mask preserves the concrete count. -/ theorem selected_descriptor_masks_card_le (ambient : Finset G) (H s : ℕ) (masks : Finset (Finset G)) (passes : (Finset G × Finset G × Finset G × Finset G) → Finset G → Prop) : (selectedPairs (protectedDescriptorFamily ambient H s) masks passes).card ≤ (2 * max 1 ambient.card) ^ (61 * H + 6 * s) := (selectedPairs_card_le _ _ _).trans (protectedDescriptorFamily_card_le ambient H s) /-- Any later descriptor wrapper is admissible if its four-set encoding is injective. No unspecified extra witness field is charged zero entropy by this theorem. -/ theorem encoded_family_card_le {ι : Type v} [DecidableEq ι] (ambient : Finset G) (H s : ℕ) (family : Finset ι) (encode : ι → Finset G × Finset G × Finset G × Finset G) (hinjective : Set.InjOn encode family) (hmem : ∀ i ∈ family, encode i ∈ protectedDescriptorFamily ambient H s) : family.card ≤ (2 * max 1 ambient.card) ^ (61 * H + 6 * s) := by have hsub : family.image encode ⊆ protectedDescriptorFamily ambient H s := by intro d hd obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hd exact hmem i hi calc family.card = (family.image encode).card := (Finset.card_image_of_injOn hinjective).symm _ ≤ (2 * max 1 ambient.card) ^ (61 * H + 6 * s) := subfamily_card_le ambient H s (family.image encode) hsub end DescriptorCounting end Green39Submission end Green39AssemblyScope_90effd92d23597c3 /- Source: Green39Submission.RichStarExtraction; SHA256 ccce1cacf542f4e6b347543d26024f542e304a6e57cf0d24954b1e300255ff12 -/ section Green39AssemblyScope_27affd8476aa29c2 /-! Actual rich-star source extraction and descriptor integration. The finite core stays in RichStar. Every remaining source or asymptotic premise is displayed explicitly until it is discharged by its corresponding theorem. -/ namespace Green39Submission.RichStar open scoped BigOperators Pointwise Classical open SourceProbability RootedDerivativeBounds section RootedAdapters variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- Source bits left random when the input `u` is required to be free. -/ def eligibleSources (T D : Finset G) (u : G) : Finset G := T \ RichStarGeometry.ordinarySources T D u theorem mem_eligibleSources {T D : Finset G} {u q : G} : q ∈ eligibleSources T D u ↔ q ∈ T ∧ q - u ∉ D := by simp only [eligibleSources, Finset.mem_sdiff, RichStarGeometry.ordinarySources, Finset.mem_filter] tauto theorem eligibleSources_subset (T D : Finset G) (u : G) : eligibleSources T D u ⊆ T := Finset.sdiff_subset theorem source_subset_eligible_of_avoid {T D S : Finset G} {u : G} (hST : S ⊆ T) (havoid : Disjoint (RichStarGeometry.ordinarySources T D u) S) : S ⊆ eligibleSources T D u := by intro q hqS exact Finset.mem_sdiff.mpr ⟨hST hqS, fun hqV => Finset.disjoint_left.mp havoid hqV hqS⟩ /-- Chosen target rows written with distinguished source `t=x-u` as label. -/ def rootRows (X : Finset G) (W : G → Finset G) (u t : G) : Finset G := if u + t ∈ X then W (u + t) else ∅ theorem mem_rootRows {X : Finset G} {W : G → Finset G} {u t q : G} : q ∈ rootRows X W u t ↔ u + t ∈ X ∧ q ∈ W (u + t) := by by_cases h : u + t ∈ X <;> simp [rootRows, h] theorem rootRows_card_le {X : Finset G} {W : G → Finset G} {M : ℕ} (hM : ∀ x ∈ X, (W x).card = M) (u t : G) : (rootRows X W u t).card ≤ M := by by_cases h : u + t ∈ X · simp [rootRows, h, hM (u + t) h] · simp [rootRows, h] theorem rootRows_geometry {A X : Finset G} {W : G → Finset G} (hA : ∀ x ∈ X, ∀ q ∈ W x, x - q ∈ A) (u t : G) : ∀ q ∈ rootRows X W u t, u + t - q ∈ A := by intro q hq obtain ⟨hx, hqW⟩ := mem_rootRows.mp hq exact hA (u + t) hx q hqW /-- Outside the ordinary-center set, one prescribed permitted source has the literal whole-parent overlap cap. -/ theorem eligible_root_overlap_cap {A T D : Finset G} {Q : ℕ} (hQ : ∀ v : G, v ∉ D → (T.filter (fun t => t - v ∈ A)).card ≤ Q) (u : G) : ∀ q ∈ eligibleSources T D u, ((eligibleSources T D u).filter (fun t => u + t - q ∈ A)).card ≤ Q := by intro q hq have hq' := mem_eligibleSources.mp hq calc _ ≤ (T.filter (fun t => t - (q - u) ∈ A)).card := by apply Finset.card_le_card intro t ht obtain ⟨htE, htA⟩ := Finset.mem_filter.mp ht refine Finset.mem_filter.mpr ⟨eligibleSources_subset T D u htE, ?_⟩ have heq : t - (q - u) = u + t - q := by abel rwa [heq] _ ≤ _ := hQ (q - u) hq'.2 theorem rootedDerivativeBound_nonneg (nRoots Q J M d j : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : 0 ≤ rootedDerivativeBound nRoots Q J M d θ j := by exact mul_nonneg (inv_nonneg.mpr (pow_nonneg hθ _)) (Nat.cast_nonneg _) theorem rootedDerivativeBound_eq_zero_of_lt (nRoots Q J M d j : ℕ) (θ : ℝ) (hj : d < j) : rootedDerivativeBound nRoots Q J M d θ j = 0 := by simp [rootedDerivativeBound, rootedExtensionBound, show j ≠ 0 by omega, show ¬ j ≤ d by omega] theorem rootedDerivativeBound_mono_roots {n₁ n₂ : ℕ} (hn : n₁ ≤ n₂) (Q J M d j : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : rootedDerivativeBound n₁ Q J M d θ j ≤ rootedDerivativeBound n₂ Q J M d θ j := by have hc : rootedExtensionBound n₁ Q J M d j ≤ rootedExtensionBound n₂ Q J M d j := by by_cases hj : j = 0 · simp only [rootedExtensionBound, if_pos hj] exact Nat.mul_le_mul_right _ hn · simp only [rootedExtensionBound, if_neg hj, le_refl] apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (pow_nonneg hθ _)) exact_mod_cast hc /-- ST20 for the actual eligible-source universe and chosen target rows. -/ theorem eligible_root_derivative_bound {A T D X : Finset G} {W : G → Finset G} {M d Q J nRoots : ℕ} (hT : T.card ≤ nRoots) (hM : ∀ x ∈ X, (W x).card = M) (hA : ∀ x ∈ X, ∀ q ∈ W x, x - q ∈ A) (hQ : ∀ v : G, v ∉ D → (T.filter (fun t => t - v ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (u : G) (B : Finset G) {θ : ℝ} (hθ : 0 < θ) : RawMoments.sourceDerivative (rootedStars (eligibleSources T D u) (rootRows X W u) d) (fun i => i.2) (fun _ => (θ ^ d)⁻¹) θ B ≤ rootedDerivativeBound nRoots Q J M d θ B.card := by have hc : (eligibleSources T D u).card ≤ nRoots := (Finset.card_le_card (eligibleSources_subset T D u)).trans hT exact (RootedDerivativeBounds.sourceDerivative_subfamily_le_profile (Finset.Subset.refl _) (fun t _ht => rootRows_card_le hM u t) (fun t _ht => rootRows_geometry hA u t) (eligible_root_overlap_cap hQ u) hJ B hθ).trans (rootedDerivativeBound_mono_roots hc Q J M d B.card hθ.le) theorem starInfluence_const_eq_card {ι : Type*} [DecidableEq ι] (I : Finset ι) (support : ι → Finset G) (w : ℝ) (u : G) : starInfluence I support (fun _ => w) u = ((I.filter (fun i => u ∈ support i)).card : ℝ) * w := by unfold starInfluence rw [← Finset.sum_filter] simp [nsmul_eq_mul] theorem containmentSum_const_eq_card {ι : Type*} [DecidableEq ι] (I : Finset ι) (support : ι → Finset G) (w : ℝ) (S : Finset G) : containmentSum I support (fun _ => w) S = ((I.filter (fun i => support i ⊆ S)).card : ℝ) * w := by classical unfold containmentSum calc _ = ∑ _i ∈ I.filter (fun i => support i ⊆ S), w := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _hi by_cases h : support i ⊆ S <;> simp [h] _ = _ := by simp [nsmul_eq_mul] /-- Every genuinely free selected star incident to `u` injects into the permitted rooted source family, preserving its complete source support. -/ theorem selected_influence_le_rooted {T D X S : Finset G} {W : G → Finset G} {d : ℕ} {u : G} {θ : ℝ} (hSE : S ⊆ eligibleSources T D u) (hθ : 0 ≤ θ) : starInfluence (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) u ≤ containmentSum (rootedStars (eligibleSources T D u) (rootRows X W u) d) (fun i => i.2) (fun _ => (θ ^ d)⁻¹) S := by classical rw [starInfluence_const_eq_card, containmentSum_const_eq_card] have hc : ((selectedFreeStars T D X W d S).filter (fun i => u ∈ inputSupport i.1 i.2)).card ≤ ((rootedStars (eligibleSources T D u) (rootRows X W u) d).filter (fun i => i.2 ⊆ S)).card := by apply Finset.card_le_card_of_injOn (fun i : G × Finset G => (i.1 - u, i.2)) · intro i hi obtain ⟨hiF, hiu⟩ := Finset.mem_filter.mp hi have hi' := mem_selectedFreeStars.mp hiF have hrow := mem_chosenStars.mp (mem_validChosenStars.mp hi'.1).1 have hroot : i.1 - u ∈ i.2 := mem_inputSupport_iff_rooted.mp hiu have htarget : u + (i.1 - u) = i.1 := by abel apply Finset.mem_filter.mpr refine ⟨mem_rootedStars.mpr ⟨hSE (hi'.2.1 hroot), ?_, hrow.2.2, hroot⟩, hi'.2.1⟩ intro q hq apply Finset.mem_inter.mpr refine ⟨mem_rootRows.mpr ?_, hSE (hi'.2.1 hq)⟩ simpa only [htarget] using And.intro hrow.1 (hrow.2.1 hq) · intro i _hi j _hj hij change (i.1 - u, i.2) = (j.1 - u, j.2) at hij exact Prod.ext (sub_left_inj.mp (Prod.mk.inj hij).1) (Prod.mk.inj hij).2 apply mul_le_mul_of_nonneg_right _ (inv_nonneg.mpr (pow_nonneg hθ _)) exact_mod_cast hc end RootedAdapters section ConditionalInfluence variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- Conditioning the source sample to avoid a fixed set leaves the remaining source bits independent; its prefactor can only reduce an event probability. -/ theorem source_joint_avoid_event_le {T V : Finset G} (hVT : V ⊆ T) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (event : Finset G → Prop) : bernoulliMean T θ (fun S => if Disjoint V S ∧ event S then 1 else 0) ≤ bernoulliMean (T \ V) θ (fun S => if event S then 1 else 0) := by have heq : bernoulliMean T θ (fun S => if Disjoint V S ∧ event S then 1 else 0) = (1 - θ) ^ V.card * bernoulliMean (T \ V) θ (fun S => if event S then 1 else 0) := by calc _ = bernoulliMean T θ (fun S => if Disjoint V S then (if event S then 1 else 0) else 0) := by apply bernoulliMean_congr intro S _hS by_cases hv : Disjoint V S <;> by_cases he : event S <;> simp [hv, he] _ = _ := bernoulliMean_avoid hVT θ _ have hfactor : (1 - θ) ^ V.card ≤ 1 := by have h := pow_le_pow_left₀ (by linarith : 0 ≤ 1 - θ) (by linarith : 1 - θ ≤ 1) V.card simpa using h have hmean0 : 0 ≤ bernoulliMean (T \ V) θ (fun S => if event S then 1 else 0) := by apply bernoulliMean_nonneg _ hθ hθ1 intro S _hS split_ifs <;> norm_num rw [heq] simpa only [one_mul] using mul_le_mul_of_nonneg_right hfactor hmean0 /-- The finite ST21 joint tail for an actual free input, with the complete rooted derivative profile proved from the parent ordinary/codegree bounds. -/ theorem free_input_influence_tail {A E0 T D X : Finset G} {W : G → Finset G} {M d Q J nRoots z : ℕ} {θ t : ℝ} (hT : T.card ≤ nRoots) (hM : ∀ x ∈ X, (W x).card = M) (hA : ∀ x ∈ X, ∀ q ∈ W x, x - q ∈ A) (hQ : ∀ v : G, v ∉ D → (T.filter (fun s => s - v ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (ht : 0 < t) (hz : 1 ≤ z) {u : G} (hu : u ∈ A \ E0) : bernoulliMean T θ (fun S => if u ∉ protectedInputs A E0 S D ∧ t < starInfluence (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) u then 1 else 0) ≤ ((∑ j ∈ Finset.range (d + 1), ((d * z).choose j : ℝ) * rootedDerivativeBound nRoots Q J M d θ j) / t) ^ z := by let V := RichStarGeometry.ordinarySources T D u let E := eligibleSources T D u let I := rootedStars E (rootRows X W u) d let Z := containmentSum I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) have hVT : V ⊆ T := Finset.filter_subset _ _ have hpoint : ∀ S, S ⊆ T → (if u ∉ protectedInputs A E0 S D ∧ t < starInfluence (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) u then (1 : ℝ) else 0) ≤ (if Disjoint V S ∧ t < Z S then 1 else 0) := by intro S hST by_cases hbad : u ∉ protectedInputs A E0 S D ∧ t < starInfluence (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) u · have havoid : Disjoint V S := (free_input_iff_ordinary_absent hST (Finset.mem_sdiff.mp hu).1 (Finset.mem_sdiff.mp hu).2).mp hbad.1 have hSE := source_subset_eligible_of_avoid hST havoid have hdom := selected_influence_le_rooted (d := d) (W := W) (X := X) hSE hθ.le have hhigh : t < Z S := hbad.2.trans_le hdom simp only [if_pos hbad, if_pos (And.intro havoid hhigh), le_refl] · rw [if_neg hbad] split_ifs <;> norm_num calc _ ≤ bernoulliMean T θ (fun S => if Disjoint V S ∧ t < Z S then 1 else 0) := bernoulliMean_mono T hθ.le hθ1 hpoint _ ≤ bernoulliMean E θ (fun S => if t < Z S then 1 else 0) := source_joint_avoid_event_le hVT hθ.le hθ1 (fun S => t < Z S) _ ≤ _ := by apply source_raw_moment_tail E I (fun i => i.2) (fun _ => (θ ^ d)⁻¹) hθ.le hθ1 ht (fun _i hi => rooted_support_subset hi) (fun _i _hi => inv_nonneg.mpr (pow_nonneg hθ.le d)) d z hz (fun _i hi => le_of_eq (mem_rootedStars.mp hi).2.2.1) · intro j exact rootedDerivativeBound_nonneg _ _ _ _ _ _ hθ.le · intro j hj exact rootedDerivativeBound_eq_zero_of_lt _ _ _ _ _ _ _ hj · intro B exact eligible_root_derivative_bound hT hM hA hQ hJ u B hθ end ConditionalInfluence section SourceSeed variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- A simultaneous source sample from explicit score, size and free-input influence failure probabilities. This is a finite union argument. -/ theorem exists_source_seed (T U : Finset G) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (score : Finset G → ℝ) (influence : G → Finset G → ℝ) (free : G → Finset G → Prop) [∀ u S, Decidable (free u S)] (a sizeCap K : ℝ) (hfail : bernoulliMean T θ (fun S => if score S < a then 1 else 0) + bernoulliMean T θ (fun S => if sizeCap < (S.card : ℝ) then 1 else 0) + (∑ u ∈ U, bernoulliMean T θ (fun S => if free u S ∧ K < influence u S then 1 else 0)) < 1) : ∃ S ⊆ T, a ≤ score S ∧ (S.card : ℝ) ≤ sizeCap ∧ ∀ u ∈ U, free u S → influence u S ≤ K := by by_contra hnone have hpoint : ∀ S, S ⊆ T → (1 : ℝ) ≤ (if score S < a then 1 else 0) + (if sizeCap < (S.card : ℝ) then 1 else 0) + ∑ u ∈ U, if free u S ∧ K < influence u S then 1 else 0 := by intro S hST have hsum : (0 : ℝ) ≤ ∑ u ∈ U, if free u S ∧ K < influence u S then 1 else 0 := by apply Finset.sum_nonneg intro u _hu split_ifs <;> norm_num have hsize0 : (0 : ℝ) ≤ if sizeCap < (S.card : ℝ) then 1 else 0 := by split_ifs <;> norm_num by_cases hy : score S < a · rw [if_pos hy] linarith · by_cases hs : sizeCap < (S.card : ℝ) · rw [if_neg hy, if_pos hs] linarith · have hbad : ∃ u ∈ U, free u S ∧ K < influence u S := by by_contra h apply hnone refine ⟨S, hST, by linarith, by linarith, ?_⟩ intro u hu hfree by_contra hhigh exact h ⟨u, hu, hfree, by linarith⟩ obtain ⟨u, hu, hbad⟩ := hbad have hentry : (1 : ℝ) ≤ ∑ v ∈ U, if free v S ∧ K < influence v S then 1 else 0 := by have hn (v : G) (_hv : v ∈ U) : (0 : ℝ) ≤ if free v S ∧ K < influence v S then 1 else 0 := by split_ifs <;> norm_num simpa only [if_pos hbad] using Finset.single_le_sum hn hu simpa only [if_neg hy, if_neg hs, zero_add] using hentry have hm := bernoulliMean_mono T hθ hθ1 hpoint rw [bernoulliMean_one, bernoulliMean_add, bernoulliMean_add, bernoulliMean_sum] at hm linarith /-- The coarse source-size failure bound also covers an empty parent set. -/ theorem source_size_tail_le_half_uniform (T : Finset G) {nRoots : ℕ} (hT : T.card ≤ nRoots) {θ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) : bernoulliMean T θ (fun S => if 2 * (nRoots : ℝ) * θ < (S.card : ℝ) then 1 else 0) ≤ 1 / 2 := by by_cases hT0 : T = ∅ · have hn : 0 ≤ 2 * (nRoots : ℝ) * θ := by positivity simp [hT0, bernoulliMean, bernoulliWeight, not_lt.mpr hn] · have hmass : 0 < (T.card : ℝ) * θ := by apply mul_pos _ hθ exact_mod_cast (Finset.card_pos.mpr (Finset.nonempty_iff_ne_empty.mpr hT0)) have hcap : 2 * (T.card : ℝ) * θ ≤ 2 * (nRoots : ℝ) * θ := by have hc : (T.card : ℝ) ≤ nRoots := by exact_mod_cast hT nlinarith calc _ ≤ bernoulliMean T θ (fun S => if 2 * (T.card : ℝ) * θ < (S.card : ℝ) then 1 else 0) := by apply bernoulliMean_mono T hθ.le hθ1 intro S _hS by_cases h : 2 * (nRoots : ℝ) * θ < (S.card : ℝ) · have h' : 2 * (T.card : ℝ) * θ < (S.card : ℝ) := hcap.trans_lt h simp [h, h'] · simp only [if_neg h] split_ifs <;> norm_num _ ≤ _ := source_size_tail_le_half T hθ.le hθ1 hmass theorem valid_free_star_lower_tail [Fintype G] {A T D X : Finset G} {W : G → Finset G} {d M J : ℕ} {R θ a : ℝ} (hM : ∀ x ∈ X, (W x).card = M) (hWT : ∀ x ∈ X, W x ⊆ T) (hWA : ∀ x ∈ X, ∀ q ∈ W x, x - q ∈ A) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hR : ∀ x ∈ X, ∀ q ∈ W x, ((RichStarGeometry.ordinarySources T D (x - q)).card : ℝ) ≤ R) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hgap : a / 2 < ((validChosenStars T D X W d).card : ℝ)) : let I := validChosenStars T D X W d let μ := chosenStarDerivativeBound A.card J M d I.card θ bernoulliMean T θ (fun S => if selectedAbsentSum I (fun i => i.2) (fun i => forbiddenSources T D i.1 i.2) d θ S < a / 2 then 1 else 0) ≤ ((∑ j ∈ Finset.range (d + 1), ((d * 2).choose j : ℝ) * μ j) ^ 2 - (I.card : ℝ) ^ 2 + 2 * (I.card : ℝ) ^ 2 * ((d : ℝ) * R) * θ) / ((I.card : ℝ) - a / 2) ^ 2 := by dsimp only have htail := source_lower_tail_gap T hθ.le hθ1 hgap.le (selectedAbsentSum (validChosenStars T D X W d) (fun i => i.2) (fun i => forbiddenSources T D i.1 i.2) d θ) have hvar := validChosenStars_centered_square_le (d := d) hM hWT hWA hJ hR hθ hθ1 have hcombined := htail.trans hvar apply (le_div_iff₀ (pow_pos (sub_pos.mpr hgap) 2)).mpr simpa only [mul_comm] using hcombined end SourceSeed section FixedPriorMean /-- The exact binomial mean constant after source normalization. -/ theorem normalized_choose_density_le (m d : ℕ) {θ ρ C : ℝ} (hθ : 0 < θ) (hρ : 0 ≤ ρ) (hcap : (m : ℝ) * ρ ≤ C * θ) : (m.choose d : ℝ) * (θ ^ d)⁻¹ * ρ ^ d ≤ C ^ d / (d.factorial : ℝ) := by have hc : (m.choose d : ℝ) ≤ (m : ℝ) ^ d / (d.factorial : ℝ) := Nat.choose_le_pow_div d m have hratio : (m : ℝ) * ρ / θ ≤ C := (div_le_iff₀ hθ).mpr hcap calc _ ≤ ((m : ℝ) ^ d / (d.factorial : ℝ)) * (θ ^ d)⁻¹ * ρ ^ d := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hc (inv_nonneg.mpr (pow_nonneg hθ.le d))) (pow_nonneg hρ d) _ = (((m : ℝ) * ρ / θ) ^ d) / (d.factorial : ℝ) := by rw [div_pow, mul_pow] ring _ ≤ _ := div_le_div_of_nonneg_right (pow_le_pow_left₀ (div_nonneg (mul_nonneg (Nat.cast_nonneg _) hρ) hθ.le) hratio d) (Nat.cast_nonneg _) theorem source_density_cap_400 {s : ℕ} {k θ ρ : ℝ} (hk : 0 < k) (hρ : 0 ≤ ρ) (hs : (s : ℝ) ≤ 200 * k * θ) (hρcap : ρ ≤ 2 / k) : (s : ℝ) * ρ ≤ 400 * θ := by calc _ ≤ (200 * k * θ) * (2 / k) := mul_le_mul hs hρcap hρ ((Nat.cast_nonneg _).trans hs) _ = _ := by field_simp [hk.ne']; ring variable {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] theorem normalized_star_mean_budget_le (U S : Finset G) (n d : ℕ) {θ C : ℝ} (hθ : 0 < θ) (hcap : (S.card : ℝ) * ((n : ℝ) / (U.card : ℝ)) ≤ C * θ) : (Fintype.card G : ℝ) * (S.card.choose d : ℝ) * (θ ^ d)⁻¹ * ((n : ℝ) / (U.card : ℝ)) ^ d ≤ (Fintype.card G : ℝ) * C ^ d / (d.factorial : ℝ) := by have hρ : 0 ≤ (n : ℝ) / (U.card : ℝ) := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) have h := mul_le_mul_of_nonneg_left (normalized_choose_density_le S.card d hθ hρ hcap) (Nat.cast_nonneg (Fintype.card G) : (0 : ℝ) ≤ Fintype.card G) simpa only [mul_assoc, mul_div_assoc] using h /-- The fixed-prior mean in ST26, with the normalized source-density cap as its sole descriptor-specific numerical premise. -/ theorem mean_freeUniverseStars_le_constant (U S : Finset G) (n d : ℕ) (hn : n ≤ U.card) {θ C : ℝ} (hθ : 0 < θ) (hcap : (S.card : ℝ) * ((n : ℝ) / (U.card : ℝ)) ≤ C * θ) : uniformMean (exactSlice U n) (containmentSum (freeUniverseStars U S d) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹)) ≤ (Fintype.card G : ℝ) * C ^ d / (d.factorial : ℝ) := by exact (mean_freeUniverseStars_le U S n d hn (θ ^ d)⁻¹ (inv_nonneg.mpr (pow_nonneg hθ.le d))).trans (normalized_star_mean_budget_le U S n d hθ hcap) /-- The actual observable tail with the absolute fixed-degree mean constant. -/ theorem observable_star_deletion_tail_constant (U S : Finset G) (n d b : ℕ) (hn : n ≤ U.card) {θ C q : ℝ} (hθ : 0 < θ) (hq : 0 < q) (hcap : (S.card : ℝ) * ((n : ℝ) / (U.card : ℝ)) ≤ C * θ) : uniformProb (exactSlice U n) (fun B => ∀ E ⊆ B, E.card ≤ b → q < (θ ^ d)⁻¹ * ∑ x : G, ((representationCount (B \ E) S x).choose d : ℝ)) ≤ (((Fintype.card G : ℝ) * C ^ d / (d.factorial : ℝ)) / q) ^ (b / d) := by have hw : 0 ≤ (θ ^ d)⁻¹ := inv_nonneg.mpr (pow_nonneg hθ.le d) have hρ : 0 ≤ (n : ℝ) / (U.card : ℝ) := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) have hmean0 : 0 ≤ (Fintype.card G : ℝ) * (S.card.choose d : ℝ) * (θ ^ d)⁻¹ * ((n : ℝ) / (U.card : ℝ)) ^ d := by positivity apply (observable_star_deletion_tail U S n d b hn (θ ^ d)⁻¹ q hw hq).trans exact pow_le_pow_left₀ (div_nonneg hmean0 hq.le) (div_le_div_of_nonneg_right (normalized_star_mean_budget_le U S n d hθ hcap) hq.le) _ end FixedPriorMean section ObservableSeed variable {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] noncomputable def richSourceScore (T D X : Finset G) (W : G → Finset G) (d : ℕ) (θ : ℝ) (S : Finset G) : ℝ := selectedAbsentSum (validChosenStars T D X W d) (fun i => i.2) (fun i => forbiddenSources T D i.1 i.2) d θ S noncomputable def richSourceInfluence (T D X : Finset G) (W : G → Finset G) (d : ℕ) (θ : ℝ) (u : G) (S : Finset G) : ℝ := starInfluence (selectedFreeStars T D X W d S) (fun i => inputSupport i.1 i.2) (fun _ => (θ ^ d)⁻¹) u /-- The actual common seed produces an observable certificate. Its source failure budget is still explicit here; subsequent numerical lemmas supply it. -/ theorem exists_seed_for_observable {A E0 T D X : Finset G} {W : G → Finset G} {d b : ℕ} {θ a sizeCap K : ℝ} (hinput : ∀ x ∈ X, ∀ q ∈ W x, x - q ∈ A \ E0) (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 < a) (hK : 0 ≤ K) (hbudget : (b : ℝ) * K ≤ a / 8) (hfail : bernoulliMean T θ (fun S => if richSourceScore T D X W d θ S < a / 2 then 1 else 0) + bernoulliMean T θ (fun S => if sizeCap < (S.card : ℝ) then 1 else 0) + (∑ u ∈ A \ E0, bernoulliMean T θ (fun S => if u ∉ protectedInputs A E0 S D ∧ K < richSourceInfluence T D X W d θ u S then 1 else 0)) < 1) : ∃ S ⊆ T, (S.card : ℝ) ≤ sizeCap ∧ ∀ E ⊆ A \ protectedInputs A E0 S D, E.card ≤ b → a / 4 < (θ ^ d)⁻¹ * ∑ x : G, ((representationCount ((A \ protectedInputs A E0 S D) \ E) S x).choose d : ℝ) := by obtain ⟨S, hST, hscore, hsize, hinfluence⟩ := exists_source_seed T (A \ E0) hθ hθ1 (richSourceScore T D X W d θ) (richSourceInfluence T D X W d θ) (fun u S => u ∉ protectedInputs A E0 S D) (a / 2) sizeCap K (by simpa only using hfail) refine ⟨S, hST, hsize, ?_⟩ apply selectedFreeStars_retains_observable hST hinput hθ ha hscore · intro u hu have huA := (Finset.mem_sdiff.mp hu).1 have huP := (Finset.mem_sdiff.mp hu).2 have huE0 : u ∉ E0 := by intro h exact huP (Finset.mem_union.mpr (Or.inl h)) exact hinfluence u (Finset.mem_sdiff.mpr ⟨huA, huE0⟩) huP · exact hbudget · exact hK theorem exists_seed_for_observable_of_tail_bounds {A E0 T D X : Finset G} {W : G → Finset G} {d b nRoots : ℕ} {θ a K eScore eInfluence : ℝ} (hinput : ∀ x ∈ X, ∀ q ∈ W x, x - q ∈ A \ E0) (hT : T.card ≤ nRoots) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (ha : 0 < a) (hK : 0 ≤ K) (hbudget : (b : ℝ) * K ≤ a / 8) (hscore : bernoulliMean T θ (fun S => if richSourceScore T D X W d θ S < a / 2 then 1 else 0) ≤ eScore) (hinfluence : ∀ u ∈ A \ E0, bernoulliMean T θ (fun S => if u ∉ protectedInputs A E0 S D ∧ K < richSourceInfluence T D X W d θ u S then 1 else 0) ≤ eInfluence) (hsmall : eScore + 1 / 2 + ((A \ E0).card : ℝ) * eInfluence < 1) : ∃ S ⊆ T, (S.card : ℝ) ≤ 2 * (nRoots : ℝ) * θ ∧ ∀ E ⊆ A \ protectedInputs A E0 S D, E.card ≤ b → a / 4 < (θ ^ d)⁻¹ * ∑ x : G, ((representationCount ((A \ protectedInputs A E0 S D) \ E) S x).choose d : ℝ) := by apply exists_seed_for_observable hinput hθ.le hθ1 ha hK hbudget have hsize := source_size_tail_le_half_uniform T hT hθ hθ1 have hsum := Finset.sum_le_sum hinfluence have hsum' : (∑ u ∈ A \ E0, bernoulliMean T θ (fun S => if u ∉ protectedInputs A E0 S D ∧ K < richSourceInfluence T D X W d θ u S then 1 else 0)) ≤ ((A \ E0).card : ℝ) * eInfluence := by simpa [nsmul_eq_mul] using hsum linarith end ObservableSeed end Green39Submission.RichStar end Green39AssemblyScope_27affd8476aa29c2 /- Source: Green39Submission.MixedEnergy; SHA256 942dfb5256777edf1c4794e6cef6ebbf6a06de3c510b4180e6336ffb351d4945 -/ section Green39AssemblyScope_2f83c98d0d60457e /-! The whole-parent ordinary-overlap energy bound used by ST5 and PS7. These are deterministic finite identities. In particular the translating set may depend on the entire sampled input, and no law for a cleaned input is used. -/ namespace Green39Submission.MixedEnergy open scoped BigOperators Pointwise Classical open CodegreeMultiplicity universe u v /-- Double counting two incidences in the same row, retaining the diagonal. -/ theorem sum_row_card_sq {α : Type u} {β : Type v} [Fintype α] (T : Finset β) (inc : α → β → Prop) : (∑ a : α, ((T.filter (inc a)).card) ^ 2) = ∑ t ∈ T, ∑ q ∈ T, (Finset.univ.filter (fun a : α => inc a t ∧ inc a q)).card := by classical calc (∑ a : α, ((T.filter (inc a)).card) ^ 2) = ∑ a : α, ∑ t ∈ T, ∑ q ∈ T, if inc a t ∧ inc a q then (1 : ℕ) else 0 := by apply Finset.sum_congr rfl intro a ha rw [pow_two] simp only [Finset.card_eq_sum_ones, Finset.sum_filter, Finset.sum_mul, Finset.mul_sum] apply Finset.sum_congr rfl intro t ht apply Finset.sum_congr rfl intro q hq by_cases ht' : inc a t <;> by_cases hq' : inc a q <;> simp [ht', hq'] _ = ∑ t ∈ T, ∑ q ∈ T, ∑ a : α, if inc a t ∧ inc a q then (1 : ℕ) else 0 := by rw [Finset.sum_comm] apply Finset.sum_congr rfl intro t ht exact Finset.sum_comm _ = _ := by simp only [Finset.card_eq_sum_ones, Finset.sum_filter] section Group variable {G : Type u} [AddCommGroup G] [DecidableEq G] /-- The manuscript's ordinary overlap `|T ∩ (A+d)|`. -/ def ordinaryOverlap (A T : Finset G) (d : G) : ℕ := (T.filter (fun t => t - d ∈ A)).card theorem ordinaryOverlap_mono {A A' T T' : Finset G} (hA : A ⊆ A') (hT : T ⊆ T') (d : G) : ordinaryOverlap A T d ≤ ordinaryOverlap A' T' d := by apply Finset.card_le_card intro t ht rcases Finset.mem_filter.mp ht with ⟨htT, htd⟩ exact Finset.mem_filter.mpr ⟨hT htT, hA htd⟩ variable [Fintype G] theorem card_centers_for_source (A : Finset G) (t : G) : (Finset.univ.filter (fun d : G => t - d ∈ A)).card = A.card := by classical have hset : Finset.univ.filter (fun d : G => t - d ∈ A) = A.image (fun a => t - a) := by ext d simp only [Finset.mem_filter, Finset.mem_univ, true_and, Finset.mem_image] constructor · intro hd exact ⟨t - d, hd, by abel⟩ · rintro ⟨a, ha, rfl⟩ simpa only [sub_sub_cancel] using ha rw [hset] exact Finset.card_image_of_injective _ (fun a b h => sub_right_inj.mp h) theorem common_centers_card_le_codegree {A : Finset G} {J : ℕ} (hA : NonzeroCodegreeBound A J) {t q : G} (htq : t ≠ q) : (Finset.univ.filter (fun d : G => t - d ∈ A ∧ q - d ∈ A)).card ≤ J := by classical let sources := Finset.univ.filter (fun d : G => t - d ∈ A ∧ q - d ∈ A) let images := A.filter (fun a => a + (q - t) ∈ A) have hcard : sources.card ≤ images.card := by apply Finset.card_le_card_of_injOn (fun d : G => t - d) · intro d hd have hd' := (Finset.mem_filter.mp hd).2 apply Finset.mem_filter.mpr refine ⟨hd'.1, ?_⟩ have heq : (t - d) + (q - t) = q - d := by abel rw [heq] exact hd'.2 · intro d hd e he hde exact sub_right_inj.mp hde exact hcard.trans (hA (q - t) (sub_ne_zero.mpr htq.symm)) /-- Exact incidence expansion; repeated targets and the pair diagonal are kept. -/ theorem ordinaryOverlap_energy_eq (A T : Finset G) : (∑ d : G, ordinaryOverlap A T d ^ 2) = ∑ t ∈ T, ∑ q ∈ T, (Finset.univ.filter (fun d : G => t - d ∈ A ∧ q - d ∈ A)).card := by classical convert (sum_row_card_sq (α := G) (β := G) T (fun (d t : G) => t - d ∈ A)) using 1 · apply Finset.sum_congr rfl intro d hd unfold ordinaryOverlap apply congrArg (fun U : Finset G => U.card ^ 2) ext t simp · apply Finset.sum_congr rfl intro t ht apply Finset.sum_congr rfl intro q hq apply congrArg Finset.card ext d simp /-- Mixed energy controlled only by the input's nonzero difference codegrees. -/ theorem ordinaryOverlap_energy_le {A : Finset G} (T : Finset G) {J : ℕ} (hA : NonzeroCodegreeBound A J) : (∑ d : G, ordinaryOverlap A T d ^ 2) ≤ A.card * T.card + J * T.card ^ 2 := by classical rw [ordinaryOverlap_energy_eq] calc (∑ t ∈ T, ∑ q ∈ T, (Finset.univ.filter (fun d : G => t - d ∈ A ∧ q - d ∈ A)).card) ≤ ∑ _t ∈ T, (A.card + J * T.card) := by apply Finset.sum_le_sum intro t ht calc (∑ q ∈ T, (Finset.univ.filter (fun d : G => t - d ∈ A ∧ q - d ∈ A)).card) ≤ ∑ q ∈ T, ((if q = t then A.card else 0) + J) := by apply Finset.sum_le_sum intro q hq by_cases hqt : q = t · subst q simp [card_centers_for_source] · simpa only [if_neg hqt, zero_add] using common_centers_card_le_codegree hA (Ne.symm hqt) _ = A.card + J * T.card := by simp [Finset.sum_add_distrib, ht, Nat.mul_comm] _ = A.card * T.card + J * T.card ^ 2 := by simp only [Finset.sum_const, smul_eq_mul] ring /-- High ordinary centers of the whole parent, before any thinning or peeling. -/ noncomputable def highCenters (A T : Finset G) (R : ℝ) : Finset G := by classical exact Finset.univ.filter (fun d => R < (ordinaryOverlap A T d : ℝ)) theorem mem_highCenters {A T : Finset G} {R : ℝ} {d : G} : d ∈ highCenters A T R ↔ R < (ordinaryOverlap A T d : ℝ) := by classical simp [highCenters] theorem ordinaryOverlap_le_of_not_mem_highCenters {A T : Finset G} {R : ℝ} {d : G} (hd : d ∉ highCenters A T R) : (ordinaryOverlap A T d : ℝ) ≤ R := by simpa only [mem_highCenters, not_lt] using hd theorem highCenters_card_mul_sq_le {A : Finset G} (T : Finset G) {J : ℕ} (hA : NonzeroCodegreeBound A J) {R : ℝ} (hR : 0 ≤ R) : ((highCenters A T R).card : ℝ) * R ^ 2 ≤ (A.card : ℝ) * (T.card : ℝ) + (J : ℝ) * (T.card : ℝ) ^ 2 := by classical calc ((highCenters A T R).card : ℝ) * R ^ 2 = ∑ _d ∈ highCenters A T R, R ^ 2 := by simp _ ≤ ∑ d ∈ highCenters A T R, (ordinaryOverlap A T d : ℝ) ^ 2 := by apply Finset.sum_le_sum intro d hd exact pow_le_pow_left₀ hR (le_of_lt (mem_highCenters.mp hd)) 2 _ ≤ ∑ d : G, (ordinaryOverlap A T d : ℝ) ^ 2 := by apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _) intro d hd hnot positivity _ ≤ (A.card : ℝ) * (T.card : ℝ) + (J : ℝ) * (T.card : ℝ) ^ 2 := by exact_mod_cast ordinaryOverlap_energy_le T hA theorem highCenters_card_le {A : Finset G} (T : Finset G) {J : ℕ} (hA : NonzeroCodegreeBound A J) {R : ℝ} (hR : 0 < R) : ((highCenters A T R).card : ℝ) ≤ ((A.card : ℝ) * (T.card : ℝ) + (J : ℝ) * (T.card : ℝ) ^ 2) / R ^ 2 := by exact (le_div_iff₀ (sq_pos_of_pos hR)).2 (highCenters_card_mul_sq_le T hA hR.le) end Group end Green39Submission.MixedEnergy end Green39AssemblyScope_2f83c98d0d60457e /- Source: Green39Submission.Parameters; SHA256 9aa4a00a0e17f4fb9667e412370b9867511fa182178a612945558e5e0965d26b -/ section Green39AssemblyScope_7608aaf4dbc441ac /-! Fixed constants and exact arithmetic from the frozen Green 39 manuscript. No probability estimate or source theorem is assumed in this module. -/ namespace Green39Submission.Parameters noncomputable section def L : ℕ := 10001 def ell : ℕ := 16 * L * (L + 1) def alpha : ℝ := 1 / ((2 : ℝ) ^ 20 * (L : ℝ) ^ 4) def delta : ℝ := 8 * (L : ℝ) * ((L : ℝ) + 1) * alpha def epsilon1 : ℝ := 2 * delta def epsilon0 : ℝ := 6 * ((L : ℝ) + 1) * alpha def eta1 : ℝ := 1 / (8 * (ell : ℝ)) def eta0 : ℝ := 1 / (4 * (L : ℝ)) def richBudgetPower : ℝ := 1 - delta + alpha def positiveRatePower : ℝ := 1 - alpha * (2 * (L : ℝ) + 1) def sparseBudgetPower : ℝ := 1 - alpha * (2 * (L : ℝ) + 2) def sparseRatePower : ℝ := 1 - alpha * (3 * (L : ℝ) + 3) def theta1 (k : ℕ) : ℝ := (k : ℝ) ^ (-epsilon1) def theta0 (k : ℕ) : ℝ := (k : ℝ) ^ (-epsilon0) def N (k : ℕ) : ℕ := ⌊(k : ℝ) ^ (2 - delta)⌋₊ def nStar (k : ℕ) : ℕ := N k / 2 def R (k : ℕ) : ℝ := (k : ℝ) ^ delta def H (k : ℕ) : ℕ := ⌊(k : ℝ) ^ (5 / 8 : ℝ)⌋₊ def J (p : ℕ) : ℕ := ⌈10000 * Real.log (p : ℝ) / Real.log (Real.log (p : ℝ))⌉₊ def codegreePackingOrder (p : ℕ) : ℕ := (J p - 1) / 6 def M1 (k : ℕ) : ℕ := ⌊(k : ℝ) ^ alpha / 2⌋₊ def M0 (k : ℕ) : ℕ := ⌈2 * (k : ℝ) ^ alpha⌉₊ def richBudget (k : ℕ) : ℕ := ⌊(nStar k : ℝ) * (M1 k : ℝ) / (1600 * (ell : ℝ) * (k : ℝ))⌋₊ def sparseBudget (k : ℕ) : ℕ := ⌊(k : ℝ) / (M0 k : ℝ) ^ (2 * L + 2)⌋₊ def richRate (k : ℕ) : ℝ := (k : ℝ) ^ richBudgetPower * Real.log (k : ℝ) def sparseRate (k : ℕ) : ℝ := (k : ℝ) / (M0 k : ℝ) ^ (3 * L + 3) theorem L_eq : L = 10001 := rfl theorem ell_eq : ell = 1600480032 := by norm_num [ell, L] theorem L_pos : 0 < L := by norm_num [L] theorem ell_pos : 0 < ell := by norm_num [ell, L] theorem L_odd : Odd L := by refine ⟨5000, ?_⟩ norm_num [L] theorem scalar_degree_margin : (100 : ℕ) * 100 < L := by norm_num [L] theorem alpha_pos : 0 < alpha := by norm_num [alpha, L] theorem alpha_lt_one : alpha < 1 := by norm_num [alpha, L] theorem delta_pos : 0 < delta := by norm_num [delta, alpha, L] theorem alpha_lt_delta : alpha < delta := by norm_num [delta, alpha, L] theorem delta_lt_two : delta < 2 := by norm_num [delta, alpha, L] theorem epsilon1_pos : 0 < epsilon1 := by norm_num [epsilon1, delta, alpha, L] theorem epsilon0_pos : 0 < epsilon0 := by norm_num [epsilon0, alpha, L] theorem epsilon1_lt_one : epsilon1 < 1 := by norm_num [epsilon1, delta, alpha, L] theorem epsilon0_lt_one : epsilon0 < 1 := by norm_num [epsilon0, alpha, L] theorem epsilon0_lt_epsilon1 : epsilon0 < epsilon1 := by norm_num [epsilon0, epsilon1, delta, alpha, L] theorem eta1_pos : 0 < eta1 := by norm_num [eta1, ell, L] theorem eta0_pos : 0 < eta0 := by norm_num [eta0, L] theorem ell_mul_alpha : (ell : ℝ) * alpha = 2 * delta := by norm_num [ell, delta, alpha, L] theorem ell_mul_epsilon1_lt : (ell : ℝ) * epsilon1 < 1 / 1024 := by norm_num [ell, epsilon1, delta, alpha, L] theorem ell_mul_eta1 : (ell : ℝ) * eta1 = 1 / 8 := by norm_num [eta1, ell, L] theorem rich_forbidden_power : delta - epsilon1 = -delta := by unfold epsilon1 ring theorem rich_mean_ratio_power : 2 - (2 - delta + (ell : ℝ) * alpha) = -delta := by rw [ell_mul_alpha] ring theorem rich_budget_pos : 0 < richBudgetPower := by norm_num [richBudgetPower, delta, alpha, L] theorem rich_budget_lt_one : richBudgetPower < 1 := by norm_num [richBudgetPower, delta, alpha, L] theorem rich_budget_gt_source : 1 - epsilon1 < richBudgetPower := by norm_num [richBudgetPower, epsilon1, delta, alpha, L] theorem rich_budget_gt_H : (5 / 8 : ℝ) < richBudgetPower := by norm_num [richBudgetPower, delta, alpha, L] theorem rich_cleanup_power_neg : -3 / 8 + delta - alpha < (0 : ℝ) := by norm_num [delta, alpha, L] theorem rich_bad_target_power_neg : -3 / 8 + delta < (0 : ℝ) := by norm_num [delta, alpha, L] theorem rich_variance_one_neg : -1 + epsilon1 + delta - alpha < (0 : ℝ) := by norm_num [epsilon1, delta, alpha, L] theorem rich_variance_endpoint_neg : -2 + delta + (ell : ℝ) * (epsilon1 - alpha) < 0 := by norm_num [epsilon1, ell, delta, alpha, L] theorem rich_variance_slope_pos : 0 < epsilon1 - alpha := by norm_num [epsilon1, delta, alpha, L] theorem rich_moment_one_neg : eta1 + epsilon1 - 1 < 0 := by norm_num [eta1, ell, epsilon1, delta, alpha, L] theorem rich_moment_partner_neg : eta1 + epsilon1 - 1 / 4 - alpha < 0 := by norm_num [eta1, ell, epsilon1, delta, alpha, L] theorem rich_moment_endpoint_neg : -1 + (ell : ℝ) * (eta1 + epsilon1) < 0 := by norm_num [eta1, ell, epsilon1, delta, alpha, L] private theorem affine_neg_of_le {a b c d : ℝ} (hab : a ≤ b) (hc : 0 ≤ c) (hd : d + b * c < 0) : d + a * c < 0 := by have hm : a * c ≤ b * c := mul_le_mul_of_nonneg_right hab hc linarith theorem rich_variance_exponent_neg {j : ℕ} (hj : j ≤ ell) : -2 + delta + (j : ℝ) * (epsilon1 - alpha) < 0 := by apply affine_neg_of_le (b := (ell : ℝ)) (by exact_mod_cast hj) (le_of_lt rich_variance_slope_pos) exact rich_variance_endpoint_neg theorem rich_moment_exponent_neg {j : ℕ} (hj : j ≤ ell) : -1 + (j : ℝ) * (eta1 + epsilon1) < 0 := by apply affine_neg_of_le (b := (ell : ℝ)) (by exact_mod_cast hj) (le_of_lt (add_pos eta1_pos epsilon1_pos)) exact rich_moment_endpoint_neg theorem sparse_variance_neg : -1 + epsilon0 * (2 * (L : ℝ) - 1) < 0 := by norm_num [epsilon0, alpha, L] theorem sparse_entropy_gap : epsilon0 - alpha * (3 * (L : ℝ) + 3) = 3 * ((L : ℝ) + 1) * alpha := by unfold epsilon0 ring theorem sparse_entropy_gap_pos : 0 < epsilon0 - alpha * (3 * (L : ℝ) + 3) := by norm_num [epsilon0, alpha, L] theorem sparse_external_gap : epsilon0 - alpha * ((L : ℝ) - 1) = (5 * (L : ℝ) + 7) * alpha := by unfold epsilon0 ring theorem sparse_external_gap_pos : 0 < epsilon0 - alpha * ((L : ℝ) - 1) := by norm_num [epsilon0, alpha, L] theorem allowance_gap : delta - epsilon0 * (L : ℝ) = 2 * (L : ℝ) * ((L : ℝ) + 1) * alpha := by unfold delta epsilon0 ring theorem allowance_gap_pos : 0 < delta - epsilon0 * (L : ℝ) := by norm_num [delta, epsilon0, alpha, L] theorem sparse_E0_cost_neg : -3 / 8 + epsilon0 * ((L : ℝ) - 1) < 0 := by norm_num [epsilon0, alpha, L] theorem sparse_wedge_cost_neg : -3 / 8 + epsilon0 * (L : ℝ) < 0 := by norm_num [epsilon0, alpha, L] theorem sparse_loop_cost_neg : -1 + epsilon0 * (L : ℝ) < 0 := by norm_num [epsilon0, alpha, L] theorem sparse_moment_one_neg : eta0 + epsilon0 - 1 < 0 := by norm_num [eta0, epsilon0, alpha, L] theorem sparse_moment_partner_neg : eta0 + epsilon0 - 1 / 4 - alpha < 0 := by norm_num [eta0, epsilon0, alpha, L] theorem sparse_moment_endpoint_neg : -1 + (L : ℝ) * (eta0 + epsilon0) < 0 := by norm_num [eta0, epsilon0, alpha, L] theorem sparse_moment_strong_cap : (L : ℝ) * (eta0 + epsilon0) < 3 / 8 := by norm_num [eta0, epsilon0, alpha, L] theorem sparse_moment_exponent_neg {j : ℕ} (hj : j ≤ L) : -1 + (j : ℝ) * (eta0 + epsilon0) < 0 := by apply affine_neg_of_le (b := (L : ℝ)) (by exact_mod_cast hj) (le_of_lt (add_pos eta0_pos epsilon0_pos)) exact sparse_moment_endpoint_neg theorem FG_collision_neg : -1 + 2 * (L : ℝ) * epsilon0 < 0 := by norm_num [epsilon0, alpha, L] theorem EX_error_neg : -epsilon0 + alpha * ((L : ℝ) - 1) < 0 := by norm_num [epsilon0, alpha, L] theorem epsilon0_lt_three_eighths : epsilon0 < 3 / 8 := by norm_num [epsilon0, alpha, L] theorem epsilon1_lt_three_eighths : epsilon1 < 3 / 8 := by norm_num [epsilon1, delta, alpha, L] theorem positive_rate_pos : 0 < positiveRatePower := by norm_num [positiveRatePower, alpha, L] theorem sparse_budget_pos : 0 < sparseBudgetPower := by norm_num [sparseBudgetPower, alpha, L] theorem sparse_budget_lt_one : sparseBudgetPower < 1 := by norm_num [sparseBudgetPower, alpha, L] theorem sparse_rate_pos : 0 < sparseRatePower := by norm_num [sparseRatePower, alpha, L] theorem sparse_rate_lt_positive_rate : sparseRatePower < positiveRatePower := by norm_num [sparseRatePower, positiveRatePower, alpha, L] theorem sparse_rate_gt_source : 1 - epsilon0 < sparseRatePower := by norm_num [sparseRatePower, epsilon0, alpha, L] theorem sparse_rate_gt_H : (5 / 8 : ℝ) < sparseRatePower := by norm_num [sparseRatePower, alpha, L] theorem deletion_entropy_power_neg : sparseBudgetPower - positiveRatePower < 0 := by norm_num [sparseBudgetPower, positiveRatePower, alpha, L] theorem positive_drift_neg : -alpha * ((L : ℝ) + 1) < 0 := by norm_num [alpha, L] theorem full_score_retention_neg : -alpha * ((L : ℝ) + 3) < 0 := by norm_num [alpha, L] theorem weighted_allowance_neg : -delta + (L : ℝ) * epsilon0 < 0 := by norm_num [delta, epsilon0, alpha, L] theorem four_mul_codegreePackingOrder_le (p : ℕ) : 4 * codegreePackingOrder p ≤ J p := by unfold codegreePackingOrder omega end end Green39Submission.Parameters end Green39AssemblyScope_7608aaf4dbc441ac /- Source: Green39Submission.Asymptotics; SHA256 6f20bbf8d59caa32e52927c7a733a7fc61edf1dd33ce87d856c5ab6c0db63814 -/ section Green39AssemblyScope_c522d8e94c263925 /-! Unconditional analytic limits for the fixed Green 39 parameters. Probability bounds must be proved in the other modules; no such bound is assumed here. -/ namespace Green39Submission.Asymptotics open Filter Topology open Parameters noncomputable section theorem nat_rpow_tendsto_atTop {a : ℝ} (ha : 0 < a) : Tendsto (fun k : ℕ => (k : ℝ) ^ a) atTop atTop := (_root_.tendsto_rpow_atTop ha).comp tendsto_natCast_atTop_atTop theorem nat_rpow_tendsto_zero {a : ℝ} (ha : a < 0) : Tendsto (fun k : ℕ => (k : ℝ) ^ a) atTop (𝓝 0) := by simpa only [neg_neg, Function.comp_def] using (_root_.tendsto_rpow_neg_atTop (neg_pos.mpr ha)).comp (tendsto_natCast_atTop_atTop (R := ℝ)) theorem nat_floor_tendsto_atTop : Tendsto (fun x : ℝ => ⌊x⌋₊) atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [eventually_ge_atTop (b : ℝ)] with x hx exact Nat.le_floor hx theorem nat_ceil_tendsto_atTop : Tendsto (fun x : ℝ => ⌈x⌉₊) atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [eventually_ge_atTop (b : ℝ)] with x hx have hb : (b : ℝ) ≤ (⌈x⌉₊ : ℝ) := hx.trans (Nat.le_ceil x) exact_mod_cast hb theorem nat_sqrt_tendsto_atTop : Tendsto Nat.sqrt atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [eventually_ge_atTop (b * b)] with p hp exact Nat.le_sqrt.mpr hp theorem prime_val_tendsto_atTop : Tendsto (fun p : {p : ℕ // p.Prime} => p.val) atTop atTop := by apply tendsto_atTop.2 intro b obtain ⟨p, hbp, hp⟩ := Nat.exists_infinite_primes b filter_upwards [eventually_ge_atTop (⟨p, hp⟩ : {p : ℕ // p.Prime})] with q hq exact hbp.trans hq theorem prime_sqrt_tendsto_atTop : Tendsto (fun p : {p : ℕ // p.Prime} => Nat.sqrt p.val) atTop atTop := nat_sqrt_tendsto_atTop.comp prime_val_tendsto_atTop theorem log_div_rpow_tendsto_zero {a : ℝ} (ha : 0 < a) : Tendsto (fun k : ℕ => Real.log (k : ℝ) / (k : ℝ) ^ a) atTop (𝓝 0) := (isLittleO_log_rpow_atTop ha).tendsto_div_nhds_zero.comp tendsto_natCast_atTop_atTop theorem log_pow_div_rpow_tendsto_zero (m : ℕ) {a : ℝ} (ha : 0 < a) : Tendsto (fun k : ℕ => Real.log (k : ℝ) ^ m / (k : ℝ) ^ a) atTop (𝓝 0) := by simpa only [Real.rpow_natCast, Function.comp_def] using (isLittleO_log_rpow_rpow_atTop (m : ℝ) ha).tendsto_div_nhds_zero.comp (tendsto_natCast_atTop_atTop (R := ℝ)) theorem rpow_neg_mul_log_tendsto_zero {a : ℝ} (ha : 0 < a) : Tendsto (fun k : ℕ => (k : ℝ) ^ (-a) * Real.log (k : ℝ)) atTop (𝓝 0) := by apply (log_div_rpow_tendsto_zero ha).congr intro k rw [Real.rpow_neg (Nat.cast_nonneg k)] ring theorem rpow_mul_log_tendsto_zero {a : ℝ} (ha : a < 0) : Tendsto (fun k : ℕ => (k : ℝ) ^ a * Real.log (k : ℝ)) atTop (𝓝 0) := by simpa only [neg_neg] using rpow_neg_mul_log_tendsto_zero (neg_pos.mpr ha) theorem theta1_tendsto_zero : Tendsto theta1 atTop (𝓝 0) := by exact nat_rpow_tendsto_zero (neg_lt_zero.mpr epsilon1_pos) theorem theta0_tendsto_zero : Tendsto theta0 atTop (𝓝 0) := by exact nat_rpow_tendsto_zero (neg_lt_zero.mpr epsilon0_pos) theorem k_mul_rpow_neg_tendsto_atTop {ε : ℝ} (hε : ε < 1) : Tendsto (fun k : ℕ => (k : ℝ) * (k : ℝ) ^ (-ε)) atTop atTop := by apply (nat_rpow_tendsto_atTop (sub_pos.mpr hε)).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) rw [Real.rpow_sub hk0, Real.rpow_one, Real.rpow_neg hk0.le] ring theorem k_mul_theta0_tendsto_atTop : Tendsto (fun k : ℕ => (k : ℝ) * theta0 k) atTop atTop := k_mul_rpow_neg_tendsto_atTop epsilon0_lt_one theorem k_mul_theta1_tendsto_atTop : Tendsto (fun k : ℕ => (k : ℝ) * theta1 k) atTop atTop := k_mul_rpow_neg_tendsto_atTop epsilon1_lt_one theorem calibrationError_tendsto_zero {ε : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) : Tendsto (fun k : ℕ => (k : ℝ) ^ (-ε) + 1 / ((k : ℝ) * (k : ℝ) ^ (-ε))) atTop (𝓝 0) := by have hi : Tendsto (fun k : ℕ => 1 / ((k : ℝ) * (k : ℝ) ^ (-ε))) atTop (𝓝 0) := by apply (k_mul_rpow_neg_tendsto_atTop hε1).inv_tendsto_atTop.congr intro k simp only [Pi.inv_apply, one_div] simpa only [add_zero] using (nat_rpow_tendsto_zero (neg_lt_zero.mpr hε0)).add hi theorem calibrationError0_tendsto_zero : Tendsto (fun k : ℕ => theta0 k + 1 / ((k : ℝ) * theta0 k)) atTop (𝓝 0) := calibrationError_tendsto_zero epsilon0_pos epsilon0_lt_one theorem calibrationError1_tendsto_zero : Tendsto (fun k : ℕ => theta1 k + 1 / ((k : ℝ) * theta1 k)) atTop (𝓝 0) := calibrationError_tendsto_zero epsilon1_pos epsilon1_lt_one theorem H_tendsto_atTop : Tendsto H atTop atTop := nat_floor_tendsto_atTop.comp (nat_rpow_tendsto_atTop (by norm_num : (0 : ℝ) < 5 / 8)) theorem H_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (H k : ℝ)) (fun k : ℕ => (k : ℝ) ^ (5 / 8 : ℝ)) := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto (nat_rpow_tendsto_atTop (by norm_num : (0 : ℝ) < 5 / 8)) theorem N_tendsto_atTop : Tendsto N atTop atTop := nat_floor_tendsto_atTop.comp (nat_rpow_tendsto_atTop (sub_pos.mpr delta_lt_two)) theorem nStar_tendsto_atTop : Tendsto nStar atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [N_tendsto_atTop.eventually_ge_atTop (2 * b)] with k hk dsimp [nStar] omega theorem M1_tendsto_atTop : Tendsto M1 atTop atTop := nat_floor_tendsto_atTop.comp ((nat_rpow_tendsto_atTop alpha_pos).atTop_div_const (by norm_num : (0 : ℝ) < 2)) theorem M0_tendsto_atTop : Tendsto M0 atTop atTop := nat_ceil_tendsto_atTop.comp ((nat_rpow_tendsto_atTop alpha_pos).const_mul_atTop (by norm_num : (0 : ℝ) < 2)) theorem eventually_ell_le_M1 : ∀ᶠ k in atTop, ell ≤ M1 k := M1_tendsto_atTop.eventually_ge_atTop ell theorem N_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (N k : ℝ)) (fun k : ℕ => (k : ℝ) ^ (2 - delta)) := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto (nat_rpow_tendsto_atTop (sub_pos.mpr delta_lt_two)) theorem nStar_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (nStar k : ℝ)) (fun k : ℕ => (k : ℝ) ^ (2 - delta) / 2) := by have he := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto ((nat_rpow_tendsto_atTop (sub_pos.mpr delta_lt_two)).atTop_div_const (by norm_num : (0 : ℝ) < 2)) simpa only [Function.comp_def, Nat.floor_div_ofNat, nStar, N] using he theorem M1_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (M1 k : ℝ)) (fun k : ℕ => (k : ℝ) ^ alpha / 2) := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto ((nat_rpow_tendsto_atTop alpha_pos).atTop_div_const (by norm_num : (0 : ℝ) < 2)) theorem M0_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (M0 k : ℝ)) (fun k : ℕ => 2 * (k : ℝ) ^ alpha) := _root_.Asymptotics.isEquivalent_nat_ceil.comp_tendsto ((nat_rpow_tendsto_atTop alpha_pos).const_mul_atTop (by norm_num : (0 : ℝ) < 2)) theorem rpow_ratio_tendsto_zero {a b : ℝ} (hab : a < b) : Tendsto (fun k : ℕ => (k : ℝ) ^ a / (k : ℝ) ^ b) atTop (𝓝 0) := by apply (nat_rpow_tendsto_zero (sub_neg.mpr hab)).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk exact Real.rpow_sub (by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk)) a b theorem rpow_log_ratio_tendsto_zero {a b : ℝ} (hab : a < b) : Tendsto (fun k : ℕ => (k : ℝ) ^ a * Real.log (k : ℝ) / (k : ℝ) ^ b) atTop (𝓝 0) := by apply (rpow_mul_log_tendsto_zero (sub_neg.mpr hab)).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk rw [Real.rpow_sub (by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk))] ring theorem richBudget_raw_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (nStar k : ℝ) * (M1 k : ℝ) / (1600 * (ell : ℝ) * (k : ℝ))) (fun k : ℕ => (k : ℝ) ^ richBudgetPower / (6400 * (ell : ℝ))) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (nStar k : ℝ) * (M1 k : ℝ) / (1600 * (ell : ℝ) * (k : ℝ))) (fun k : ℕ => ((k : ℝ) ^ (2 - delta) / 2) * ((k : ℝ) ^ alpha / 2) / (1600 * (ell : ℝ) * (k : ℝ))) := (nStar_equivalent.mul M1_equivalent).div _root_.Asymptotics.IsEquivalent.refl apply he.congr_right filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hell : (0 : ℝ) < ell := by exact_mod_cast ell_pos have hpow : (k : ℝ) ^ (2 - delta) * (k : ℝ) ^ alpha / (k : ℝ) = (k : ℝ) ^ richBudgetPower := by calc _ = (k : ℝ) ^ ((2 - delta) + alpha) / (k : ℝ) ^ (1 : ℝ) := by rw [← Real.rpow_add hk0, Real.rpow_one] _ = (k : ℝ) ^ (((2 - delta) + alpha) - 1) := (Real.rpow_sub hk0 _ _).symm _ = (k : ℝ) ^ richBudgetPower := by congr 1; unfold richBudgetPower; ring calc _ = ((k : ℝ) ^ (2 - delta) * (k : ℝ) ^ alpha / (k : ℝ)) / (6400 * (ell : ℝ)) := by field_simp [hk0.ne', hell.ne']; ring _ = _ := by rw [hpow] theorem richBudget_raw_tendsto_atTop : Tendsto (fun k : ℕ => (nStar k : ℝ) * (M1 k : ℝ) / (1600 * (ell : ℝ) * (k : ℝ))) atTop atTop := by apply richBudget_raw_equivalent.symm.tendsto_atTop exact (nat_rpow_tendsto_atTop rich_budget_pos).atTop_div_const (mul_pos (by norm_num) (by exact_mod_cast ell_pos)) theorem richBudget_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (richBudget k : ℝ)) (fun k : ℕ => (k : ℝ) ^ richBudgetPower / (6400 * (ell : ℝ))) := by have hf : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (richBudget k : ℝ)) (fun k : ℕ => (nStar k : ℝ) * (M1 k : ℝ) / (1600 * (ell : ℝ) * (k : ℝ))) := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto richBudget_raw_tendsto_atTop exact hf.trans richBudget_raw_equivalent theorem richBudget_tendsto_atTop : Tendsto richBudget atTop atTop := nat_floor_tendsto_atTop.comp richBudget_raw_tendsto_atTop theorem M0_quotient_equivalent (d : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) / (M0 k : ℝ) ^ d) (fun k : ℕ => (k : ℝ) ^ (1 - alpha * (d : ℝ)) / (2 : ℝ) ^ d) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) / (M0 k : ℝ) ^ d) (fun k : ℕ => (k : ℝ) / (2 * (k : ℝ) ^ alpha) ^ d) := _root_.Asymptotics.IsEquivalent.refl.div (M0_equivalent.pow d) apply he.congr_right filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) rw [mul_pow, ← Real.rpow_mul_natCast hk0.le, Real.rpow_sub hk0, Real.rpow_one] simp only [div_div, mul_comm] theorem sparseBudget_raw_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) / (M0 k : ℝ) ^ (2 * L + 2)) (fun k : ℕ => (k : ℝ) ^ sparseBudgetPower / (2 : ℝ) ^ (2 * L + 2)) := by simpa only [sparseBudgetPower, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] using M0_quotient_equivalent (2 * L + 2) theorem sparseBudget_raw_tendsto_atTop : Tendsto (fun k : ℕ => (k : ℝ) / (M0 k : ℝ) ^ (2 * L + 2)) atTop atTop := by apply sparseBudget_raw_equivalent.symm.tendsto_atTop exact (nat_rpow_tendsto_atTop sparse_budget_pos).atTop_div_const (pow_pos (by norm_num : (0 : ℝ) < 2) _) theorem sparseBudget_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (sparseBudget k : ℝ)) (fun k : ℕ => (k : ℝ) ^ sparseBudgetPower / (2 : ℝ) ^ (2 * L + 2)) := by have hf : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (sparseBudget k : ℝ)) (fun k : ℕ => (k : ℝ) / (M0 k : ℝ) ^ (2 * L + 2)) := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto sparseBudget_raw_tendsto_atTop exact hf.trans sparseBudget_raw_equivalent theorem sparseBudget_tendsto_atTop : Tendsto sparseBudget atTop atTop := nat_floor_tendsto_atTop.comp sparseBudget_raw_tendsto_atTop theorem richBudget_div_k_tendsto_zero : Tendsto (fun k : ℕ => (richBudget k : ℝ) / (k : ℝ)) atTop (𝓝 0) := by have he := richBudget_equivalent.div (show _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ)) (fun k : ℕ => (k : ℝ)) from _root_.Asymptotics.IsEquivalent.refl) apply he.symm.tendsto_nhds change Tendsto (fun k : ℕ => ((k : ℝ) ^ richBudgetPower / (6400 * (ell : ℝ))) / (k : ℝ)) atTop (𝓝 0) simpa only [Real.rpow_one, div_div, mul_comm, zero_div] using (rpow_ratio_tendsto_zero rich_budget_lt_one).div_const (6400 * (ell : ℝ)) theorem sparseBudget_div_k_tendsto_zero : Tendsto (fun k : ℕ => (sparseBudget k : ℝ) / (k : ℝ)) atTop (𝓝 0) := by have he := sparseBudget_equivalent.div (show _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ)) (fun k : ℕ => (k : ℝ)) from _root_.Asymptotics.IsEquivalent.refl) apply he.symm.tendsto_nhds change Tendsto (fun k : ℕ => ((k : ℝ) ^ sparseBudgetPower / (2 : ℝ) ^ (2 * L + 2)) / (k : ℝ)) atTop (𝓝 0) simpa only [Real.rpow_one, div_div, mul_comm, zero_div] using (rpow_ratio_tendsto_zero sparse_budget_lt_one).div_const ((2 : ℝ) ^ (2 * L + 2)) theorem choose_M1_equivalent (r : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((M1 k).choose r : ℝ)) (fun k : ℕ => (M1 k : ℝ) ^ r / (r.factorial : ℝ)) := (isEquivalent_choose r).comp_tendsto M1_tendsto_atTop theorem rich_star_choose_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((M1 k).choose ell : ℝ)) (fun k : ℕ => (M1 k : ℝ) ^ ell / (ell.factorial : ℝ)) := choose_M1_equivalent ell /-- Exact finite two-slot ratio; the degree is symbolic, never enumerated. -/ theorem matching_binomial_ratio {m r : ℕ} (hr : 2 ≤ r) (hm : r ≤ m) : ((m : ℝ) / 2) * ((m - 2).choose (r - 2) : ℝ) / (m.choose r : ℝ) = (r : ℝ) * ((r : ℝ) - 1) / (2 * ((m : ℝ) - 1)) := by have hc : (m.choose r : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hm).ne' have hm2 : (2 : ℝ) ≤ m := by exact_mod_cast hr.trans hm have hm1 : (m : ℝ) - 1 ≠ 0 := by linarith have he : (m.choose r : ℝ) * (r.choose 2 : ℝ) = (m.choose 2 : ℝ) * ((m - 2).choose (r - 2) : ℝ) := by exact_mod_cast (Nat.choose_mul (n := m) (k := r) (s := 2) hr) rw [Nat.cast_choose_two ℝ r, Nat.cast_choose_two ℝ m] at he field_simp at he field_simp [hc, hm1] nlinarith [he] theorem matching_fraction_M1_tendsto_zero (r : ℕ) (hr : 2 ≤ r) : Tendsto (fun k : ℕ => ((M1 k : ℝ) / 2) * ((M1 k - 2).choose (r - 2) : ℝ) / ((M1 k).choose r : ℝ)) atTop (𝓝 0) := by have hM : Tendsto (fun k : ℕ => (M1 k : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp M1_tendsto_atTop have hs : Tendsto (fun k : ℕ => (M1 k : ℝ) - 1) atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [hM.eventually_ge_atTop (b + 1)] with k hk linarith have hfrac : Tendsto (fun k : ℕ => (r : ℝ) * ((r : ℝ) - 1) / (2 * ((M1 k : ℝ) - 1))) atTop (𝓝 0) := by simpa only [div_eq_mul_inv, mul_inv_rev, Pi.inv_apply, mul_assoc, mul_comm, mul_left_comm, mul_zero, zero_mul] using hs.inv_tendsto_atTop.const_mul ((r : ℝ) * ((r : ℝ) - 1) / 2) apply (tendsto_congr' ?_).2 hfrac filter_upwards [M1_tendsto_atTop.eventually_ge_atTop r] with k hk exact matching_binomial_ratio hr hk theorem half_le_nat_floor {x : ℝ} (hx : 2 ≤ x) : x / 2 ≤ (⌊x⌋₊ : ℝ) := by have hf := Nat.lt_floor_add_one x linarith theorem nat_floor_bounds {x : ℝ} (hx : 2 ≤ x) : x / 2 ≤ (⌊x⌋₊ : ℝ) ∧ (⌊x⌋₊ : ℝ) ≤ x := by exact ⟨half_le_nat_floor hx, Nat.floor_le (by linarith)⟩ theorem M0_bounds {k : ℕ} (hk : 1 ≤ k) : 2 * (k : ℝ) ^ alpha ≤ (M0 k : ℝ) ∧ (M0 k : ℝ) ≤ 3 * (k : ℝ) ^ alpha := by have hk' : (1 : ℝ) ≤ k := by exact_mod_cast hk have hx : 1 ≤ (k : ℝ) ^ alpha := Real.one_le_rpow hk' (le_of_lt alpha_pos) constructor · exact Nat.le_ceil _ · have hc := Nat.ceil_lt_add_one (show 0 ≤ 2 * (k : ℝ) ^ alpha by positivity) change (⌈2 * (k : ℝ) ^ alpha⌉₊ : ℝ) ≤ 3 * (k : ℝ) ^ alpha linarith theorem eventually_M1_bounds : ∀ᶠ k : ℕ in atTop, (k : ℝ) ^ alpha / 4 ≤ (M1 k : ℝ) ∧ (M1 k : ℝ) ≤ (k : ℝ) ^ alpha / 2 := by filter_upwards [(nat_rpow_tendsto_atTop alpha_pos).eventually_ge_atTop 4] with k hk have hb := nat_floor_bounds (x := (k : ℝ) ^ alpha / 2) (by linarith) simpa only [M1, div_div, show (2 : ℝ) * 2 = 4 by norm_num] using hb theorem eventually_N_bounds : ∀ᶠ k : ℕ in atTop, (k : ℝ) ^ (2 - delta) / 2 ≤ (N k : ℝ) ∧ (N k : ℝ) ≤ (k : ℝ) ^ (2 - delta) := by filter_upwards [(nat_rpow_tendsto_atTop (sub_pos.mpr delta_lt_two)).eventually_ge_atTop 2] with k hk exact nat_floor_bounds hk theorem H_one_le {k : ℕ} (hk : 1 ≤ k) : 1 ≤ H k := by apply (Nat.one_le_floor_iff _).mpr exact Real.one_le_rpow (by exact_mod_cast hk) (by norm_num) theorem eventually_sparseBudget_lower : ∀ᶠ k : ℕ in atTop, (k : ℝ) / (2 * (M0 k : ℝ) ^ (2 * L + 2)) ≤ (sparseBudget k : ℝ) := by filter_upwards [sparseBudget_raw_tendsto_atTop.eventually_ge_atTop 2] with k hk have h := half_le_nat_floor hk simpa only [sparseBudget, div_div, mul_comm] using h theorem half_le_nat_div {b d : ℕ} (hd : 0 < d) (hbd : 2 * d ≤ b) : (b : ℝ) / (2 * (d : ℝ)) ≤ ((b / d : ℕ) : ℝ) := by have hd0 : (0 : ℝ) < d := by exact_mod_cast hd have hbd0 : 2 * (d : ℝ) ≤ b := by exact_mod_cast hbd have hx : (2 : ℝ) ≤ (b : ℝ) / (d : ℝ) := (le_div_iff₀ hd0).mpr hbd0 have h := half_le_nat_floor hx rw [Nat.floor_div_eq_div] at h simpa only [div_div, mul_comm] using h def sparseCleanupOrder (k : ℕ) : ℕ := sparseBudget k / L def sparseCleanupConstant (C a : ℝ) : ℝ := a / (4 * (L : ℝ) * (C + a)) theorem sparseCleanupConstant_pos {C a : ℝ} (hC : 0 ≤ C) (ha : 0 < a) : 0 < sparseCleanupConstant C a := by have hL : (0 : ℝ) < L := by exact_mod_cast L_pos exact div_pos ha (mul_pos (mul_pos (by norm_num) hL) (add_pos_of_nonneg_of_pos hC ha)) theorem eventually_sparseCleanupOrder_lower : ∀ᶠ k : ℕ in atTop, (k : ℝ) / (4 * (L : ℝ) * (M0 k : ℝ) ^ (2 * L + 2)) ≤ (sparseCleanupOrder k : ℝ) := by filter_upwards [eventually_sparseBudget_lower, sparseBudget_tendsto_atTop.eventually_ge_atTop (2 * L)] with k hk hb have hL : (0 : ℝ) < L := by exact_mod_cast L_pos have hdiv := half_le_nat_div L_pos hb calc (k : ℝ) / (4 * (L : ℝ) * (M0 k : ℝ) ^ (2 * L + 2)) = ((k : ℝ) / (2 * (M0 k : ℝ) ^ (2 * L + 2))) / (2 * (L : ℝ)) := by rw [div_div] congr 1 ring _ ≤ (sparseBudget k : ℝ) / (2 * (L : ℝ)) := div_le_div_of_nonneg_right hk (by positivity) _ ≤ (sparseCleanupOrder k : ℝ) := hdiv /-- The literal integer cleanup order pays the full WG14 exponential rate. -/ theorem eventually_sparse_cleanup_exponent_lower {C a : ℝ} (hC : 0 ≤ C) (ha : 0 < a) : ∀ᶠ k : ℕ in atTop, sparseCleanupConstant C a * sparseRate k ≤ (sparseCleanupOrder k : ℝ) * a / (C * (M0 k : ℝ) ^ (L + 1) + a) := by filter_upwards [eventually_sparseCleanupOrder_lower, eventually_ge_atTop (1 : ℕ)] with k hk hk1 have hL : (0 : ℝ) < L := by exact_mod_cast L_pos have hk1' : (1 : ℝ) ≤ k := by exact_mod_cast hk1 have hM1 : (1 : ℝ) ≤ M0 k := by have hpow := Real.one_le_rpow hk1' alpha_pos.le have hM := (M0_bounds hk1).1 linarith have hM0 : (0 : ℝ) < M0 k := zero_lt_one.trans_le hM1 have hMpow : (1 : ℝ) ≤ (M0 k : ℝ) ^ (L + 1) := one_le_pow₀ hM1 have hCa : 0 < C + a := add_pos_of_nonneg_of_pos hC ha have hden : 0 < C * (M0 k : ℝ) ^ (L + 1) + a := add_pos_of_nonneg_of_pos (mul_nonneg hC (pow_nonneg hM0.le _)) ha have hdenle : C * (M0 k : ℝ) ^ (L + 1) + a ≤ (C + a) * (M0 k : ℝ) ^ (L + 1) := by nlinarith [mul_le_mul_of_nonneg_left hMpow ha.le] have hfrac : a / ((C + a) * (M0 k : ℝ) ^ (L + 1)) ≤ a / (C * (M0 k : ℝ) ^ (L + 1) + a) := div_le_div_of_nonneg_left ha.le hden hdenle calc sparseCleanupConstant C a * sparseRate k = ((k : ℝ) / (4 * (L : ℝ) * (M0 k : ℝ) ^ (2 * L + 2))) * (a / ((C + a) * (M0 k : ℝ) ^ (L + 1))) := by dsimp [sparseCleanupConstant, sparseRate] rw [show 3 * L + 3 = (2 * L + 2) + (L + 1) by omega, pow_add] field_simp [hL.ne', hM0.ne', hCa.ne'] _ ≤ (sparseCleanupOrder k : ℝ) * (a / (C * (M0 k : ℝ) ^ (L + 1) + a)) := mul_le_mul hk hfrac (div_nonneg ha.le (mul_nonneg hCa.le (pow_nonneg hM0.le _))) (Nat.cast_nonneg _) _ = (sparseCleanupOrder k : ℝ) * a / (C * (M0 k : ℝ) ^ (L + 1) + a) := by rw [mul_div_assoc] theorem eventually_J_le_log : ∀ᶠ p : ℕ in atTop, (J p : ℝ) ≤ 10001 * Real.log (p : ℝ) := by have hlog : Tendsto (fun p : ℕ => Real.log (p : ℝ)) atTop atTop := Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop have hloglog : Tendsto (fun p : ℕ => Real.log (Real.log (p : ℝ))) atTop atTop := Real.tendsto_log_atTop.comp hlog filter_upwards [hlog.eventually_ge_atTop 1, hloglog.eventually_ge_atTop 1] with p hp hpp have hnum : 0 ≤ 10000 * Real.log (p : ℝ) := by positivity have hden : 0 < Real.log (Real.log (p : ℝ)) := by linarith have hdiv : 10000 * Real.log (p : ℝ) / Real.log (Real.log (p : ℝ)) ≤ 10000 * Real.log (p : ℝ) := by apply (div_le_iff₀ hden).mpr simpa only [mul_one] using mul_le_mul_of_nonneg_left hpp hnum have hc := Nat.ceil_lt_add_one (div_nonneg hnum (le_of_lt hden)) change (⌈10000 * Real.log (p : ℝ) / Real.log (Real.log (p : ℝ))⌉₊ : ℝ) ≤ _ linarith theorem J_div_rpow_tendsto_zero {a : ℝ} (ha : 0 < a) : Tendsto (fun p : ℕ => (J p : ℝ) / (p : ℝ) ^ a) atTop (𝓝 0) := by have hu : Tendsto (fun p : ℕ => 10001 * Real.log (p : ℝ) / (p : ℝ) ^ a) atTop (𝓝 0) := by simpa only [mul_div_assoc, mul_zero] using (log_div_rpow_tendsto_zero ha).const_mul 10001 apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu · exact Eventually.of_forall fun p => div_nonneg (Nat.cast_nonneg _) (Real.rpow_nonneg (Nat.cast_nonneg _) _) · filter_upwards [eventually_J_le_log] with p hp exact div_le_div_of_nonneg_right hp (Real.rpow_nonneg (Nat.cast_nonneg _) _) theorem le_sqrt_fourth_power {p : ℕ} (hp : 2 ≤ Nat.sqrt p) : p ≤ (Nat.sqrt p) ^ 4 := by have hsq : Nat.sqrt p + 1 ≤ Nat.sqrt p * Nat.sqrt p := by have hm := Nat.mul_le_mul_right (Nat.sqrt p) hp omega calc p ≤ (Nat.sqrt p + 1) ^ 2 := (Nat.lt_succ_sqrt' p).le _ ≤ (Nat.sqrt p * Nat.sqrt p) ^ 2 := Nat.pow_le_pow_left hsq _ _ = Nat.sqrt p ^ 4 := by ring theorem eventually_J_le_sqrt_log : ∀ᶠ p : ℕ in atTop, (J p : ℝ) ≤ 40004 * Real.log (Nat.sqrt p : ℝ) := by filter_upwards [eventually_J_le_log, nat_sqrt_tendsto_atTop.eventually_ge_atTop 2, eventually_ge_atTop (1 : ℕ)] with p hJ hk hp have hp0 : (0 : ℝ) < p := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hp) have hpow : (p : ℝ) ≤ (Nat.sqrt p : ℝ) ^ (4 : ℕ) := by exact_mod_cast le_sqrt_fourth_power hk have hlog := Real.log_le_log hp0 hpow rw [Real.log_pow] at hlog norm_num only [Nat.cast_ofNat] at hlog linarith theorem J_mul_sqrt_rpow_tendsto_zero {a : ℝ} (ha : a < 0) : Tendsto (fun p : ℕ => (J p : ℝ) * (Nat.sqrt p : ℝ) ^ a) atTop (𝓝 0) := by have hu : Tendsto (fun p : ℕ => 40004 * ((Nat.sqrt p : ℝ) ^ a * Real.log (Nat.sqrt p : ℝ))) atTop (𝓝 0) := by simpa only [mul_zero, Function.comp_def] using ((rpow_mul_log_tendsto_zero ha).comp nat_sqrt_tendsto_atTop).const_mul 40004 apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu · exact Eventually.of_forall fun p => mul_nonneg (Nat.cast_nonneg _) (Real.rpow_nonneg (Nat.cast_nonneg _) _) · filter_upwards [eventually_J_le_sqrt_log] with p hp have hh := mul_le_mul_of_nonneg_right hp (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) a) simpa only [mul_assoc, mul_comm, mul_left_comm] using hh theorem J_add_one_mul_sqrt_rpow_tendsto_zero {a : ℝ} (ha : a < 0) : Tendsto (fun p : ℕ => ((J p : ℝ) + 1) * (Nat.sqrt p : ℝ) ^ a) atTop (𝓝 0) := by simpa only [add_mul, one_mul, zero_add, Function.comp_def] using (J_mul_sqrt_rpow_tendsto_zero ha).add ((nat_rpow_tendsto_zero ha).comp nat_sqrt_tendsto_atTop) theorem half_pow_le_factorial {q : ℕ} (hq : 2 ≤ q) : (q / 2) ^ (q / 2) ≤ q.factorial := by have hbase : 1 ≤ q / 2 := by omega have he : q / 2 ≤ q - q / 2 := by omega calc (q / 2) ^ (q / 2) ≤ (q / 2) ^ (q - q / 2) := by gcongr _ ≤ (q / 2).factorial * (q / 2) ^ (q - q / 2) := by simpa only [Nat.succ_eq_add_one, Nat.zero_add, one_mul] using Nat.mul_le_mul_right ((q / 2) ^ (q - q / 2)) (Nat.succ_le_of_lt (Nat.factorial_pos (q / 2))) _ ≤ q.factorial := Nat.factorial_mul_pow_sub_le_factorial (Nat.div_le_self q 2) theorem codegree_order_lower {p : ℕ} (ht : 1 ≤ Real.log (p : ℝ) / Real.log (Real.log (p : ℝ))) : 1000 * (Real.log (p : ℝ) / Real.log (Real.log (p : ℝ))) ≤ (codegreePackingOrder p : ℝ) := by have hJ : 10000 * Real.log (p : ℝ) / Real.log (Real.log (p : ℝ)) ≤ (J p : ℝ) := Nat.le_ceil _ have hn : J p ≤ 6 * codegreePackingOrder p + 6 := by unfold codegreePackingOrder omega have hn' : (J p : ℝ) ≤ 6 * (codegreePackingOrder p : ℝ) + 6 := by exact_mod_cast hn rw [mul_div_assoc] at hJ linarith /-- A deliberately coarse quantitative factorial bound, with ample fixed margin. -/ theorem factorial_tail_of_log_conditions {p q : ℕ} (hp : 2 ≤ p) (hx : 1 ≤ Real.log (p : ℝ)) (hy : 1 ≤ Real.log (Real.log (p : ℝ))) (hsmall : Real.log (Real.log (p : ℝ)) ≤ (Real.log (p : ℝ)) ^ (1 / 2 : ℝ)) (hq : 1000 * (Real.log (p : ℝ) / Real.log (Real.log (p : ℝ))) ≤ (q : ℝ)) : (p : ℝ) / (q.factorial : ℝ) ≤ (p : ℝ) ^ (-100 : ℝ) := by let x : ℝ := Real.log (p : ℝ) let y : ℝ := Real.log x let m : ℕ := q / 2 have hx0 : 0 < x := lt_of_lt_of_le zero_lt_one hx have hy0 : 0 < y := lt_of_lt_of_le zero_lt_one hy have ht : 1 ≤ x / y := by apply (one_le_div hy0).mpr have := Real.log_le_sub_one_of_pos hx0 dsimp [y] linarith have hq2 : 2 ≤ q := by have : (2 : ℝ) ≤ q := by change 1000 * (x / y) ≤ (q : ℝ) at hq; linarith exact_mod_cast this have hqm : q ≤ 4 * m := by dsimp [m]; omega have hqm' : (q : ℝ) ≤ 4 * (m : ℝ) := by exact_mod_cast hqm have hm_lower : 250 * (x / y) ≤ (m : ℝ) := by change 1000 * (x / y) ≤ (q : ℝ) at hq linarith have hsqrt0 : 0 < x ^ (1 / 2 : ℝ) := Real.rpow_pos_of_pos hx0 _ have hsquare : x ^ (1 / 2 : ℝ) * x ^ (1 / 2 : ℝ) = x := by rw [← Real.rpow_add hx0] norm_num have htsqrt : x ^ (1 / 2 : ℝ) ≤ x / y := by apply (le_div_iff₀ hy0).mpr calc x ^ (1 / 2 : ℝ) * y ≤ x ^ (1 / 2 : ℝ) * x ^ (1 / 2 : ℝ) := mul_le_mul_of_nonneg_left hsmall (le_of_lt hsqrt0) _ = x := hsquare have hm_sqrt : x ^ (1 / 2 : ℝ) ≤ (m : ℝ) := by linarith have hm0 : 0 < (m : ℝ) := hsqrt0.trans_le hm_sqrt have hlogm : y / 2 ≤ Real.log (m : ℝ) := by have hh := Real.log_le_log hsqrt0 hm_sqrt rw [Real.log_rpow hx0] at hh dsimp [y] linarith have hfac0 : 0 < (q.factorial : ℝ) := by exact_mod_cast Nat.factorial_pos q have hpow : (m : ℝ) ^ m ≤ (q.factorial : ℝ) := by exact_mod_cast half_pow_le_factorial hq2 have hlogfac : (m : ℝ) * Real.log (m : ℝ) ≤ Real.log (q.factorial : ℝ) := by simpa only [Real.log_pow] using Real.log_le_log (pow_pos hm0 _) hpow have hprod : 125 * x ≤ (m : ℝ) * Real.log (m : ℝ) := by calc 125 * x = (250 * (x / y)) * (y / 2) := by field_simp [hy0.ne']; ring _ ≤ (m : ℝ) * Real.log (m : ℝ) := mul_le_mul hm_lower hlogm (by positivity) (Nat.cast_nonneg _) have hp0 : (0 : ℝ) < p := by exact_mod_cast (lt_of_lt_of_le (by norm_num : 0 < 2) hp) have hfac : (p : ℝ) ^ (101 : ℕ) ≤ (q.factorial : ℝ) := by apply (Real.log_le_log_iff (pow_pos hp0 _) hfac0).mp rw [Real.log_pow] change (101 : ℝ) * x ≤ Real.log (q.factorial : ℝ) linarith calc (p : ℝ) / (q.factorial : ℝ) ≤ (p : ℝ) / (p : ℝ) ^ (101 : ℕ) := div_le_div_of_nonneg_left (le_of_lt hp0) (pow_pos hp0 _) hfac _ = (p : ℝ) ^ (-100 : ℝ) := by have he := (Real.rpow_sub hp0 (1 : ℝ) (101 : ℝ)).symm norm_num only [Real.rpow_one, Real.rpow_natCast, sub_eq_add_neg] at he simpa using he theorem eventually_codegree_factorial_tail : ∀ᶠ p : ℕ in atTop, (p : ℝ) / ((codegreePackingOrder p).factorial : ℝ) ≤ (p : ℝ) ^ (-100 : ℝ) := by have hlog : Tendsto (fun p : ℕ => Real.log (p : ℝ)) atTop atTop := Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop have hloglog : Tendsto (fun p : ℕ => Real.log (Real.log (p : ℝ))) atTop atTop := Real.tendsto_log_atTop.comp hlog have hratio : Tendsto (fun p : ℕ => Real.log (Real.log (p : ℝ)) / (Real.log (p : ℝ)) ^ (1 / 2 : ℝ)) atTop (𝓝 0) := (isLittleO_log_rpow_atTop (by norm_num : (0 : ℝ) < 1 / 2)).tendsto_div_nhds_zero.comp hlog have hratio_lt : ∀ᶠ p : ℕ in atTop, Real.log (Real.log (p : ℝ)) / (Real.log (p : ℝ)) ^ (1 / 2 : ℝ) < 1 := (tendsto_order.1 hratio).2 1 (by norm_num) filter_upwards [eventually_ge_atTop (2 : ℕ), hlog.eventually_ge_atTop 1, hloglog.eventually_ge_atTop 1, hratio_lt] with p hp hx hy hr have hx0 : 0 < Real.log (p : ℝ) := lt_of_lt_of_le zero_lt_one hx have hy0 : 0 < Real.log (Real.log (p : ℝ)) := lt_of_lt_of_le zero_lt_one hy have ht : 1 ≤ Real.log (p : ℝ) / Real.log (Real.log (p : ℝ)) := by apply (one_le_div hy0).mpr have := Real.log_le_sub_one_of_pos hx0 linarith have hsmall : Real.log (Real.log (p : ℝ)) ≤ (Real.log (p : ℝ)) ^ (1 / 2 : ℝ) := (div_lt_one (Real.rpow_pos_of_pos hx0 _)).mp hr |>.le exact factorial_tail_of_log_conditions hp hx hy hsmall (codegree_order_lower ht) theorem multiplicity_factorial_lower (h : ℕ) : (h : ℝ) ^ (3 * h) ≤ ((5 * h).factorial : ℝ) := by have hn : h ^ (3 * h) ≤ (5 * h).factorial := by calc h ^ (3 * h) ≤ (2 * h) ^ (3 * h) := by gcongr; omega _ ≤ (2 * h).factorial * (2 * h) ^ (3 * h) := by simpa only [Nat.succ_eq_add_one, Nat.zero_add, one_mul] using Nat.mul_le_mul_right ((2 * h) ^ (3 * h)) (Nat.succ_le_of_lt (Nat.factorial_pos (2 * h))) _ ≤ (5 * h).factorial := by simpa only [show 5 * h - 2 * h = 3 * h by omega] using Nat.factorial_mul_pow_sub_le_factorial (show 2 * h ≤ 5 * h by omega) exact_mod_cast hn theorem multiplicity_factorial_lower_sharp (h : ℕ) : (h : ℝ) ^ (4 * h) ≤ ((5 * h).factorial : ℝ) := by have hn : h ^ (4 * h) ≤ (5 * h).factorial := by calc h ^ (4 * h) ≤ h.factorial * h ^ (4 * h) := by simpa only [Nat.succ_eq_add_one, Nat.zero_add, one_mul] using Nat.mul_le_mul_right (h ^ (4 * h)) (Nat.succ_le_of_lt (Nat.factorial_pos h)) _ ≤ (5 * h).factorial := by simpa only [show 5 * h - h = 4 * h by omega] using Nat.factorial_mul_pow_sub_le_factorial (show h ≤ 5 * h by omega) exact_mod_cast hn theorem multiplicity_base_bound_sharp {k v : ℝ} (hk : 1 ≤ k) (hv : 0 ≤ v) (hcap : v ≤ k ^ (5 / 8 : ℝ)) : v ^ (26 : ℕ) / (8 * k ^ (18 : ℕ)) ≤ k ^ (-1 : ℝ) := by have hk0 : 0 < k := lt_of_lt_of_le zero_lt_one hk calc v ^ (26 : ℕ) / (8 * k ^ (18 : ℕ)) ≤ (k ^ (5 / 8 : ℝ)) ^ (26 : ℕ) / (8 * k ^ (18 : ℕ)) := by gcongr _ = k ^ (-7 / 4 : ℝ) / 8 := by rw [← Real.rpow_mul_natCast hk0.le, ← Real.rpow_natCast k 18] calc _ = (k ^ ((5 / 8 : ℝ) * 26) / k ^ (18 : ℝ)) / 8 := by simp only [div_div, mul_comm, Nat.cast_ofNat] _ = _ := by rw [← Real.rpow_sub hk0]; norm_num _ ≤ k ^ (-7 / 4 : ℝ) := div_le_self (Real.rpow_nonneg hk0.le _) (by norm_num) _ ≤ k ^ (-1 : ℝ) := Real.rpow_le_rpow_of_exponent_le hk (by norm_num) /-- Rank-six MP tail with the factor-two mean bound and only k ≥ 1. -/ theorem multiplicity_numeric_tail_sharp {k μ : ℝ} {h : ℕ} (hk : 1 ≤ k) (hh : 0 < h) (hcap : (h : ℝ) ≤ k ^ (5 / 8 : ℝ)) (hμ0 : 0 ≤ μ) (hμ : μ ≤ (h : ℝ) ^ (6 : ℕ) / (2 * k ^ (4 : ℕ))) : (4 * k ^ (2 : ℕ)) ^ h * μ ^ (5 * h) / ((5 * h).factorial : ℝ) ≤ k ^ (-(h : ℝ)) := by have hk0 : 0 < k := lt_of_lt_of_le zero_lt_one hk have hh0 : 0 < (h : ℝ) := by exact_mod_cast hh have hfactorial := multiplicity_factorial_lower_sharp h have hbase : 0 ≤ 4 * k ^ (2 : ℕ) := by positivity calc (4 * k ^ (2 : ℕ)) ^ h * μ ^ (5 * h) / ((5 * h).factorial : ℝ) ≤ (4 * k ^ (2 : ℕ)) ^ h * μ ^ (5 * h) / (h : ℝ) ^ (4 * h) := div_le_div_of_nonneg_left (mul_nonneg (pow_nonneg hbase _) (pow_nonneg hμ0 _)) (pow_pos hh0 _) hfactorial _ ≤ (4 * k ^ (2 : ℕ)) ^ h * ((h : ℝ) ^ (6 : ℕ) / (2 * k ^ (4 : ℕ))) ^ (5 * h) / (h : ℝ) ^ (4 * h) := by gcongr _ = ((h : ℝ) ^ (26 : ℕ) / (8 * k ^ (18 : ℕ))) ^ h := by rw [pow_mul, pow_mul, ← mul_pow, ← div_pow] congr 1 field_simp [hk0.ne', hh0.ne'] ring _ ≤ (k ^ (-1 : ℝ)) ^ h := by gcongr exact multiplicity_base_bound_sharp hk hh0.le hcap _ = k ^ (-(h : ℝ)) := by rw [← Real.rpow_mul_natCast hk0.le] congr 1 ring theorem four_le_eighth_power {k : ℝ} (hk : 65536 ≤ k) : 4 ≤ k ^ (1 / 8 : ℝ) := by have he : (65536 : ℝ) ^ (1 / 8 : ℝ) = 4 := by calc (65536 : ℝ) ^ (1 / 8 : ℝ) = ((4 : ℝ) ^ (8 : ℕ)) ^ (1 / 8 : ℝ) := by norm_num _ = (4 : ℝ) ^ ((8 : ℝ) * (1 / 8 : ℝ)) := (Real.rpow_natCast_mul (by norm_num : (0 : ℝ) ≤ 4) 8 (1 / 8 : ℝ)).symm _ = 4 := by norm_num calc 4 = (65536 : ℝ) ^ (1 / 8 : ℝ) := he.symm _ ≤ k ^ (1 / 8 : ℝ) := Real.rpow_le_rpow (by norm_num) hk (by norm_num) theorem multiplicity_base_bound {k v : ℝ} (hk : 65536 ≤ k) (hv : 0 ≤ v) (hcap : v ≤ k ^ (5 / 8 : ℝ)) : 4 * v ^ (27 : ℕ) / k ^ (18 : ℕ) ≤ k ^ (-1 : ℝ) := by have hk0 : 0 < k := by linarith have hpow : v ^ (27 : ℕ) ≤ (k ^ (5 / 8 : ℝ)) ^ (27 : ℕ) := by gcongr calc 4 * v ^ (27 : ℕ) / k ^ (18 : ℕ) ≤ 4 * (k ^ (5 / 8 : ℝ)) ^ (27 : ℕ) / k ^ (18 : ℕ) := by gcongr _ = 4 * k ^ (-9 / 8 : ℝ) := by rw [← Real.rpow_mul_natCast (le_of_lt hk0), ← Real.rpow_natCast k 18, mul_div_assoc, ← Real.rpow_sub hk0] congr 1 norm_num _ ≤ k ^ (1 / 8 : ℝ) * k ^ (-9 / 8 : ℝ) := mul_le_mul_of_nonneg_right (four_le_eighth_power hk) (Real.rpow_nonneg (le_of_lt hk0) _) _ = k ^ (-1 : ℝ) := by rw [← Real.rpow_add hk0]; norm_num /-- Numeric MP specialization, independent of the finite-probability encoding. -/ theorem multiplicity_numeric_tail {k μ : ℝ} {h : ℕ} (hk : 65536 ≤ k) (hh : 0 < h) (hcap : (h : ℝ) ≤ k ^ (5 / 8 : ℝ)) (hμ0 : 0 ≤ μ) (hμ : μ ≤ (h : ℝ) ^ (6 : ℕ) / k ^ (4 : ℕ)) : (4 * k ^ (2 : ℕ)) ^ h * μ ^ (5 * h) / ((5 * h).factorial : ℝ) ≤ k ^ (-(h : ℝ)) := by have hk0 : 0 < k := by linarith have hh0 : 0 < (h : ℝ) := by exact_mod_cast hh have hfactorial := multiplicity_factorial_lower h have hbase : 0 ≤ 4 * k ^ (2 : ℕ) := by positivity calc (4 * k ^ (2 : ℕ)) ^ h * μ ^ (5 * h) / ((5 * h).factorial : ℝ) ≤ (4 * k ^ (2 : ℕ)) ^ h * μ ^ (5 * h) / (h : ℝ) ^ (3 * h) := div_le_div_of_nonneg_left (mul_nonneg (pow_nonneg hbase _) (pow_nonneg hμ0 _)) (pow_pos hh0 _) hfactorial _ ≤ (4 * k ^ (2 : ℕ)) ^ h * ((h : ℝ) ^ (6 : ℕ) / k ^ (4 : ℕ)) ^ (5 * h) / (h : ℝ) ^ (3 * h) := by gcongr _ = (4 * (h : ℝ) ^ (27 : ℕ) / k ^ (18 : ℕ)) ^ h := by rw [pow_mul, pow_mul, ← mul_pow, ← div_pow] congr 1 field_simp [hk0.ne', hh0.ne'] _ ≤ (k ^ (-1 : ℝ)) ^ h := by gcongr exact multiplicity_base_bound hk (le_of_lt hh0) hcap _ = k ^ (-(h : ℝ)) := by rw [← Real.rpow_mul_natCast (le_of_lt hk0)] congr 1 ring def weightedAllowance (p : ℕ) : ℝ := (N (Nat.sqrt p) : ℝ) / ((p : ℝ) * theta0 (Nat.sqrt p) ^ L) theorem weightedAllowance_le {p : ℕ} (hp : 0 < p) : weightedAllowance p ≤ (Nat.sqrt p : ℝ) ^ (-delta + (L : ℝ) * epsilon0) := by have hp0 : (0 : ℝ) < p := by exact_mod_cast hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast (Nat.sqrt_pos.mpr hp) have ht : 0 < theta0 (Nat.sqrt p) := Real.rpow_pos_of_pos hk0 _ have hk2 : (Nat.sqrt p : ℝ) ^ 2 ≤ p := by exact_mod_cast Nat.sqrt_le' p have hN : (N (Nat.sqrt p) : ℝ) ≤ (Nat.sqrt p : ℝ) ^ (2 - delta) := Nat.floor_le (Real.rpow_nonneg (le_of_lt hk0) _) calc weightedAllowance p ≤ (Nat.sqrt p : ℝ) ^ (2 - delta) / ((p : ℝ) * theta0 (Nat.sqrt p) ^ L) := div_le_div_of_nonneg_right hN (le_of_lt (mul_pos hp0 (pow_pos ht _))) _ ≤ (Nat.sqrt p : ℝ) ^ (2 - delta) / ((Nat.sqrt p : ℝ) ^ 2 * theta0 (Nat.sqrt p) ^ L) := div_le_div_of_nonneg_left (Real.rpow_nonneg (le_of_lt hk0) _) (mul_pos (pow_pos hk0 _) (pow_pos ht _)) (mul_le_mul_of_nonneg_right hk2 (pow_nonneg (le_of_lt ht) _)) _ = (Nat.sqrt p : ℝ) ^ (-delta + (L : ℝ) * epsilon0) := by rw [theta0, ← Real.rpow_mul_natCast (le_of_lt hk0), ← Real.rpow_natCast (Nat.sqrt p : ℝ) 2, ← Real.rpow_add hk0, ← Real.rpow_sub hk0] congr 1 push_cast ring theorem weightedAllowance_tendsto_zero : Tendsto weightedAllowance atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds ((nat_rpow_tendsto_zero weighted_allowance_neg).comp nat_sqrt_tendsto_atTop) · exact Eventually.of_forall fun p => div_nonneg (Nat.cast_nonneg _) (mul_nonneg (Nat.cast_nonneg _) (pow_nonneg (Real.rpow_nonneg (Nat.cast_nonneg _) _) _)) · filter_upwards [eventually_ge_atTop (1 : ℕ)] with p hp exact weightedAllowance_le (lt_of_lt_of_le Nat.zero_lt_one hp) theorem weightedAllowance_primes_tendsto_zero : Tendsto (fun p : {p : ℕ // p.Prime} => weightedAllowance p.val) atTop (𝓝 0) := weightedAllowance_tendsto_zero.comp prime_val_tendsto_atTop theorem richRate_tendsto_atTop : Tendsto richRate atTop atTop := (nat_rpow_tendsto_atTop rich_budget_pos).atTop_mul_atTop₀ (Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop) theorem sparseRate_lower {k : ℕ} (hk : 1 ≤ k) : (k : ℝ) ^ sparseRatePower / (3 : ℝ) ^ (3 * L + 3) ≤ sparseRate k := by have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hp : 0 < (k : ℝ) ^ alpha := Real.rpow_pos_of_pos hk0 alpha have hm : 0 < (M0 k : ℝ) := lt_of_lt_of_le (by positivity) (M0_bounds hk).1 have hb : (M0 k : ℝ) ^ (3 * L + 3) ≤ (3 * (k : ℝ) ^ alpha) ^ (3 * L + 3) := by gcongr exact (M0_bounds hk).2 have hexp : sparseRatePower = 1 - alpha * ((3 * L + 3 : ℕ) : ℝ) := by simp only [sparseRatePower, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] calc (k : ℝ) ^ sparseRatePower / (3 : ℝ) ^ (3 * L + 3) = (k : ℝ) / (3 * (k : ℝ) ^ alpha) ^ (3 * L + 3) := by rw [hexp, Real.rpow_sub hk0, Real.rpow_one, Real.rpow_mul_natCast (le_of_lt hk0), mul_pow] simp only [div_div, mul_comm] _ ≤ (k : ℝ) / (M0 k : ℝ) ^ (3 * L + 3) := div_le_div_of_nonneg_left (le_of_lt hk0) (pow_pos hm _) hb _ = sparseRate k := rfl theorem sparseRate_tendsto_atTop : Tendsto sparseRate atTop atTop := by apply tendsto_atTop_mono' atTop ((eventually_ge_atTop (1 : ℕ)).mono fun k hk => sparseRate_lower hk) exact (nat_rpow_tendsto_atTop sparse_rate_pos).atTop_div_const (pow_pos (by norm_num : (0 : ℝ) < 3) _) theorem sparseRate_equivalent : _root_.Asymptotics.IsEquivalent atTop sparseRate (fun k : ℕ => (k : ℝ) ^ sparseRatePower / (2 : ℝ) ^ (3 * L + 3)) := by change _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) / (M0 k : ℝ) ^ (3 * L + 3)) _ simpa only [sparseRatePower, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat] using M0_quotient_equivalent (3 * L + 3) def positiveRate (k : ℕ) : ℝ := (k : ℝ) / (M0 k : ℝ) ^ (2 * L + 1) theorem positiveRate_equivalent : _root_.Asymptotics.IsEquivalent atTop positiveRate (fun k : ℕ => (k : ℝ) ^ positiveRatePower / (2 : ℝ) ^ (2 * L + 1)) := by change _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) / (M0 k : ℝ) ^ (2 * L + 1)) _ simpa only [positiveRatePower, Nat.cast_add, Nat.cast_mul, Nat.cast_ofNat, Nat.cast_one] using M0_quotient_equivalent (2 * L + 1) theorem positiveRate_tendsto_atTop : Tendsto positiveRate atTop atTop := by apply positiveRate_equivalent.symm.tendsto_atTop exact (nat_rpow_tendsto_atTop positive_rate_pos).atTop_div_const (pow_pos (by norm_num : (0 : ℝ) < 2) _) /-- Common upper scale for the logarithm of the source descriptor count. -/ def descriptorEntropy (ε : ℝ) (k : ℕ) : ℝ := ((H k : ℝ) + (k : ℝ) * (k : ℝ) ^ (-ε)) * Real.log (k : ℝ) theorem descriptorEntropy_div_rpow_tendsto_zero {ε b : ℝ} (hbH : (5 / 8 : ℝ) < b) (hbε : 1 - ε < b) : Tendsto (fun k : ℕ => descriptorEntropy ε k / (k : ℝ) ^ b) atTop (𝓝 0) := by have hH : Tendsto (fun k : ℕ => (H k : ℝ) * Real.log (k : ℝ) / (k : ℝ) ^ b) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (H k : ℝ) * Real.log (k : ℝ) / (k : ℝ) ^ b) (fun k : ℕ => (k : ℝ) ^ (5 / 8 : ℝ) * Real.log (k : ℝ) / (k : ℝ) ^ b) := (H_equivalent.mul _root_.Asymptotics.IsEquivalent.refl).div _root_.Asymptotics.IsEquivalent.refl exact he.symm.tendsto_nhds (rpow_log_ratio_tendsto_zero hbH) have hs : Tendsto (fun k : ℕ => (k : ℝ) * (k : ℝ) ^ (-ε) * Real.log (k : ℝ) / (k : ℝ) ^ b) atTop (𝓝 0) := by apply (rpow_log_ratio_tendsto_zero hbε).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) rw [Real.rpow_sub hk0, Real.rpow_one, Real.rpow_neg hk0.le] ring simpa only [descriptorEntropy, add_mul, add_div, zero_add] using hH.add hs theorem rich_descriptorEntropy_ratio_tendsto_zero : Tendsto (fun k : ℕ => descriptorEntropy epsilon1 k / richRate k) atTop (𝓝 0) := by have he := descriptorEntropy_div_rpow_tendsto_zero rich_budget_gt_H rich_budget_gt_source have hl := (Real.tendsto_log_atTop.comp (tendsto_natCast_atTop_atTop (R := ℝ))).inv_tendsto_atTop simpa only [richRate, Function.comp_def, Pi.inv_apply, div_eq_mul_inv, mul_inv_rev, mul_assoc, mul_comm, mul_left_comm, mul_zero, zero_mul] using he.mul hl theorem sparse_descriptorEntropy_ratio_tendsto_zero : Tendsto (fun k : ℕ => descriptorEntropy epsilon0 k / sparseRate k) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => descriptorEntropy epsilon0 k / sparseRate k) (fun k : ℕ => descriptorEntropy epsilon0 k / ((k : ℝ) ^ sparseRatePower / (2 : ℝ) ^ (3 * L + 3))) := _root_.Asymptotics.IsEquivalent.refl.div sparseRate_equivalent apply he.symm.tendsto_nhds have h := (descriptorEntropy_div_rpow_tendsto_zero sparse_rate_gt_H sparse_rate_gt_source).mul_const ((2 : ℝ) ^ (3 * L + 3)) simpa only [zero_mul, div_div_eq_mul_div, mul_div_right_comm] using h /-- The coarse cost b log k already fits the positive cleanup rate. -/ theorem sparse_deletionEntropy_ratio_tendsto_zero : Tendsto (fun k : ℕ => (sparseBudget k : ℝ) * Real.log (k : ℝ) / positiveRate k) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (sparseBudget k : ℝ) * Real.log (k : ℝ) / positiveRate k) (fun k : ℕ => ((k : ℝ) ^ sparseBudgetPower / (2 : ℝ) ^ (2 * L + 2)) * Real.log (k : ℝ) / ((k : ℝ) ^ positiveRatePower / (2 : ℝ) ^ (2 * L + 1))) := (sparseBudget_equivalent.mul _root_.Asymptotics.IsEquivalent.refl).div positiveRate_equivalent apply he.symm.tendsto_nhds have h := (rpow_log_ratio_tendsto_zero (sub_neg.mp deletion_entropy_power_neg)).mul_const ((2 : ℝ) ^ (2 * L + 1) / (2 : ℝ) ^ (2 * L + 2)) apply (show Tendsto (fun k : ℕ => ((k : ℝ) ^ sparseBudgetPower * Real.log (k : ℝ) / (k : ℝ) ^ positiveRatePower) * ((2 : ℝ) ^ (2 * L + 1) / (2 : ℝ) ^ (2 * L + 2))) atTop (𝓝 0) by simpa only [zero_mul] using h).congr intro k simp only [div_eq_mul_inv, mul_inv_rev, inv_inv] ring theorem exp_neg_mul_tendsto_zero {f : ℕ → ℝ} (hf : Tendsto f atTop atTop) {c : ℝ} (hc : 0 < c) : Tendsto (fun k => Real.exp (-c * f k)) atTop (𝓝 0) := by have hpos := hf.const_mul_atTop hc have hneg := tendsto_neg_atTop_atBot.comp hpos simpa only [Function.comp_def, neg_mul] using Real.tendsto_exp_atBot.comp hneg theorem rich_failure_tendsto_zero {c : ℝ} (hc : 0 < c) : Tendsto (fun k => Real.exp (-c * richRate k)) atTop (𝓝 0) := exp_neg_mul_tendsto_zero richRate_tendsto_atTop hc theorem sparse_failure_tendsto_zero {c : ℝ} (hc : 0 < c) : Tendsto (fun k => Real.exp (-c * sparseRate k)) atTop (𝓝 0) := exp_neg_mul_tendsto_zero sparseRate_tendsto_atTop hc def multiplicityFailure (k : ℕ) : ℝ := (k : ℝ) ^ (-(H k : ℝ)) theorem multiplicity_failure_tendsto_zero : Tendsto multiplicityFailure atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (nat_rpow_tendsto_zero (by norm_num : (-1 : ℝ) < 0)) · exact Eventually.of_forall fun k => Real.rpow_nonneg (Nat.cast_nonneg k) _ · filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hH : (1 : ℝ) ≤ H k := by exact_mod_cast H_one_le hk exact Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hk) (by linarith) theorem codegree_failure_tendsto_zero : Tendsto (fun p : ℕ => (p : ℝ) ^ (-100 : ℝ)) atTop (𝓝 0) := nat_rpow_tendsto_zero (by norm_num) def failureBound (c1 c0 : ℝ) (p : ℕ) : ℝ := (p : ℝ) ^ (-100 : ℝ) + multiplicityFailure (Nat.sqrt p) + Real.exp (-c1 * richRate (Nat.sqrt p)) + Real.exp (-c0 * sparseRate (Nat.sqrt p)) theorem failureBound_tendsto_zero {c1 c0 : ℝ} (hc1 : 0 < c1) (hc0 : 0 < c0) : Tendsto (failureBound c1 c0) atTop (𝓝 0) := by change Tendsto (fun p : ℕ => failureBound c1 c0 p) atTop (𝓝 0) simpa only [failureBound, Function.comp_def, add_zero] using ((codegree_failure_tendsto_zero.add (multiplicity_failure_tendsto_zero.comp nat_sqrt_tendsto_atTop)).add ((rich_failure_tendsto_zero hc1).comp nat_sqrt_tendsto_atTop)).add ((sparse_failure_tendsto_zero hc0).comp nat_sqrt_tendsto_atTop) theorem failureBound_primes_tendsto_zero {c1 c0 : ℝ} (hc1 : 0 < c1) (hc0 : 0 < c0) : Tendsto (fun p : {p : ℕ // p.Prime} => failureBound c1 c0 p.val) atTop (𝓝 0) := (failureBound_tendsto_zero hc1 hc0).comp prime_val_tendsto_atTop end end Green39Submission.Asymptotics end Green39AssemblyScope_c522d8e94c263925 /- Source: Green39Submission.HighCenters; SHA256 f4f6513e311708736a88429431915bca59e4831c090fc3724bc792eb8f2991dc -/ section Green39AssemblyScope_e2a71b69caf22939 /-! The whole-parent high-center bound and the auxiliary heavy-input deletion. The ordinary center threshold is exactly `k^(3/4)`; the auxiliary input threshold is a separate positive real parameter, later `Parameters.R k`. All deletions below are deterministic certificates on the realized input. No probability law for a cleaned input, and no covering conclusion, is assumed. -/ namespace Green39Submission.HighCenters open scoped BigOperators Pointwise open Filter Topology open CodegreeMultiplicity MixedEnergy universe u noncomputable section section Incidence variable {G : Type u} [AddCommGroup G] [DecidableEq G] /-- Restricted ordinary incidence double counting, retaining the actual input. -/ theorem sum_ordinaryOverlap_eq (B T D : Finset G) : (∑ u ∈ B, ordinaryOverlap D T u) = ∑ t ∈ T, representationCount B D t := by simpa only [ordinaryOverlap, RichStarGeometry.ordinarySources] using RichStarGeometry.sum_card_ordinarySources B T D /-- An auxiliary deletion used only when counting patterns. -/ def heavyInputs (B T D : Finset G) (Raux : ℝ) : Finset G := by classical exact B.filter (fun u => Raux < (ordinaryOverlap D T u : ℝ)) theorem mem_heavyInputs {B T D : Finset G} {Raux : ℝ} {u : G} : u ∈ heavyInputs B T D Raux ↔ u ∈ B ∧ Raux < (ordinaryOverlap D T u : ℝ) := by classical simp [heavyInputs] theorem heavyInputs_subset (B T D : Finset G) (Raux : ℝ) : heavyInputs B T D Raux ⊆ B := by intro u hu exact (mem_heavyInputs.mp hu).1 theorem ordinaryOverlap_le_of_mem_sdiff_heavyInputs {B T D : Finset G} {Raux : ℝ} {u : G} (hu : u ∈ B \ heavyInputs B T D Raux) : (ordinaryOverlap D T u : ℝ) ≤ Raux := by rcases Finset.mem_sdiff.mp hu with ⟨huB, huF⟩ exact not_lt.mp (fun h => huF (mem_heavyInputs.mpr ⟨huB, h⟩)) /-- Deterministic Markov counting; no thinning or input sampling is involved. -/ theorem heavyInputs_card_mul_le {B T D : Finset G} {K : ℕ} {Raux : ℝ} (hcap : ∀ t ∈ T, representationCount B D t ≤ K) : ((heavyInputs B T D Raux).card : ℝ) * Raux ≤ (K : ℝ) * (T.card : ℝ) := by classical have hsum : (∑ u ∈ B, ordinaryOverlap D T u) ≤ K * T.card := by simpa only [ordinaryOverlap, RichStarGeometry.ordinarySources, Nat.mul_comm] using RichStarGeometry.sum_card_ordinarySources_le hcap calc ((heavyInputs B T D Raux).card : ℝ) * Raux = ∑ _u ∈ heavyInputs B T D Raux, Raux := by simp _ ≤ ∑ u ∈ heavyInputs B T D Raux, (ordinaryOverlap D T u : ℝ) := by apply Finset.sum_le_sum intro u hu exact (mem_heavyInputs.mp hu).2.le _ ≤ ∑ u ∈ B, (ordinaryOverlap D T u : ℝ) := by apply Finset.sum_le_sum_of_subset_of_nonneg (heavyInputs_subset B T D Raux) intro u hu hnot positivity _ ≤ (K : ℝ) * (T.card : ℝ) := by exact_mod_cast hsum theorem heavyInputs_card_le {B T D : Finset G} {K : ℕ} {Raux : ℝ} (hcap : ∀ t ∈ T, representationCount B D t ≤ K) (hR : 0 < Raux) : ((heavyInputs B T D Raux).card : ℝ) ≤ (K : ℝ) * (T.card : ℝ) / Raux := by exact (le_div_iff₀ hR).2 (heavyInputs_card_mul_le hcap) /-- The literal `500k/Raux` budget used in ST6. -/ theorem heavyInputs_card_le_500 {B T D : Finset G} {k : ℕ} {Raux : ℝ} (hcap : ∀ t : G, representationCount B D t ≤ 5) (hT : T.card ≤ 100 * k) (hR : 0 < Raux) : ((heavyInputs B T D Raux).card : ℝ) ≤ 500 * (k : ℝ) / Raux := by apply (le_div_iff₀ hR).2 have hT' : (T.card : ℝ) ≤ 100 * (k : ℝ) := by exact_mod_cast hT calc ((heavyInputs B T D Raux).card : ℝ) * Raux ≤ 5 * (T.card : ℝ) := heavyInputs_card_mul_le (fun t _ht => hcap t) _ ≤ 500 * (k : ℝ) := by linarith end Incidence section Finite variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- A sufficient numerical condition for the literal whole-parent `H` cap. -/ theorem highCenters_card_le_H {A T : Finset G} {k J : ℕ} (hk : 0 < k) (hAk : A.card = k) (hT : T.card ≤ 100 * k) (hcode : NonzeroCodegreeBound A J) (hcoef : 10000 * ((J : ℝ) + 1) ≤ (k : ℝ) ^ (1 / 8 : ℝ)) : (highCenters A T ((k : ℝ) ^ (3 / 4 : ℝ))).card ≤ Parameters.H k := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hT' : (T.card : ℝ) ≤ 100 * (k : ℝ) := by exact_mod_cast hT have hraw := highCenters_card_mul_sq_le T hcode (Real.rpow_nonneg (Nat.cast_nonneg k) (3 / 4 : ℝ)) rw [hAk] at hraw have hquad : (k : ℝ) * (T.card : ℝ) + (J : ℝ) * (T.card : ℝ) ^ 2 ≤ 10000 * ((J : ℝ) + 1) * (k : ℝ) ^ 2 := by calc (k : ℝ) * (T.card : ℝ) + (J : ℝ) * (T.card : ℝ) ^ 2 ≤ (k : ℝ) * (100 * (k : ℝ)) + (J : ℝ) * (100 * (k : ℝ)) ^ 2 := by gcongr _ ≤ 10000 * ((J : ℝ) + 1) * (k : ℝ) ^ 2 := by nlinarith [sq_nonneg (k : ℝ)] have hpow : (k : ℝ) ^ (1 / 8 : ℝ) * (k : ℝ) ^ 2 = (k : ℝ) ^ (5 / 8 : ℝ) * ((k : ℝ) ^ (3 / 4 : ℝ)) ^ 2 := by calc (k : ℝ) ^ (1 / 8 : ℝ) * (k : ℝ) ^ 2 = (k : ℝ) ^ (1 / 8 : ℝ) * (k : ℝ) ^ (2 : ℝ) := by rw [Real.rpow_two] _ = (k : ℝ) ^ (17 / 8 : ℝ) := by rw [← Real.rpow_add hk0] norm_num _ = (k : ℝ) ^ (5 / 8 : ℝ) * (k : ℝ) ^ ((3 / 4 : ℝ) * (2 : ℕ)) := by rw [← Real.rpow_add hk0] norm_num _ = _ := by rw [Real.rpow_mul_natCast hk0.le] have hRpos : 0 < (k : ℝ) ^ (3 / 4 : ℝ) := Real.rpow_pos_of_pos hk0 _ apply Nat.le_floor apply (mul_le_mul_iff_left₀ (sq_pos_of_pos hRpos)).mp calc ((highCenters A T ((k : ℝ) ^ (3 / 4 : ℝ))).card : ℝ) * ((k : ℝ) ^ (3 / 4 : ℝ)) ^ 2 ≤ (k : ℝ) * (T.card : ℝ) + (J : ℝ) * (T.card : ℝ) ^ 2 := hraw _ ≤ 10000 * ((J : ℝ) + 1) * (k : ℝ) ^ 2 := hquad _ ≤ (k : ℝ) ^ (1 / 8 : ℝ) * (k : ℝ) ^ 2 := mul_le_mul_of_nonneg_right hcoef (sq_nonneg _) _ = _ := hpow /-- The actual rank-six deletion can be chosen for the whole-parent centers. -/ theorem whole_parent_multiplicityCleanup {A T : Finset G} {k J : ℕ} (hk : 0 < k) (hAk : A.card = k) (hT : T.card ≤ 100 * k) (hcode : NonzeroCodegreeBound A J) (hcoef : 10000 * ((J : ℝ) + 1) ≤ (k : ℝ) ^ (1 / 8 : ℝ)) (hclean : UniformMultiplicityCleanup A 6 (30 * Parameters.H k) (Parameters.H k)) : MultiplicityCleanup A (highCenters A T ((k : ℝ) ^ (3 / 4 : ℝ))) 6 (30 * Parameters.H k) := hclean _ (highCenters_card_le_H hk hAk hT hcode hcoef) /-- A rank-six certificate supplies both ST6 deletions and their combined budget. The cap-five statement is retained on `A \\ E0`, before removing F. -/ theorem exists_cleanup_and_heavy_deletion {A T D : Finset G} {b k : ℕ} {Raux : ℝ} (hclean : MultiplicityCleanup A D 6 b) (hT : T.card ≤ 100 * k) (hR : 0 < Raux) : ∃ E0 F : Finset G, E0 ⊆ A ∧ E0.card ≤ b ∧ F = heavyInputs (A \ E0) T D Raux ∧ F ⊆ A \ E0 ∧ (∀ t : G, representationCount (A \ E0) D t ≤ 5) ∧ (F.card : ℝ) ≤ 500 * (k : ℝ) / Raux ∧ E0 ∪ F ⊆ A ∧ ((E0 ∪ F).card : ℝ) ≤ (b : ℝ) + 500 * (k : ℝ) / Raux ∧ ∀ u ∈ A \ (E0 ∪ F), (ordinaryOverlap D T u : ℝ) ≤ Raux := by rcases multiplicityCleanup_six_certificate hclean with ⟨E0, hE0A, hE0b, hcap⟩ let F := heavyInputs (A \ E0) T D Raux have hFsub : F ⊆ A \ E0 := heavyInputs_subset _ _ _ _ have hFcard : (F.card : ℝ) ≤ 500 * (k : ℝ) / Raux := heavyInputs_card_le_500 hcap hT hR have hEFsub : E0 ∪ F ⊆ A := by intro u hu rcases Finset.mem_union.mp hu with huE | huF · exact hE0A huE · exact (Finset.mem_sdiff.mp (hFsub huF)).1 have hEFcard : ((E0 ∪ F).card : ℝ) ≤ (b : ℝ) + 500 * (k : ℝ) / Raux := by have hcard : ((E0 ∪ F).card : ℝ) ≤ (E0.card : ℝ) + (F.card : ℝ) := by exact_mod_cast Finset.card_union_le E0 F have hb : (E0.card : ℝ) ≤ b := by exact_mod_cast hE0b linarith refine ⟨E0, F, hE0A, hE0b, rfl, hFsub, hcap, hFcard, hEFsub, hEFcard, ?_⟩ intro u hu rcases Finset.mem_sdiff.mp hu with ⟨huA, huEF⟩ apply ordinaryOverlap_le_of_mem_sdiff_heavyInputs apply Finset.mem_sdiff.mpr constructor · exact Finset.mem_sdiff.mpr ⟨huA, fun huE => huEF (Finset.mem_union.mpr (Or.inl huE))⟩ · exact fun huF => huEF (Finset.mem_union.mpr (Or.inr huF)) /-- The literal ST5--ST6 preparation, with `30H` and the manuscript's separate auxiliary threshold `R k = k^delta`. -/ theorem whole_parent_counting_deletion {A T : Finset G} {k J : ℕ} (hk : 0 < k) (hAk : A.card = k) (hT : T.card ≤ 100 * k) (hcode : NonzeroCodegreeBound A J) (hcoef : 10000 * ((J : ℝ) + 1) ≤ (k : ℝ) ^ (1 / 8 : ℝ)) (hclean : UniformMultiplicityCleanup A 6 (30 * Parameters.H k) (Parameters.H k)) : let D := highCenters A T ((k : ℝ) ^ (3 / 4 : ℝ)) ∃ E0 F : Finset G, E0 ⊆ A ∧ E0.card ≤ 30 * Parameters.H k ∧ F = heavyInputs (A \ E0) T D (Parameters.R k) ∧ F ⊆ A \ E0 ∧ (∀ t : G, representationCount (A \ E0) D t ≤ 5) ∧ (F.card : ℝ) ≤ 500 * (k : ℝ) / Parameters.R k ∧ E0 ∪ F ⊆ A ∧ ((E0 ∪ F).card : ℝ) ≤ ((30 * Parameters.H k : ℕ) : ℝ) + 500 * (k : ℝ) / Parameters.R k ∧ ∀ u ∈ A \ (E0 ∪ F), (ordinaryOverlap D T u : ℝ) ≤ Parameters.R k := by have hR : 0 < Parameters.R k := Real.rpow_pos_of_pos (by exact_mod_cast hk) _ exact exists_cleanup_and_heavy_deletion (whole_parent_multiplicityCleanup hk hAk hT hcode hcoef hclean) hT hR end Finite /-- The numerical condition for the high-center cap holds for every sufficiently large integer modulus, hence uniformly along all primes. -/ theorem eventually_highCenter_coefficient : ∀ᶠ p : ℕ in atTop, 0 < Nat.sqrt p ∧ 10000 * ((Parameters.J p : ℝ) + 1) ≤ (Nat.sqrt p : ℝ) ^ (1 / 8 : ℝ) := by have hlim : Tendsto (fun p : ℕ => 10000 * (((Parameters.J p : ℝ) + 1) * (Nat.sqrt p : ℝ) ^ (-(1 / 8 : ℝ)))) atTop (𝓝 0) := by simpa only [mul_zero] using (Asymptotics.J_add_one_mul_sqrt_rpow_tendsto_zero (a := -(1 / 8 : ℝ)) (by norm_num)).const_mul (10000 : ℝ) have hsmall : ∀ᶠ p : ℕ in atTop, 10000 * (((Parameters.J p : ℝ) + 1) * (Nat.sqrt p : ℝ) ^ (-(1 / 8 : ℝ))) < 1 := (tendsto_order.1 hlim).2 1 (by norm_num) filter_upwards [hsmall, Asymptotics.nat_sqrt_tendsto_atTop.eventually_ge_atTop 1] with p hp hk have hkpos : 0 < Nat.sqrt p := lt_of_lt_of_le Nat.zero_lt_one hk have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hkpos refine ⟨hkpos, ?_⟩ have hpow : 0 < (Nat.sqrt p : ℝ) ^ (1 / 8 : ℝ) := Real.rpow_pos_of_pos hk0 _ rw [Real.rpow_neg hk0.le] at hp have hdiv : 10000 * ((Parameters.J p : ℝ) + 1) / (Nat.sqrt p : ℝ) ^ (1 / 8 : ℝ) < 1 := by simpa only [div_eq_mul_inv, mul_assoc] using hp exact ((div_lt_one hpow).mp hdiv).le /-- ST5 with the literal floor, whole parent and codegree parameter. -/ theorem eventually_prime_highCenters_card_le_H : ∀ᶠ p : PrimeIndex in atTop, ∀ A T : Finset (ZMod (p : ℕ)), A.card = Nat.sqrt (p : ℕ) → T.card ≤ 100 * Nat.sqrt (p : ℕ) → NonzeroCodegreeBound A (Parameters.J (p : ℕ)) → (highCenters A T ((Nat.sqrt (p : ℕ) : ℝ) ^ (3 / 4 : ℝ))).card ≤ Parameters.H (Nat.sqrt (p : ℕ)) := by filter_upwards [Asymptotics.prime_val_tendsto_atTop.eventually eventually_highCenter_coefficient] with p hp intro A T hAk hT hcode exact highCenters_card_le_H hp.1 hAk hT hcode hp.2 /-- On the common input event, every whole parent admits its actual `30H` rank-six cleanup. The choice may depend on the entire realized parent. -/ theorem eventually_prime_whole_parent_multiplicityCleanup : ∀ᶠ p : PrimeIndex in atTop, ∀ A T : Finset (ZMod (p : ℕ)), A.card = Nat.sqrt (p : ℕ) → T.card ≤ 100 * Nat.sqrt (p : ℕ) → NonzeroCodegreeBound A (Parameters.J (p : ℕ)) → UniformMultiplicityCleanup A 6 (30 * Parameters.H (Nat.sqrt (p : ℕ))) (Parameters.H (Nat.sqrt (p : ℕ))) → MultiplicityCleanup A (highCenters A T ((Nat.sqrt (p : ℕ) : ℝ) ^ (3 / 4 : ℝ))) 6 (30 * Parameters.H (Nat.sqrt (p : ℕ))) := by filter_upwards [eventually_prime_highCenters_card_le_H] with p hp intro A T hAk hT hcode hclean exact hclean _ (hp A T hAk hT hcode) end end Green39Submission.HighCenters end Green39AssemblyScope_e2a71b69caf22939 /- Source: Green39Submission.DescriptorAsymptotics; SHA256 096dad6e733438e78364d86d794b4383571b5638b492b3672ae85fcf0616f11f -/ section Green39AssemblyScope_666561fbf86df079 /-! Uniform deterministic size and density consequences for the actual four-set source descriptor. The limits depend only on fixed cap constants, never on a descriptor selection rule or an adaptive posterior. -/ namespace Green39Submission.DescriptorAsymptotics open Filter Topology Parameters Green39Submission.Asymptotics DescriptorPrior open scoped Pointwise noncomputable section def sourceScale (ε : ℝ) (k : ℕ) : ℝ := (k : ℝ) * (k : ℝ) ^ (-ε) def sourceCenter (ε : ℝ) (k : ℕ) : ℝ := 100 * sourceScale ε k def sourceWidth (ε : ℝ) (k : ℕ) : ℝ := (sourceCenter ε k) ^ (3 / 4 : ℝ) def sourceUpper (ε : ℝ) (k : ℕ) : ℝ := sourceCenter ε k + sourceWidth ε k def protectedCap (ε C : ℝ) (k : ℕ) : ℝ := 30 * (H k : ℝ) + 5 * C * sourceScale ε k def removedCap (ε C : ℝ) (k : ℕ) : ℝ := protectedCap ε C k + C * sourceScale ε k * (H k : ℝ) def protectedFraction (ε C : ℝ) (k : ℕ) : ℝ := protectedCap ε C k / (k : ℝ) def removedFraction (ε C : ℝ) (k : ℕ) : ℝ := removedCap ε C k / (k : ℝ) ^ (2 : ℕ) def normalizedSourceUpper (ε : ℝ) (k : ℕ) : ℝ := sourceUpper ε k / sourceScale ε k def normalizedMeanUpper (ε C : ℝ) (k : ℕ) : ℝ := normalizedSourceUpper ε k / (1 - removedFraction ε C k) theorem sourceScale_nonneg (ε : ℝ) (k : ℕ) : 0 ≤ sourceScale ε k := by unfold sourceScale positivity theorem sourceScale_pos (ε : ℝ) {k : ℕ} (hk : 0 < k) : 0 < sourceScale ε k := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk exact mul_pos hk0 (Real.rpow_pos_of_pos hk0 _) theorem sourceScale_eq_rpow (ε : ℝ) {k : ℕ} (hk : 0 < k) : sourceScale ε k = (k : ℝ) ^ (1 - ε) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk rw [Real.rpow_sub hk0, Real.rpow_one] unfold sourceScale rw [Real.rpow_neg hk0.le] rfl theorem sourceScale_tendsto_atTop {ε : ℝ} (hε : ε < 1) : Tendsto (sourceScale ε) atTop atTop := k_mul_rpow_neg_tendsto_atTop hε theorem H_div_rpow_tendsto_zero {b : ℝ} (hb : (5 / 8 : ℝ) < b) : Tendsto (fun k : ℕ => (H k : ℝ) / (k : ℝ) ^ b) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (H k : ℝ) / (k : ℝ) ^ b) (fun k : ℕ => (k : ℝ) ^ (5 / 8 : ℝ) / (k : ℝ) ^ b) := H_equivalent.div _root_.Asymptotics.IsEquivalent.refl exact he.symm.tendsto_nhds (rpow_ratio_tendsto_zero hb) theorem H_div_k_tendsto_zero : Tendsto (fun k : ℕ => (H k : ℝ) / (k : ℝ)) atTop (𝓝 0) := by simpa only [Real.rpow_one] using H_div_rpow_tendsto_zero (by norm_num : (5 / 8 : ℝ) < 1) theorem H_div_sourceScale_tendsto_zero {ε : ℝ} (hε : ε < 3 / 8) : Tendsto (fun k : ℕ => (H k : ℝ) / sourceScale ε k) atTop (𝓝 0) := by apply (H_div_rpow_tendsto_zero (show (5 / 8 : ℝ) < 1 - ε by linarith)).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk rw [sourceScale_eq_rpow ε (lt_of_lt_of_le Nat.zero_lt_one hk)] theorem protectedFraction_nonneg {ε C : ℝ} (hC : 0 ≤ C) (k : ℕ) : 0 ≤ protectedFraction ε C k := by unfold protectedFraction protectedCap exact div_nonneg (add_nonneg (by positivity) (mul_nonneg (by positivity) (sourceScale_nonneg ε k))) (Nat.cast_nonneg _) theorem removedCap_nonneg {ε C : ℝ} (hC : 0 ≤ C) (k : ℕ) : 0 ≤ removedCap ε C k := by unfold removedCap protectedCap have hs := sourceScale_nonneg ε k positivity theorem removedFraction_nonneg {ε C : ℝ} (hC : 0 ≤ C) (k : ℕ) : 0 ≤ removedFraction ε C k := div_nonneg (removedCap_nonneg hC k) (sq_nonneg _) theorem protectedFraction_tendsto_zero {ε : ℝ} (hε : 0 < ε) (C : ℝ) : Tendsto (protectedFraction ε C) atTop (𝓝 0) := by have hh : Tendsto (fun k : ℕ => 30 * ((H k : ℝ) / (k : ℝ)) + (5 * C) * (k : ℝ) ^ (-ε)) atTop (𝓝 0) := by simpa only [mul_zero, zero_add] using (H_div_k_tendsto_zero.const_mul 30).add ((nat_rpow_tendsto_zero (neg_lt_zero.mpr hε)).const_mul (5 * C)) apply hh.congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (k : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt (lt_of_lt_of_le Nat.zero_lt_one hk)) dsimp [protectedFraction, protectedCap, sourceScale] field_simp [hk0] theorem removedFraction_tendsto_zero {ε : ℝ} (hε : 0 < ε) (C : ℝ) : Tendsto (removedFraction ε C) atTop (𝓝 0) := by have hinv : Tendsto (fun k : ℕ => (k : ℝ)⁻¹) atTop (𝓝 0) := by apply (tendsto_natCast_atTop_atTop (R := ℝ)).inv_tendsto_atTop.congr intro k rfl have htheta := nat_rpow_tendsto_zero (neg_lt_zero.mpr hε) have hh : Tendsto (fun k : ℕ => protectedFraction ε C k * (k : ℝ)⁻¹ + C * (((H k : ℝ) / (k : ℝ)) * (k : ℝ) ^ (-ε))) atTop (𝓝 0) := by simpa only [mul_zero, zero_mul, zero_add] using ((protectedFraction_tendsto_zero hε C).mul hinv).add ((H_div_k_tendsto_zero.mul htheta).const_mul C) apply hh.congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (k : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt (lt_of_lt_of_le Nat.zero_lt_one hk)) dsimp [protectedFraction, removedFraction, removedCap, sourceScale] field_simp [hk0] theorem protectedCap_div_sourceScale_tendsto {ε : ℝ} (hε : ε < 3 / 8) (C : ℝ) : Tendsto (fun k : ℕ => protectedCap ε C k / sourceScale ε k) atTop (𝓝 (5 * C)) := by have hh : Tendsto (fun k : ℕ => 30 * ((H k : ℝ) / sourceScale ε k) + 5 * C) atTop (𝓝 (5 * C)) := by simpa only [mul_zero, zero_add] using (H_div_sourceScale_tendsto_zero hε).const_mul 30 |>.add tendsto_const_nhds apply hh.congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hs := sourceScale_pos ε (lt_of_lt_of_le Nat.zero_lt_one hk) dsimp [protectedCap] field_simp [hs.ne'] theorem sourceWidth_ratio_tendsto_zero {ε : ℝ} (hε : ε < 1) : Tendsto (fun k : ℕ => sourceWidth ε k / sourceScale ε k) atTop (𝓝 0) := by have hc : Tendsto (sourceCenter ε) atTop atTop := (sourceScale_tendsto_atTop hε).const_mul_atTop (by norm_num : (0 : ℝ) < 100) have hh : Tendsto (fun k : ℕ => 100 * (sourceCenter ε k) ^ (-1 / 4 : ℝ)) atTop (𝓝 0) := by simpa only [Function.comp_def, mul_zero, neg_div] using ((_root_.tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 1 / 4)).comp hc).const_mul 100 apply hh.congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hs := sourceScale_pos ε (lt_of_lt_of_le Nat.zero_lt_one hk) have hc0 : 0 < sourceCenter ε k := mul_pos (by norm_num) hs rw [show (-1 / 4 : ℝ) = 3 / 4 - 1 by norm_num, Real.rpow_sub hc0, Real.rpow_one] dsimp [sourceWidth, sourceCenter] field_simp [hs.ne'] theorem normalizedSourceUpper_tendsto {ε : ℝ} (hε : ε < 1) : Tendsto (normalizedSourceUpper ε) atTop (𝓝 100) := by have hh : Tendsto (fun k : ℕ => 100 + sourceWidth ε k / sourceScale ε k) atTop (𝓝 100) := by simpa only [add_zero] using tendsto_const_nhds.add (sourceWidth_ratio_tendsto_zero hε) apply hh.congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hs := sourceScale_pos ε (lt_of_lt_of_le Nat.zero_lt_one hk) dsimp [normalizedSourceUpper, sourceUpper, sourceCenter] field_simp [hs.ne'] theorem normalizedMeanUpper_tendsto {ε : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (C : ℝ) : Tendsto (normalizedMeanUpper ε C) atTop (𝓝 100) := by have hd : Tendsto (fun k : ℕ => 1 - removedFraction ε C k) atTop (𝓝 (1 : ℝ)) := by simpa only [sub_zero] using (tendsto_const_nhds (x := (1 : ℝ))).sub (removedFraction_tendsto_zero hε0 C) change Tendsto (fun k : ℕ => normalizedMeanUpper ε C k) atTop (𝓝 100) have hh := (normalizedSourceUpper_tendsto hε1).div hd (by norm_num : (1 : ℝ) ≠ 0) have hh' : Tendsto (fun k : ℕ => normalizedMeanUpper ε C k) atTop (𝓝 ((100 : ℝ) / 1)) := hh.congr (fun k => rfl) simpa only [div_one] using hh' universe u section DescriptorGeometry variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The exact tuple caps; no random law or extraction rule occurs here. -/ structure SizeCaps (ε C : ℝ) (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : Prop where centers : d.1.card ≤ H k exceptional : d.2.1.card ≤ 30 * H k protection : d.2.2.1.card ≤ 30 * H k + 5 * d.2.2.2.card sources : (d.2.2.2.card : ℝ) ≤ C * sourceScale ε k omit [AddCommGroup G] [DecidableEq G] [Fintype G] in theorem SizeCaps.of_actual_protection {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hD : d.1.card ≤ H k) (hE : d.2.1.card ≤ 30 * H k) (hP : d.2.2.1.card ≤ d.2.1.card + 5 * d.2.2.2.card) (hS : (d.2.2.2.card : ℝ) ≤ C * sourceScale ε k) : SizeCaps ε C k d := ⟨hD, hE, hP.trans (Nat.add_le_add_right hE _), hS⟩ def NarrowWindow (ε : ℝ) (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : Prop := |(d.2.2.2.card : ℝ) - sourceCenter ε k| ≤ sourceWidth ε k def UpperWindow (ε : ℝ) (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : Prop := (d.2.2.2.card : ℝ) ≤ sourceUpper ε k def remainderSize (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : ℕ := k - d.2.2.1.card def freeSize (d : Finset G × Finset G × Finset G × Finset G) : ℕ := (sourceFreeUniverse d).card def priorDensity (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : ℝ := (remainderSize k d : ℝ) / (freeSize d : ℝ) theorem translated_free_card_bounds (d : Finset G × Finset G × Finset G × Finset G) (x : G) : ((d.2.2.2.image (fun t => x - t)) ∩ sourceFreeUniverse d).card ≤ d.2.2.2.card ∧ ((d.2.2.2.image (fun t => x - t)) ∩ sourceFreeUniverse d).card ≤ freeSize d := by constructor · exact (Finset.card_le_card Finset.inter_subset_left).trans Finset.card_image_le · exact Finset.card_le_card Finset.inter_subset_right omit [AddCommGroup G] [DecidableEq G] [Fintype G] in theorem SizeCaps.protected_card_le {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (h : SizeCaps ε C k d) : (d.2.2.1.card : ℝ) ≤ protectedCap ε C k := by have hp : (d.2.2.1.card : ℝ) ≤ 30 * (H k : ℝ) + 5 * (d.2.2.2.card : ℝ) := by exact_mod_cast h.protection have hs := h.sources dsimp [protectedCap] linarith omit [Fintype G] in theorem SizeCaps.removed_card_le {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (h : SizeCaps ε C k d) : ((d.2.2.1 ∪ sourceForbidden d).card : ℝ) ≤ removedCap ε C k := by have hf : (sourceForbidden d).card ≤ d.2.2.2.card * d.1.card := Finset.card_sub_le have hu : ((d.2.2.1 ∪ sourceForbidden d).card : ℝ) ≤ (d.2.2.1.card : ℝ) + (sourceForbidden d).card := by exact_mod_cast Finset.card_union_le d.2.2.1 (sourceForbidden d) have hf' : ((sourceForbidden d).card : ℝ) ≤ (d.2.2.2.card : ℝ) * (d.1.card : ℝ) := by exact_mod_cast hf have hd : (d.1.card : ℝ) ≤ H k := by exact_mod_cast h.centers have hmul := mul_le_mul h.sources hd (Nat.cast_nonneg d.1.card) ((Nat.cast_nonneg d.2.2.2.card).trans h.sources) have hp := h.protected_card_le dsimp [removedCap] linarith theorem freeSize_add_removed (d : Finset G × Finset G × Finset G × Finset G) : freeSize d + (d.2.2.1 ∪ sourceForbidden d).card = Fintype.card G := by simpa only [freeSize, sourceFreeUniverse, freeUniverse, Finset.card_univ] using Finset.card_sdiff_add_card_eq_card (Finset.subset_univ (d.2.2.1 ∪ sourceForbidden d)) theorem freeSize_le_card (d : Finset G × Finset G × Finset G × Finset G) : freeSize d ≤ Fintype.card G := by have h := freeSize_add_removed d omega omit [AddCommGroup G] [DecidableEq G] [Fintype G] in theorem remainderSize_le (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : remainderSize k d ≤ k := Nat.sub_le _ _ theorem freeSize_lower {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hC : 0 ≤ C) (hk : 0 < k) (hkp : k ^ 2 ≤ Fintype.card G) (h : SizeCaps ε C k d) : (1 - removedFraction ε C k) * (Fintype.card G : ℝ) ≤ (freeSize d : ℝ) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hkp' : (k : ℝ) ^ (2 : ℕ) ≤ (Fintype.card G : ℝ) := by exact_mod_cast hkp have hp0 : (0 : ℝ) < Fintype.card G := (sq_pos_of_pos hk0).trans_le hkp' have hdiv : removedCap ε C k / (Fintype.card G : ℝ) ≤ removedFraction ε C k := div_le_div_of_nonneg_left (removedCap_nonneg hC k) (sq_pos_of_pos hk0) hkp' have hcap : removedCap ε C k ≤ removedFraction ε C k * (Fintype.card G : ℝ) := (div_le_iff₀ hp0).mp hdiv have hr := h.removed_card_le have he : (freeSize d : ℝ) + ((d.2.2.1 ∪ sourceForbidden d).card : ℝ) = (Fintype.card G : ℝ) := by exact_mod_cast freeSize_add_removed d nlinarith theorem freeSize_ratio_error_le {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hC : 0 ≤ C) (hk : 0 < k) (hkp : k ^ 2 ≤ Fintype.card G) (h : SizeCaps ε C k d) : |(freeSize d : ℝ) / (Fintype.card G : ℝ) - 1| ≤ removedFraction ε C k := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hkp' : (k : ℝ) ^ (2 : ℕ) ≤ (Fintype.card G : ℝ) := by exact_mod_cast hkp have hp0 : (0 : ℝ) < Fintype.card G := (sq_pos_of_pos hk0).trans_le hkp' have hlo := (le_div_iff₀ hp0).mpr (freeSize_lower hC hk hkp h) have hhi : (freeSize d : ℝ) / (Fintype.card G : ℝ) ≤ 1 := by apply (div_le_one hp0).mpr exact_mod_cast freeSize_le_card d rw [abs_of_nonpos (sub_nonpos.mpr hhi)] linarith omit [AddCommGroup G] [DecidableEq G] [Fintype G] in theorem remainderSize_ratio_error_le {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hk : 0 < k) (hPk : d.2.2.1.card ≤ k) (h : SizeCaps ε C k d) : |(remainderSize k d : ℝ) / (k : ℝ) - 1| ≤ protectedFraction ε C k := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hn : (remainderSize k d : ℝ) = (k : ℝ) - (d.2.2.1.card : ℝ) := Nat.cast_sub hPk have he : (remainderSize k d : ℝ) / (k : ℝ) - 1 = -(d.2.2.1.card : ℝ) / (k : ℝ) := by rw [hn] field_simp [hk0.ne'] ring rw [he, neg_div, abs_neg, abs_of_nonneg (div_nonneg (Nat.cast_nonneg _) hk0.le)] exact div_le_div_of_nonneg_right h.protected_card_le hk0.le /-- Every denominator and feasibility condition used by the exact prior is explicit. -/ structure PriorSizeBounds (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : Prop where parameter_two : 2 ≤ k protected_le : d.2.2.1.card ≤ k remainder_half : (k : ℝ) / 2 ≤ (remainderSize k d : ℝ) remainder_le : remainderSize k d ≤ k free_half : (Fintype.card G : ℝ) / 2 ≤ (freeSize d : ℝ) square_le_twice_free : (k : ℝ) ^ (2 : ℕ) ≤ 2 * (freeSize d : ℝ) free_le : freeSize d ≤ Fintype.card G remainder_le_free : remainderSize k d ≤ freeSize d remainder_pos : 0 < remainderSize k d free_pos : 0 < freeSize d density_pos : 0 < priorDensity k d density_le : priorDensity k d ≤ 2 / (k : ℝ) theorem priorSizeBounds_of_small_errors {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hC : 0 ≤ C) (hk : 2 ≤ k) (hkp : k ^ 2 ≤ Fintype.card G) (h : SizeCaps ε C k d) (hPsmall : protectedFraction ε C k ≤ 1 / 2) (hRsmall : removedFraction ε C k ≤ 1 / 2) : PriorSizeBounds k d := by have hkpos : 0 < k := by omega have hk0 : (0 : ℝ) < k := by exact_mod_cast hkpos have hk2 : (2 : ℝ) ≤ k := by exact_mod_cast hk have hkp' : (k : ℝ) ^ (2 : ℕ) ≤ (Fintype.card G : ℝ) := by exact_mod_cast hkp have hp0 : (0 : ℝ) < Fintype.card G := (sq_pos_of_pos hk0).trans_le hkp' have hPcap : protectedCap ε C k ≤ (k : ℝ) / 2 := by have hh := (div_le_iff₀ hk0).mp hPsmall linarith have hPr : (d.2.2.1.card : ℝ) ≤ (k : ℝ) / 2 := h.protected_card_le.trans hPcap have hPk : d.2.2.1.card ≤ k := by exact_mod_cast (hPr.trans (by linarith : (k : ℝ) / 2 ≤ k)) have hn : (remainderSize k d : ℝ) = (k : ℝ) - (d.2.2.1.card : ℝ) := Nat.cast_sub hPk have hnhalf : (k : ℝ) / 2 ≤ (remainderSize k d : ℝ) := by linarith have hvhalf : (Fintype.card G : ℝ) / 2 ≤ (freeSize d : ℝ) := by have hlow := freeSize_lower hC hkpos hkp h nlinarith have hn0 : (0 : ℝ) < remainderSize k d := (div_pos hk0 (by norm_num)).trans_le hnhalf have hv0 : (0 : ℝ) < freeSize d := (div_pos hp0 (by norm_num)).trans_le hvhalf have hnk : (remainderSize k d : ℝ) ≤ k := by exact_mod_cast remainderSize_le k d have hnv : remainderSize k d ≤ freeSize d := by have : (remainderSize k d : ℝ) ≤ freeSize d := by nlinarith exact_mod_cast this have hrho : priorDensity k d ≤ 2 / (k : ℝ) := by have hvk : (k : ℝ) ^ (2 : ℕ) / 2 ≤ (freeSize d : ℝ) := by linarith calc priorDensity k d ≤ (k : ℝ) / (freeSize d : ℝ) := div_le_div_of_nonneg_right hnk hv0.le _ ≤ (k : ℝ) / ((k : ℝ) ^ (2 : ℕ) / 2) := div_le_div_of_nonneg_left hk0.le (div_pos (sq_pos_of_pos hk0) (by norm_num)) hvk _ = 2 / (k : ℝ) := by field_simp [hk0.ne'] exact ⟨hk, hPk, hnhalf, remainderSize_le k d, hvhalf, by linarith, freeSize_le_card d, hnv, by exact_mod_cast hn0, by exact_mod_cast hv0, div_pos hn0 hv0, hrho⟩ theorem sourcePrior_nonempty_of_bounds {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (h : PriorSizeBounds k d) : (sourcePrior k d).Nonempty := exactSlice_nonempty.mpr h.remainder_le_free omit [AddCommGroup G] [DecidableEq G] [Fintype G] in theorem narrow_source_card_le {ε : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (h : NarrowWindow ε k d) : (d.2.2.2.card : ℝ) ≤ sourceUpper ε k := by have hh := (abs_le.mp h).2 dsimp [sourceUpper] linarith theorem normalized_free_mean_le_of_upper {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hC : 0 ≤ C) (hk : 0 < k) (hkp : k ^ 2 ≤ Fintype.card G) (h : SizeCaps ε C k d) (hwindow : UpperWindow ε k d) (hR : removedFraction ε C k < 1) : priorDensity k d * (d.2.2.2.card : ℝ) / (k : ℝ) ^ (-ε) ≤ normalizedMeanUpper ε C k := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have htheta : 0 < (k : ℝ) ^ (-ε) := Real.rpow_pos_of_pos hk0 _ have hden : 0 < 1 - removedFraction ε C k := sub_pos.mpr hR have hkp' : (k : ℝ) ^ (2 : ℕ) ≤ (Fintype.card G : ℝ) := by exact_mod_cast hkp have hvlow : (k : ℝ) ^ (2 : ℕ) * (1 - removedFraction ε C k) ≤ (freeSize d : ℝ) := by have hv := freeSize_lower hC hk hkp h have hm := mul_le_mul_of_nonneg_left hkp' hden.le nlinarith have hv0 : (0 : ℝ) < freeSize d := (mul_pos (sq_pos_of_pos hk0) hden).trans_le hvlow have hrho : priorDensity k d ≤ 1 / ((k : ℝ) * (1 - removedFraction ε C k)) := by have hnk : (remainderSize k d : ℝ) ≤ k := by exact_mod_cast remainderSize_le k d calc priorDensity k d ≤ (k : ℝ) / (freeSize d : ℝ) := div_le_div_of_nonneg_right hnk hv0.le _ ≤ (k : ℝ) / ((k : ℝ) ^ (2 : ℕ) * (1 - removedFraction ε C k)) := div_le_div_of_nonneg_left hk0.le (mul_pos (sq_pos_of_pos hk0) hden) hvlow _ = 1 / ((k : ℝ) * (1 - removedFraction ε C k)) := by field_simp [hk0.ne', hden.ne'] have hm := mul_le_mul hrho hwindow (Nat.cast_nonneg _) (div_nonneg (by norm_num) (mul_nonneg hk0.le hden.le)) calc priorDensity k d * (d.2.2.2.card : ℝ) / (k : ℝ) ^ (-ε) ≤ (1 / ((k : ℝ) * (1 - removedFraction ε C k))) * sourceUpper ε k / (k : ℝ) ^ (-ε) := div_le_div_of_nonneg_right hm htheta.le _ = normalizedMeanUpper ε C k := by dsimp [normalizedMeanUpper, normalizedSourceUpper, sourceScale] field_simp [hk0.ne', htheta.ne', hden.ne'] theorem normalized_free_mean_le {ε C : ℝ} {k : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hC : 0 ≤ C) (hk : 0 < k) (hkp : k ^ 2 ≤ Fintype.card G) (h : SizeCaps ε C k d) (hwindow : NarrowWindow ε k d) (hR : removedFraction ε C k < 1) : priorDensity k d * (d.2.2.2.card : ℝ) / (k : ℝ) ^ (-ε) ≤ normalizedMeanUpper ε C k := normalized_free_mean_le_of_upper hC hk hkp h (narrow_source_card_le hwindow) hR theorem normalized_subsource_mean_le_of_upper {ε C : ℝ} {k q : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hC : 0 ≤ C) (hk : 0 < k) (hkp : k ^ 2 ≤ Fintype.card G) (h : SizeCaps ε C k d) (hwindow : UpperWindow ε k d) (hR : removedFraction ε C k < 1) (hq : q ≤ d.2.2.2.card) : priorDensity k d * (q : ℝ) / (k : ℝ) ^ (-ε) ≤ normalizedMeanUpper ε C k := by have hrho : 0 ≤ priorDensity k d := div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _) have hq' : (q : ℝ) ≤ d.2.2.2.card := by exact_mod_cast hq exact (div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hq' hrho) (Real.rpow_nonneg (Nat.cast_nonneg _) _)).trans (normalized_free_mean_le_of_upper hC hk hkp h hwindow hR) theorem normalized_subsource_mean_le {ε C : ℝ} {k q : ℕ} {d : Finset G × Finset G × Finset G × Finset G} (hC : 0 ≤ C) (hk : 0 < k) (hkp : k ^ 2 ≤ Fintype.card G) (h : SizeCaps ε C k d) (hwindow : NarrowWindow ε k d) (hR : removedFraction ε C k < 1) (hq : q ≤ d.2.2.2.card) : priorDensity k d * (q : ℝ) / (k : ℝ) ^ (-ε) ≤ normalizedMeanUpper ε C k := normalized_subsource_mean_le_of_upper hC hk hkp h (narrow_source_card_le hwindow) hR hq end DescriptorGeometry /-- The finite group and descriptor are both quantified after the eventual threshold. In particular the ambient group may change with k or p. -/ theorem eventually_uniform_prior_size_bounds {ε C : ℝ} (hε : 0 < ε) (hC : 0 ≤ C) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, k ^ 2 ≤ Fintype.card G → SizeCaps ε C k d → PriorSizeBounds k d := by have hp := (tendsto_order.1 (protectedFraction_tendsto_zero hε C)).2 (1 / 2) (by norm_num) have hr := (tendsto_order.1 (removedFraction_tendsto_zero hε C)).2 (1 / 2) (by norm_num) filter_upwards [hp, hr, eventually_ge_atTop (2 : ℕ)] with k hpk hrk hk intro G _ _ _ d hkp hd exact priorSizeBounds_of_small_errors hC hk hkp hd hpk.le hrk.le theorem eventually_uniform_prior_ratios {ε C η : ℝ} (hε : 0 < ε) (hC : 0 ≤ C) (hη : 0 < η) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, k ^ 2 ≤ Fintype.card G → SizeCaps ε C k d → |(remainderSize k d : ℝ) / (k : ℝ) - 1| ≤ η ∧ |(freeSize d : ℝ) / (Fintype.card G : ℝ) - 1| ≤ η := by have hp := (tendsto_order.1 (protectedFraction_tendsto_zero hε C)).2 η hη have hr := (tendsto_order.1 (removedFraction_tendsto_zero hε C)).2 η hη filter_upwards [eventually_uniform_prior_size_bounds hε hC, hp, hr] with k hb hpk hrk intro G _ _ _ d hkp hd have hs := hb G d hkp hd have hk : 0 < k := by have := hs.parameter_two; omega exact ⟨(remainderSize_ratio_error_le hk hs.protected_le hd).trans hpk.le, (freeSize_ratio_error_le hC hk hkp hd).trans hrk.le⟩ theorem eventually_upper_sources_le_two_hundred {ε : ℝ} (hε : ε < 1) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, UpperWindow ε k d → (d.2.2.2.card : ℝ) ≤ 200 * sourceScale ε k := by have hu := (tendsto_order.1 (normalizedSourceUpper_tendsto hε)).2 200 (by norm_num) filter_upwards [hu, eventually_ge_atTop (1 : ℕ)] with k huk hk intro G _ _ _ d hd have hs := sourceScale_pos ε (lt_of_lt_of_le Nat.zero_lt_one hk) have hupper : sourceUpper ε k ≤ 200 * sourceScale ε k := (div_le_iff₀ hs).mp huk.le exact hd.trans hupper theorem eventually_narrow_sources_le_two_hundred {ε : ℝ} (hε : ε < 1) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, NarrowWindow ε k d → (d.2.2.2.card : ℝ) ≤ 200 * sourceScale ε k := by filter_upwards [eventually_upper_sources_le_two_hundred hε] with k hk intro G _ _ _ d hd exact hk G d (narrow_source_card_le hd) theorem eventually_uniform_normalized_mean_upper_of_upper {ε C ξ : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (hC : 0 ≤ C) (hξ : 0 < ξ) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, k ^ 2 ≤ Fintype.card G → SizeCaps ε C k d → UpperWindow ε k d → ∀ q : ℕ, q ≤ d.2.2.2.card → priorDensity k d * (q : ℝ) / (k : ℝ) ^ (-ε) ≤ 100 + ξ := by have hu := (tendsto_order.1 (normalizedMeanUpper_tendsto hε0 hε1 C)).2 (100 + ξ) (by linarith) have hr := (tendsto_order.1 (removedFraction_tendsto_zero hε0 C)).2 1 (by norm_num) filter_upwards [hu, hr, eventually_ge_atTop (1 : ℕ)] with k huk hrk hk intro G _ _ _ d hkp hd hwindow q hq exact (normalized_subsource_mean_le_of_upper hC (lt_of_lt_of_le Nat.zero_lt_one hk) hkp hd hwindow hrk hq).trans huk.le theorem eventually_uniform_normalized_mean_upper {ε C ξ : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (hC : 0 ≤ C) (hξ : 0 < ξ) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, k ^ 2 ≤ Fintype.card G → SizeCaps ε C k d → NarrowWindow ε k d → ∀ q : ℕ, q ≤ d.2.2.2.card → priorDensity k d * (q : ℝ) / (k : ℝ) ^ (-ε) ≤ 100 + ξ := by filter_upwards [eventually_uniform_normalized_mean_upper_of_upper hε0 hε1 hC hξ] with k hk intro G _ _ _ d hkp hd hwindow exact hk G d hkp hd (narrow_source_card_le hwindow) theorem source_theta_pos_le_one {ε : ℝ} {k : ℕ} (hε : 0 ≤ ε) (hk : 1 ≤ k) : 0 < (k : ℝ) ^ (-ε) ∧ (k : ℝ) ^ (-ε) ≤ 1 := by have hk1 : (1 : ℝ) ≤ k := by exact_mod_cast hk have hk0 : (0 : ℝ) < k := zero_lt_one.trans_le hk1 refine ⟨Real.rpow_pos_of_pos hk0 _, ?_⟩ have hh := Real.rpow_le_rpow_of_exponent_le hk1 (neg_nonpos.mpr hε) simpa only [Real.rpow_zero] using hh /-- All numeric CAL premises, uniformly over actual descriptor priors. The remaining condition q≤|U| is a finite containment fact for the local test set. -/ theorem eventually_uniform_calibration_parameters_of_upper {ε C ξ δ : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (hC : 0 ≤ C) (hξ : 0 < ξ) (hδ : 0 < δ) (minRank : ℕ) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, k ^ 2 ≤ Fintype.card G → SizeCaps ε C k d → UpperWindow ε k d → PriorSizeBounds k d ∧ minRank ≤ remainderSize k d ∧ 0 < (k : ℝ) ^ (-ε) ∧ (k : ℝ) ^ (-ε) ≤ 1 ∧ (k : ℝ) ^ (-ε) + 1 / ((k : ℝ) * (k : ℝ) ^ (-ε)) ≤ δ ∧ ∀ q : ℕ, q ≤ d.2.2.2.card → priorDensity k d * (q : ℝ) / (k : ℝ) ^ (-ε) ≤ 100 + ξ := by have hc := (tendsto_order.1 (calibrationError_tendsto_zero hε0 hε1)).2 δ hδ filter_upwards [eventually_uniform_prior_size_bounds hε0 hC, eventually_uniform_normalized_mean_upper_of_upper hε0 hε1 hC hξ, hc, eventually_ge_atTop (2 * minRank)] with k hb hm hcal hkRank intro G _ _ _ d hkp hd hwindow have hs := hb G d hkp hd have hRank : minRank ≤ remainderSize k d := by have hkr : 2 * (minRank : ℝ) ≤ k := by exact_mod_cast hkRank have hn := hs.remainder_half have : (minRank : ℝ) ≤ remainderSize k d := by linarith exact_mod_cast this have htheta := source_theta_pos_le_one hε0.le (le_trans (by norm_num) hs.parameter_two) exact ⟨hs, hRank, htheta.1, htheta.2, hcal.le, hm G d hkp hd hwindow⟩ theorem eventually_uniform_calibration_parameters {ε C ξ δ : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (hC : 0 ≤ C) (hξ : 0 < ξ) (hδ : 0 < δ) (minRank : ℕ) : ∀ᶠ k : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, k ^ 2 ≤ Fintype.card G → SizeCaps ε C k d → NarrowWindow ε k d → PriorSizeBounds k d ∧ minRank ≤ remainderSize k d ∧ 0 < (k : ℝ) ^ (-ε) ∧ (k : ℝ) ^ (-ε) ≤ 1 ∧ (k : ℝ) ^ (-ε) + 1 / ((k : ℝ) * (k : ℝ) ^ (-ε)) ≤ δ ∧ ∀ q : ℕ, q ≤ d.2.2.2.card → priorDensity k d * (q : ℝ) / (k : ℝ) ^ (-ε) ≤ 100 + ξ := by filter_upwards [eventually_uniform_calibration_parameters_of_upper hε0 hε1 hC hξ hδ minRank] with k hk intro G _ _ _ d hkp hd hwindow exact hk G d hkp hd (narrow_source_card_le hwindow) theorem eventually_uniform_sqrt_prior_size_bounds {ε C : ℝ} (hε : 0 < ε) (hC : 0 ≤ C) : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, Fintype.card G = p → SizeCaps ε C (Nat.sqrt p) d → PriorSizeBounds (Nat.sqrt p) d := by filter_upwards [nat_sqrt_tendsto_atTop.eventually (eventually_uniform_prior_size_bounds hε hC)] with p hp intro G _ _ _ d hcard hd exact hp G d (hcard ▸ Nat.sqrt_le' p) hd theorem eventually_uniform_sqrt_calibration_parameters {ε C ξ δ : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (hC : 0 ≤ C) (hξ : 0 < ξ) (hδ : 0 < δ) (minRank : ℕ) : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, Fintype.card G = p → SizeCaps ε C (Nat.sqrt p) d → NarrowWindow ε (Nat.sqrt p) d → PriorSizeBounds (Nat.sqrt p) d ∧ minRank ≤ remainderSize (Nat.sqrt p) d ∧ 0 < (Nat.sqrt p : ℝ) ^ (-ε) ∧ (Nat.sqrt p : ℝ) ^ (-ε) ≤ 1 ∧ (Nat.sqrt p : ℝ) ^ (-ε) + 1 / ((Nat.sqrt p : ℝ) * (Nat.sqrt p : ℝ) ^ (-ε)) ≤ δ ∧ ∀ q : ℕ, q ≤ d.2.2.2.card → priorDensity (Nat.sqrt p) d * (q : ℝ) / (Nat.sqrt p : ℝ) ^ (-ε) ≤ 100 + ξ := by filter_upwards [nat_sqrt_tendsto_atTop.eventually (eventually_uniform_calibration_parameters hε0 hε1 hC hξ hδ minRank)] with p hp intro G _ _ _ d hcard hd hwindow exact hp G d (hcard ▸ Nat.sqrt_le' p) hd hwindow theorem eventually_uniform_sqrt_calibration_parameters_of_upper {ε C ξ δ : ℝ} (hε0 : 0 < ε) (hε1 : ε < 1) (hC : 0 ≤ C) (hξ : 0 < ξ) (hδ : 0 < δ) (minRank : ℕ) : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, Fintype.card G = p → SizeCaps ε C (Nat.sqrt p) d → UpperWindow ε (Nat.sqrt p) d → PriorSizeBounds (Nat.sqrt p) d ∧ minRank ≤ remainderSize (Nat.sqrt p) d ∧ 0 < (Nat.sqrt p : ℝ) ^ (-ε) ∧ (Nat.sqrt p : ℝ) ^ (-ε) ≤ 1 ∧ (Nat.sqrt p : ℝ) ^ (-ε) + 1 / ((Nat.sqrt p : ℝ) * (Nat.sqrt p : ℝ) ^ (-ε)) ≤ δ ∧ ∀ q : ℕ, q ≤ d.2.2.2.card → priorDensity (Nat.sqrt p) d * (q : ℝ) / (Nat.sqrt p : ℝ) ^ (-ε) ≤ 100 + ξ := by filter_upwards [nat_sqrt_tendsto_atTop.eventually (eventually_uniform_calibration_parameters_of_upper hε0 hε1 hC hξ hδ minRank)] with p hp intro G _ _ _ d hcard hd hwindow exact hp G d (hcard ▸ Nat.sqrt_le' p) hd hwindow end end Green39Submission.DescriptorAsymptotics end Green39AssemblyScope_666561fbf86df079 /- Source: Green39Submission.RichStarAsymptotics; SHA256 9402aaf49d7dd834555683bc64de9bc5150e9fa26a901cac05aa10073e913277 -/ section Green39AssemblyScope_bf2b04e625b0145d /-! Concrete parameter estimates for rich-star source extraction. Every source correction uses the actual finite binomial profile. The fixed degree is kept symbolic; no enumeration of its range is performed by the proof elaborator. -/ noncomputable section namespace Green39Submission.RichStarAsymptotics open Filter Topology open scoped BigOperators open Parameters Green39Submission.Asymptotics def chooseConstant (r : ℕ) : ℝ := 1 / ((2 : ℝ) ^ r * (r.factorial : ℝ)) theorem chooseConstant_pos (r : ℕ) : 0 < chooseConstant r := by unfold chooseConstant exact one_div_pos.mpr (mul_pos (pow_pos (by norm_num) _) (by exact_mod_cast Nat.factorial_pos r)) /-- The exact total chosen-star scale, before internal-alias losses. -/ def starScale (k : ℕ) : ℝ := (nStar k : ℝ) * ((M1 k).choose ell : ℝ) /-- The exact sharp zeroth rooted derivative used in the deletion threshold. -/ def rootScale (k : ℕ) : ℝ := 100 * (k : ℝ) * ((M1 k - 1).choose (ell - 1) : ℝ) def momentOrder (k : ℕ) : ℕ := ⌊(k : ℝ) ^ eta1⌋₊ def ordinaryCap (k : ℕ) : ℕ := ⌊(k : ℝ) ^ (3 / 4 : ℝ)⌋₊ theorem shifted_M1_tendsto_atTop (s : ℕ) : Tendsto (fun k => M1 k - s) atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [M1_tendsto_atTop.eventually_ge_atTop (b + s)] with k hk omega theorem shifted_M1_equivalent (s : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((M1 k - s : ℕ) : ℝ)) (fun k : ℕ => (k : ℝ) ^ alpha / 2) := by have hM : Tendsto (fun k : ℕ => (M1 k : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp M1_tendsto_atTop have hsmall : Tendsto (fun k : ℕ => (s : ℝ) / (M1 k : ℝ)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop hM have hratio : Tendsto (fun k : ℕ => ((M1 k - s : ℕ) : ℝ) / (M1 k : ℝ)) atTop (𝓝 1) := by apply (show Tendsto (fun k : ℕ => 1 - (s : ℝ) / (M1 k : ℝ)) atTop (𝓝 1) by simpa only [sub_zero] using tendsto_const_nhds.sub hsmall).congr' filter_upwards [M1_tendsto_atTop.eventually_ge_atTop (max s 1)] with k hk have hs : s ≤ M1 k := (le_max_left _ _).trans hk have hm : (0 : ℝ) < M1 k := by exact_mod_cast (Nat.zero_lt_one.trans_le ((le_max_right s 1).trans hk)) rw [Nat.cast_sub hs] field_simp [hm.ne'] exact (_root_.Asymptotics.isEquivalent_of_tendsto_one hratio).trans M1_equivalent /-- Fixed shifted binomial coefficients retain their exact leading constants. -/ theorem shifted_choose_M1_equivalent (s r : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((M1 k - s).choose r : ℝ)) (fun k : ℕ => chooseConstant r * (k : ℝ) ^ (alpha * (r : ℝ))) := by have hchoose := (isEquivalent_choose r).comp_tendsto (shifted_M1_tendsto_atTop s) have hscaled := ((shifted_M1_equivalent s).pow r).div (_root_.Asymptotics.IsEquivalent.refl (u := fun _ : ℕ => (r.factorial : ℝ))) apply (hchoose.trans hscaled).congr_right exact Eventually.of_forall fun k => by change ((k : ℝ) ^ alpha / 2) ^ r / (r.factorial : ℝ) = _ rw [div_pow, ← Real.rpow_mul_natCast (Nat.cast_nonneg k)] simp only [chooseConstant, div_eq_mul_inv, mul_inv_rev, one_mul] ring theorem starScale_equivalent : _root_.Asymptotics.IsEquivalent atTop starScale (fun k : ℕ => (chooseConstant ell / 2) * (k : ℝ) ^ (2 - delta + alpha * (ell : ℝ))) := by have hchoose : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((M1 k).choose ell : ℝ)) (fun k : ℕ => chooseConstant ell * (k : ℝ) ^ (alpha * (ell : ℝ))) := by simpa only [Nat.sub_zero] using shifted_choose_M1_equivalent 0 ell apply (nStar_equivalent.mul hchoose).congr_right filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk change (k : ℝ) ^ (2 - delta) / 2 * (chooseConstant ell * (k : ℝ) ^ (alpha * (ell : ℝ))) = _ rw [Real.rpow_add hk0] ring theorem rootScale_equivalent : _root_.Asymptotics.IsEquivalent atTop rootScale (fun k : ℕ => (100 * chooseConstant (ell - 1)) * (k : ℝ) ^ (1 + alpha * ((ell - 1 : ℕ) : ℝ))) := by have he : _root_.Asymptotics.IsEquivalent atTop rootScale (fun k : ℕ => 100 * (k : ℝ) * (chooseConstant (ell - 1) * (k : ℝ) ^ (alpha * ((ell - 1 : ℕ) : ℝ)))) := _root_.Asymptotics.IsEquivalent.refl.mul (shifted_choose_M1_equivalent 1 (ell - 1)) apply he.congr_right filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk rw [Real.rpow_add hk0, Real.rpow_one] ring /-- Algebraic combination of concrete monomial equivalents, including division. -/ theorem rpow_mul_div_equivalent {f g : ℕ → ℝ} {a b c d : ℝ} (hf : _root_.Asymptotics.IsEquivalent atTop f (fun k : ℕ => c * (k : ℝ) ^ a)) (hg : _root_.Asymptotics.IsEquivalent atTop g (fun k : ℕ => d * (k : ℝ) ^ b)) (u : ℝ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) ^ u * f k / g k) (fun k : ℕ => (c / d) * (k : ℝ) ^ (u + a - b)) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) ^ u * f k / g k) (fun k : ℕ => (k : ℝ) ^ u * (c * (k : ℝ) ^ a) / (d * (k : ℝ) ^ b)) := (_root_.Asymptotics.IsEquivalent.refl.mul hf).div hg apply he.congr_right filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk rw [Real.rpow_sub hk0, Real.rpow_add hk0] simp only [div_eq_mul_inv, mul_inv_rev] ring theorem tendsto_zero_of_monomial_equivalent {f : ℕ → ℝ} {c a : ℝ} (hf : _root_.Asymptotics.IsEquivalent atTop f (fun k => c * (k : ℝ) ^ a)) (ha : a < 0) : Tendsto f atTop (𝓝 0) := by apply hf.symm.tendsto_nhds simpa only [mul_zero] using (nat_rpow_tendsto_zero ha).const_mul c theorem J_mul_tendsto_zero_of_monomial_equivalent {f : ℕ → ℝ} {c a : ℝ} (hf : _root_.Asymptotics.IsEquivalent atTop f (fun k => c * (k : ℝ) ^ a)) (ha : a < 0) : Tendsto (fun p : ℕ => (J p : ℝ) * f (Nat.sqrt p)) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun p : ℕ => (J p : ℝ) * f (Nat.sqrt p)) (fun p : ℕ => (J p : ℝ) * (c * (Nat.sqrt p : ℝ) ^ a)) := _root_.Asymptotics.IsEquivalent.refl.mul (hf.comp_tendsto nat_sqrt_tendsto_atTop) apply he.symm.tendsto_nhds simpa only [mul_assoc, mul_comm, mul_left_comm, mul_zero] using (J_mul_sqrt_rpow_tendsto_zero ha).const_mul c theorem inv_theta1_pow {k : ℕ} (_hk : 0 < k) (j : ℕ) : (theta1 k ^ j)⁻¹ = (k : ℝ) ^ (epsilon1 * (j : ℝ)) := by unfold theta1 rw [← Real.rpow_mul_natCast (Nat.cast_nonneg k), ← Real.rpow_neg (Nat.cast_nonneg k)] congr 1 ring theorem chosen_first_ratio_tendsto_zero : Tendsto (fun k : ℕ => (k : ℝ) ^ (epsilon1 + 1) * ((M1 k - 1).choose (ell - 1) : ℝ) / starScale k) atTop (𝓝 0) := by have he := rpow_mul_div_equivalent (shifted_choose_M1_equivalent 1 (ell - 1)) starScale_equivalent (epsilon1 + 1) apply tendsto_zero_of_monomial_equivalent he have hell : (1 : ℕ) ≤ ell := ell_pos rw [Nat.cast_sub hell, Nat.cast_one] nlinarith [rich_variance_one_neg] theorem chosen_higher_ratio_equivalent (j : ℕ) (hj : j ≤ ell) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (k : ℝ) ^ (epsilon1 * (j : ℝ)) * ((M1 k - j).choose (ell - j) : ℝ) / starScale k) (fun k : ℕ => (chooseConstant (ell - j) / (chooseConstant ell / 2)) * (k : ℝ) ^ (-2 + delta + (j : ℝ) * (epsilon1 - alpha))) := by have he := rpow_mul_div_equivalent (shifted_choose_M1_equivalent j (ell - j)) starScale_equivalent (epsilon1 * (j : ℝ)) convert he using 1 ext k rw [Nat.cast_sub hj] congr 2 ring theorem chosen_profile_ratio_tendsto_zero (j : ℕ) (hj : 1 ≤ j) (hjd : j ≤ ell) : Tendsto (fun p : ℕ => RichStar.chosenStarDerivativeBound (Nat.sqrt p) (J p) (M1 (Nat.sqrt p)) ell 0 (theta1 (Nat.sqrt p)) j / starScale (Nat.sqrt p)) atTop (𝓝 0) := by by_cases hj1 : j = 1 · subst j apply (chosen_first_ratio_tendsto_zero.comp nat_sqrt_tendsto_atTop).congr' filter_upwards [nat_sqrt_tendsto_atTop.eventually_ge_atTop 1] with p hp have hk : 0 < Nat.sqrt p := Nat.zero_lt_one.trans_le hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hk simp only [RichStar.chosenStarDerivativeBound, show (1 : ℕ) ≠ 0 by decide, if_false, if_pos hjd, if_true, Nat.cast_mul, inv_theta1_pow hk, Nat.cast_one, mul_one, Function.comp_def] rw [Real.rpow_add hk0, Real.rpow_one] ring · have he := chosen_higher_ratio_equivalent j hjd have hz := J_mul_tendsto_zero_of_monomial_equivalent he (rich_variance_exponent_neg hjd) apply hz.congr' filter_upwards [nat_sqrt_tendsto_atTop.eventually_ge_atTop 1] with p hp have hk : 0 < Nat.sqrt p := Nat.zero_lt_one.trans_le hp simp only [RichStar.chosenStarDerivativeBound, show j ≠ 0 by omega, if_false, if_pos hjd, hj1, Nat.cast_mul, inv_theta1_pow hk] ring /-- Positive-order correction in the actual q=2 raw-moment profile. -/ def chosenCorrection (p : ℕ) : ℝ := ∑ j ∈ Finset.range ell, ((ell * 2).choose (j + 1) : ℝ) * RichStar.chosenStarDerivativeBound (Nat.sqrt p) (J p) (M1 (Nat.sqrt p)) ell 0 (theta1 (Nat.sqrt p)) (j + 1) theorem chosenCorrection_ratio_tendsto_zero : Tendsto (fun p : ℕ => chosenCorrection p / starScale (Nat.sqrt p)) atTop (𝓝 0) := by have hsum : Tendsto (fun p : ℕ => ∑ j ∈ Finset.range ell, ((ell * 2).choose (j + 1) : ℝ) * (RichStar.chosenStarDerivativeBound (Nat.sqrt p) (J p) (M1 (Nat.sqrt p)) ell 0 (theta1 (Nat.sqrt p)) (j + 1) / starScale (Nat.sqrt p))) atTop (𝓝 (∑ _j ∈ Finset.range ell, (0 : ℝ))) := by apply tendsto_finsetSum intro j hj have hjd : j + 1 ≤ ell := by have := Finset.mem_range.mp hj; omega simpa only [mul_zero] using (chosen_profile_ratio_tendsto_zero (j + 1) (by omega) hjd).const_mul (((ell * 2).choose (j + 1) : ℝ)) simpa only [chosenCorrection, Finset.sum_div, mul_div_assoc, Finset.sum_const_zero] using hsum theorem theta1_R_tendsto_zero : Tendsto (fun k => theta1 k * R k) atTop (𝓝 0) := by apply (nat_rpow_tendsto_zero (neg_lt_zero.mpr delta_pos)).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk dsimp [theta1, R] rw [← Real.rpow_add hk0] congr 1 unfold epsilon1 ring theorem monomial_mul_equivalent {f g : ℕ → ℝ} {a b c d : ℝ} (hf : _root_.Asymptotics.IsEquivalent atTop f (fun k : ℕ => c * (k : ℝ) ^ a)) (hg : _root_.Asymptotics.IsEquivalent atTop g (fun k : ℕ => d * (k : ℝ) ^ b)) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => f k * g k) (fun k : ℕ => (c * d) * (k : ℝ) ^ (a + b)) := by apply (hf.mul hg).congr_right filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk change (c * (k : ℝ) ^ a) * (d * (k : ℝ) ^ b) = _ rw [Real.rpow_add hk0] ring theorem momentOrder_tendsto_atTop : Tendsto momentOrder atTop atTop := nat_floor_tendsto_atTop.comp (nat_rpow_tendsto_atTop eta1_pos) theorem momentOrder_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (momentOrder k : ℝ)) (fun k : ℕ => (k : ℝ) ^ eta1) := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto (nat_rpow_tendsto_atTop eta1_pos) theorem ell_mul_momentOrder_tendsto_atTop : Tendsto (fun k => ell * momentOrder k) atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [momentOrder_tendsto_atTop.eventually_ge_atTop b] with k hk have hell : 1 ≤ ell := ell_pos nlinarith [Nat.mul_le_mul_right (momentOrder k) hell] def momentChoose (k j : ℕ) : ℝ := ((ell * momentOrder k).choose j : ℝ) theorem momentChoose_equivalent (j : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => momentChoose k j) (fun k : ℕ => ((ell : ℝ) ^ j / (j.factorial : ℝ)) * (k : ℝ) ^ (eta1 * (j : ℝ))) := by have hbase : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((ell * momentOrder k : ℕ) : ℝ)) (fun k : ℕ => (ell : ℝ) * (k : ℝ) ^ eta1) := by convert (_root_.Asymptotics.IsEquivalent.refl (u := fun _ : ℕ => (ell : ℝ))).mul momentOrder_equivalent using 1 <;> funext k <;> simp only [Nat.cast_mul, Pi.mul_apply] have hchoose := (isEquivalent_choose j).comp_tendsto ell_mul_momentOrder_tendsto_atTop have hp := (hbase.pow j).div (_root_.Asymptotics.IsEquivalent.refl (u := fun _ : ℕ => (j.factorial : ℝ))) apply (hchoose.trans hp).congr_right exact Eventually.of_forall fun k => by change ((ell : ℝ) * (k : ℝ) ^ eta1) ^ j / (j.factorial : ℝ) = _ rw [mul_pow, ← Real.rpow_mul_natCast (Nat.cast_nonneg k)] ring theorem ordinaryCap_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (ordinaryCap k : ℝ)) (fun k : ℕ => 1 * (k : ℝ) ^ (3 / 4 : ℝ)) := by simpa only [one_mul, ordinaryCap, Function.comp_def] using _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto (nat_rpow_tendsto_atTop (by norm_num : (0 : ℝ) < 3 / 4)) def rootedDistinguishedTerm (k j : ℕ) : ℝ := (j : ℝ) * momentChoose k j * ((theta1 k ^ j)⁻¹ * ((M1 k - j).choose (ell - j) : ℝ) / rootScale k) theorem rootedDistinguishedTerm_tendsto_zero (j : ℕ) (hj : 1 ≤ j) (hjd : j ≤ ell) : Tendsto (fun k : ℕ => rootedDistinguishedTerm k j) atTop (𝓝 0) := by have hr := rpow_mul_div_equivalent (shifted_choose_M1_equivalent j (ell - j)) rootScale_equivalent (epsilon1 * (j : ℝ)) have he := monomial_mul_equivalent (momentChoose_equivalent j) hr have hexp : eta1 * (j : ℝ) + (epsilon1 * (j : ℝ) + alpha * ((ell - j : ℕ) : ℝ) - (1 + alpha * ((ell - 1 : ℕ) : ℝ))) < 0 := by rw [Nat.cast_sub hjd, Nat.cast_sub (show 1 ≤ ell from ell_pos), Nat.cast_one] have hj' : (1 : ℝ) ≤ j := by exact_mod_cast hj nlinarith [rich_moment_exponent_neg hjd, mul_nonneg alpha_pos.le (sub_nonneg.mpr hj')] have hz := (tendsto_zero_of_monomial_equivalent he hexp).const_mul (j : ℝ) apply (show Tendsto (fun k : ℕ => (j : ℝ) * (momentChoose k j * ((k : ℝ) ^ (epsilon1 * (j : ℝ)) * ((M1 k - j).choose (ell - j) : ℝ) / rootScale k))) atTop (𝓝 0) by simpa only [mul_zero] using hz).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk rw [rootedDistinguishedTerm, inv_theta1_pow (Nat.zero_lt_one.trans_le hk)] ring def rootedOrdinaryFirstTerm (k : ℕ) : ℝ := momentChoose k 1 * (ordinaryCap k : ℝ) * ((theta1 k ^ 1)⁻¹ * ((M1 k - 2).choose (ell - 2) : ℝ) / rootScale k) theorem rootedOrdinaryFirstTerm_tendsto_zero : Tendsto rootedOrdinaryFirstTerm atTop (𝓝 0) := by have hr := rpow_mul_div_equivalent (shifted_choose_M1_equivalent 2 (ell - 2)) rootScale_equivalent epsilon1 have he := monomial_mul_equivalent (monomial_mul_equivalent (momentChoose_equivalent 1) ordinaryCap_equivalent) hr have hell : 2 ≤ ell := by norm_num [ell, L] have hexp : (eta1 * (1 : ℝ) + 3 / 4) + (epsilon1 + alpha * ((ell - 2 : ℕ) : ℝ) - (1 + alpha * ((ell - 1 : ℕ) : ℝ))) < 0 := by rw [Nat.cast_sub hell, Nat.cast_sub (show 1 ≤ ell by omega)] norm_num only [Nat.cast_ofNat, Nat.cast_one, mul_one] nlinarith [rich_moment_partner_neg] apply (tendsto_zero_of_monomial_equivalent he (by simpa only [Nat.cast_one] using hexp)).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk rw [rootedOrdinaryFirstTerm, inv_theta1_pow (Nat.zero_lt_one.trans_le hk)] simp only [Nat.cast_one, mul_one] def rootedOrdinaryHigherTerm (p j : ℕ) : ℝ := momentChoose (Nat.sqrt p) j * (J p : ℝ) * ((theta1 (Nat.sqrt p) ^ j)⁻¹ * ((M1 (Nat.sqrt p) - (j + 1)).choose (ell - (j + 1)) : ℝ) / rootScale (Nat.sqrt p)) theorem rootedOrdinaryHigherTerm_tendsto_zero (j : ℕ) (hjd : j < ell) : Tendsto (fun p : ℕ => rootedOrdinaryHigherTerm p j) atTop (𝓝 0) := by have hr := rpow_mul_div_equivalent (shifted_choose_M1_equivalent (j + 1) (ell - (j + 1))) rootScale_equivalent (epsilon1 * (j : ℝ)) have he := monomial_mul_equivalent (momentChoose_equivalent j) hr have hexp : eta1 * (j : ℝ) + (epsilon1 * (j : ℝ) + alpha * ((ell - (j + 1) : ℕ) : ℝ) - (1 + alpha * ((ell - 1 : ℕ) : ℝ))) < 0 := by rw [Nat.cast_sub (by omega : j + 1 ≤ ell), Nat.cast_sub (show 1 ≤ ell from ell_pos), Nat.cast_add, Nat.cast_one] nlinarith [rich_moment_exponent_neg hjd.le, mul_nonneg alpha_pos.le (Nat.cast_nonneg j : (0 : ℝ) ≤ j)] apply (J_mul_tendsto_zero_of_monomial_equivalent he hexp).congr' filter_upwards [nat_sqrt_tendsto_atTop.eventually_ge_atTop 1] with p hp rw [rootedOrdinaryHigherTerm, inv_theta1_pow (Nat.zero_lt_one.trans_le hp)] ring theorem rooted_profile_ratio_tendsto_zero (j : ℕ) (hj : 1 ≤ j) (hjd : j ≤ ell) : Tendsto (fun p : ℕ => momentChoose (Nat.sqrt p) j * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) j / rootScale (Nat.sqrt p)) atTop (𝓝 0) := by have hdist := (rootedDistinguishedTerm_tendsto_zero j hj hjd).comp nat_sqrt_tendsto_atTop have hj0 : j ≠ 0 := by omega by_cases hlt : j < ell · by_cases hj1 : j = 1 · subst j have hsum := hdist.add (rootedOrdinaryFirstTerm_tendsto_zero.comp nat_sqrt_tendsto_atTop) apply (show Tendsto (fun p : ℕ => rootedDistinguishedTerm (Nat.sqrt p) 1 + rootedOrdinaryFirstTerm (Nat.sqrt p)) atTop (𝓝 0) by simpa only [Function.comp_def, add_zero] using hsum).congr intro p simp only [rootedDistinguishedTerm, rootedOrdinaryFirstTerm, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, hj0, if_false, if_pos hjd, if_pos hlt, if_true, Nat.cast_add, Nat.cast_mul, Nat.cast_one, one_mul] norm_num only [show (1 + 1 : ℕ) = 2 by decide] ring · have hsum := hdist.add (rootedOrdinaryHigherTerm_tendsto_zero j hlt) apply (show Tendsto (fun p : ℕ => rootedDistinguishedTerm (Nat.sqrt p) j + rootedOrdinaryHigherTerm p j) atTop (𝓝 0) by simpa only [Function.comp_def, add_zero] using hsum).congr intro p simp only [rootedDistinguishedTerm, rootedOrdinaryHigherTerm, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, hj0, hj1, if_false, if_pos hjd, if_pos hlt, Nat.cast_add, Nat.cast_mul] ring · apply hdist.congr intro p simp only [Function.comp_def, rootedDistinguishedTerm, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, hj0, hlt, if_false, if_pos hjd, Nat.add_zero, Nat.cast_mul] ring /-- The exact positive-order rooted correction, with its exact binomial zeroth term retained. -/ def rootedCorrection (p : ℕ) : ℝ := ∑ j ∈ Finset.range ell, momentChoose (Nat.sqrt p) (j + 1) * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) (j + 1) theorem rootedCorrection_ratio_tendsto_zero : Tendsto (fun p : ℕ => rootedCorrection p / rootScale (Nat.sqrt p)) atTop (𝓝 0) := by have hsum : Tendsto (fun p : ℕ => ∑ j ∈ Finset.range ell, momentChoose (Nat.sqrt p) (j + 1) * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) (j + 1) / rootScale (Nat.sqrt p)) atTop (𝓝 (∑ _j ∈ Finset.range ell, (0 : ℝ))) := by apply tendsto_finsetSum intro j hj exact rooted_profile_ratio_tendsto_zero (j + 1) (by omega) (by have := Finset.mem_range.mp hj; omega) simpa only [rootedCorrection, Finset.sum_div, Finset.sum_const_zero] using hsum theorem eventually_starScale_pos : ∀ᶠ k in atTop, 0 < starScale k := by filter_upwards [nStar_tendsto_atTop.eventually_ge_atTop 1, eventually_ell_le_M1] with k hn hM exact mul_pos (by exact_mod_cast Nat.zero_lt_one.trans_le hn) (by exact_mod_cast Nat.choose_pos hM) theorem eventually_rootScale_pos : ∀ᶠ k in atTop, 0 < rootScale k := by filter_upwards [eventually_ge_atTop (1 : ℕ), eventually_ell_le_M1] with k hk hM unfold rootScale exact mul_pos (mul_pos (by norm_num) (by exact_mod_cast Nat.zero_lt_one.trans_le hk)) (by exact_mod_cast Nat.choose_pos (Nat.sub_le_sub_right hM 1)) def matchingLoss (k : ℕ) : ℝ := ((M1 k : ℝ) / 2) * ((M1 k - 2).choose (ell - 2) : ℝ) / ((M1 k).choose ell : ℝ) theorem matchingLoss_tendsto_zero : Tendsto matchingLoss atTop (𝓝 0) := matching_fraction_M1_tendsto_zero ell (by norm_num [ell, L]) /-- A numerical consequence of the exact matching loss, uniform over every possible valid labelled-star count with the displayed finite guards. -/ theorem valid_fraction_bounds (k v : ℕ) (hn : 0 < nStar k) (hM : ell ≤ M1 k) (hupper : v ≤ nStar k * (M1 k).choose ell) (hloss : 2 * (nStar k * (M1 k).choose ell) ≤ 2 * v + nStar k * M1 k * (M1 k - 2).choose (ell - 2)) : 1 - matchingLoss k ≤ (v : ℝ) / starScale k ∧ (v : ℝ) / starScale k ≤ 1 := by have hc : (0 : ℝ) < ((M1 k).choose ell : ℝ) := by exact_mod_cast Nat.choose_pos hM have hn' : (0 : ℝ) < nStar k := by exact_mod_cast hn have hs : 0 < starScale k := mul_pos hn' hc have hu : (v : ℝ) ≤ starScale k := by unfold starScale exact_mod_cast hupper have hl : 2 * starScale k ≤ 2 * (v : ℝ) + (nStar k : ℝ) * (M1 k : ℝ) * ((M1 k - 2).choose (ell - 2) : ℝ) := by unfold starScale exact_mod_cast hloss constructor · apply (le_div_iff₀ hs).2 have heq : (1 - matchingLoss k) * starScale k = starScale k - (nStar k : ℝ) * (M1 k : ℝ) * ((M1 k - 2).choose (ell - 2) : ℝ) / 2 := by unfold matchingLoss starScale field_simp [hc.ne'] rw [heq] linarith · exact (div_le_one hs).2 hu theorem eventually_valid_fraction_close {ε : ℝ} (hε : 0 < ε) : ∀ᶠ k in atTop, ∀ v : ℕ, v ≤ nStar k * (M1 k).choose ell → 2 * (nStar k * (M1 k).choose ell) ≤ 2 * v + nStar k * M1 k * (M1 k - 2).choose (ell - 2) → 1 - ε ≤ (v : ℝ) / starScale k ∧ (v : ℝ) / starScale k ≤ 1 := by filter_upwards [nStar_tendsto_atTop.eventually_ge_atTop 1, eventually_ell_le_M1, matchingLoss_tendsto_zero.eventually_lt_const hε] with k hn hM heps intro v hu hl have hb := valid_fraction_bounds k v (Nat.zero_lt_one.trans_le hn) hM hu hl exact ⟨(sub_le_sub_left heps.le 1).trans hb.1, hb.2⟩ theorem valid_fraction_tendsto_one (v : ℕ → ℕ) (hupper : ∀ᶠ k in atTop, v k ≤ nStar k * (M1 k).choose ell) (hloss : ∀ᶠ k in atTop, 2 * (nStar k * (M1 k).choose ell) ≤ 2 * v k + nStar k * M1 k * (M1 k - 2).choose (ell - 2)) : Tendsto (fun k : ℕ => (v k : ℝ) / starScale k) atTop (𝓝 1) := by have hlo : Tendsto (fun k : ℕ => 1 - matchingLoss k) atTop (𝓝 1) := by simpa only [sub_zero] using tendsto_const_nhds.sub matchingLoss_tendsto_zero apply tendsto_of_tendsto_of_tendsto_of_le_of_le' hlo tendsto_const_nhds · filter_upwards [nStar_tendsto_atTop.eventually_ge_atTop 1, eventually_ell_le_M1, hupper, hloss] with k hn hM hu hl exact (valid_fraction_bounds k (v k) (Nat.zero_lt_one.trans_le hn) hM hu hl).1 · filter_upwards [nStar_tendsto_atTop.eventually_ge_atTop 1, eventually_ell_le_M1, hupper, hloss] with k hn hM hu hl exact (valid_fraction_bounds k (v k) (Nat.zero_lt_one.trans_le hn) hM hu hl).2 theorem eventually_matching_three_quarters : ∀ᶠ k in atTop, 2 * M1 k * (M1 k - 2).choose (ell - 2) ≤ (M1 k).choose ell := by filter_upwards [eventually_ell_le_M1, matchingLoss_tendsto_zero.eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 4)] with k hM hl have hc : (0 : ℝ) < ((M1 k).choose ell : ℝ) := by exact_mod_cast Nat.choose_pos hM have hbound := (div_lt_iff₀ hc).1 hl change (M1 k : ℝ) / 2 * ((M1 k - 2).choose (ell - 2) : ℝ) < (1 / 4 : ℝ) * ((M1 k).choose ell : ℝ) at hbound have hh : 2 * (M1 k : ℝ) * ((M1 k - 2).choose (ell - 2) : ℝ) ≤ ((M1 k).choose ell : ℝ) := by nlinarith exact_mod_cast hh /-- The literal moment order defeats the union over all k input points. -/ theorem k_mul_three_quarters_pow_tendsto_zero : Tendsto (fun k : ℕ => (k : ℝ) * (3 / 4 : ℝ) ^ momentOrder k) atTop (𝓝 0) := by let c : ℝ := -Real.log (3 / 4 : ℝ) have hc : 0 < c := neg_pos.mpr (Real.log_neg (by norm_num) (by norm_num)) have hu : Tendsto (fun k : ℕ => Real.exp (-(c / 4) * (k : ℝ) ^ eta1)) atTop (𝓝 0) := exp_neg_mul_tendsto_zero (nat_rpow_tendsto_atTop eta1_pos) (div_pos hc (by norm_num)) apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu · exact Eventually.of_forall fun k => mul_nonneg (Nat.cast_nonneg _) (by positivity) · filter_upwards [eventually_ge_atTop (1 : ℕ), (nat_rpow_tendsto_atTop eta1_pos).eventually_ge_atTop 2, (log_div_rpow_tendsto_zero eta1_pos).eventually_lt_const (div_pos hc (by norm_num : (0 : ℝ) < 4))] with k hk hpow hlog have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk have hpow0 : 0 < (k : ℝ) ^ eta1 := Real.rpow_pos_of_pos hk0 _ have hlog' : Real.log (k : ℝ) ≤ c / 4 * (k : ℝ) ^ eta1 := ((div_lt_iff₀ hpow0).1 hlog).le have hz : (k : ℝ) ^ eta1 / 2 ≤ (momentOrder k : ℝ) := half_le_nat_floor hpow have hexp : Real.log (k : ℝ) + (momentOrder k : ℝ) * Real.log (3 / 4 : ℝ) ≤ -(c / 4) * (k : ℝ) ^ eta1 := by have hcprod := mul_le_mul_of_nonneg_left hz hc.le dsimp [c] at hcprod hlog' ⊢ linarith calc (k : ℝ) * (3 / 4 : ℝ) ^ momentOrder k = Real.exp (Real.log (k : ℝ) + (momentOrder k : ℝ) * Real.log (3 / 4 : ℝ)) := by rw [Real.exp_add, Real.exp_log hk0, Real.exp_nat_mul, Real.exp_log (by norm_num : (0 : ℝ) < 3 / 4)] _ ≤ _ := Real.exp_le_exp.mpr hexp theorem N_monomial_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (N k : ℝ)) (fun k : ℕ => 1 * (k : ℝ) ^ (2 - delta)) := by simpa only [one_mul] using N_equivalent theorem H_monomial_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (H k : ℝ)) (fun k : ℕ => 1 * (k : ℝ) ^ (5 / 8 : ℝ)) := by simpa only [one_mul] using H_equivalent theorem M1_monomial_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (M1 k : ℝ)) (fun k : ℕ => (1 / 2 : ℝ) * (k : ℝ) ^ alpha) := by apply M1_equivalent.congr_right exact Eventually.of_forall fun _ => by ring theorem NM1_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (N k : ℝ) * (M1 k : ℝ)) (fun k : ℕ => (1 / 2 : ℝ) * (k : ℝ) ^ (2 - delta + alpha)) := by simpa only [one_mul] using monomial_mul_equivalent N_monomial_equivalent M1_monomial_equivalent theorem one_monomial_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun _ : ℕ => (1 : ℝ)) (fun k : ℕ => 1 * (k : ℝ) ^ (0 : ℝ)) := by simp only [Real.rpow_zero, one_mul] exact _root_.Asymptotics.IsEquivalent.refl theorem row_bad_unit_ratio_tendsto_zero : Tendsto (fun k : ℕ => (k : ℝ) / (N k : ℝ)) atTop (𝓝 0) := by have he := rpow_mul_div_equivalent one_monomial_equivalent N_monomial_equivalent 1 have hn : (1 : ℝ) + 0 - (2 - delta) < 0 := by linarith [rich_bad_target_power_neg] simpa only [Real.rpow_one, mul_one] using tendsto_zero_of_monomial_equivalent he hn theorem row_bad_HJ_ratio_tendsto_zero : Tendsto (fun p : ℕ => (J p : ℝ) * ((Nat.sqrt p : ℝ) * (H (Nat.sqrt p) : ℝ) / (N (Nat.sqrt p) : ℝ))) atTop (𝓝 0) := by have he := rpow_mul_div_equivalent H_monomial_equivalent N_monomial_equivalent 1 have hn : (1 : ℝ) + 5 / 8 - (2 - delta) < 0 := by linarith [rich_bad_target_power_neg] simpa only [Real.rpow_one] using J_mul_tendsto_zero_of_monomial_equivalent he hn theorem row_deleted_H_ratio_tendsto_zero : Tendsto (fun k : ℕ => (k : ℝ) * (H k : ℝ) / ((N k : ℝ) * (M1 k : ℝ))) atTop (𝓝 0) := by have he := rpow_mul_div_equivalent H_monomial_equivalent NM1_equivalent 1 have hn : (1 : ℝ) + 5 / 8 - (2 - delta + alpha) < 0 := by linarith [rich_cleanup_power_neg] simpa only [Real.rpow_one] using tendsto_zero_of_monomial_equivalent he hn theorem row_deleted_R_ratio_tendsto_zero : Tendsto (fun k : ℕ => (k : ℝ) * (k : ℝ) / R k / ((N k : ℝ) * (M1 k : ℝ))) atTop (𝓝 0) := by have he := rpow_mul_div_equivalent one_monomial_equivalent NM1_equivalent (2 - delta) have hn : (2 - delta) + 0 - (2 - delta + alpha) < 0 := by linarith [alpha_pos] apply (tendsto_zero_of_monomial_equivalent he hn).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk rw [Real.rpow_sub hk0, Real.rpow_two] unfold R ring /-- The literal PS19 bad-target and input-deletion costs in the retained-row gate. -/ def rowLoss (p : ℕ) : ℝ := let k := Nat.sqrt p 500 * (k : ℝ) * (1 + (H k : ℝ) * (J p : ℝ)) * (M1 k : ℝ) + 100 * (k : ℝ) * (30 * (H k : ℝ) + 500 * (k : ℝ) / R k) theorem rowLoss_ratio_tendsto_zero : Tendsto (fun p : ℕ => rowLoss p / ((N (Nat.sqrt p) : ℝ) * (M1 (Nat.sqrt p) : ℝ))) atTop (𝓝 0) := by have h₁ := (row_bad_unit_ratio_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul 500 have h₂ := row_bad_HJ_ratio_tendsto_zero.const_mul 500 have h₃ := (row_deleted_H_ratio_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul 3000 have h₄ := (row_deleted_R_ratio_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul 50000 have hz : Tendsto (fun p : ℕ => ((500 * ((Nat.sqrt p : ℝ) / (N (Nat.sqrt p) : ℝ)) + 500 * ((J p : ℝ) * ((Nat.sqrt p : ℝ) * (H (Nat.sqrt p) : ℝ) / (N (Nat.sqrt p) : ℝ)))) + 3000 * ((Nat.sqrt p : ℝ) * (H (Nat.sqrt p) : ℝ) / ((N (Nat.sqrt p) : ℝ) * (M1 (Nat.sqrt p) : ℝ)))) + 50000 * ((Nat.sqrt p : ℝ) * (Nat.sqrt p : ℝ) / R (Nat.sqrt p) / ((N (Nat.sqrt p) : ℝ) * (M1 (Nat.sqrt p) : ℝ)))) atTop (𝓝 0) := by simpa only [Function.comp_def, mul_zero, add_zero] using ((h₁.add h₂).add h₃).add h₄ apply hz.congr' filter_upwards [(N_tendsto_atTop.comp nat_sqrt_tendsto_atTop).eventually_ge_atTop 1, (M1_tendsto_atTop.comp nat_sqrt_tendsto_atTop).eventually_ge_atTop 1, nat_sqrt_tendsto_atTop.eventually_ge_atTop 1] with p hN hM hk have hN0 : (0 : ℝ) < N (Nat.sqrt p) := by exact_mod_cast Nat.zero_lt_one.trans_le hN have hM0 : (0 : ℝ) < M1 (Nat.sqrt p) := by exact_mod_cast Nat.zero_lt_one.trans_le hM have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast Nat.zero_lt_one.trans_le hk have hR0 : 0 < R (Nat.sqrt p) := Real.rpow_pos_of_pos hk0 _ unfold rowLoss field_simp [hN0.ne', hM0.ne', hR0.ne'] ring /-- The exact real-valued room inequality required by `exists_retained_rows`. -/ theorem eventually_row_room : ∀ᶠ p : ℕ in atTop, let k := Nat.sqrt p ((nStar k : ℝ) + 500 * (k : ℝ) * (1 + (H k : ℝ) * (J p : ℝ))) * (M1 k : ℝ) + 100 * (k : ℝ) * (30 * (H k : ℝ) + 500 * (k : ℝ) / R k) ≤ (N k : ℝ) * (M1 k : ℝ) := by filter_upwards [rowLoss_ratio_tendsto_zero.eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2), (N_tendsto_atTop.comp nat_sqrt_tendsto_atTop).eventually_ge_atTop 1, (M1_tendsto_atTop.comp nat_sqrt_tendsto_atTop).eventually_ge_atTop 1] with p hsmall hN hM have hN0 : (0 : ℝ) < N (Nat.sqrt p) := by exact_mod_cast Nat.zero_lt_one.trans_le hN have hM0 : (0 : ℝ) < M1 (Nat.sqrt p) := by exact_mod_cast Nat.zero_lt_one.trans_le hM have hloss := (div_lt_iff₀ (mul_pos hN0 hM0)).1 hsmall have hn : 2 * nStar (Nat.sqrt p) ≤ N (Nat.sqrt p) := by unfold nStar; omega have hn' : 2 * (nStar (Nat.sqrt p) : ℝ) ≤ (N (Nat.sqrt p) : ℝ) := by exact_mod_cast hn have hprod := mul_le_mul_of_nonneg_right hn' hM0.le dsimp only [rowLoss] at hloss dsimp only nlinarith theorem chosen_profile_mono_caps {a a' J J' M d v j : ℕ} {θ : ℝ} (ha : a ≤ a') (hJ : J ≤ J') (hθ : 0 ≤ θ) : RichStar.chosenStarDerivativeBound a J M d v θ j ≤ RichStar.chosenStarDerivativeBound a' J' M d v θ j := by unfold RichStar.chosenStarDerivativeBound split_ifs with hj0 hjd hj1 · exact le_rfl · apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (pow_nonneg hθ _)) exact_mod_cast Nat.mul_le_mul_right ((M - j).choose (d - j)) ha · apply mul_le_mul_of_nonneg_left _ (inv_nonneg.mpr (pow_nonneg hθ _)) exact_mod_cast Nat.mul_le_mul_right ((M - j).choose (d - j)) hJ · exact le_rfl theorem chosenMomentBase_le (p a J' v : ℕ) (ha : a ≤ Nat.sqrt p) (hJ : J' ≤ J p) : (∑ j ∈ Finset.range (ell + 1), ((ell * 2).choose j : ℝ) * RichStar.chosenStarDerivativeBound a J' (M1 (Nat.sqrt p)) ell v (theta1 (Nat.sqrt p)) j) ≤ (v : ℝ) + chosenCorrection p := by rw [Finset.sum_range_succ'] have hz : ((ell * 2).choose 0 : ℝ) * RichStar.chosenStarDerivativeBound a J' (M1 (Nat.sqrt p)) ell v (theta1 (Nat.sqrt p)) 0 = (v : ℝ) := by simp [RichStar.chosenStarDerivativeBound] rw [hz, add_comm (v : ℝ)] refine add_le_add ?_ (le_refl (v : ℝ)) unfold chosenCorrection apply Finset.sum_le_sum intro j _hj apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) have hh := chosen_profile_mono_caps (M := M1 (Nat.sqrt p)) (d := ell) (v := v) (j := j + 1) ha hJ (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon1)) exact hh.trans_eq (by simp only [RichStar.chosenStarDerivativeBound, Nat.add_one_ne_zero, if_false, theta1]) theorem chosenMomentBase_ge (p a J' v : ℕ) : (v : ℝ) ≤ (∑ j ∈ Finset.range (ell + 1), ((ell * 2).choose j : ℝ) * RichStar.chosenStarDerivativeBound a J' (M1 (Nat.sqrt p)) ell v (theta1 (Nat.sqrt p)) j) := by rw [Finset.sum_range_succ'] have hz : ((ell * 2).choose 0 : ℝ) * RichStar.chosenStarDerivativeBound a J' (M1 (Nat.sqrt p)) ell v (theta1 (Nat.sqrt p)) 0 = (v : ℝ) := by simp [RichStar.chosenStarDerivativeBound] rw [hz] apply le_add_of_nonneg_left exact Finset.sum_nonneg fun j _ => mul_nonneg (Nat.cast_nonneg _) (RichStar.chosenStarDerivativeBound_nonneg _ _ _ _ _ _ (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon1))) theorem chosenCorrection_nonneg (p : ℕ) : 0 ≤ chosenCorrection p := by unfold chosenCorrection exact Finset.sum_nonneg fun j _ => mul_nonneg (Nat.cast_nonneg _) (RichStar.chosenStarDerivativeBound_nonneg _ _ _ _ _ _ (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon1))) theorem rooted_profile_mono_caps {n n' Q Q' J J' M d j : ℕ} {θ : ℝ} (hn : n ≤ n') (hQ : Q ≤ Q') (hJ : J ≤ J') (hθ : 0 ≤ θ) : RootedDerivativeBounds.rootedDerivativeBound n Q J M d θ j ≤ RootedDerivativeBounds.rootedDerivativeBound n' Q' J' M d θ j := by have hcount : RootedDerivativeBounds.rootedExtensionBound n Q J M d j ≤ RootedDerivativeBounds.rootedExtensionBound n' Q' J' M d j := by unfold RootedDerivativeBounds.rootedExtensionBound split_ifs <;> gcongr unfold RootedDerivativeBounds.rootedDerivativeBound exact mul_le_mul_of_nonneg_left (by exact_mod_cast hcount) (inv_nonneg.mpr (pow_nonneg hθ _)) theorem rootedMomentBase_eq (p : ℕ) : (∑ j ∈ Finset.range (ell + 1), momentChoose (Nat.sqrt p) j * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) j) = rootScale (Nat.sqrt p) + rootedCorrection p := by rw [Finset.sum_range_succ'] have hz : momentChoose (Nat.sqrt p) 0 * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) 0 = rootScale (Nat.sqrt p) := by simp [momentChoose, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, rootScale, Nat.cast_mul] change rootedCorrection p + _ = _ rw [hz, add_comm] theorem rootedMomentBase_le (p n Q J' : ℕ) (hn : n ≤ 100 * Nat.sqrt p) (hQ : Q ≤ ordinaryCap (Nat.sqrt p)) (hJ : J' ≤ J p) : (∑ j ∈ Finset.range (ell + 1), momentChoose (Nat.sqrt p) j * RootedDerivativeBounds.rootedDerivativeBound n Q J' (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) j) ≤ rootScale (Nat.sqrt p) + rootedCorrection p := by rw [← rootedMomentBase_eq] apply Finset.sum_le_sum intro j _hj apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) exact rooted_profile_mono_caps hn hQ hJ (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon1)) theorem rootedCorrection_nonneg (p : ℕ) : 0 ≤ rootedCorrection p := by unfold rootedCorrection apply Finset.sum_nonneg intro j _hj apply mul_nonneg (Nat.cast_nonneg _) unfold RootedDerivativeBounds.rootedDerivativeBound exact mul_nonneg (inv_nonneg.mpr (pow_nonneg (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon1)) _)) (Nat.cast_nonneg _) /-- The raw rooted-moment base is at most three halves of the exact K0, uniformly over every admissible number of roots and both codegree caps. -/ theorem eventually_rootedMomentBase_le : ∀ᶠ p : ℕ in atTop, 0 < rootScale (Nat.sqrt p) ∧ ∀ n Q J' : ℕ, n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → (∑ j ∈ Finset.range (ell + 1), momentChoose (Nat.sqrt p) j * RootedDerivativeBounds.rootedDerivativeBound n Q J' (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) j) ≤ (3 / 2 : ℝ) * rootScale (Nat.sqrt p) := by filter_upwards [nat_sqrt_tendsto_atTop.eventually eventually_rootScale_pos, rootedCorrection_ratio_tendsto_zero.eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2)] with p hroot hsmall refine ⟨hroot, ?_⟩ intro n Q J' hn hQ hJ have hc := (div_lt_iff₀ hroot).1 hsmall exact (rootedMomentBase_le p n Q J' hn hQ hJ).trans (by linarith) theorem eventually_rootedMoment_ratio_le_three_quarters : ∀ᶠ p : ℕ in atTop, 0 < rootScale (Nat.sqrt p) ∧ ∀ n Q J' : ℕ, n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → (∑ j ∈ Finset.range (ell + 1), momentChoose (Nat.sqrt p) j * RootedDerivativeBounds.rootedDerivativeBound n Q J' (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) j) / (2 * rootScale (Nat.sqrt p)) ≤ (3 / 4 : ℝ) := by filter_upwards [eventually_rootedMomentBase_le] with p hp refine ⟨hp.1, ?_⟩ intro n Q J' hn hQ hJ apply (div_le_iff₀ (mul_pos (by norm_num) hp.1)).2 have h := hp.2 n Q J' hn hQ hJ linarith def chosenFailure (p : ℕ) : ℝ := let ratio := (4 / 3 : ℝ) * (chosenCorrection p / starScale (Nat.sqrt p)) 9 * (2 * ratio + ratio ^ 2 + 2 * (ell : ℝ) * (theta1 (Nat.sqrt p) * R (Nat.sqrt p))) theorem chosenFailure_tendsto_zero : Tendsto chosenFailure atTop (𝓝 0) := by have hc := chosenCorrection_ratio_tendsto_zero.const_mul (4 / 3 : ℝ) have hR := (theta1_R_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul (2 * (ell : ℝ)) have hlim := (((hc.const_mul 2).add (hc.pow 2)).add hR).const_mul 9 change Tendsto (fun p : ℕ => 9 * (2 * ((4 / 3 : ℝ) * (chosenCorrection p / starScale (Nat.sqrt p))) + ((4 / 3 : ℝ) * (chosenCorrection p / starScale (Nat.sqrt p))) ^ 2 + 2 * (ell : ℝ) * (theta1 (Nat.sqrt p) * R (Nat.sqrt p)))) atTop (𝓝 0) simpa only [Function.comp_def, mul_zero, zero_mul, pow_two, add_zero] using hlim /-- A uniform numerical envelope for the actual centered-square lower tail, after the valid count has reached three quarters of the full star scale. -/ theorem centered_tail_ratio_le_chosenFailure (p : ℕ) {v C : ℝ} (hA : 0 < starScale (Nat.sqrt p)) (hv : (3 / 4 : ℝ) * starScale (Nat.sqrt p) ≤ v) (hC : 0 ≤ C) (hCcap : C ≤ chosenCorrection p) : 9 * (2 * (C / v) + (C / v) ^ 2 + 2 * (ell : ℝ) * R (Nat.sqrt p) * theta1 (Nat.sqrt p)) ≤ chosenFailure p := by let ratio := (4 / 3 : ℝ) * (chosenCorrection p / starScale (Nat.sqrt p)) have hv0 : 0 < v := (mul_pos (by norm_num) hA).trans_le hv have hr0 : 0 ≤ ratio := mul_nonneg (by norm_num) (div_nonneg (chosenCorrection_nonneg p) hA.le) have hcv0 : 0 ≤ C / v := div_nonneg hC hv0.le have hcv : C / v ≤ ratio := by apply (div_le_iff₀ hv0).2 calc C ≤ chosenCorrection p := hCcap _ = ratio * ((3 / 4 : ℝ) * starScale (Nat.sqrt p)) := by dsimp [ratio] field_simp [hA.ne'] _ ≤ ratio * v := mul_le_mul_of_nonneg_left hv hr0 have hsq : (C / v) ^ 2 ≤ ratio ^ 2 := by nlinarith [mul_nonneg (sub_nonneg.mpr hcv) (add_nonneg hr0 hcv0)] change _ ≤ 9 * (2 * ratio + ratio ^ 2 + 2 * (ell : ℝ) * (theta1 (Nat.sqrt p) * R (Nat.sqrt p))) nlinarith /-- Direct normalization of the exact centered-square quotient in `RichStar.valid_free_star_lower_tail`, with no rate assumption on its inputs. -/ theorem centered_square_gap_le_chosenFailure (p : ℕ) {v K : ℝ} (hA : 0 < starScale (Nat.sqrt p)) (hv : (3 / 4 : ℝ) * starScale (Nat.sqrt p) ≤ v) (hKlo : v ≤ K) (hKhi : K ≤ v + chosenCorrection p) : (K ^ 2 - v ^ 2 + 2 * v ^ 2 * ((ell : ℝ) * R (Nat.sqrt p)) * theta1 (Nat.sqrt p)) / (v - starScale (Nat.sqrt p) / 2) ^ 2 ≤ chosenFailure p := by let C : ℝ := K - v let D : ℝ := 2 * (C / v) + (C / v) ^ 2 + 2 * (ell : ℝ) * R (Nat.sqrt p) * theta1 (Nat.sqrt p) have hC : 0 ≤ C := sub_nonneg.mpr hKlo have hCcap : C ≤ chosenCorrection p := by dsimp [C]; linarith have hv0 : 0 < v := (mul_pos (by norm_num) hA).trans_le hv have hgap : v / 3 ≤ v - starScale (Nat.sqrt p) / 2 := by linarith have hgap0 : 0 < v - starScale (Nat.sqrt p) / 2 := (div_pos hv0 (by norm_num)).trans_le hgap have hD : 0 ≤ D := by dsimp [D] exact add_nonneg (add_nonneg (mul_nonneg (by norm_num) (div_nonneg hC hv0.le)) (sq_nonneg _)) (mul_nonneg (mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg _)) (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) delta)) (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon1))) have hnum : K ^ 2 - v ^ 2 + 2 * v ^ 2 * ((ell : ℝ) * R (Nat.sqrt p)) * theta1 (Nat.sqrt p) = v ^ 2 * D := by dsimp [D, C] field_simp [hv0.ne'] ring have hs := pow_le_pow_left₀ (div_nonneg hv0.le (by norm_num : (0 : ℝ) ≤ 3)) hgap 2 have hsq : v ^ 2 ≤ 9 * (v - starScale (Nat.sqrt p) / 2) ^ 2 := by nlinarith have hnorm : (K ^ 2 - v ^ 2 + 2 * v ^ 2 * ((ell : ℝ) * R (Nat.sqrt p)) * theta1 (Nat.sqrt p)) / (v - starScale (Nat.sqrt p) / 2) ^ 2 ≤ 9 * D := by apply (div_le_iff₀ (pow_pos hgap0 2)).2 rw [hnum] have hh := mul_le_mul_of_nonneg_right hsq hD nlinarith exact hnorm.trans (centered_tail_ratio_le_chosenFailure p hA hv hC hCcap) /-- The floor budget pays for deletion at the exact rooted threshold, with the literal factor 1600 from `Parameters.richBudget`. -/ theorem richBudget_retention_le (k : ℕ) (hk : 0 < k) : (richBudget k : ℝ) * (2 * rootScale k) ≤ starScale k / 8 := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hell : (0 : ℝ) < ell := by exact_mod_cast ell_pos have hbinom : (M1 k : ℝ) * ((M1 k - 1).choose (ell - 1) : ℝ) = (ell : ℝ) * ((M1 k).choose ell : ℝ) := by have hn := (Nat.choose_mul (n := M1 k) (k := ell) (s := 1) ell_pos).symm simpa only [Nat.choose_one_right, Nat.cast_mul, mul_comm] using congrArg (fun n : ℕ => (n : ℝ)) hn have hfloor : (richBudget k : ℝ) ≤ (nStar k : ℝ) * (M1 k : ℝ) / (1600 * (ell : ℝ) * (k : ℝ)) := Nat.floor_le (by positivity) have hroot : 0 ≤ 2 * rootScale k := by unfold rootScale; positivity calc (richBudget k : ℝ) * (2 * rootScale k) ≤ ((nStar k : ℝ) * (M1 k : ℝ) / (1600 * (ell : ℝ) * (k : ℝ))) * (2 * rootScale k) := mul_le_mul_of_nonneg_right hfloor hroot _ = (nStar k : ℝ) * ((M1 k : ℝ) * ((M1 k - 1).choose (ell - 1) : ℝ)) / (8 * (ell : ℝ)) := by unfold rootScale field_simp [hk0.ne', hell.ne'] ring _ = starScale k / 8 := by rw [hbinom] unfold starScale field_simp [hell.ne'] theorem eventually_richBudget_retention_le : ∀ᶠ k in atTop, (richBudget k : ℝ) * (2 * rootScale k) ≤ starScale k / 8 := by filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk exact richBudget_retention_le k (Nat.zero_lt_one.trans_le hk) /-- The three source bad-event budgets leave positive room for a common seed. -/ theorem eventually_common_source_failure_lt_one : ∀ᶠ p : ℕ in atTop, chosenFailure p + (Nat.sqrt p : ℝ) * (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) + (1 / 2 : ℝ) < 1 := by have hz := k_mul_three_quarters_pow_tendsto_zero.comp nat_sqrt_tendsto_atTop have htotal : Tendsto (fun p : ℕ => chosenFailure p + (Nat.sqrt p : ℝ) * (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) + (1 / 2 : ℝ)) atTop (𝓝 (1 / 2 : ℝ)) := by simpa only [Function.comp_def, zero_add] using (chosenFailure_tendsto_zero.add hz).add_const (1 / 2 : ℝ) exact htotal.eventually_lt_const (by norm_num) end Green39Submission.RichStarAsymptotics end end Green39AssemblyScope_bf2b04e625b0145d /- Source: Green39Submission.RichDescriptorTail; SHA256 4d7aefdd0d9600b0d3346a138b48dd55f0ad8c057cc701531a5ce333839e1774 -/ section Green39AssemblyScope_7c21078423950598 /-! Unconditional entropy-times-tail decay for the literal rich descriptor. All floors and both natural exponents are retained, including the deletion order `richBudget k / ell`. The fixed degree remains symbolic throughout. This is a numerical limit, not a premise about random covers or extracted descriptors. -/ namespace Green39Submission.RichDescriptorTail open Filter Topology open Parameters Green39Submission.Asymptotics RichStarAsymptotics noncomputable section /-- The fixed prior's rich-star mean constant, without expanding the degree. -/ def meanConstant : ℝ := (400 : ℝ) ^ ell / (ell.factorial : ℝ) def sourceCardCap (k : ℕ) : ℕ := ⌊200 * (k : ℝ) * theta1 k⌋₊ def deletionOrder (k : ℕ) : ℕ := richBudget k / ell def descriptorExponent (k : ℕ) : ℕ := 122 * H k + 12 * sourceCardCap k def descriptorFactor (k : ℕ) : ℝ := (4 * (k : ℝ) ^ 2) ^ descriptorExponent k def descriptorLog (k : ℕ) : ℝ := (descriptorExponent k : ℝ) * Real.log (4 * (k : ℝ) ^ 2) def deletionBase (k : ℕ) : ℝ := 16 * (k : ℝ) ^ 2 * meanConstant / starScale k def richDescriptorTail (k : ℕ) : ℝ := descriptorFactor k * deletionBase k ^ deletionOrder k theorem meanConstant_pos : 0 < meanConstant := by exact div_pos (pow_pos (by norm_num : (0 : ℝ) < 400) _) (by exact_mod_cast Nat.factorial_pos ell) theorem starScale_nonneg (k : ℕ) : 0 ≤ starScale k := by unfold starScale positivity theorem deletionBase_nonneg (k : ℕ) : 0 ≤ deletionBase k := by exact div_nonneg (mul_nonneg (mul_nonneg (by norm_num) (sq_nonneg _)) meanConstant_pos.le) (starScale_nonneg k) theorem descriptorFactor_nonneg (k : ℕ) : 0 ≤ descriptorFactor k := by unfold descriptorFactor positivity theorem richDescriptorTail_nonneg (k : ℕ) : 0 ≤ richDescriptorTail k := mul_nonneg (descriptorFactor_nonneg k) (pow_nonneg (deletionBase_nonneg k) _) /-- The actual mean-to-threshold ratio vanishes, with its fixed constant. -/ theorem deletionBase_tendsto_zero : Tendsto deletionBase atTop (𝓝 0) := by have hc : _root_.Asymptotics.IsEquivalent atTop (fun _ : ℕ => 16 * meanConstant) (fun k : ℕ => (16 * meanConstant) * (k : ℝ) ^ (0 : ℝ)) := by simpa only [Real.rpow_zero, mul_one] using (_root_.Asymptotics.IsEquivalent.refl (u := fun _ : ℕ => 16 * meanConstant)) have he := rpow_mul_div_equivalent hc starScale_equivalent (2 : ℝ) have hexp : (2 : ℝ) + 0 - (2 - delta + alpha * (ell : ℝ)) < 0 := by nlinarith [ell_mul_alpha, delta_pos] apply (tendsto_zero_of_monomial_equivalent he hexp).congr intro k unfold deletionBase rw [Real.rpow_two] ring theorem eventually_deletionBase_pos : ∀ᶠ k : ℕ in atTop, 0 < deletionBase k := by filter_upwards [eventually_ge_atTop (1 : ℕ), eventually_starScale_pos] with k hk ha have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk exact div_pos (mul_pos (mul_pos (by norm_num) (sq_pos_of_pos hk0)) meanConstant_pos) ha /-- Supplies the sign and base-below-one conditions for every later comparator. -/ theorem eventually_deletionBase_pos_lt_one : ∀ᶠ k : ℕ in atTop, 0 < deletionBase k ∧ deletionBase k < 1 := by filter_upwards [eventually_deletionBase_pos, deletionBase_tendsto_zero.eventually_lt_const (by norm_num : (0 : ℝ) < 1)] with k hk hlt exact ⟨hk, hlt⟩ /-- Uniform domination of the actual fixed-prior base using only `p <= 4k²`. It remains valid at zero denominators, though eventual positivity is above. -/ theorem fixedPriorBase_le_deletionBase {p k : ℕ} (hp : p ≤ 4 * k ^ 2) : 2 * (p : ℝ) * meanConstant / (starScale k / 2) ≤ deletionBase k := by have hp' : (p : ℝ) ≤ 4 * (k : ℝ) ^ 2 := by exact_mod_cast hp unfold deletionBase rw [div_div_eq_mul_div] apply div_le_div_of_nonneg_right _ (starScale_nonneg k) calc 2 * (p : ℝ) * meanConstant * 2 = 4 * (p : ℝ) * meanConstant := by ring _ ≤ 4 * (4 * (k : ℝ) ^ 2) * meanConstant := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hp' (by norm_num)) meanConstant_pos.le _ = _ := by ring theorem fixedPriorTail_le_deletionTail {p k : ℕ} (hp : p ≤ 4 * k ^ 2) : (2 * (p : ℝ) * meanConstant / (starScale k / 2)) ^ deletionOrder k ≤ deletionBase k ^ deletionOrder k := by apply pow_le_pow_left₀ _ (fixedPriorBase_le_deletionBase hp) exact div_nonneg (mul_nonneg (mul_nonneg (by norm_num) (Nat.cast_nonneg p)) meanConstant_pos.le) (div_nonneg (starScale_nonneg k) (by norm_num)) theorem sourceCardCap_real_le (k : ℕ) : (sourceCardCap k : ℝ) ≤ 200 * (k : ℝ) * theta1 k := by apply Nat.floor_le unfold theta1 positivity /-- The exact descriptor's logarithm is bounded by the previously proved entropy scale, with every source and center coefficient included. -/ theorem descriptorLog_le_entropy {k : ℕ} (hk : 2 ≤ k) : descriptorLog k ≤ 9600 * descriptorEntropy epsilon1 k := by have hk2 : (2 : ℝ) ≤ k := by exact_mod_cast hk have hk0 : (0 : ℝ) < k := by linarith have hsq : (4 : ℝ) ≤ (k : ℝ) ^ 2 := by nlinarith have hbase1 : (1 : ℝ) ≤ 4 * (k : ℝ) ^ 2 := by nlinarith have hlog0 : 0 ≤ Real.log (4 * (k : ℝ) ^ 2) := Real.log_nonneg hbase1 have hlog : Real.log (4 * (k : ℝ) ^ 2) ≤ 4 * Real.log (k : ℝ) := by have hpow : 4 * (k : ℝ) ^ 2 ≤ (k : ℝ) ^ 4 := by calc 4 * (k : ℝ) ^ 2 ≤ (k : ℝ) ^ 2 * (k : ℝ) ^ 2 := mul_le_mul_of_nonneg_right hsq (sq_nonneg _) _ = _ := by ring have hh := Real.log_le_log (by positivity : 0 < 4 * (k : ℝ) ^ 2) hpow simpa only [Real.log_pow, Nat.cast_ofNat] using hh have htheta : 0 ≤ theta1 k := Real.rpow_nonneg (Nat.cast_nonneg k) _ have hcore : 0 ≤ (H k : ℝ) + (k : ℝ) * theta1 k := by positivity have hexp : (descriptorExponent k : ℝ) ≤ 2400 * ((H k : ℝ) + (k : ℝ) * theta1 k) := by dsimp [descriptorExponent] push_cast nlinarith [sourceCardCap_real_le k, (Nat.cast_nonneg (H k) : (0 : ℝ) ≤ H k)] calc descriptorLog k ≤ (2400 * ((H k : ℝ) + (k : ℝ) * theta1 k)) * (4 * Real.log (k : ℝ)) := mul_le_mul hexp hlog hlog0 (mul_nonneg (by norm_num) hcore) _ = 9600 * descriptorEntropy epsilon1 k := by unfold descriptorEntropy theta1 ring /-- Entropy is smaller even than the literal deletion budget, without needing to discard any of its polynomial margin. -/ theorem entropy_div_budget_tendsto_zero : Tendsto (fun k : ℕ => descriptorEntropy epsilon1 k / (richBudget k : ℝ)) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => descriptorEntropy epsilon1 k / (richBudget k : ℝ)) (fun k : ℕ => descriptorEntropy epsilon1 k / ((k : ℝ) ^ richBudgetPower / (6400 * (ell : ℝ)))) := _root_.Asymptotics.IsEquivalent.refl.div richBudget_equivalent apply he.symm.tendsto_nhds have hz := (descriptorEntropy_div_rpow_tendsto_zero rich_budget_gt_H rich_budget_gt_source).mul_const (6400 * (ell : ℝ)) simpa only [div_div_eq_mul_div, div_mul_eq_mul_div, mul_div_assoc, mul_comm, zero_mul] using hz theorem deletionOrder_tendsto_atTop : Tendsto deletionOrder atTop atTop := by apply tendsto_atTop.2 intro n filter_upwards [richBudget_tendsto_atTop.eventually_ge_atTop (n * ell)] with k hk exact (Nat.le_div_iff_mul_le ell_pos).2 hk /-- Exact natural division loses at most a factor two eventually. -/ theorem eventually_descriptorLog_le_order : ∀ᶠ k : ℕ in atTop, descriptorLog k ≤ (deletionOrder k : ℝ) := by have hell : (0 : ℝ) < ell := by exact_mod_cast ell_pos have hconst : (0 : ℝ) < 1 / (19200 * (ell : ℝ)) := by positivity filter_upwards [eventually_ge_atTop (2 : ℕ), richBudget_tendsto_atTop.eventually_ge_atTop (2 * ell), entropy_div_budget_tendsto_zero.eventually_lt_const hconst] with k hk hb hsmall have hb0 : (0 : ℝ) < richBudget k := by have hb' : 2 * (ell : ℝ) ≤ richBudget k := by exact_mod_cast hb linarith have hcross := (div_lt_div_iff₀ hb0 (by positivity : (0 : ℝ) < 19200 * (ell : ℝ))).1 hsmall have hbound : 9600 * descriptorEntropy epsilon1 k ≤ (richBudget k : ℝ) / (2 * (ell : ℝ)) := by apply (le_div_iff₀ (by positivity : (0 : ℝ) < 2 * (ell : ℝ))).2 nlinarith calc descriptorLog k ≤ 9600 * descriptorEntropy epsilon1 k := descriptorLog_le_entropy hk _ ≤ (richBudget k : ℝ) / (2 * (ell : ℝ)) := hbound _ ≤ (deletionOrder k : ℝ) := half_le_nat_div ell_pos hb theorem descriptorFactor_eq_exp {k : ℕ} (hk : 0 < k) : descriptorFactor k = Real.exp (descriptorLog k) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hb : 0 < 4 * (k : ℝ) ^ 2 := by positivity unfold descriptorFactor descriptorLog rw [← Real.log_pow] exact (Real.exp_log (pow_pos hb _)).symm /-- A concrete eventual envelope for the full descriptor union bound. -/ theorem eventually_richDescriptorTail_le_exp : ∀ᶠ k : ℕ in atTop, richDescriptorTail k ≤ Real.exp (-(deletionOrder k : ℝ)) := by filter_upwards [eventually_descriptorLog_le_order, deletionBase_tendsto_zero.eventually_lt_const (Real.exp_pos (-2)), eventually_ge_atTop (1 : ℕ)] with k hcost hbase hk have hkpos : 0 < k := Nat.zero_lt_one.trans_le hk calc richDescriptorTail k ≤ descriptorFactor k * Real.exp (-2) ^ deletionOrder k := mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (deletionBase_nonneg k) hbase.le _) (descriptorFactor_nonneg k) _ = Real.exp (descriptorLog k + (deletionOrder k : ℝ) * (-2)) := by rw [descriptorFactor_eq_exp hkpos, ← Real.exp_nat_mul, ← Real.exp_add] _ ≤ Real.exp (-(deletionOrder k : ℝ)) := by apply Real.exp_le_exp.mpr linarith /-- The exact entropy-times-tail expression, with no asymptotic premises. -/ theorem richDescriptorTail_tendsto_zero : Tendsto richDescriptorTail atTop (𝓝 0) := by have hr : Tendsto (fun k : ℕ => (deletionOrder k : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp deletionOrder_tendsto_atTop have hu : Tendsto (fun k : ℕ => Real.exp (-(deletionOrder k : ℝ))) atTop (𝓝 0) := by simpa only [neg_one_mul] using exp_neg_mul_tendsto_zero hr (by norm_num : (0 : ℝ) < 1) exact tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hu (Eventually.of_forall richDescriptorTail_nonneg) eventually_richDescriptorTail_le_exp theorem sqrt_richDescriptorTail_tendsto_zero : Tendsto (fun p : ℕ => richDescriptorTail (Nat.sqrt p)) atTop (𝓝 0) := richDescriptorTail_tendsto_zero.comp nat_sqrt_tendsto_atTop /-- Expanded literal expression requested by the rich-star extraction route. -/ theorem literal_sqrt_richDescriptorTail_tendsto_zero : Tendsto (fun p : ℕ => let k := Nat.sqrt p (4 * (k : ℝ) ^ 2) ^ (122 * H k + 12 * ⌊200 * (k : ℝ) * theta1 k⌋₊) * (16 * (k : ℝ) ^ 2 * ((400 : ℝ) ^ ell / (ell.factorial : ℝ)) / ((nStar k : ℝ) * ((M1 k).choose ell : ℝ))) ^ (richBudget k / ell)) atTop (𝓝 0) := by simpa only [richDescriptorTail, descriptorFactor, descriptorExponent, sourceCardCap, deletionBase, meanConstant, starScale, deletionOrder] using sqrt_richDescriptorTail_tendsto_zero theorem prime_richDescriptorTail_tendsto_zero : Tendsto (fun p : {p : ℕ // p.Prime} => richDescriptorTail (Nat.sqrt p.val)) atTop (𝓝 0) := richDescriptorTail_tendsto_zero.comp prime_sqrt_tendsto_atTop end end Green39Submission.RichDescriptorTail end Green39AssemblyScope_7c21078423950598 /- Source: Green39Submission.CodegreeMultiplicityTail; SHA256 043d20967628e22350b35824eec0d74259b54339aa0bd1cbb7e6c656f7fb8c6e -/ section Green39AssemblyScope_ee5e26b622adb597 /-! Literal prime-indexed common input events for Green39. The finite estimates are proved in CodegreeMultiplicity and the numerical estimates in Asymptotics. Both events below concern the same original uniform exact-cardinality slice. No covering theorem is a premise. -/ namespace Green39Submission.CodegreeMultiplicityTail open scoped BigOperators open Filter Topology open CodegreeMultiplicity universe u section Finite variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The sharp rank-six specialization. The universe-size comparisons are explicit; the literal prime square-root case supplies them below. -/ theorem uniformMultiplicityCleanup_six_failure_le (k : ℕ) (hkone : 1 ≤ k) (hk : k ≤ Fintype.card G) (hksq : k ^ 2 ≤ Fintype.card G) (hNupper : Fintype.card G ≤ 2 * k ^ 2) : uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ UniformMultiplicityCleanup A 6 (30 * Parameters.H k) (Parameters.H k)) ≤ (k : ℝ) ^ (-(Parameters.H k : ℝ)) := by classical let h := Parameters.H k let μ : ℝ := (Fintype.card G : ℝ) * (h.choose 6 : ℝ) * DisjointSupport.fallingRatio (Fintype.card G) k 6 have hkpos : 0 < k := lt_of_lt_of_le Nat.zero_lt_one hkone have hh : 0 < h := lt_of_lt_of_le Nat.zero_lt_one (Asymptotics.H_one_le hkone) have hcap : (h : ℝ) ≤ (k : ℝ) ^ (5 / 8 : ℝ) := Nat.floor_le (Real.rpow_nonneg (Nat.cast_nonneg k) _) have hμ0 : 0 ≤ μ := mul_nonneg (by positivity) (DisjointSupport.fallingRatio_nonneg _ _ _) have hμ : μ ≤ (h : ℝ) ^ 6 / (2 * (k : ℝ) ^ 4) := multiplicityMean_six_le_half (Fintype.card G) k h hkpos hk hksq have hNR : (Fintype.card G : ℝ) ≤ 2 * (k : ℝ) ^ 2 := by exact_mod_cast hNupper have hdesc : (∑ a ∈ Finset.range (h + 1), ((Fintype.card G).choose a : ℝ)) ≤ (4 * (k : ℝ) ^ 2) ^ h := by calc (∑ a ∈ Finset.range (h + 1), ((Fintype.card G).choose a : ℝ)) ≤ ((2 : ℝ) * (Fintype.card G : ℝ)) ^ h := centerDescriptorCount_le (Fintype.card G) h (Fintype.card_pos (α := G)) _ ≤ (4 * (k : ℝ) ^ 2) ^ h := pow_le_pow_left₀ (by positivity) (by linarith) h have hfinite := uniformMultiplicityCleanup_failure_le (G := G) k 6 (5 * h) h hk (by norm_num) have hbudget : 6 * (5 * h) = 30 * h := by omega rw [hbudget] at hfinite calc uniformProb (exactSlice (Finset.univ : Finset G) k) (fun A => ¬ UniformMultiplicityCleanup A 6 (30 * Parameters.H k) (Parameters.H k)) ≤ (∑ a ∈ Finset.range (h + 1), ((Fintype.card G).choose a : ℝ)) * μ ^ (5 * h) / ((5 * h).factorial : ℝ) := hfinite _ ≤ (4 * (k : ℝ) ^ 2) ^ h * μ ^ (5 * h) / ((5 * h).factorial : ℝ) := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right hdesc (pow_nonneg hμ0 _)) (Nat.cast_nonneg _) _ ≤ (k : ℝ) ^ (-(h : ℝ)) := Asymptotics.multiplicity_numeric_tail_sharp (by exact_mod_cast hkone) hh hcap hμ0 hμ end Finite /-- Failure of the literal common codegree cap on the original exact slice. -/ noncomputable def primeCodegreeFailure (p : PrimeIndex) : ℝ := uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt (p : ℕ))) (fun A => ¬ NonzeroCodegreeBound A (Parameters.J (p : ℕ))) /-- Failure of uniform rank-six cleanup with the exact `30H` deletion budget. -/ noncomputable def primeMultiplicityFailure (p : PrimeIndex) : ℝ := uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt (p : ℕ))) (fun A => ¬ UniformMultiplicityCleanup A 6 (30 * Parameters.H (Nat.sqrt (p : ℕ))) (Parameters.H (Nat.sqrt (p : ℕ)))) /-- The common input event is a conjunction on one sample space. -/ noncomputable def primeCommonInputFailure (p : PrimeIndex) : ℝ := uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt (p : ℕ))) (fun A => ¬ (NonzeroCodegreeBound A (Parameters.J (p : ℕ)) ∧ UniformMultiplicityCleanup A 6 (30 * Parameters.H (Nat.sqrt (p : ℕ))) (Parameters.H (Nat.sqrt (p : ℕ))))) theorem primeCodegreeFailure_le_factorial (p : PrimeIndex) : primeCodegreeFailure p ≤ ((p : ℕ) : ℝ) / ((Parameters.codegreePackingOrder (p : ℕ)).factorial : ℝ) := by unfold primeCodegreeFailure have h := nonzeroCodegreeBound_failure_le (G := ZMod (p : ℕ)) (Nat.sqrt (p : ℕ)) (Parameters.J (p : ℕ)) (Parameters.codegreePackingOrder (p : ℕ)) (by simpa only [ZMod.card] using Nat.sqrt_le_self (p : ℕ)) (by simpa only [ZMod.card] using Nat.sqrt_le' (p : ℕ)) (Parameters.four_mul_codegreePackingOrder_le (p : ℕ)) simpa only [ZMod.card] using h /-- The finite prime specialization already holds for `sqrt p ≥ 3`, and therefore includes the manuscript's stated rank-six threshold. -/ theorem primeMultiplicityFailure_le (p : PrimeIndex) (hk : 3 ≤ Nat.sqrt (p : ℕ)) : primeMultiplicityFailure p ≤ Asymptotics.multiplicityFailure (Nat.sqrt (p : ℕ)) := by unfold primeMultiplicityFailure Asymptotics.multiplicityFailure apply uniformMultiplicityCleanup_six_failure_le · omega · simpa only [ZMod.card] using Nat.sqrt_le_self (p : ℕ) · simpa only [ZMod.card] using Nat.sqrt_le' (p : ℕ) · have hs := Nat.lt_succ_sqrt' (p : ℕ) have hm := Nat.mul_le_mul_left (Nat.sqrt (p : ℕ)) hk have hupper : (p : ℕ) ≤ 2 * (Nat.sqrt (p : ℕ)) ^ 2 := by nlinarith simpa only [ZMod.card] using hupper theorem eventually_primeCodegreeFailure_le : ∀ᶠ p : PrimeIndex in atTop, primeCodegreeFailure p ≤ ((p : ℕ) : ℝ) ^ (-100 : ℝ) := by have htail := Asymptotics.prime_val_tendsto_atTop.eventually Asymptotics.eventually_codegree_factorial_tail filter_upwards [htail] with p hp exact (primeCodegreeFailure_le_factorial p).trans hp theorem eventually_primeMultiplicityFailure_le : ∀ᶠ p : PrimeIndex in atTop, primeMultiplicityFailure p ≤ Asymptotics.multiplicityFailure (Nat.sqrt (p : ℕ)) := by filter_upwards [Asymptotics.prime_sqrt_tendsto_atTop.eventually_ge_atTop 3] with p hp exact primeMultiplicityFailure_le p hp theorem primeCommonInputFailure_le (p : PrimeIndex) : primeCommonInputFailure p ≤ primeCodegreeFailure p + primeMultiplicityFailure p := by classical unfold primeCommonInputFailure primeCodegreeFailure primeMultiplicityFailure calc uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt (p : ℕ))) (fun A => ¬ (NonzeroCodegreeBound A (Parameters.J (p : ℕ)) ∧ UniformMultiplicityCleanup A 6 (30 * Parameters.H (Nat.sqrt (p : ℕ))) (Parameters.H (Nat.sqrt (p : ℕ))))) = uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt (p : ℕ))) (fun A => (¬ NonzeroCodegreeBound A (Parameters.J (p : ℕ))) ∨ ¬ UniformMultiplicityCleanup A 6 (30 * Parameters.H (Nat.sqrt (p : ℕ))) (Parameters.H (Nat.sqrt (p : ℕ)))) := by apply uniformProb_congr intro A hA exact not_and_or _ ≤ _ := uniformProb_or_le _ _ _ theorem eventually_primeCommonInputFailure_le : ∀ᶠ p : PrimeIndex in atTop, primeCommonInputFailure p ≤ ((p : ℕ) : ℝ) ^ (-100 : ℝ) + Asymptotics.multiplicityFailure (Nat.sqrt (p : ℕ)) := by filter_upwards [eventually_primeCodegreeFailure_le, eventually_primeMultiplicityFailure_le] with p hc hm exact (primeCommonInputFailure_le p).trans (add_le_add hc hm) /-- Both required input events hold simultaneously with probability tending to one. This is independent of the later cover-exclusion argument. -/ theorem primeCommonInputFailure_tendsto_zero : Tendsto primeCommonInputFailure atTop (𝓝 (0 : ℝ)) := by have hupper : Tendsto (fun p : PrimeIndex => ((p : ℕ) : ℝ) ^ (-100 : ℝ) + Asymptotics.multiplicityFailure (Nat.sqrt (p : ℕ))) atTop (𝓝 (0 : ℝ)) := by simpa only [Function.comp_def, zero_add] using ((Asymptotics.codegree_failure_tendsto_zero.comp Asymptotics.prime_val_tendsto_atTop).add (Asymptotics.multiplicity_failure_tendsto_zero.comp Asymptotics.prime_sqrt_tendsto_atTop)) apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hupper · exact Eventually.of_forall (fun p => uniformProb_nonneg _ _) · exact eventually_primeCommonInputFailure_le end Green39Submission.CodegreeMultiplicityTail end Green39AssemblyScope_ee5e26b622adb597 /- Source: Green39Submission.RichObstruction; SHA256 430b08a1393de907d7ebc3e3ff0ee2185377fad5394fd83aeddd6c4aa001aec0 -/ section Green39AssemblyScope_e5cba3bc33993c7e /-! The rich-target argument, assembled from the actual parent preparation, source law, and exact fixed-descriptor prior. Auxiliary rows and counting deletions do not form part of the encoded descriptor. -/ namespace Green39Submission.RichObstruction open scoped BigOperators Pointwise Classical open Filter Topology Parameters RichStar RichStarGeometry RichStarAsymptotics open CodegreeMultiplicity SourceProbability DescriptorPrior DescriptorAsymptotics open RootedDerivativeBounds noncomputable section universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] abbrev Descriptor (G : Type u) := Finset G × Finset G × Finset G × Finset G /-- The extra filter retains the actual source-dependent protection cap. -/ def richDescriptorFamily (h s : ℕ) : Finset (Descriptor G) := (DescriptorCounting.protectedDescriptorFamily Finset.univ h s).filter (fun d => d.2.2.1.card ≤ 30 * h + 5 * d.2.2.2.card) theorem mem_richDescriptorFamily {D E0 P S : Finset G} {h s : ℕ} : (D, E0, P, S) ∈ richDescriptorFamily h s ↔ D.card ≤ h ∧ E0.card ≤ 30 * h ∧ P.card ≤ 30 * h + 5 * S.card ∧ S.card ≤ s := by constructor · intro hd obtain ⟨hbroad, hactual⟩ := Finset.mem_filter.mp hd obtain ⟨hD, hE, hP, hS⟩ := (DescriptorCounting.mem_descriptorFamily Finset.univ D E0 P S h (30 * h) (30 * h + 5 * s) s).mp hbroad exact ⟨hD.2, hE.2, hactual, hS.2⟩ · rintro ⟨hD, hE, hP, hS⟩ apply Finset.mem_filter.mpr refine ⟨?_, hP⟩ apply (DescriptorCounting.mem_descriptorFamily Finset.univ D E0 P S h (30 * h) (30 * h + 5 * s) s).mpr exact ⟨⟨Finset.subset_univ _, hD⟩, ⟨Finset.subset_univ _, hE⟩, ⟨Finset.subset_univ _, hP.trans (Nat.add_le_add_left (Nat.mul_le_mul_left 5 hS) _)⟩, ⟨Finset.subset_univ _, hS⟩⟩ theorem richDescriptorFamily_card_le (h s : ℕ) (hp : 2 ≤ Fintype.card G) : (richDescriptorFamily (G := G) h s).card ≤ (Fintype.card G) ^ (122 * h + 12 * s) := by calc _ ≤ (DescriptorCounting.protectedDescriptorFamily (Finset.univ : Finset G) h s).card := Finset.card_filter_le _ _ _ ≤ _ := by simpa only [Finset.card_univ] using (DescriptorCounting.protectedDescriptorFamily_card_le_ambient_power (Finset.univ : Finset G) h s (by simpa only [Finset.card_univ] using hp)) def richObservable (d : Descriptor G) (degree b : ℕ) (θ a : ℝ) (B : Finset G) : Prop := ∀ E ⊆ B, E.card ≤ b → a / 4 < (θ ^ degree)⁻¹ * ∑ x : G, ((representationCount (B \ E) d.2.2.2 x).choose degree : ℝ) /-- The source certificate is encoded by precisely its four required sets. -/ theorem descriptor_of_source {A E0 S D : Finset G} {k h s degree b : ℕ} {θ a : ℝ} (hAk : A.card = k) (hE0A : E0 ⊆ A) (hD : D.card ≤ h) (hE0 : E0.card ≤ 30 * h) (hS : S.card ≤ s) (hcap : ∀ t ∈ S, representationCount (A \ E0) D t ≤ 5) (hobs : richObservable (D, E0, protectedInputs A E0 S D, S) degree b θ a (A \ protectedInputs A E0 S D)) : ∃ d ∈ richDescriptorFamily h s, sourceConsistent k d A ∧ richObservable d degree b θ a (A \ d.2.2.1) := by let P := protectedInputs A E0 S D have hP : P.card ≤ 30 * h + 5 * S.card := (ProtectedScores.card_protectedInputs_le A E0 S D 5 hcap).trans (Nat.add_le_add_right hE0 _) exact ⟨(D, E0, P, S), mem_richDescriptorFamily.mpr ⟨hD, hE0, hP, hS⟩, sourceConsistent_protectedInputs k A E0 S D hAk hE0A, hobs⟩ theorem richDescriptorFamily_sizeCaps {k : ℕ} {d : Descriptor G} (hd : d ∈ richDescriptorFamily (H k) ⌊200 * (k : ℝ) * theta1 k⌋₊) : SizeCaps epsilon1 200 k d := by rcases d with ⟨D, E0, P, S⟩ obtain ⟨hD, hE, hP, hS⟩ := mem_richDescriptorFamily.mp hd refine ⟨hD, hE, hP, ?_⟩ have hfloor : (S.card : ℝ) ≤ 200 * (k : ℝ) * theta1 k := (Nat.cast_le.mpr hS).trans (Nat.floor_le (by unfold theta1; positivity)) simpa only [sourceScale, theta1, mul_assoc] using hfloor theorem fixed_prior_rich_tail {k degree b : ℕ} {d : Descriptor G} {θ a : ℝ} (hk : 0 < k) (hprior : PriorSizeBounds k d) (hθ : 0 < θ) (ha : 0 < a) (hS : (d.2.2.2.card : ℝ) ≤ 200 * (k : ℝ) * θ) : uniformProb (sourcePrior k d) (richObservable d degree b θ a) ≤ (((Fintype.card G : ℝ) * (400 : ℝ) ^ degree / (degree.factorial : ℝ)) / (a / 4)) ^ (b / degree) := by have hcap := source_density_cap_400 (by exact_mod_cast hk : (0 : ℝ) < k) hprior.density_pos.le hS hprior.density_le exact observable_star_deletion_tail_constant (sourceFreeUniverse d) d.2.2.2 (k - d.2.2.1.card) degree b hprior.remainder_le_free hθ (div_pos ha (by norm_num)) hcap /-- Actual fixed-parent data before the auxiliary source thinning. -/ structure PreparedRichParent (p : ℕ) (A T : Finset G) where centers : Finset G exceptional : Finset G targets : Finset G rows : G → Finset G centers_card : centers.card ≤ H (Nat.sqrt p) exceptional_subset : exceptional ⊆ A exceptional_card : exceptional.card ≤ 30 * H (Nat.sqrt p) clean_multiplicity : ∀ t : G, representationCount (A \ exceptional) centers t ≤ 5 targets_card : targets.card = nStar (Nat.sqrt p) row_card : ∀ x ∈ targets, (rows x).card = M1 (Nat.sqrt p) row_sources : ∀ x ∈ targets, rows x ⊆ T row_inputs : ∀ x ∈ targets, ∀ t ∈ rows x, x - t ∈ A \ exceptional no_loop : ∀ x ∈ targets, x ∉ loopTargets (A \ exceptional) T centers no_wedge : ∀ x ∈ targets, x ∉ wedgeTargets (A \ exceptional) T centers ordinary_weight : ∀ x ∈ targets, ∀ t ∈ rows x, ((ordinarySources T centers (x - t)).card : ℝ) ≤ R (Nat.sqrt p) ordinary_cap : ∀ v : G, v ∉ centers → (T.filter (fun t => t - v ∈ A)).card ≤ ordinaryCap (Nat.sqrt p) /-- Rich targets in the literal parent representation count. -/ def richTargets (A T : Finset G) (k : ℕ) : Finset G := Finset.univ.filter (fun x => (k : ℝ) ^ alpha < (representationCount A T x : ℝ)) theorem rich_target_has_two_rows {A T : Finset G} {k : ℕ} {x : G} (hx : x ∈ richTargets A T k) : 2 * M1 k ≤ representationCount A T x := by have hx' := (Finset.mem_filter.mp hx).2 have hM : (M1 k : ℝ) ≤ (k : ℝ) ^ alpha / 2 := Nat.floor_le (by positivity) have h : 2 * (M1 k : ℝ) ≤ (representationCount A T x : ℝ) := by linarith exact_mod_cast h /-- The finite preparation uses only the two common original-input events, the displayed numerical room, and a genuinely rich parent. -/ theorem exists_preparedRichParent (p : ℕ) {A T : Finset G} (hk : 0 < Nat.sqrt p) (hAk : A.card = Nat.sqrt p) (hT : T.card ≤ 100 * Nat.sqrt p) (hcode : NonzeroCodegreeBound A (J p)) (hclean : UniformMultiplicityCleanup A 6 (30 * H (Nat.sqrt p)) (H (Nat.sqrt p))) (hcoef : 10000 * ((J p : ℝ) + 1) ≤ (Nat.sqrt p : ℝ) ^ (1 / 8 : ℝ)) (hM : 0 < M1 (Nat.sqrt p)) (hroom : ((nStar (Nat.sqrt p) : ℝ) + 500 * (Nat.sqrt p : ℝ) * (1 + (H (Nat.sqrt p) : ℝ) * (J p : ℝ))) * (M1 (Nat.sqrt p) : ℝ) + 100 * (Nat.sqrt p : ℝ) * (30 * (H (Nat.sqrt p) : ℝ) + 500 * (Nat.sqrt p : ℝ) / R (Nat.sqrt p)) ≤ (N (Nat.sqrt p) : ℝ) * (M1 (Nat.sqrt p) : ℝ)) (hrich : N (Nat.sqrt p) ≤ (richTargets A T (Nat.sqrt p)).card) : Nonempty (PreparedRichParent p A T) := by let k := Nat.sqrt p let D := MixedEnergy.highCenters A T ((k : ℝ) ^ (3 / 4 : ℝ)) have hD : D.card ≤ H k := HighCenters.highCenters_card_le_H hk hAk hT hcode hcoef obtain ⟨E0, F, hE0A, hE0, hF, hFA, hcap, hFcard, hEFA, hEFcard, hweight⟩ := HighCenters.whole_parent_counting_deletion hk hAk hT hcode hcoef hclean let Bad := loopTargets (A \ E0) T D ∪ wedgeTargets (A \ E0) T D have hcode0 : NonzeroCodegreeBound (A \ E0) (J p) := nonzeroCodegreeBound_mono_input Finset.sdiff_subset hcode have hbad0 : Bad.card ≤ (T.card * 5) * (1 + D.card * J p) := card_badAliasTargets_le (fun t _ht => hcap t) (fun d₁ _hd₁ d₂ _hd₂ hne => filtered_common_target_card_le_codegree hcode0 T hne) have hbad : Bad.card ≤ 500 * k * (1 + H k * J p) := by calc Bad.card ≤ (T.card * 5) * (1 + D.card * J p) := hbad0 _ ≤ (100 * k * 5) * (1 + H k * J p) := Nat.mul_le_mul (Nat.mul_le_mul_right 5 hT) (Nat.add_le_add_left (Nat.mul_le_mul_right (J p) hD) 1) _ = _ := by ring obtain ⟨X0, hX0, hX0card⟩ := Finset.exists_subset_card_eq hrich have hrich0 : ∀ x ∈ X0, 2 * M1 k ≤ representationCount A T x := fun x hx => rich_target_has_two_rows (hX0 hx) have hroomNat : (nStar k + Bad.card) * M1 k + (E0 ∪ F).card * T.card ≤ X0.card * M1 k := by have hbadR : (Bad.card : ℝ) ≤ 500 * (k : ℝ) * (1 + (H k : ℝ) * (J p : ℝ)) := by exact_mod_cast hbad have hTR : (T.card : ℝ) ≤ 100 * (k : ℝ) := by exact_mod_cast hT have hEFR : ((E0 ∪ F).card : ℝ) ≤ 30 * (H k : ℝ) + 500 * (k : ℝ) / R k := by simpa only [Nat.cast_mul, Nat.cast_ofNat] using hEFcard have hbound : ((nStar k : ℝ) + (Bad.card : ℝ)) * (M1 k : ℝ) + ((E0 ∪ F).card : ℝ) * (T.card : ℝ) ≤ (N k : ℝ) * (M1 k : ℝ) := by calc _ ≤ ((nStar k : ℝ) + 500 * (k : ℝ) * (1 + (H k : ℝ) * (J p : ℝ))) * (M1 k : ℝ) + (30 * (H k : ℝ) + 500 * (k : ℝ) / R k) * (100 * (k : ℝ)) := by apply add_le_add · exact mul_le_mul_of_nonneg_right (add_le_add le_rfl hbadR) (Nat.cast_nonneg _) · exact mul_le_mul hEFR hTR (Nat.cast_nonneg _) ((Nat.cast_nonneg _).trans hEFR) _ ≤ _ := by simpa only [mul_comm (30 * (H k : ℝ) + _)] using hroom rw [hX0card] exact_mod_cast hbound obtain ⟨X, hXX0, hXcard, W, hW⟩ := exists_retained_rows A (E0 ∪ F) T X0 Bad (M1 k) (nStar k) hM hrich0 hroomNat have hinput : ∀ x ∈ X, ∀ t ∈ W x, x - t ∈ A \ E0 := by intro x hx t ht rcases Finset.mem_sdiff.mp ((hW x hx).2.2.1 t ht) with ⟨hinA, hout⟩ exact Finset.mem_sdiff.mpr ⟨hinA, fun h => hout (Finset.mem_union_left _ h)⟩ refine ⟨{ centers := D exceptional := E0 targets := X rows := W centers_card := hD exceptional_subset := hE0A exceptional_card := hE0 clean_multiplicity := hcap targets_card := hXcard row_card := fun x hx => (hW x hx).2.2.2 row_sources := fun x hx => (hW x hx).2.1 row_inputs := hinput no_loop := ?_ no_wedge := ?_ ordinary_weight := ?_ ordinary_cap := ?_ }⟩ · intro x hx hl exact (hW x hx).1 (Finset.mem_union_left _ hl) · intro x hx hw exact (hW x hx).1 (Finset.mem_union_right _ hw) · intro x hx t ht exact hweight (x - t) ((hW x hx).2.2.1 t ht) · intro v hv exact Nat.le_floor (MixedEnergy.ordinaryOverlap_le_of_not_mem_highCenters hv) /-- Numerical requirements only; each is proved eventually below. -/ structure RichParameterConditions (p : ℕ) : Prop where k_pos : 0 < Nat.sqrt p theta_pos : 0 < theta1 (Nat.sqrt p) theta_le_one : theta1 (Nat.sqrt p) ≤ 1 star_pos : 0 < starScale (Nat.sqrt p) root_pos : 0 < rootScale (Nat.sqrt p) row_pos : 0 < M1 (Nat.sqrt p) moment_pos : 1 ≤ momentOrder (Nat.sqrt p) high_coefficient : 10000 * ((J p : ℝ) + 1) ≤ (Nat.sqrt p : ℝ) ^ (1 / 8 : ℝ) matching_small : 2 * M1 (Nat.sqrt p) * (M1 (Nat.sqrt p) - 2).choose (ell - 2) ≤ (M1 (Nat.sqrt p)).choose ell root_ratio : (∑ j ∈ Finset.range (ell + 1), momentChoose (Nat.sqrt p) j * rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M1 (Nat.sqrt p)) ell (theta1 (Nat.sqrt p)) j) / (2 * rootScale (Nat.sqrt p)) ≤ (3 / 4 : ℝ) source_failure : chosenFailure p + (Nat.sqrt p : ℝ) * (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) + (1 / 2 : ℝ) < 1 row_room : ((nStar (Nat.sqrt p) : ℝ) + 500 * (Nat.sqrt p : ℝ) * (1 + (H (Nat.sqrt p) : ℝ) * (J p : ℝ))) * (M1 (Nat.sqrt p) : ℝ) + 100 * (Nat.sqrt p : ℝ) * (30 * (H (Nat.sqrt p) : ℝ) + 500 * (Nat.sqrt p : ℝ) / R (Nat.sqrt p)) ≤ (N (Nat.sqrt p) : ℝ) * (M1 (Nat.sqrt p) : ℝ) theorem eventually_richParameterConditions : ∀ᶠ p : ℕ in atTop, RichParameterConditions p := by filter_upwards [HighCenters.eventually_highCenter_coefficient, Asymptotics.nat_sqrt_tendsto_atTop.eventually eventually_starScale_pos, (Asymptotics.M1_tendsto_atTop.comp Asymptotics.nat_sqrt_tendsto_atTop).eventually_ge_atTop 1, (momentOrder_tendsto_atTop.comp Asymptotics.nat_sqrt_tendsto_atTop).eventually_ge_atTop 1, Asymptotics.nat_sqrt_tendsto_atTop.eventually eventually_matching_three_quarters, eventually_rootedMoment_ratio_le_three_quarters, eventually_common_source_failure_lt_one, eventually_row_room] with p hcoef hstar hrow hmoment hmatch hroot hfailure hroom have htheta := source_theta_pos_le_one epsilon1_pos.le (Nat.succ_le_of_lt hcoef.1) exact ⟨hcoef.1, htheta.1, htheta.2, hstar, hroot.1, Nat.zero_lt_one.trans_le hrow, hmoment, hcoef.2, hmatch, hroot.2 _ _ _ le_rfl le_rfl le_rfl, hfailure, hroom⟩ theorem PreparedRichParent.row_inputs_original {p : ℕ} {A T : Finset G} (data : PreparedRichParent p A T) : ∀ x ∈ data.targets, ∀ t ∈ data.rows x, x - t ∈ A := fun x hx t ht => (Finset.mem_sdiff.mp (data.row_inputs x hx t ht)).1 theorem prepared_score_tail {p : ℕ} {A T : Finset G} (hp : RichParameterConditions p) (hAk : A.card = Nat.sqrt p) (hcode : NonzeroCodegreeBound A (J p)) (data : PreparedRichParent p A T) : bernoulliMean T (theta1 (Nat.sqrt p)) (fun S => if richSourceScore T data.centers data.targets data.rows ell (theta1 (Nat.sqrt p)) S < starScale (Nat.sqrt p) / 2 then 1 else 0) ≤ chosenFailure p := by let v := (validChosenStars T data.centers data.targets data.rows ell).card have hthree : 3 * (data.targets.card * (M1 (Nat.sqrt p)).choose ell) ≤ 4 * v := validChosenStars_card_three_quarters (by norm_num [ell, L]) data.row_card data.row_sources data.row_inputs data.no_loop data.no_wedge hp.matching_small rw [data.targets_card] at hthree have hv : (3 / 4 : ℝ) * starScale (Nat.sqrt p) ≤ (v : ℝ) := by have h : (3 : ℝ) * ((nStar (Nat.sqrt p) : ℝ) * ((M1 (Nat.sqrt p)).choose ell : ℝ)) ≤ 4 * (v : ℝ) := by exact_mod_cast hthree dsimp only [starScale] linarith have hgap : starScale (Nat.sqrt p) / 2 < (v : ℝ) := by nlinarith [hp.star_pos] have htail := valid_free_star_lower_tail (d := ell) data.row_card data.row_sources data.row_inputs_original hcode data.ordinary_weight hp.theta_pos hp.theta_le_one hgap apply htail.trans exact centered_square_gap_le_chosenFailure p hp.star_pos hv (chosenMomentBase_ge p A.card (J p) v) (chosenMomentBase_le p A.card (J p) v hAk.le le_rfl) theorem prepared_influence_tail {p : ℕ} {A T : Finset G} (hp : RichParameterConditions p) (hT : T.card ≤ 100 * Nat.sqrt p) (hcode : NonzeroCodegreeBound A (J p)) (data : PreparedRichParent p A T) {u : G} (hu : u ∈ A \ data.exceptional) : bernoulliMean T (theta1 (Nat.sqrt p)) (fun S => if u ∉ protectedInputs A data.exceptional S data.centers ∧ 2 * rootScale (Nat.sqrt p) < richSourceInfluence T data.centers data.targets data.rows ell (theta1 (Nat.sqrt p)) u S then 1 else 0) ≤ (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) := by have htail := free_input_influence_tail (d := ell) (z := momentOrder (Nat.sqrt p)) (t := 2 * rootScale (Nat.sqrt p)) hT data.row_card data.row_inputs_original data.ordinary_cap hcode hp.theta_pos hp.theta_le_one (mul_pos (by norm_num) hp.root_pos) hp.moment_pos hu apply htail.trans apply pow_le_pow_left₀ _ hp.root_ratio apply div_nonneg _ (mul_nonneg (by norm_num) hp.root_pos.le) exact Finset.sum_nonneg fun j _ => mul_nonneg (Nat.cast_nonneg _) (rootedDerivativeBound_nonneg _ _ _ _ _ _ hp.theta_pos.le) /-- All three source tails are now specialized to the literal fixed parameters. -/ theorem prepared_source_seed {p : ℕ} {A T : Finset G} (hp : RichParameterConditions p) (hAk : A.card = Nat.sqrt p) (hT : T.card ≤ 100 * Nat.sqrt p) (hcode : NonzeroCodegreeBound A (J p)) (data : PreparedRichParent p A T) : ∃ S ⊆ T, (S.card : ℝ) ≤ 200 * (Nat.sqrt p : ℝ) * theta1 (Nat.sqrt p) ∧ richObservable (data.centers, data.exceptional, protectedInputs A data.exceptional S data.centers, S) ell (richBudget (Nat.sqrt p)) (theta1 (Nat.sqrt p)) (starScale (Nat.sqrt p)) (A \ protectedInputs A data.exceptional S data.centers) := by have hcard : ((A \ data.exceptional).card : ℝ) ≤ (Nat.sqrt p : ℝ) := by exact_mod_cast (Finset.card_le_card (Finset.sdiff_subset : A \ data.exceptional ⊆ A)).trans hAk.le have hsmall : chosenFailure p + (1 / 2 : ℝ) + ((A \ data.exceptional).card : ℝ) * (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) < 1 := by have h := mul_le_mul_of_nonneg_right hcard (pow_nonneg (by norm_num : (0 : ℝ) ≤ 3 / 4) (momentOrder (Nat.sqrt p))) linarith [hp.source_failure] obtain ⟨S, hST, hS, hobs⟩ := exists_seed_for_observable_of_tail_bounds data.row_inputs hT hp.theta_pos hp.theta_le_one hp.star_pos (mul_nonneg (by norm_num) hp.root_pos.le) (richBudget_retention_le (Nat.sqrt p) hp.k_pos) (prepared_score_tail hp hAk hcode data) (fun u hu => prepared_influence_tail hp hT hcode data hu) hsmall refine ⟨S, hST, ?_, hobs⟩ calc (S.card : ℝ) ≤ 2 * ((100 * Nat.sqrt p : ℕ) : ℝ) * theta1 (Nat.sqrt p) := hS _ = _ := by push_cast; ring /-- Every bad rich parent on the two actual input gates yields a counted descriptor, without encoding the parent, the retained rows, or the heavy inputs. -/ theorem exists_descriptor_of_rich_parent {p : ℕ} {A T : Finset G} (hp : RichParameterConditions p) (hAk : A.card = Nat.sqrt p) (hT : T.card ≤ 100 * Nat.sqrt p) (hcode : NonzeroCodegreeBound A (J p)) (hclean : UniformMultiplicityCleanup A 6 (30 * H (Nat.sqrt p)) (H (Nat.sqrt p))) (hrich : N (Nat.sqrt p) ≤ (richTargets A T (Nat.sqrt p)).card) : ∃ d ∈ richDescriptorFamily (H (Nat.sqrt p)) (RichDescriptorTail.sourceCardCap (Nat.sqrt p)), sourceConsistent (Nat.sqrt p) d A ∧ richObservable d ell (richBudget (Nat.sqrt p)) (theta1 (Nat.sqrt p)) (starScale (Nat.sqrt p)) (A \ d.2.2.1) := by obtain ⟨data⟩ := exists_preparedRichParent p hp.k_pos hAk hT hcode hclean hp.high_coefficient hp.row_pos hp.row_room hrich obtain ⟨S, hST, hS, hobs⟩ := prepared_source_seed hp hAk hT hcode data exact descriptor_of_source hAk data.exceptional_subset data.centers_card data.exceptional_card (Nat.le_floor hS) (fun t _ht => data.clean_multiplicity t) hobs /-- Uniform domination of the fixed-descriptor tail by the numerical rate. -/ theorem fixed_prior_rich_tail_comparison {p : ℕ} (hp : RichParameterConditions p) (hupper : Fintype.card G ≤ 4 * (Nat.sqrt p) ^ 2) {d : Descriptor G} (hd : d ∈ richDescriptorFamily (H (Nat.sqrt p)) (RichDescriptorTail.sourceCardCap (Nat.sqrt p))) (hprior : PriorSizeBounds (Nat.sqrt p) d) : uniformProb (sourcePrior (Nat.sqrt p) d) (richObservable d ell (richBudget (Nat.sqrt p)) (theta1 (Nat.sqrt p)) (starScale (Nat.sqrt p))) ≤ RichDescriptorTail.deletionBase (Nat.sqrt p) ^ RichDescriptorTail.deletionOrder (Nat.sqrt p) := by have hcaps := richDescriptorFamily_sizeCaps hd have hS : (d.2.2.2.card : ℝ) ≤ 200 * (Nat.sqrt p : ℝ) * theta1 (Nat.sqrt p) := by simpa only [sourceScale, theta1, mul_assoc] using hcaps.sources have hraw := fixed_prior_rich_tail (degree := ell) (b := richBudget (Nat.sqrt p)) hp.k_pos hprior hp.theta_pos hp.star_pos hS have hbase : (((Fintype.card G : ℝ) * (400 : ℝ) ^ ell / (ell.factorial : ℝ)) / (starScale (Nat.sqrt p) / 4)) = 2 * (Fintype.card G : ℝ) * RichDescriptorTail.meanConstant / (starScale (Nat.sqrt p) / 2) := by unfold RichDescriptorTail.meanConstant simp only [div_div_eq_mul_div] ring rw [hbase] at hraw exact hraw.trans (RichDescriptorTail.fixedPriorTail_le_deletionTail hupper) def originalInputGate (p : ℕ) (A : Finset G) : Prop := NonzeroCodegreeBound A (J p) ∧ UniformMultiplicityCleanup A 6 (30 * H (Nat.sqrt p)) (H (Nat.sqrt p)) def hasRichParent (p : ℕ) (A : Finset G) : Prop := ∃ T : Finset G, T.card ≤ 100 * Nat.sqrt p ∧ N (Nat.sqrt p) ≤ (richTargets A T (Nat.sqrt p)).card /-- The only input exceptions are the proved original-slice codegree and multiplicity events. Every adaptive rich parent is paid through its descriptor. -/ theorem rich_failure_bound {p : ℕ} (hp : RichParameterConditions p) (hcard : 2 ≤ Fintype.card G) (hupper : Fintype.card G ≤ 4 * (Nat.sqrt p) ^ 2) (hprior : ∀ d ∈ richDescriptorFamily (G := G) (H (Nat.sqrt p)) (RichDescriptorTail.sourceCardCap (Nat.sqrt p)), PriorSizeBounds (Nat.sqrt p) d) : uniformProb (exactSlice (Finset.univ : Finset G) (Nat.sqrt p)) (hasRichParent p) ≤ uniformProb (exactSlice (Finset.univ : Finset G) (Nat.sqrt p)) (fun A => ¬ originalInputGate p A) + RichDescriptorTail.richDescriptorTail (Nat.sqrt p) := by let family := richDescriptorFamily (G := G) (H (Nat.sqrt p)) (RichDescriptorTail.sourceCardCap (Nat.sqrt p)) let tail := RichDescriptorTail.deletionBase (Nat.sqrt p) ^ RichDescriptorTail.deletionOrder (Nat.sqrt p) have hunion := DescriptorUnion.source_probability_le_gate_failure_add_card_mul (Nat.sqrt p) family (originalInputGate p) (hasRichParent p) (fun d => richObservable d ell (richBudget (Nat.sqrt p)) (theta1 (Nat.sqrt p)) (starScale (Nat.sqrt p))) tail (fun d hd => (hprior d hd).protected_le) (fun A hA hgood hbad => by obtain ⟨T, hT, hrich⟩ := hbad exact exists_descriptor_of_rich_parent hp (mem_exactSlice.mp hA).2 hT hgood.1 hgood.2 hrich) (fun d hd => fixed_prior_rich_tail_comparison hp hupper hd (hprior d hd)) have hfamily : (family.card : ℝ) ≤ RichDescriptorTail.descriptorFactor (Nat.sqrt p) := by have hc : (family.card : ℝ) ≤ (Fintype.card G : ℝ) ^ (122 * H (Nat.sqrt p) + 12 * RichDescriptorTail.sourceCardCap (Nat.sqrt p)) := by exact_mod_cast (richDescriptorFamily_card_le (H (Nat.sqrt p)) (RichDescriptorTail.sourceCardCap (Nat.sqrt p)) hcard) exact hc.trans (pow_le_pow_left₀ (Nat.cast_nonneg _) (by exact_mod_cast hupper) _) exact hunion.trans (add_le_add le_rfl (mul_le_mul_of_nonneg_right hfamily (pow_nonneg (RichDescriptorTail.deletionBase_nonneg _) _))) noncomputable def primeRichFailure (p : PrimeIndex) : ℝ := uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt (p : ℕ))) (hasRichParent (p : ℕ)) theorem eventually_primeRichFailure_le : ∀ᶠ p : PrimeIndex in atTop, primeRichFailure p ≤ CodegreeMultiplicityTail.primeCommonInputFailure p + RichDescriptorTail.richDescriptorTail (Nat.sqrt (p : ℕ)) := by filter_upwards [Asymptotics.prime_val_tendsto_atTop.eventually eventually_richParameterConditions, Asymptotics.prime_val_tendsto_atTop.eventually (eventually_uniform_sqrt_prior_size_bounds epsilon1_pos (by norm_num : (0 : ℝ) ≤ 200))] with p hp hpriors have hcard : 2 ≤ Fintype.card (ZMod (p : ℕ)) := by simpa only [ZMod.card] using p.property.two_le have hupper : Fintype.card (ZMod (p : ℕ)) ≤ 4 * (Nat.sqrt (p : ℕ)) ^ 2 := by have hs := Nat.lt_succ_sqrt' (p : ℕ) have hk : 1 ≤ Nat.sqrt (p : ℕ) := Nat.succ_le_of_lt hp.k_pos have hm := Nat.mul_le_mul_left (Nat.sqrt (p : ℕ)) hk simpa only [ZMod.card] using (show (p : ℕ) ≤ 4 * (Nat.sqrt (p : ℕ)) ^ 2 by nlinarith) have hprior : ∀ d ∈ richDescriptorFamily (G := ZMod (p : ℕ)) (H (Nat.sqrt (p : ℕ))) (RichDescriptorTail.sourceCardCap (Nat.sqrt (p : ℕ))), PriorSizeBounds (Nat.sqrt (p : ℕ)) d := by intro d hd exact hpriors (ZMod (p : ℕ)) d (by simp only [ZMod.card]) (richDescriptorFamily_sizeCaps hd) exact rich_failure_bound hp hcard hupper hprior /-- Unconditional uniform rich-target theorem in the original exact-k input model, along all primes and with the literal translate constant 100. -/ theorem primeRichFailure_tendsto_zero : Tendsto primeRichFailure atTop (𝓝 (0 : ℝ)) := by have hupper : Tendsto (fun p : PrimeIndex => CodegreeMultiplicityTail.primeCommonInputFailure p + RichDescriptorTail.richDescriptorTail (Nat.sqrt (p : ℕ))) atTop (𝓝 (0 : ℝ)) := by simpa only [add_zero] using CodegreeMultiplicityTail.primeCommonInputFailure_tendsto_zero.add RichDescriptorTail.prime_richDescriptorTail_tendsto_zero apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hupper · exact Eventually.of_forall (fun p => uniformProb_nonneg _ _) · exact eventually_primeRichFailure_le end end Green39Submission.RichObstruction end Green39AssemblyScope_e5cba3bc33993c7e /- Source: Green39Submission.ScalarPolynomial; SHA256 01ed92c1066545a334d35a8bfaf4526f183ff5447792eb98a9ef637bed940a71 -/ section Green39AssemblyScope_7318a81765e622a8 /-! # The consecutive-root scalar polynomial from Appendix A The coefficient formula is represented first by an equivalent sum of two ordinary binomial coefficients; `coefficientWeight_formula` supplies EP3's quotient form. The exact Newton expansion, formal-series coefficient identity, positive recurrence, actual real derivatives, and uniform margins are proved below. No principal covering statement is an input to these lemmas. -/ noncomputable section open scoped BigOperators open scoped fwdDiff namespace Green39Submission namespace Scalar /-- The normalization in EP1. -/ def normalizer (L d : ℕ) : ℝ := ((L + d).choose (d + 1) : ℝ) /-- The positive numerator of the alternating Newton coefficient. -/ def coefficientWeight (L d j : ℕ) : ℝ := ((L + d - j).choose (d + 1) : ℝ) + (j : ℝ) * ((L + d - j).choose d : ℝ) /-- The explicit finite Newton coefficient, extended by zero past the degree. -/ def newtonCoeff (L d j : ℕ) : ℝ := if j ≤ L then (-1 : ℝ) ^ j * coefficientWeight L d j / normalizer L d else 0 /-- The polynomial evaluated at a natural number, using generalized binomial coefficients. -/ def integerValue (L d r : ℕ) : ℝ := (1 - (r : ℝ)) * Ring.choose ((L : ℝ) + (d : ℝ) - (r : ℝ)) (L - 1) / normalizer L d /-- The finite coefficient sum corresponding to a derivative of the Poisson polynomial. -/ def poissonShift (L d c : ℕ) (t : ℝ) : ℝ := ∑ i ∈ Finset.range (L - c + 1), newtonCoeff L d (c + i) * t ^ i / (i.factorial : ℝ) theorem normalizer_pos {L d : ℕ} (hL : 0 < L) : 0 < normalizer L d := by unfold normalizer exact_mod_cast (Nat.choose_pos (show d + 1 ≤ L + d by omega)) theorem coefficientWeight_zero (L d : ℕ) : coefficientWeight L d 0 = normalizer L d := by simp [coefficientWeight, normalizer] theorem coefficientWeight_nonneg (L d j : ℕ) : 0 ≤ coefficientWeight L d j := by unfold coefficientWeight positivity theorem coefficientWeight_pos {L d j : ℕ} (hL : 0 < L) (hj : j ≤ L) : 0 < coefficientWeight L d j := by by_cases hj0 : j = 0 · simpa [hj0, coefficientWeight_zero] using normalizer_pos (d := d) hL · have hc : 0 < ((L + d - j).choose d : ℝ) := by exact_mod_cast (Nat.choose_pos (show d ≤ L + d - j by omega)) have hjpos : (0 : ℝ) < j := by exact_mod_cast Nat.pos_of_ne_zero hj0 exact add_pos_of_nonneg_of_pos (Nat.cast_nonneg _) (mul_pos hjpos hc) /-- The rational expression for the same numerator, including the endpoint `j = L`. -/ theorem coefficientWeight_formula {L d j : ℕ} (hj : j ≤ L) : coefficientWeight L d j = (((L : ℝ) + (d : ℝ) * (j : ℝ)) * ((L + d - j).choose d : ℝ)) / ((d : ℝ) + 1) := by have hd : (d : ℝ) + 1 ≠ 0 := by positivity have hsub : L + d - j - d = L - j := by omega have hchoose := Nat.choose_succ_right_eq (L + d - j) d rw [hsub] at hchoose have hchoose' : ((L + d - j).choose (d + 1) : ℝ) * ((d : ℝ) + 1) = ((L + d - j).choose d : ℝ) * ((L : ℝ) - (j : ℝ)) := by have hcast := congrArg (fun n : ℕ => (n : ℝ)) hchoose push_cast at hcast rw [Nat.cast_sub hj] at hcast exact hcast apply (eq_div_iff hd).2 unfold coefficientWeight nlinarith [hchoose'] theorem coefficientWeight_top (L d : ℕ) : coefficientWeight L d L = (L : ℝ) := by have hsub : L + d - L = d := by omega simp [coefficientWeight, hsub] /-- The reversed coefficient form used in the generating-function identity. -/ theorem coefficientWeight_reversed {L d j : ℕ} (hj : j ≤ L) : coefficientWeight L d j = (L : ℝ) * ((L + d - j).choose d : ℝ) - (d : ℝ) * ((L + d - j).choose (d + 1) : ℝ) := by have hchoose := Nat.choose_succ_right_eq (L + d - j) d rw [show L + d - j - d = L - j by omega] at hchoose have hcast := congrArg (fun n : ℕ => (n : ℝ)) hchoose push_cast at hcast rw [Nat.cast_sub hj] at hcast unfold coefficientWeight nlinarith [hcast] /-- A subtraction-free version of the monotonicity identity for `d > 0`. -/ theorem coefficientWeight_step {L d j : ℕ} (hj : j < L) : coefficientWeight L (d + 1) j = coefficientWeight L (d + 1) (j + 1) + (j : ℝ) * ((L + (d + 1) - (j + 1)).choose d : ℝ) := by have hsub : L + (d + 1) - j = (L + (d + 1) - (j + 1)) + 1 := by omega unfold coefficientWeight rw [hsub] simp only [Nat.choose_succ_succ, Nat.cast_add, Nat.cast_one] ring theorem coefficientWeight_succ_le {L d j : ℕ} (hj : j < L) : coefficientWeight L d (j + 1) ≤ coefficientWeight L d j := by cases d with | zero => rw [coefficientWeight_formula (show j + 1 ≤ L by omega), coefficientWeight_formula (Nat.le_of_lt hj)] simp | succ d => rw [coefficientWeight_step (d := d) hj] have h : 0 ≤ (j : ℝ) * ((L + (d + 1) - (j + 1)).choose d : ℝ) := by positivity linarith theorem coefficientWeight_le_normalizer {L d j : ℕ} (hj : j ≤ L) : coefficientWeight L d j ≤ normalizer L d := by induction j with | zero => simp [coefficientWeight_zero] | succ j ih => exact (coefficientWeight_succ_le (show j < L by omega)).trans (ih (show j ≤ L by omega)) theorem newtonCoeff_zero {L d : ℕ} (hL : 0 < L) : newtonCoeff L d 0 = 1 := by rw [newtonCoeff, if_pos (Nat.zero_le _), pow_zero, one_mul, coefficientWeight_zero] exact div_self (ne_of_gt (normalizer_pos hL)) theorem newtonCoeff_eq_zero_of_lt {L d j : ℕ} (hj : L < j) : newtonCoeff L d j = 0 := by simp [newtonCoeff, Nat.not_le.mpr hj] theorem newtonCoeff_top (L d : ℕ) : newtonCoeff L d L = (-1 : ℝ) ^ L * (L : ℝ) / normalizer L d := by simp [newtonCoeff, coefficientWeight_top] theorem newtonCoeff_top_neg {L d : ℕ} (hL : Odd L) : newtonCoeff L d L < 0 := by have hLpos : 0 < L := hL.pos have hLpos' : (0 : ℝ) < L := by exact_mod_cast hLpos rw [newtonCoeff_top, hL.neg_one_pow] simp only [neg_one_mul] exact div_neg_of_neg_of_pos (neg_neg_of_pos hLpos') (normalizer_pos hLpos) theorem abs_newtonCoeff_le_one {L d : ℕ} (hL : 0 < L) (j : ℕ) : |newtonCoeff L d j| ≤ 1 := by by_cases hj : j ≤ L · rw [newtonCoeff, if_pos hj, abs_div, abs_mul, abs_pow] simp only [abs_neg, abs_one, one_pow, one_mul, abs_of_nonneg (coefficientWeight_nonneg L d j), abs_of_pos (normalizer_pos (d := d) hL)] apply (div_le_iff₀ (normalizer_pos (d := d) hL)).2 simpa using coefficientWeight_le_normalizer (d := d) hj · simp [newtonCoeff, hj] /-- A generalized binomial with integral upper argument and even lower argument is nonnegative. -/ theorem choose_nat_sub_nonneg {a r n : ℕ} (hn : Even n) : 0 ≤ Ring.choose ((a : ℝ) - (r : ℝ)) n := by by_cases hr : r ≤ a · rw [← Nat.cast_sub hr, Ring.choose_natCast] positivity · have har : a < r := Nat.lt_of_not_ge hr have hs : 0 < r - a := Nat.sub_pos_of_lt har have hx : (a : ℝ) - (r : ℝ) = -((r - a : ℕ) : ℝ) := by rw [Nat.cast_sub (Nat.le_of_lt har)] ring have hn' : Even (n : ℤ) := by obtain ⟨m, hm⟩ := hn refine ⟨(m : ℤ), ?_⟩ exact_mod_cast hm rw [hx, Ring.choose_neg, Int.negOnePow_even _ hn', one_smul] have hu : ((r - a : ℕ) : ℝ) + (n : ℝ) - 1 = ((r - a + n - 1 : ℕ) : ℝ) := by rw [Nat.cast_sub (show 1 ≤ r - a + n by omega)] push_cast ring rw [hu, Ring.choose_natCast] positivity theorem integerValue_zero {L d : ℕ} (hL : 0 < L) : integerValue L d 0 = 1 := by unfold integerValue simp only [Nat.cast_zero, sub_zero, one_mul] rw [← Nat.cast_add, Ring.choose_natCast] have hs : (L + d).choose (L - 1) = (L + d).choose (d + 1) := Nat.choose_symm_of_eq_add (by omega) rw [hs] exact div_self (ne_of_gt (normalizer_pos (d := d) hL)) theorem integerValue_nonpos {L d r : ℕ} (hL : Odd L) (hr : 1 ≤ r) : integerValue L d r ≤ 0 := by have heven : Even (L - 1) := by obtain ⟨m, hm⟩ := hL refine ⟨m, ?_⟩ omega have hc : 0 ≤ Ring.choose ((L : ℝ) + (d : ℝ) - (r : ℝ)) (L - 1) := by simpa only [Nat.cast_add] using (choose_nat_sub_nonneg (a := L + d) (r := r) heven) have hr' : (1 : ℝ) ≤ r := by exact_mod_cast hr unfold integerValue exact div_nonpos_of_nonpos_of_nonneg (mul_nonpos_of_nonpos_of_nonneg (sub_nonpos.mpr hr') hc) (le_of_lt (normalizer_pos (d := d) hL.pos)) /-- One backward shift of the upper argument lowers the binomial degree. -/ theorem fwdDiff_descending_choose (a : ℝ) (n : ℕ) : Δ_[(1 : ℕ)] (fun r : ℕ => Ring.choose (a - (r : ℝ)) (n + 1)) = (-1 : ℝ) • (fun r : ℕ => Ring.choose (a - 1 - (r : ℝ)) n) := by funext r simp only [fwdDiff, Pi.smul_apply, smul_eq_mul, Nat.cast_add, Nat.cast_one] have hx : a - ((r : ℝ) + 1) = a - 1 - (r : ℝ) := by ring have hy : a - 1 - (r : ℝ) + 1 = a - (r : ℝ) := by ring rw [hx] have hp := Ring.choose_succ_succ (a - 1 - (r : ℝ)) n rw [hy] at hp linarith /-- Exact iterated differences, before the binomial degree is exhausted. -/ theorem fwdDiff_iter_descending_choose (a : ℝ) (j n : ℕ) : (fwdDiff (1 : ℕ))^[j] (fun r : ℕ => Ring.choose (a - (r : ℝ)) (j + n)) = (-1 : ℝ) ^ j • (fun r : ℕ => Ring.choose (a - (j : ℝ) - (r : ℝ)) n) := by induction j generalizing a with | zero => simp | succ j ih => have hindex : (j + 1) + n = (j + n) + 1 := by omega rw [hindex, Function.iterate_succ_apply, fwdDiff_descending_choose, fwdDiff_iter_const_smul, ih] funext r simp only [Pi.smul_apply, smul_eq_mul, Nat.cast_succ, pow_succ] have harg : a - 1 - (j : ℝ) - (r : ℝ) = a - ((j : ℝ) + 1) - (r : ℝ) := by ring rw [harg] ring /-- All higher differences vanish exactly, including at arbitrary natural inputs. -/ theorem fwdDiff_iter_descending_choose_eq_zero (a : ℝ) {n j : ℕ} (hj : n < j) : (fwdDiff (1 : ℕ))^[j] (fun r : ℕ => Ring.choose (a - (r : ℝ)) n) = 0 := by obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_lt hj have hn : (fwdDiff (1 : ℕ))^[n] (fun r : ℕ => Ring.choose (a - (r : ℝ)) n) = fun _ => (-1 : ℝ) ^ n := by funext r simpa only [Nat.add_zero, Ring.choose_zero_right, Pi.smul_apply, smul_eq_mul, mul_one] using congrFun (fwdDiff_iter_descending_choose a n 0) r rw [show n + k + 1 = (k + 1) + n by omega, Function.iterate_add_apply, hn, Function.iterate_succ_apply, fwdDiff_const] funext r simp [fwdDiff_iter_eq_sum_shift] /-- The origin differences of the binomial factor, with zero coefficients included. -/ theorem fwdDiff_iter_base_at_zero {L : ℕ} (hL : 0 < L) (d j : ℕ) : (fwdDiff (1 : ℕ))^[j] (fun r : ℕ => Ring.choose ((L : ℝ) + (d : ℝ) - (r : ℝ)) (L - 1)) 0 = (-1 : ℝ) ^ j * ((L + d - j).choose (d + 1) : ℝ) := by by_cases hj : j < L · have hi : j + (L - 1 - j) = L - 1 := by omega have hh := congrFun (fwdDiff_iter_descending_choose ((L : ℝ) + (d : ℝ)) j (L - 1 - j)) 0 simp only [hi, Nat.cast_zero, sub_zero, Pi.smul_apply, smul_eq_mul] at hh rw [hh] have hja : j ≤ L + d := by omega rw [← Nat.cast_add, ← Nat.cast_sub hja, Ring.choose_natCast] congr 2 exact Nat.choose_symm_of_eq_add (by omega) · have hz := fwdDiff_iter_descending_choose_eq_zero ((L : ℝ) + (d : ℝ)) (n := L - 1) (j := j) (by omega) rw [hz, Pi.zero_apply, Nat.choose_eq_zero_of_lt (show L + d - j < d + 1 by omega), Nat.cast_zero, mul_zero] /-- The forward-difference step evaluated at a natural argument. -/ theorem fwdDiff_iter_succ_nat (f : ℕ → ℝ) (j r : ℕ) : (fwdDiff (1 : ℕ))^[j + 1] f r = (fwdDiff (1 : ℕ))^[j] f (r + 1) - (fwdDiff (1 : ℕ))^[j] f r := by rw [Function.iterate_succ_apply'] rfl /-- The discrete Leibniz rule specialized to the linear factor `1-r`. -/ theorem fwdDiff_iter_linear_mul (f : ℕ → ℝ) (j r : ℕ) : (fwdDiff (1 : ℕ))^[j + 1] (fun s : ℕ => (1 - (s : ℝ)) * f s) r = (-(r : ℝ) - (j : ℝ)) * (fwdDiff (1 : ℕ))^[j + 1] f r - ((j : ℝ) + 1) * (fwdDiff (1 : ℕ))^[j] f r := by induction j generalizing r with | zero => rw [fwdDiff_iter_succ_nat, fwdDiff_iter_succ_nat] simp only [Function.iterate_zero_apply, Nat.cast_add, Nat.cast_one, Nat.cast_zero] ring | succ j ih => rw [fwdDiff_iter_succ_nat, ih, ih, fwdDiff_iter_succ_nat f (j + 1) r] simp only [fwdDiff_iter_succ_nat f j (r + 1), fwdDiff_iter_succ_nat f j r] push_cast ring /-- The displayed coefficients really are the Newton coefficients of the integer polynomial. -/ theorem fwdDiff_iter_integerValue_at_zero {L : ℕ} (hL : 0 < L) (d j : ℕ) : (fwdDiff (1 : ℕ))^[j] (integerValue L d) 0 = newtonCoeff L d j := by cases j with | zero => simp [integerValue_zero hL, newtonCoeff_zero hL] | succ j => have hf : integerValue L d = (normalizer L d)⁻¹ • (fun r : ℕ => (1 - (r : ℝ)) * Ring.choose ((L : ℝ) + (d : ℝ) - (r : ℝ)) (L - 1)) := by funext r simp only [integerValue, Pi.smul_apply, smul_eq_mul, div_eq_mul_inv] ring rw [hf, fwdDiff_iter_const_smul] simp only [Pi.smul_apply, smul_eq_mul] rw [fwdDiff_iter_linear_mul, fwdDiff_iter_base_at_zero hL, fwdDiff_iter_base_at_zero hL] by_cases hj : j + 1 ≤ L · have hsub : L + d - j = L + d - (j + 1) + 1 := by omega rw [newtonCoeff, if_pos hj, coefficientWeight, hsub, Nat.choose_succ_succ] simp only [Nat.cast_add, Nat.cast_one, Nat.cast_zero, neg_zero, zero_sub, pow_succ, div_eq_mul_inv] ring · have hz₁ : (L + d - (j + 1)).choose (d + 1) = 0 := Nat.choose_eq_zero_of_lt (by omega) have hz₀ : (L + d - j).choose (d + 1) = 0 := Nat.choose_eq_zero_of_lt (by omega) simp [newtonCoeff, hj, hz₁, hz₀] /-- Exact finite Newton expansion at every natural input, including inputs beyond all roots. -/ theorem integerValue_eq_newton_sum {L : ℕ} (hL : 0 < L) (d r : ℕ) : integerValue L d r = ∑ j ∈ Finset.range (L + 1), newtonCoeff L d j * (r.choose j : ℝ) := by have hnewton := shift_eq_sum_fwdDiff_iter (1 : ℕ) (integerValue L d) r 0 simp only [nsmul_eq_mul, mul_one, zero_add, Nat.cast_id] at hnewton rw [hnewton] simp_rw [fwdDiff_iter_integerValue_at_zero hL, mul_comm (r.choose _ : ℝ)] let f : ℕ → ℝ := fun j => newtonCoeff L d j * (r.choose j : ℝ) change (∑ j ∈ Finset.range (r + 1), f j) = ∑ j ∈ Finset.range (L + 1), f j have hrange : (∑ j ∈ Finset.range (r + 1), f j) = ∑ j ∈ Finset.range (max (r + 1) (L + 1)), f j := by apply Finset.sum_subset (Finset.range_mono (Nat.le_max_left _ _)) intro j _ hj simp only [Finset.mem_range] at hj have hjr : r < j := by omega simp [f, Nat.choose_eq_zero_of_lt hjr] have hLrange : (∑ j ∈ Finset.range (L + 1), f j) = ∑ j ∈ Finset.range (max (r + 1) (L + 1)), f j := by apply Finset.sum_subset (Finset.range_mono (Nat.le_max_right _ _)) intro j _ hj simp only [Finset.mem_range] at hj have hjL : L < j := by omega simp [f, newtonCoeff_eq_zero_of_lt hjL] exact hrange.trans hLrange.symm /-- The coefficient recurrence for `exp (-C z) * (1-z)^(-d-1)`. -/ def coefficientSequence (d C : ℝ) : ℕ → ℝ | 0 => 1 | 1 => d + 1 - C | n + 2 => ((((n : ℝ) + 2) + d - C) * coefficientSequence d C (n + 1) + C * coefficientSequence d C n) / ((n : ℝ) + 2) theorem coefficientSequence_zero (d C : ℝ) : coefficientSequence d C 0 = 1 := rfl theorem coefficientSequence_one (d C : ℝ) : coefficientSequence d C 1 = d + 1 - C := rfl theorem coefficientSequence_recurrence (d C : ℝ) (n : ℕ) : ((n : ℝ) + 2) * coefficientSequence d C (n + 2) = (((n : ℝ) + 2) + d - C) * coefficientSequence d C (n + 1) + C * coefficientSequence d C n := by rw [coefficientSequence] have hn : (n : ℝ) + 2 ≠ 0 := by positivity field_simp theorem coefficientSequence_bounds {d C : ℝ} (hC : 0 ≤ C) (hCd : C ≤ d) (n : ℕ) : 1 ≤ coefficientSequence d C n ∧ coefficientSequence d C n ≤ coefficientSequence d C (n + 1) := by induction n with | zero => simp only [Nat.zero_add, coefficientSequence_zero, coefficientSequence_one] constructor · rfl · linarith | succ n ih => have hu : 1 ≤ coefficientSequence d C (n + 1) := ih.1.trans ih.2 refine ⟨hu, ?_⟩ change coefficientSequence d C (n + 1) ≤ coefficientSequence d C (n + 2) apply le_of_mul_le_mul_left (a := (n : ℝ) + 2) ?_ (by positivity) have hrec := coefficientSequence_recurrence d C n have hp : 0 ≤ (d - C) * coefficientSequence d C (n + 1) := mul_nonneg (sub_nonneg.mpr hCd) (zero_le_one.trans hu) have hq : 0 ≤ C * coefficientSequence d C n := mul_nonneg hC (zero_le_one.trans ih.1) nlinarith [hrec, hp, hq] theorem coefficientSequence_sum_recurrence (d C : ℝ) (n : ℕ) : ((n : ℝ) + 1) * coefficientSequence d C (n + 1) = (d + 1) * (∑ i ∈ Finset.range (n + 1), coefficientSequence d C i) - C * coefficientSequence d C n := by induction n with | zero => simp [coefficientSequence] | succ n ih => have hrec := coefficientSequence_recurrence d C n simp only [Nat.cast_succ] rw [Finset.sum_range_succ] nlinarith [ih, hrec] /-- EP6's margin algebra, separated from the later coefficient-identification proof. -/ theorem weighted_sum_margin_mul {L d C t u v s : ℝ} (hd : 0 ≤ d) (hC : 0 ≤ C) (htu : t ≤ L) (hvu : v ≤ u) (hu : 0 ≤ u) (hrec : t * u = (d + 1) * s - C * v) : (L - d * C) * u ≤ (d + 1) * (L * u - d * s) := by have hp : 0 ≤ d * (L - t) * u := mul_nonneg (mul_nonneg hd (sub_nonneg.mpr htu)) hu have hq : 0 ≤ d * C * (u - v) := mul_nonneg (mul_nonneg hd hC) (sub_nonneg.mpr hvu) have hrec' := congrArg (fun z : ℝ => d * z) hrec nlinarith [hp, hq, hrec'] theorem weighted_sum_margin_pos {L d C t u v s : ℝ} (hd : 0 ≤ d) (hC : 0 ≤ C) (ht : t ≤ L) (hv : v ≤ u) (hu : 0 < u) (hrec : t * u = (d + 1) * s - C * v) (hgap : d * C < L) : 0 < L * u - d * s := by have hmargin := weighted_sum_margin_mul hd hC ht hv hu.le hrec have hpos : 0 < (L - d * C) * u := mul_pos (sub_pos.mpr hgap) hu have hd1 : 0 < d + 1 := by linarith nlinarith [hmargin, hpos] theorem coefficientSequence_margin_pos {L d C : ℝ} (hC : 0 ≤ C) (hCd : C ≤ d) (hgap : d * C < L) (n : ℕ) (hn : (n : ℝ) ≤ L) : 0 < L * coefficientSequence d C n - d * (∑ i ∈ Finset.range n, coefficientSequence d C i) := by have hd : 0 ≤ d := hC.trans hCd cases n with | zero => simp only [coefficientSequence_zero, Finset.sum_range_zero, mul_one, mul_zero, sub_zero] exact lt_of_le_of_lt (mul_nonneg hd hC) hgap | succ n => have hb := coefficientSequence_bounds hC hCd n have hu : 0 < coefficientSequence d C (n + 1) := lt_of_lt_of_le zero_lt_one (hb.1.trans hb.2) have hrec := coefficientSequence_sum_recurrence d C n apply weighted_sum_margin_pos hd hC (t := (n : ℝ) + 1) ?_ hb.2 hu hrec hgap exact_mod_cast hn /-- EP6's quantitative margin, uniform over all coefficient indices up to `L`. -/ theorem coefficientSequence_margin_lower {L d C : ℝ} (hC : 0 ≤ C) (hCd : C ≤ d) (hgap : d * C ≤ L) (n : ℕ) (hn : (n : ℝ) ≤ L) : (L - d * C) / (d + 1) ≤ L * coefficientSequence d C n - d * (∑ i ∈ Finset.range n, coefficientSequence d C i) := by have hd : 0 ≤ d := hC.trans hCd have hd1 : 0 < d + 1 := by linarith cases n with | zero => simp only [coefficientSequence_zero, Finset.sum_range_zero, mul_one, mul_zero, sub_zero] apply (div_le_iff₀ hd1).2 have hL : 0 ≤ L := (mul_nonneg hd hC).trans hgap nlinarith [mul_nonneg hd hL, mul_nonneg hd hC] | succ n => have hb := coefficientSequence_bounds hC hCd n have hu : 1 ≤ coefficientSequence d C (n + 1) := hb.1.trans hb.2 have ht : (n : ℝ) + 1 ≤ L := by exact_mod_cast hn have hrec := coefficientSequence_sum_recurrence d C n have hmargin := weighted_sum_margin_mul hd hC ht hb.2 (zero_le_one.trans hu) hrec have hunit : L - d * C ≤ (L - d * C) * coefficientSequence d C (n + 1) := by nlinarith [mul_nonneg (sub_nonneg.mpr hgap) (sub_nonneg.mpr hu)] apply (div_le_iff₀ hd1).2 nlinarith [hmargin, hunit] /-- The exponential series is used only through its exact formal coefficients. -/ def exponentialSeries (C : ℝ) : PowerSeries ℝ := PowerSeries.mk fun n => (-C) ^ n / (n.factorial : ℝ) /-- The exact binomial series `(1-X)^(-d-1)`. -/ def binomialSeries (d : ℕ) : PowerSeries ℝ := PowerSeries.mk fun n => ((d + n).choose d : ℝ) /-- The coefficient series in EP4 and EP5. -/ def scalarSeries (d : ℕ) (C : ℝ) : PowerSeries ℝ := exponentialSeries C * binomialSeries d /-- The companion series whose coefficients are partial sums of `scalarSeries`. -/ def companionSeries (d : ℕ) (C : ℝ) : PowerSeries ℝ := exponentialSeries C * (PowerSeries.X * binomialSeries (d + 1)) theorem derivative_exponentialSeries (C : ℝ) : PowerSeries.derivative ℝ (exponentialSeries C) = PowerSeries.C (-C) * exponentialSeries C := by ext n simp only [PowerSeries.coeff_derivative, PowerSeries.coeff_C_mul, exponentialSeries, PowerSeries.coeff_mk, Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, pow_succ] have hn : (n : ℝ) + 1 ≠ 0 := by positivity have hf : (n.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero n field_simp [hn, hf] theorem derivative_binomialSeries (d : ℕ) : PowerSeries.derivative ℝ (binomialSeries d) = PowerSeries.C ((d : ℝ) + 1) * binomialSeries (d + 1) := by ext n simp only [PowerSeries.coeff_derivative, PowerSeries.coeff_C_mul, binomialSeries, PowerSeries.coeff_mk] have hchoose := Nat.choose_succ_right_eq (d + n + 1) d rw [show d + n + 1 - d = n + 1 by omega] at hchoose have hcast := congrArg (fun m : ℕ => (m : ℝ)) hchoose push_cast at hcast simpa only [Nat.add_assoc, Nat.add_left_comm, Nat.add_comm, mul_comm] using hcast.symm theorem binomialSeries_step (d : ℕ) : (1 - PowerSeries.X) * binomialSeries (d + 1) = binomialSeries d := by ext n cases n with | zero => simp [sub_mul, binomialSeries] | succ n => simp only [sub_mul, one_mul, map_sub, PowerSeries.coeff_succ_X_mul, binomialSeries, PowerSeries.coeff_mk] have hpascal := congrArg (fun m : ℕ => (m : ℝ)) (Nat.choose_succ_succ (d + n + 1) d) push_cast at hpascal have h₁ : d + 1 + (n + 1) = (d + n + 1) + 1 := by omega have h₂ : d + 1 + n = d + n + 1 := by omega have h₃ : d + (n + 1) = d + n + 1 := by omega rw [h₁, h₂, h₃] linarith /-- The formal differential equation from which the positive recurrence follows. -/ theorem scalarSeries_differential (d : ℕ) (C : ℝ) : (1 - PowerSeries.X) * PowerSeries.derivative ℝ (scalarSeries d C) = (PowerSeries.C ((d : ℝ) + 1 - C) + PowerSeries.C C * PowerSeries.X) * scalarSeries d C := by unfold scalarSeries rw [Derivation.leibniz, smul_eq_mul, smul_eq_mul, derivative_exponentialSeries, derivative_binomialSeries] calc (1 - PowerSeries.X) * (exponentialSeries C * (PowerSeries.C ((d : ℝ) + 1) * binomialSeries (d + 1)) + binomialSeries d * (PowerSeries.C (-C) * exponentialSeries C)) = PowerSeries.C ((d : ℝ) + 1) * exponentialSeries C * ((1 - PowerSeries.X) * binomialSeries (d + 1)) + PowerSeries.C (-C) * (1 - PowerSeries.X) * (exponentialSeries C * binomialSeries d) := by ring _ = PowerSeries.C ((d : ℝ) + 1) * exponentialSeries C * binomialSeries d + PowerSeries.C (-C) * (1 - PowerSeries.X) * (exponentialSeries C * binomialSeries d) := by rw [binomialSeries_step] _ = _ := by simp only [map_sub, map_neg]; ring theorem scalarSeries_coeff_zero (d : ℕ) (C : ℝ) : PowerSeries.coeff 0 (scalarSeries d C) = 1 := by simp [scalarSeries, PowerSeries.coeff_mul, exponentialSeries, binomialSeries] theorem scalarSeries_coeff_one (d : ℕ) (C : ℝ) : PowerSeries.coeff 1 (scalarSeries d C) = (d : ℝ) + 1 - C := by have h := congrArg (PowerSeries.coeff 0) (scalarSeries_differential d C) simpa only [sub_mul, one_mul, add_mul, mul_assoc, map_sub, map_add, PowerSeries.coeff_zero_X_mul, PowerSeries.coeff_C_mul, PowerSeries.coeff_derivative, Nat.cast_zero, zero_add, mul_one, sub_zero, mul_zero, add_zero, scalarSeries_coeff_zero] using h theorem scalarSeries_coeff_recurrence (d : ℕ) (C : ℝ) (n : ℕ) : ((n : ℝ) + 2) * PowerSeries.coeff (n + 2) (scalarSeries d C) = (((n : ℝ) + 2) + (d : ℝ) - C) * PowerSeries.coeff (n + 1) (scalarSeries d C) + C * PowerSeries.coeff n (scalarSeries d C) := by have h := congrArg (PowerSeries.coeff (n + 1)) (scalarSeries_differential d C) simp only [sub_mul, one_mul, add_mul, mul_assoc, map_sub, map_add, PowerSeries.coeff_C_mul, PowerSeries.coeff_succ_X_mul, PowerSeries.coeff_derivative, Nat.cast_add, Nat.cast_one] at h nlinarith [h] /-- The actual coefficient series is the recursively defined positive sequence. -/ theorem scalarSeries_coeff_eq_sequence (d : ℕ) (C : ℝ) (n : ℕ) : PowerSeries.coeff n (scalarSeries d C) = coefficientSequence (d : ℝ) C n := by induction n using Nat.strong_induction_on with | h n ih => cases n with | zero => simp [scalarSeries_coeff_zero, coefficientSequence_zero] | succ n => cases n with | zero => simp [scalarSeries_coeff_one, coefficientSequence_one] | succ n => have hi₀ := ih n (by omega) have hi₁ := ih (n + 1) (by omega) have hrec := scalarSeries_coeff_recurrence d C n rw [hi₀, hi₁] at hrec change PowerSeries.coeff (n + 2) (scalarSeries d C) = _ rw [coefficientSequence] apply (eq_div_iff (show (n : ℝ) + 2 ≠ 0 by positivity)).2 nlinarith [hrec] theorem companionSeries_difference (d : ℕ) (C : ℝ) : (1 - PowerSeries.X) * companionSeries d C = PowerSeries.X * scalarSeries d C := by unfold companionSeries scalarSeries calc (1 - PowerSeries.X) * (exponentialSeries C * (PowerSeries.X * binomialSeries (d + 1))) = PowerSeries.X * exponentialSeries C * ((1 - PowerSeries.X) * binomialSeries (d + 1)) := by ring _ = _ := by rw [binomialSeries_step]; ring /-- Coefficients of the companion series are exact finite partial sums. -/ theorem companionSeries_coeff_eq_sum (d : ℕ) (C : ℝ) (n : ℕ) : PowerSeries.coeff n (companionSeries d C) = ∑ i ∈ Finset.range n, PowerSeries.coeff i (scalarSeries d C) := by induction n with | zero => simp [companionSeries] | succ n ih => have h := congrArg (PowerSeries.coeff (n + 1)) (companionSeries_difference d C) simp only [sub_mul, one_mul, map_sub, PowerSeries.coeff_succ_X_mul] at h rw [Finset.sum_range_succ, ← ih] linarith [h] theorem scalarSeries_coeff_sum (d : ℕ) (C : ℝ) (n : ℕ) : PowerSeries.coeff n (scalarSeries d C) = ∑ i ∈ Finset.range (n + 1), ((-C) ^ i / (i.factorial : ℝ)) * ((d + (n - i)).choose d : ℝ) := by rw [scalarSeries, PowerSeries.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] simp only [exponentialSeries, binomialSeries, PowerSeries.coeff_mk] theorem coeff_X_binomialSeries (d n : ℕ) : PowerSeries.coeff n (PowerSeries.X * binomialSeries (d + 1)) = ((d + n).choose (d + 1) : ℝ) := by cases n with | zero => simp | succ n => simp only [PowerSeries.coeff_succ_X_mul, binomialSeries, PowerSeries.coeff_mk] congr 2 omega theorem companionSeries_coeff_sum (d : ℕ) (C : ℝ) (n : ℕ) : PowerSeries.coeff n (companionSeries d C) = ∑ i ∈ Finset.range (n + 1), ((-C) ^ i / (i.factorial : ℝ)) * ((d + (n - i)).choose (d + 1) : ℝ) := by rw [companionSeries, PowerSeries.coeff_mul, Finset.Nat.sum_antidiagonal_eq_sum_range_succ_mk] simp only [exponentialSeries, PowerSeries.coeff_mk, coeff_X_binomialSeries] theorem scaled_newtonCoeff {L d c i : ℕ} (hL : 0 < L) (hi : c + i ≤ L) : ((-1 : ℝ) ^ c * normalizer L d) * newtonCoeff L d (c + i) = (-1 : ℝ) ^ i * coefficientWeight L d (c + i) := by have hB : normalizer L d ≠ 0 := ne_of_gt (normalizer_pos hL) have hc : (-1 : ℝ) ^ c * (-1 : ℝ) ^ c = 1 := by rw [← mul_pow] norm_num rw [newtonCoeff, if_pos hi, pow_add] calc ((-1 : ℝ) ^ c * normalizer L d) * ((-1 : ℝ) ^ c * (-1 : ℝ) ^ i * coefficientWeight L d (c + i) / normalizer L d) = ((-1 : ℝ) ^ c * (-1 : ℝ) ^ c) * ((-1 : ℝ) ^ i * coefficientWeight L d (c + i)) := by field_simp [hB] _ = _ := by rw [hc, one_mul] /-- EP4 as an exact identity of finite coefficient sums. -/ theorem poissonShift_series_identity {L d c : ℕ} (hL : 0 < L) (hc : c ≤ L) (C : ℝ) : (-1 : ℝ) ^ c * normalizer L d * poissonShift L d c C = (L : ℝ) * PowerSeries.coeff (L - c) (scalarSeries d C) - (d : ℝ) * PowerSeries.coeff (L - c) (companionSeries d C) := by rw [poissonShift, Finset.mul_sum, scalarSeries_coeff_sum, companionSeries_coeff_sum, Finset.mul_sum, Finset.mul_sum, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro i hi have hii : i ≤ L - c := by have := Finset.mem_range.mp hi; omega have hci : c + i ≤ L := by omega have hindex : L + d - (c + i) = d + (L - c - i) := by omega calc ((-1 : ℝ) ^ c * normalizer L d) * (newtonCoeff L d (c + i) * C ^ i / (i.factorial : ℝ)) = (((-1 : ℝ) ^ c * normalizer L d) * newtonCoeff L d (c + i)) * C ^ i / (i.factorial : ℝ) := by ring _ = ((-C) ^ i / (i.factorial : ℝ)) * coefficientWeight L d (c + i) := by rw [scaled_newtonCoeff hL hci, neg_pow] ring _ = _ := by rw [coefficientWeight_reversed hci, hindex]; ring /-- The shifted Poisson sum is exactly the positive recurrence margin. -/ theorem poissonShift_sequence_identity {L d c : ℕ} (hL : 0 < L) (hc : c ≤ L) (C : ℝ) : (-1 : ℝ) ^ c * normalizer L d * poissonShift L d c C = (L : ℝ) * coefficientSequence (d : ℝ) C (L - c) - (d : ℝ) * (∑ i ∈ Finset.range (L - c), coefficientSequence (d : ℝ) C i) := by rw [poissonShift_series_identity hL hc, companionSeries_coeff_eq_sum] simp_rw [scalarSeries_coeff_eq_sequence] /-- Every signed shifted sum is strictly positive in the full parameter range of EP1. -/ theorem poissonShift_signed_pos {L d c : ℕ} {C : ℝ} (hc : c ≤ L) (hC : 0 ≤ C) (hCd : C ≤ (d : ℝ)) (hgap : (d : ℝ) * C < (L : ℝ)) : 0 < (-1 : ℝ) ^ c * poissonShift L d c C := by have hLreal : (0 : ℝ) < L := lt_of_le_of_lt (mul_nonneg (Nat.cast_nonneg _) hC) hgap have hL : 0 < L := by exact_mod_cast hLreal have hn : ((L - c : ℕ) : ℝ) ≤ (L : ℝ) := by exact_mod_cast Nat.sub_le L c have hmargin := coefficientSequence_margin_pos hC hCd hgap (L - c) hn have hid := poissonShift_sequence_identity (d := d) hL hc C have hB := normalizer_pos (d := d) hL by_contra hnonpos have hs : (-1 : ℝ) ^ c * poissonShift L d c C ≤ 0 := le_of_not_gt hnonpos have hbad := mul_nonpos_of_nonneg_of_nonpos hB.le hs nlinarith [hid, hmargin, hbad] /-- A uniform explicit lower bound for every signed shifted Poisson sum. -/ theorem poissonShift_signed_lower {L d c : ℕ} {C : ℝ} (hL : 0 < L) (hc : c ≤ L) (hC : 0 ≤ C) (hCd : C ≤ (d : ℝ)) (hgap : (d : ℝ) * C ≤ (L : ℝ)) : ((L : ℝ) - (d : ℝ) * C) / (((d : ℝ) + 1) * normalizer L d) ≤ (-1 : ℝ) ^ c * poissonShift L d c C := by have hn : ((L - c : ℕ) : ℝ) ≤ (L : ℝ) := by exact_mod_cast Nat.sub_le L c have hmargin := coefficientSequence_margin_lower hC hCd hgap (L - c) hn have hid := poissonShift_sequence_identity (d := d) hL hc C rw [← div_div] apply (div_le_iff₀ (normalizer_pos (d := d) hL)).2 calc ((L : ℝ) - (d : ℝ) * C) / ((d : ℝ) + 1) ≤ (L : ℝ) * coefficientSequence (d : ℝ) C (L - c) - (d : ℝ) * (∑ i ∈ Finset.range (L - c), coefficientSequence (d : ℝ) C i) := hmargin _ = ((-1 : ℝ) ^ c * poissonShift L d c C) * normalizer L d := by rw [← hid] ring /-- The fixed positive margin used in protected-score calibration. -/ def fixedMargin : ℝ := 1 / (101 * normalizer 10001 100) theorem fixedMargin_pos : 0 < fixedMargin := by unfold fixedMargin exact one_div_pos.mpr (mul_pos (by norm_num) (normalizer_pos (by decide))) theorem fixed_poissonShift_signed_lower {c : ℕ} {C : ℝ} (hc : c ≤ 10001) (hC : 0 ≤ C) (hC100 : C ≤ 100) : fixedMargin ≤ (-1 : ℝ) ^ c * poissonShift 10001 100 c C := by have hd : C ≤ ((100 : ℕ) : ℝ) := by norm_num only [Nat.cast_ofNat]; exact hC100 have hgap : ((100 : ℕ) : ℝ) * C ≤ ((10001 : ℕ) : ℝ) := by norm_num only [Nat.cast_ofNat] nlinarith have hmargin := poissonShift_signed_lower (by decide : 0 < 10001) hc hC hd hgap norm_num only [Nat.cast_ofNat] at hmargin apply le_trans ?_ hmargin unfold fixedMargin have hB := normalizer_pos (d := 100) (by decide : 0 < 10001) apply div_le_div_of_nonneg_right · nlinarith · exact (mul_pos (by norm_num) hB).le /-- The exact fixed-degree instance used by the Green 39 manuscript. -/ theorem fixed_poissonShift_signed_pos {c : ℕ} {C : ℝ} (hc : c ≤ 10001) (hC : 0 ≤ C) (hC100 : C ≤ 100) : 0 < (-1 : ℝ) ^ c * poissonShift 10001 100 c C := by apply poissonShift_signed_pos hc hC · norm_num only [Nat.cast_ofNat] exact hC100 · norm_num only [Nat.cast_ofNat] nlinarith /-- Exponential normalization makes differentiation shift the coefficient index. -/ theorem hasDerivAt_scaled_monomial (a t : ℝ) (i : ℕ) : HasDerivAt (fun x : ℝ => a * x ^ (i + 1) / ((i + 1).factorial : ℝ)) (a * t ^ i / (i.factorial : ℝ)) t := by have h : HasDerivAt (fun x : ℝ => a * x ^ (i + 1) / ((i + 1).factorial : ℝ)) (a * (((i : ℝ) + 1) * t ^ i) / ((i + 1).factorial : ℝ)) t := by simpa only [Pi.pow_apply, id_eq, Nat.add_sub_cancel, Nat.cast_add, Nat.cast_one, mul_one] using (((hasDerivAt_id t).pow (i + 1)).const_mul a).div_const (((i + 1).factorial : ℝ)) convert h using 1 rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one] have hi : (i : ℝ) + 1 ≠ 0 := by positivity have hf : (i.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero i field_simp [hi, hf] theorem poissonShift_succ_expansion (L d c : ℕ) (t : ℝ) : poissonShift L d c t = newtonCoeff L d c + ∑ i ∈ Finset.range (L - c), newtonCoeff L d (c + (i + 1)) * t ^ (i + 1) / ((i + 1).factorial : ℝ) := by unfold poissonShift rw [Finset.sum_range_succ'] simp [add_comm] theorem hasDerivAt_poissonShift (L d c : ℕ) (t : ℝ) : HasDerivAt (poissonShift L d c) (poissonShift L d (c + 1) t) t := by by_cases hc : c < L · have hsum : HasDerivAt (fun x : ℝ => ∑ i ∈ Finset.range (L - c), newtonCoeff L d (c + (i + 1)) * x ^ (i + 1) / ((i + 1).factorial : ℝ)) (∑ i ∈ Finset.range (L - c), newtonCoeff L d (c + (i + 1)) * t ^ i / (i.factorial : ℝ)) t := by apply HasDerivAt.fun_sum intro i _ exact hasDerivAt_scaled_monomial _ t i have hfun : poissonShift L d c = fun x : ℝ => newtonCoeff L d c + ∑ i ∈ Finset.range (L - c), newtonCoeff L d (c + (i + 1)) * x ^ (i + 1) / ((i + 1).factorial : ℝ) := by funext x exact poissonShift_succ_expansion L d c x have hderiv : (∑ i ∈ Finset.range (L - c), newtonCoeff L d (c + (i + 1)) * t ^ i / (i.factorial : ℝ)) = poissonShift L d (c + 1) t := by unfold poissonShift rw [show L - (c + 1) + 1 = L - c by omega] apply Finset.sum_congr rfl intro i _ rw [show c + (i + 1) = (c + 1) + i by omega] rw [hfun] simpa only [hderiv] using hsum.const_add (newtonCoeff L d c) · have hc' : L ≤ c := Nat.le_of_not_gt hc have hfun : poissonShift L d c = fun _ : ℝ => newtonCoeff L d c := by funext x simp [poissonShift, Nat.sub_eq_zero_of_le hc'] have hnext : poissonShift L d (c + 1) t = 0 := by simp [poissonShift, Nat.sub_eq_zero_of_le (show L ≤ c + 1 by omega), newtonCoeff_eq_zero_of_lt (show L < c + 1 by omega)] rw [hfun, hnext] exact hasDerivAt_const t (newtonCoeff L d c) theorem differentiable_poissonShift (L d c : ℕ) : Differentiable ℝ (poissonShift L d c) := fun t => (hasDerivAt_poissonShift L d c t).differentiableAt theorem continuous_poissonShift (L d c : ℕ) : Continuous (poissonShift L d c) := (differentiable_poissonShift L d c).continuous /-- The finite shifted sums are exactly the actual iterated real derivatives. -/ theorem iteratedDeriv_poissonShift (L d c n : ℕ) : iteratedDeriv n (poissonShift L d c) = poissonShift L d (c + n) := by induction n with | zero => simp | succ n ih => rw [iteratedDeriv_succ, ih] funext t rw [(hasDerivAt_poissonShift L d (c + n) t).deriv] simp only [Nat.add_assoc] /-- EP1's signed-derivative assertion, with a uniform explicit numerical-parameter margin. -/ theorem fixed_poisson_derivative_lower {c : ℕ} {C : ℝ} (hc : c ≤ 10001) (hC : 0 ≤ C) (hC100 : C ≤ 100) : fixedMargin ≤ (-1 : ℝ) ^ c * iteratedDeriv c (poissonShift 10001 100 0) C := by rw [iteratedDeriv_poissonShift, Nat.zero_add] exact fixed_poissonShift_signed_lower hc hC hC100 theorem fixed_poisson_derivative_pos {c : ℕ} {C : ℝ} (hc : c ≤ 10001) (hC : 0 ≤ C) (hC100 : C ≤ 100) : 0 < (-1 : ℝ) ^ c * iteratedDeriv c (poissonShift 10001 100 0) C := fixedMargin_pos.trans_le (fixed_poisson_derivative_lower hc hC hC100) /-- All the margins persist simultaneously on one fixed interval beyond `100`. -/ theorem exists_extended_fixed_margin : ∃ ε : ℝ, 0 < ε ∧ ∀ c : ℕ, c ≤ 10001 → ∀ C : ℝ, 0 ≤ C → C ≤ 100 + ε → fixedMargin / 2 ≤ (-1 : ℝ) ^ c * poissonShift 10001 100 c C := by have hevent (i : Fin 10002) : ∀ᶠ x in nhds (100 : ℝ), fixedMargin / 2 < (-1 : ℝ) ^ (i : ℕ) * poissonShift 10001 100 (i : ℕ) x := by have hcont : Continuous (fun x : ℝ => (-1 : ℝ) ^ (i : ℕ) * poissonShift 10001 100 (i : ℕ) x) := continuous_const.mul (continuous_poissonShift 10001 100 (i : ℕ)) have hi : (i : ℕ) ≤ 10001 := by have := i.isLt; omega have hbase := fixed_poissonShift_signed_lower hi (by norm_num : (0 : ℝ) ≤ 100) le_rfl have hstrict : fixedMargin / 2 < (-1 : ℝ) ^ (i : ℕ) * poissonShift 10001 100 (i : ℕ) 100 := by linarith [fixedMargin_pos] exact Filter.Tendsto.eventually_const_lt hstrict hcont.continuousAt have hall : ∀ᶠ x in nhds (100 : ℝ), ∀ i : Fin 10002, fixedMargin / 2 < (-1 : ℝ) ^ (i : ℕ) * poissonShift 10001 100 (i : ℕ) x := Filter.eventually_all.mpr hevent obtain ⟨δ, hδ, hδcontrol⟩ := Metric.eventually_nhds_iff.mp hall refine ⟨δ / 2, half_pos hδ, ?_⟩ intro c hc C hC hupper by_cases hC100 : C ≤ 100 · have hbase := fixed_poissonShift_signed_lower hc hC hC100 linarith [fixedMargin_pos] · have hdist : dist C (100 : ℝ) < δ := by rw [Real.dist_eq, abs_of_pos (sub_pos.mpr (lt_of_not_ge hC100))] linarith exact (hδcontrol hdist ⟨c, by omega⟩).le end Scalar end Green39Submission end end Green39AssemblyScope_7318a81765e622a8 /- Source: Green39Submission.HypergeometricCalibration; SHA256 8504239b8fbbdb007ac2ccc42ebb60fc6c728b70f1d50e1a8c8efc912b648379 -/ section Green39AssemblyScope_a3f78f023e98d9a0 /-! # Exact-slice hypergeometric calibration CAL1 is proved from the exact finite slice and a product comparison. Natural subtraction in the factors includes small target sets, in particular `q = 0` and `q < j`. CAL2 uses finite coefficient sums and the frozen scalar module; this module does not import the protected-score implementation. -/ noncomputable section namespace Green39Submission.HypergeometricCalibration open scoped BigOperators open Green39Submission.DisjointSupport universe u theorem choose_inter_card_eq_containmentSum {α : Type u} [DecidableEq α] (B W : Finset α) (j : ℕ) : ((B ∩ W).card.choose j : ℝ) = containmentSum (W.powersetCard j) id (fun _ => 1) B := by classical have hf : (W.powersetCard j).filter (fun S => S ⊆ B) = (B ∩ W).powersetCard j := by ext S simp only [Finset.mem_filter, Finset.mem_powersetCard, Finset.subset_inter_iff] tauto unfold containmentSum have hc := congrArg (fun S : Finset (Finset α) => (S.card : ℝ)) hf simpa only [id_eq, Finset.sum_boole, Finset.card_powersetCard] using hc.symm /-- Exact factorial moments of an intersection count on a uniform fixed-cardinality slice. -/ theorem uniformMean_choose_inter_card {α : Type u} [DecidableEq α] (U W : Finset α) (n j : ℕ) (hWU : W ⊆ U) (hn : n ≤ U.card) : uniformMean (exactSlice U n) (fun B => ((B ∩ W).card.choose j : ℝ)) = (W.card.choose j : ℝ) * fallingRatio U.card n j := by classical have hf : (fun B : Finset α => ((B ∩ W).card.choose j : ℝ)) = containmentSum (W.powersetCard j) id (fun _ => 1) := by funext B exact choose_inter_card_eq_containmentSum B W j rw [hf, uniformMean_containmentSum] calc (∑ S ∈ W.powersetCard j, (1 : ℝ) * uniformProb (exactSlice U n) (fun B => id S ⊆ B)) = ∑ _S ∈ W.powersetCard j, fallingRatio U.card n j := by apply Finset.sum_congr rfl intro S hS obtain ⟨hSW, hcard⟩ := Finset.mem_powersetCard.mp hS simp only [one_mul, id_eq] rw [exactSlice_containment_eq_fallingRatio U S n (hSW.trans hWU) hn, hcard] _ = _ := by simp [Finset.card_powersetCard] /-- The exact normalized binomial moment in CAL1. -/ def scaledBinomialMoment (v n q : ℕ) (θ : ℝ) (j : ℕ) : ℝ := (θ⁻¹) ^ j * (q.choose j : ℝ) * fallingRatio v n j /-- The normalized hypergeometric mean parameter. -/ def scaledParameter (v n q : ℕ) (θ : ℝ) : ℝ := (n : ℝ) * (q : ℝ) / ((v : ℝ) * θ) /-- One factor of the normalized falling-factorial moment; natural zero tails are retained. -/ def scaledFactor (v n q : ℕ) (θ : ℝ) (i : ℕ) : ℝ := ((q - i : ℕ) : ℝ) * (((n - i : ℕ) : ℝ) / ((v - i : ℕ) : ℝ)) * θ⁻¹ theorem scaledBinomialMoment_zero (v n q : ℕ) (θ : ℝ) : scaledBinomialMoment v n q θ 0 = 1 := by simp [scaledBinomialMoment, DisjointSupport.fallingRatio_zero] theorem scaledBinomialMoment_nonneg (v n q j : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : 0 ≤ scaledBinomialMoment v n q θ j := by unfold scaledBinomialMoment exact mul_nonneg (mul_nonneg (pow_nonneg (inv_nonneg.mpr hθ) _) (Nat.cast_nonneg _)) (fallingRatio_nonneg _ _ _) theorem product_scaledFactor_eq (v n q : ℕ) (θ : ℝ) (j : ℕ) : (∏ i ∈ Finset.range j, scaledFactor v n q θ i) = (θ⁻¹) ^ j * (q.descFactorial j : ℝ) * fallingRatio v n j := by induction j with | zero => simp [DisjointSupport.fallingRatio_zero] | succ j ih => rw [Finset.prod_range_succ, ih, Nat.descFactorial_succ, Nat.cast_mul, fallingRatio_succ, pow_succ] unfold scaledFactor ring theorem scaledBinomialMoment_eq_product (v n q : ℕ) (θ : ℝ) (j : ℕ) : scaledBinomialMoment v n q θ j = (∏ i ∈ Finset.range j, scaledFactor v n q θ i) / (j.factorial : ℝ) := by rw [product_scaledFactor_eq, Nat.descFactorial_eq_factorial_mul_choose, Nat.cast_mul] unfold scaledBinomialMoment have hj : (j.factorial : ℝ) ≠ 0 := by exact_mod_cast Nat.factorial_ne_zero j field_simp [hj] theorem scaledFactor_nonneg (v n q i : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : 0 ≤ scaledFactor v n q θ i := by unfold scaledFactor positivity theorem scaledParameter_nonneg (v n q : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : 0 ≤ scaledParameter v n q θ := by unfold scaledParameter positivity theorem scaledFactor_le_parameter (v n q i : ℕ) {θ : ℝ} (hnv : n ≤ v) (hθ : 0 ≤ θ) : scaledFactor v n q θ i ≤ scaledParameter v n q θ := by have hq : ((q - i : ℕ) : ℝ) ≤ (q : ℝ) := by exact_mod_cast Nat.sub_le q i have hr := sub_ratio_le_ratio v n i hnv unfold scaledFactor calc ((q - i : ℕ) : ℝ) * (((n - i : ℕ) : ℝ) / ((v - i : ℕ) : ℝ)) * θ⁻¹ ≤ (q : ℝ) * ((n : ℝ) / (v : ℝ)) * θ⁻¹ := mul_le_mul_of_nonneg_right (mul_le_mul hq hr (by positivity) (Nat.cast_nonneg _)) (inv_nonneg.mpr hθ) _ = _ := by simp only [scaledParameter, div_eq_mul_inv, mul_inv_rev]; ring /-- A one-factor absolute loss bound which does not divide by the target count `q`. -/ theorem scaledFactor_loss_le (v n q i : ℕ) {θ : ℝ} (hnv : n ≤ v) (hin : i < n) (hθ : 0 < θ) : scaledParameter v n q θ - scaledFactor v n q θ i ≤ (i : ℝ) * ((n : ℝ) + (q : ℝ)) / ((v : ℝ) * θ) := by have hiv : i < v := hin.trans_le hnv have hv : (0 : ℝ) < v := by exact_mod_cast (Nat.zero_le i).trans_lt hiv have hvi : (0 : ℝ) < ((v - i : ℕ) : ℝ) := by exact_mod_cast Nat.sub_pos_of_lt hiv have hratio : ((n - i : ℕ) : ℝ) / (v : ℝ) ≤ ((n - i : ℕ) : ℝ) / ((v - i : ℕ) : ℝ) := by apply (div_le_div_iff₀ hv hvi).2 exact mul_le_mul_of_nonneg_left (by exact_mod_cast Nat.sub_le v i) (Nat.cast_nonneg (n - i)) have hq : (q : ℝ) - (i : ℝ) ≤ ((q - i : ℕ) : ℝ) := by have hnat : q ≤ (q - i) + i := by omega have hcast : (q : ℝ) ≤ ((q - i : ℕ) : ℝ) + (i : ℝ) := by exact_mod_cast hnat linarith have hnum : (n : ℝ) * (q : ℝ) - (i : ℝ) * ((n : ℝ) + (q : ℝ)) ≤ ((q - i : ℕ) : ℝ) * ((n - i : ℕ) : ℝ) := by have hm := mul_le_mul_of_nonneg_right hq (Nat.cast_nonneg (n - i)) rw [Nat.cast_sub hin.le] at hm ⊢ nlinarith [sq_nonneg (i : ℝ)] have hlower : ((q - i : ℕ) : ℝ) * ((n - i : ℕ) : ℝ) / ((v : ℝ) * θ) ≤ scaledFactor v n q θ i := by unfold scaledFactor calc ((q - i : ℕ) : ℝ) * ((n - i : ℕ) : ℝ) / ((v : ℝ) * θ) = ((q - i : ℕ) : ℝ) * (((n - i : ℕ) : ℝ) / (v : ℝ)) * θ⁻¹ := by simp only [div_eq_mul_inv, mul_inv_rev] ring _ ≤ _ := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hratio (Nat.cast_nonneg (q - i))) (inv_nonneg.mpr hθ.le) have hdiv := (div_le_div_of_nonneg_right hnum (mul_nonneg hv.le hθ.le)).trans hlower rw [sub_div] at hdiv change (n : ℝ) * (q : ℝ) / ((v : ℝ) * θ) - scaledFactor v n q θ i ≤ _ linarith [hdiv] theorem scaledFactor_loss_le_bounded (v n q i : ℕ) {θ K : ℝ} (hnv : n ≤ v) (hin : i < n) (hθ : 0 < θ) (hK : scaledParameter v n q θ ≤ K) : scaledParameter v n q θ - scaledFactor v n q θ i ≤ (i : ℝ) * ((n : ℝ) / ((v : ℝ) * θ) + K / (n : ℝ)) := by have hn : (0 : ℝ) < n := by exact_mod_cast (Nat.zero_le i).trans_lt hin have hv : (0 : ℝ) < v := hn.trans_le (by exact_mod_cast hnv) have hparam : (q : ℝ) / ((v : ℝ) * θ) = scaledParameter v n q θ / (n : ℝ) := by unfold scaledParameter field_simp [hn.ne', hv.ne', hθ.ne'] calc scaledParameter v n q θ - scaledFactor v n q θ i ≤ (i : ℝ) * ((n : ℝ) + (q : ℝ)) / ((v : ℝ) * θ) := scaledFactor_loss_le v n q i hnv hin hθ _ = (i : ℝ) * ((n : ℝ) / ((v : ℝ) * θ) + scaledParameter v n q θ / (n : ℝ)) := by rw [← hparam]; ring _ ≤ _ := mul_le_mul_of_nonneg_left (add_le_add le_rfl (div_le_div_of_nonneg_right hK hn.le)) (Nat.cast_nonneg i) /-- A symbolic telescoping estimate for any bounded family of nonnegative factors. -/ theorem pow_sub_product_bound (a : ℕ → ℝ) {t K E : ℝ} (ht : 0 ≤ t) (htK : t ≤ K) (hK : 1 ≤ K) (hE : 0 ≤ E) (j : ℕ) (ha : ∀ i < j, 0 ≤ a i ∧ a i ≤ t ∧ t - a i ≤ E) : 0 ≤ t ^ j - ∏ i ∈ Finset.range j, a i ∧ t ^ j - ∏ i ∈ Finset.range j, a i ≤ (j : ℝ) * E * K ^ j := by have hK0 : 0 ≤ K := zero_le_one.trans hK induction j with | zero => simp | succ j ih => have hprev : ∀ i < j, 0 ≤ a i ∧ a i ≤ t ∧ t - a i ≤ E := by intro i hi exact ha i (by omega) have hih := ih hprev have hj := ha j (by omega) have hprod0 : 0 ≤ ∏ i ∈ Finset.range j, a i := Finset.prod_nonneg (fun i hi => (hprev i (Finset.mem_range.mp hi)).1) have hprodK : (∏ i ∈ Finset.range j, a i) ≤ K ^ j := by calc (∏ i ∈ Finset.range j, a i) ≤ ∏ _i ∈ Finset.range j, K := by apply Finset.prod_le_prod · intro i hi exact (hprev i (Finset.mem_range.mp hi)).1 · intro i hi exact (hprev i (Finset.mem_range.mp hi)).2.1.trans htK _ = _ := by simp have hident : t ^ (j + 1) - (∏ i ∈ Finset.range (j + 1), a i) = t * (t ^ j - ∏ i ∈ Finset.range j, a i) + (∏ i ∈ Finset.range j, a i) * (t - a j) := by rw [pow_succ, Finset.prod_range_succ] ring rw [hident] constructor · exact add_nonneg (mul_nonneg ht hih.1) (mul_nonneg hprod0 (sub_nonneg.mpr hj.2.1)) · have hfirst := mul_le_mul htK hih.2 hih.1 hK0 have hsecond := mul_le_mul hprodK hj.2.2 (sub_nonneg.mpr hj.2.1) (pow_nonneg hK0 j) calc t * (t ^ j - ∏ i ∈ Finset.range j, a i) + (∏ i ∈ Finset.range j, a i) * (t - a j) ≤ K * ((j : ℝ) * E * K ^ j) + K ^ j * E := add_le_add hfirst hsecond _ ≤ ((j + 1 : ℕ) : ℝ) * E * K ^ (j + 1) := by rw [pow_succ, Nat.cast_add, Nat.cast_one] have hm : 0 ≤ (K - 1) * K ^ j * E := by positivity nlinarith [hm] theorem scaledBinomialMoment_le_power (v n q j : ℕ) {θ : ℝ} (hnv : n ≤ v) (hθ : 0 ≤ θ) : scaledBinomialMoment v n q θ j ≤ scaledParameter v n q θ ^ j / (j.factorial : ℝ) := by rw [scaledBinomialMoment_eq_product] apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) calc (∏ i ∈ Finset.range j, scaledFactor v n q θ i) ≤ ∏ _i ∈ Finset.range j, scaledParameter v n q θ := by apply Finset.prod_le_prod · intro i _ exact scaledFactor_nonneg v n q i hθ · intro i _ exact scaledFactor_le_parameter v n q i hnv hθ _ = _ := by simp theorem scaledBinomialMoment_le_uniform (v n q L j : ℕ) {θ K : ℝ} (hnv : n ≤ v) (hθ : 0 ≤ θ) (hK : 1 ≤ K) (htK : scaledParameter v n q θ ≤ K) (hj : j ≤ L) : scaledBinomialMoment v n q θ j ≤ K ^ L := by have ht := scaledParameter_nonneg v n q hθ have hfac : (1 : ℝ) ≤ j.factorial := by have hf : 1 ≤ j.factorial := by have := Nat.factorial_pos j; omega exact_mod_cast hf calc scaledBinomialMoment v n q θ j ≤ scaledParameter v n q θ ^ j / (j.factorial : ℝ) := scaledBinomialMoment_le_power v n q j hnv hθ _ ≤ scaledParameter v n q θ ^ j := div_le_self (pow_nonneg ht j) hfac _ ≤ K ^ j := by gcongr _ ≤ K ^ L := by gcongr /-- Uniform fixed-rank CAL1 estimate, with all small-target cases included. -/ theorem scaledBinomialMoment_error_le (v n q L j : ℕ) {θ K : ℝ} (hn : 0 < n) (hLn : L ≤ n) (hnv : n ≤ v) (_hqv : q ≤ v) (hθ : 0 < θ) (hK : 1 ≤ K) (htK : scaledParameter v n q θ ≤ K) (hj : j ≤ L) : |scaledBinomialMoment v n q θ j - scaledParameter v n q θ ^ j / (j.factorial : ℝ)| ≤ (L : ℝ) ^ 2 * K ^ L * ((n : ℝ) / ((v : ℝ) * θ) + K / (n : ℝ)) := by let B : ℝ := (n : ℝ) / ((v : ℝ) * θ) + K / (n : ℝ) let E : ℝ := (L : ℝ) * B have hB : 0 ≤ B := by dsimp [B]; positivity have hE : 0 ≤ E := mul_nonneg (Nat.cast_nonneg _) hB have ht := scaledParameter_nonneg v n q hθ.le have ha : ∀ i < j, 0 ≤ scaledFactor v n q θ i ∧ scaledFactor v n q θ i ≤ scaledParameter v n q θ ∧ scaledParameter v n q θ - scaledFactor v n q θ i ≤ E := by intro i hi refine ⟨scaledFactor_nonneg v n q i hθ.le, scaledFactor_le_parameter v n q i hnv hθ.le, ?_⟩ have hin : i < n := lt_of_lt_of_le (lt_of_lt_of_le hi hj) hLn have hiL : (i : ℝ) ≤ L := by exact_mod_cast (Nat.le_of_lt (lt_of_lt_of_le hi hj)) exact (scaledFactor_loss_le_bounded v n q i hnv hin hθ htK).trans (mul_le_mul_of_nonneg_right hiL hB) have hprod := pow_sub_product_bound (scaledFactor v n q θ) ht htK hK hE j ha have hpower : K ^ j ≤ K ^ L := by gcongr have hjL : (j : ℝ) ≤ L := by exact_mod_cast hj have huniform : (j : ℝ) * E * K ^ j ≤ (L : ℝ) ^ 2 * K ^ L * B := by calc (j : ℝ) * E * K ^ j ≤ (L : ℝ) * E * K ^ L := mul_le_mul (mul_le_mul_of_nonneg_right hjL hE) hpower (pow_nonneg (zero_le_one.trans hK) j) (mul_nonneg (Nat.cast_nonneg _) hE) _ = _ := by dsimp [E]; ring have hfac : (1 : ℝ) ≤ j.factorial := by have hf : 1 ≤ j.factorial := by have := Nat.factorial_pos j; omega exact_mod_cast hf rw [scaledBinomialMoment_eq_product, abs_sub_comm, ← sub_div, abs_of_nonneg (div_nonneg hprod.1 (Nat.cast_nonneg _))] exact (div_le_self hprod.1 hfac).trans (hprod.2.trans huniform) /-- The elementary scale comparison used to turn the finite CAL1 estimate into `O(1/(kθ))`. -/ theorem calibration_scale_le (v n k : ℕ) {θ K : ℝ} (hk : 0 < k) (hkn : (k : ℝ) ≤ 2 * (n : ℝ)) (hnk : n ≤ k) (hkv : (k : ℝ) ^ 2 ≤ 2 * (v : ℝ)) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) : (n : ℝ) / ((v : ℝ) * θ) + K / (n : ℝ) ≤ 2 * (K + 1) / ((k : ℝ) * θ) := by have hk' : (0 : ℝ) < k := by exact_mod_cast hk have hn' : (0 : ℝ) < n := by linarith have hv' : (0 : ℝ) < v := by nlinarith [sq_pos_of_pos hk'] have hnk' : (n : ℝ) ≤ k := by exact_mod_cast hnk have hfirst : (n : ℝ) / ((v : ℝ) * θ) ≤ 2 / ((k : ℝ) * θ) := by apply (div_le_div_iff₀ (mul_pos hv' hθ) (mul_pos hk' hθ)).2 have hnkprod : (n : ℝ) * (k : ℝ) ≤ 2 * (v : ℝ) := by nlinarith [mul_le_mul_of_nonneg_right hnk' hk'.le] have hh := mul_le_mul_of_nonneg_right hnkprod hθ.le nlinarith [hh] have hsecond : K / (n : ℝ) ≤ (2 * K) / ((k : ℝ) * θ) := by apply (div_le_div_iff₀ hn' (mul_pos hk' hθ)).2 have hkθ : (k : ℝ) * θ ≤ 2 * (n : ℝ) := by have hh := mul_le_mul_of_nonneg_left hθ1 hk'.le nlinarith [hh] have hh := mul_le_mul_of_nonneg_left hkθ hK nlinarith [hh] calc (n : ℝ) / ((v : ℝ) * θ) + K / (n : ℝ) ≤ 2 / ((k : ℝ) * θ) + (2 * K) / ((k : ℝ) * θ) := add_le_add hfirst hsecond _ = _ := by ring /-- One symbolic CAL1 constant, depending only on the fixed degree and parameter cap. -/ def momentErrorConstant (L : ℕ) (K : ℝ) : ℝ := 2 * (L : ℝ) ^ 2 * K ^ L * (K + 1) theorem momentErrorConstant_nonneg (L : ℕ) {K : ℝ} (hK : 0 ≤ K) : 0 ≤ momentErrorConstant L K := by unfold momentErrorConstant positivity theorem scaledBinomialMoment_error_le_inv_scale (v n q k L j : ℕ) {θ K : ℝ} (hk : 0 < k) (hkn : (k : ℝ) ≤ 2 * (n : ℝ)) (hnk : n ≤ k) (hkv : (k : ℝ) ^ 2 ≤ 2 * (v : ℝ)) (hLn : L ≤ n) (hnv : n ≤ v) (hqv : q ≤ v) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 1 ≤ K) (htK : scaledParameter v n q θ ≤ K) (hj : j ≤ L) : |scaledBinomialMoment v n q θ j - scaledParameter v n q θ ^ j / (j.factorial : ℝ)| ≤ momentErrorConstant L K / ((k : ℝ) * θ) := by have hk' : (0 : ℝ) < k := by exact_mod_cast hk have hn' : (0 : ℝ) < n := by linarith have hn : 0 < n := by exact_mod_cast hn' have hscale := calibration_scale_le v n k hk hkn hnk hkv hθ hθ1 (zero_le_one.trans hK) calc |scaledBinomialMoment v n q θ j - scaledParameter v n q θ ^ j / (j.factorial : ℝ)| ≤ (L : ℝ) ^ 2 * K ^ L * ((n : ℝ) / ((v : ℝ) * θ) + K / (n : ℝ)) := scaledBinomialMoment_error_le v n q L j hn hLn hnv hqv hθ hK htK hj _ ≤ (L : ℝ) ^ 2 * K ^ L * (2 * (K + 1) / ((k : ℝ) * θ)) := mul_le_mul_of_nonneg_left hscale (by positivity) _ = _ := by unfold momentErrorConstant; ring /-- The normalized forced-count coefficient, expressed without inverse powers. -/ def scaledShiftedCoeff (a : ℕ → ℝ) (θ : ℝ) (c j : ℕ) : ℝ := ∑ r ∈ Finset.range (c + 1), a (j + r) * θ ^ (c - r) * (c.choose r : ℝ) /-- Exact prior interpolation mean as a function of the three slice cardinalities. -/ def priorInterpolationMean (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c v n q : ℕ) : ℝ := if c ≤ L then ∑ j ∈ Finset.range (L - c + 1), (∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) * (q.choose j : ℝ) * fallingRatio v n j else 0 theorem priorInterpolationMean_eq_zero (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c v n q : ℕ) (hc : L < c) : priorInterpolationMean a L θ c v n q = 0 := by simp [priorInterpolationMean, Nat.not_le.mpr hc] theorem scale_shifted_coefficient (a : ℕ → ℝ) {θ : ℝ} (hθ : θ ≠ 0) (c j : ℕ) : θ ^ (c + j) * (∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) = scaledShiftedCoeff a θ c j := by rw [scaledShiftedCoeff, Finset.mul_sum] apply Finset.sum_congr rfl intro r hr have hrc : r ≤ c := by have := Finset.mem_range.mp hr; omega have hp : θ ^ (c + j) * (θ⁻¹) ^ (j + r) = θ ^ (c - r) := by rw [show c + j = (c - r) + (j + r) by omega, pow_add, inv_pow, mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ hθ), mul_one] calc θ ^ (c + j) * (a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) = (θ ^ (c + j) * (θ⁻¹) ^ (j + r)) * (a (j + r) * (c.choose r : ℝ)) := by ring _ = _ := by rw [hp]; ring theorem scaledShiftedCoeff_split (a : ℕ → ℝ) (θ : ℝ) (c j : ℕ) : scaledShiftedCoeff a θ c j = a (c + j) + ∑ r ∈ Finset.range c, a (j + r) * θ ^ (c - r) * (c.choose r : ℝ) := by rw [scaledShiftedCoeff, Finset.sum_range_succ] simp only [Nat.sub_self, pow_zero, mul_one, Nat.choose_self, Nat.cast_one] rw [Nat.add_comm j c] ring theorem scaledShiftedCoeff_error_le (a : ℕ → ℝ) {θ : ℝ} (ha : ∀ m, |a m| ≤ 1) (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (c j : ℕ) : |scaledShiftedCoeff a θ c j - a (c + j)| ≤ (2 : ℝ) ^ c * θ := by rw [scaledShiftedCoeff_split, add_sub_cancel_left] calc |∑ r ∈ Finset.range c, a (j + r) * θ ^ (c - r) * (c.choose r : ℝ)| ≤ ∑ r ∈ Finset.range c, |a (j + r) * θ ^ (c - r) * (c.choose r : ℝ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ r ∈ Finset.range c, θ * (c.choose r : ℝ) := by apply Finset.sum_le_sum intro r hr have hrc : r < c := Finset.mem_range.mp hr have hp : θ ^ (c - r) ≤ θ := by rw [show c - r = (c - r - 1) + 1 by omega, pow_succ] have hh := mul_le_mul_of_nonneg_right (pow_le_one₀ (n := c - r - 1) hθ hθ1) hθ simpa using hh rw [abs_mul, abs_mul, abs_pow, abs_of_nonneg hθ, abs_of_nonneg (show (0 : ℝ) ≤ (c.choose r : ℝ) from Nat.cast_nonneg _)] apply mul_le_mul_of_nonneg_right _ (Nat.cast_nonneg _) calc |a (j + r)| * θ ^ (c - r) ≤ 1 * θ ^ (c - r) := mul_le_mul_of_nonneg_right (ha _) (pow_nonneg hθ _) _ ≤ θ := by simpa using hp _ = θ * (∑ r ∈ Finset.range c, (c.choose r : ℝ)) := by rw [Finset.mul_sum] _ ≤ θ * (2 : ℝ) ^ c := by apply mul_le_mul_of_nonneg_left _ hθ have hc := Nat.sum_range_choose c rw [Finset.sum_range_succ, Nat.choose_self] at hc have hcast := congrArg (fun m : ℕ => (m : ℝ)) hc push_cast at hcast linarith _ = _ := by ring theorem scaledShiftedCoeff_error_le_uniform (a : ℕ → ℝ) {θ : ℝ} (ha : ∀ m, |a m| ≤ 1) (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (L c j : ℕ) (hc : c ≤ L) : |scaledShiftedCoeff a θ c j - a (c + j)| ≤ (2 : ℝ) ^ L * θ := by apply (scaledShiftedCoeff_error_le a ha hθ hθ1 c j).trans gcongr norm_num theorem uniformMean_factorial_polynomial {α : Type u} [DecidableEq α] (U W : Finset α) (n m : ℕ) (b : ℕ → ℝ) (hWU : W ⊆ U) (hn : n ≤ U.card) : uniformMean (exactSlice U n) (fun B => ∑ j ∈ Finset.range m, b j * ((B ∩ W).card.choose j : ℝ)) = ∑ j ∈ Finset.range m, b j * (W.card.choose j : ℝ) * fallingRatio U.card n j := by rw [uniformMean_sum] apply Finset.sum_congr rfl intro j _ rw [uniformMean_const_mul, uniformMean_choose_inter_card U W n j hWU hn] ring /-- The prior cardinality formula is the actual exact-slice interpolation mean. -/ theorem uniformMean_explicit_interpolation {α : Type u} [DecidableEq α] (U W : Finset α) (n L c : ℕ) (a : ℕ → ℝ) (θ : ℝ) (hWU : W ⊆ U) (hn : n ≤ U.card) : uniformMean (exactSlice U n) (fun B => if c ≤ L then ∑ j ∈ Finset.range (L - c + 1), (∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) * ((B ∩ W).card.choose j : ℝ) else 0) = priorInterpolationMean a L θ c U.card n W.card := by by_cases hc : c ≤ L · simp only [hc, ↓reduceIte, priorInterpolationMean] exact uniformMean_factorial_polynomial U W n (L - c + 1) (fun j => ∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) hWU hn · simp [hc, priorInterpolationMean, uniformMean_zero] theorem scale_priorInterpolationMean (a : ℕ → ℝ) (L c v n q : ℕ) {θ : ℝ} (hθ : θ ≠ 0) (hc : c ≤ L) : θ ^ c * priorInterpolationMean a L θ c v n q = ∑ j ∈ Finset.range (L - c + 1), scaledShiftedCoeff a θ c j * scaledBinomialMoment v n q θ j := by rw [priorInterpolationMean, if_pos hc, Finset.mul_sum] apply Finset.sum_congr rfl intro j _ rw [← scale_shifted_coefficient a hθ c j] unfold scaledBinomialMoment have hp : θ ^ (c + j) * (θ⁻¹) ^ j = θ ^ c := by rw [pow_add, inv_pow, mul_assoc, mul_inv_cancel₀ (pow_ne_zero _ hθ), mul_one] calc θ ^ c * ((∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) * (q.choose j : ℝ) * fallingRatio v n j) = (θ ^ (c + j) * (θ⁻¹) ^ j) * ((∑ r ∈ Finset.range (c + 1), a (j + r) * (θ⁻¹) ^ (j + r) * (c.choose r : ℝ)) * (q.choose j : ℝ) * fallingRatio v n j) := by rw [hp] _ = _ := by ring /-- A fixed symbolic constant for the complete CAL2 error. -/ def calibrationErrorConstant (L : ℕ) (K : ℝ) : ℝ := ((L : ℝ) + 1) * ((2 : ℝ) ^ L * K ^ L + momentErrorConstant L K) theorem calibrationErrorConstant_nonneg (L : ℕ) {K : ℝ} (hK : 0 ≤ K) : 0 ≤ calibrationErrorConstant L K := by unfold calibrationErrorConstant exact mul_nonneg (by positivity) (add_nonneg (by positivity) (momentErrorConstant_nonneg L hK)) theorem calibrationErrorConstant_pos (L : ℕ) {K : ℝ} (hK : 0 < K) : 0 < calibrationErrorConstant L K := by unfold calibrationErrorConstant exact mul_pos (by positivity) (add_pos_of_pos_of_nonneg (mul_pos (pow_pos (by norm_num) _) (pow_pos hK _)) (momentErrorConstant_nonneg L hK.le)) /-- CAL2 with an explicit constant and the exact hypergeometric prior. -/ theorem priorInterpolationMean_calibration_error (a : ℕ → ℝ) (L c v n q k : ℕ) {θ K : ℝ} (ha : ∀ m, |a m| ≤ 1) (hc : c ≤ L) (hk : 0 < k) (hkn : (k : ℝ) ≤ 2 * (n : ℝ)) (hnk : n ≤ k) (hkv : (k : ℝ) ^ 2 ≤ 2 * (v : ℝ)) (hLn : L ≤ n) (hnv : n ≤ v) (hqv : q ≤ v) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 1 ≤ K) (htK : scaledParameter v n q θ ≤ K) : |θ ^ c * priorInterpolationMean a L θ c v n q - ∑ j ∈ Finset.range (L - c + 1), a (c + j) * scaledParameter v n q θ ^ j / (j.factorial : ℝ)| ≤ calibrationErrorConstant L K * (θ + 1 / ((k : ℝ) * θ)) := by have hK0 : 0 ≤ K := zero_le_one.trans hK have hD := momentErrorConstant_nonneg L hK0 have hden : 0 ≤ (k : ℝ) * θ := mul_nonneg (Nat.cast_nonneg _) hθ.le have hterm (j : ℕ) (hj : j ∈ Finset.range (L - c + 1)) : |scaledShiftedCoeff a θ c j * scaledBinomialMoment v n q θ j - a (c + j) * scaledParameter v n q θ ^ j / (j.factorial : ℝ)| ≤ ((2 : ℝ) ^ L * θ) * K ^ L + momentErrorConstant L K / ((k : ℝ) * θ) := by have hjL : j ≤ L := by have := Finset.mem_range.mp hj; omega have hm0 := scaledBinomialMoment_nonneg v n q j hθ.le have hmK := scaledBinomialMoment_le_uniform v n q L j hnv hθ.le hK htK hjL have hcoeff := scaledShiftedCoeff_error_le_uniform a ha hθ.le hθ1 L c j hc have hmoment := scaledBinomialMoment_error_le_inv_scale v n q k L j hk hkn hnk hkv hLn hnv hqv hθ hθ1 hK htK hjL calc |scaledShiftedCoeff a θ c j * scaledBinomialMoment v n q θ j - a (c + j) * scaledParameter v n q θ ^ j / (j.factorial : ℝ)| = |(scaledShiftedCoeff a θ c j - a (c + j)) * scaledBinomialMoment v n q θ j + a (c + j) * (scaledBinomialMoment v n q θ j - scaledParameter v n q θ ^ j / (j.factorial : ℝ))| := by congr 1 ring _ ≤ |(scaledShiftedCoeff a θ c j - a (c + j)) * scaledBinomialMoment v n q θ j| + |a (c + j) * (scaledBinomialMoment v n q θ j - scaledParameter v n q θ ^ j / (j.factorial : ℝ))| := abs_add_le _ _ _ = |scaledShiftedCoeff a θ c j - a (c + j)| * scaledBinomialMoment v n q θ j + |a (c + j)| * |scaledBinomialMoment v n q θ j - scaledParameter v n q θ ^ j / (j.factorial : ℝ)| := by rw [abs_mul, abs_mul, abs_of_nonneg hm0] _ ≤ ((2 : ℝ) ^ L * θ) * K ^ L + 1 * (momentErrorConstant L K / ((k : ℝ) * θ)) := add_le_add (mul_le_mul hcoeff hmK hm0 (by positivity)) (mul_le_mul (ha _) hmoment (abs_nonneg _) (by norm_num)) _ = _ := by ring have hR : 0 ≤ ((2 : ℝ) ^ L * θ) * K ^ L + momentErrorConstant L K / ((k : ℝ) * θ) := add_nonneg (by positivity) (div_nonneg hD hden) have hcount : ((L - c + 1 : ℕ) : ℝ) ≤ (L : ℝ) + 1 := by exact_mod_cast Nat.add_le_add_right (Nat.sub_le L c) 1 rw [scale_priorInterpolationMean a L c v n q hθ.ne' hc, ← Finset.sum_sub_distrib] calc |∑ j ∈ Finset.range (L - c + 1), (scaledShiftedCoeff a θ c j * scaledBinomialMoment v n q θ j - a (c + j) * scaledParameter v n q θ ^ j / (j.factorial : ℝ))| ≤ ∑ j ∈ Finset.range (L - c + 1), |scaledShiftedCoeff a θ c j * scaledBinomialMoment v n q θ j - a (c + j) * scaledParameter v n q θ ^ j / (j.factorial : ℝ)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _j ∈ Finset.range (L - c + 1), (((2 : ℝ) ^ L * θ) * K ^ L + momentErrorConstant L K / ((k : ℝ) * θ)) := Finset.sum_le_sum hterm _ = ((L - c + 1 : ℕ) : ℝ) * (((2 : ℝ) ^ L * θ) * K ^ L + momentErrorConstant L K / ((k : ℝ) * θ)) := by simp only [Finset.sum_const, Finset.card_range, nsmul_eq_mul] _ ≤ ((L : ℝ) + 1) * (((2 : ℝ) ^ L * θ) * K ^ L + momentErrorConstant L K / ((k : ℝ) * θ)) := mul_le_mul_of_nonneg_right hcount hR _ ≤ ((L : ℝ) + 1) * (((2 : ℝ) ^ L * K ^ L + momentErrorConstant L K) * (θ + 1 / ((k : ℝ) * θ))) := by apply mul_le_mul_of_nonneg_left _ (by positivity) calc ((2 : ℝ) ^ L * θ) * K ^ L + momentErrorConstant L K / ((k : ℝ) * θ) ≤ (((2 : ℝ) ^ L * θ) * K ^ L + momentErrorConstant L K / ((k : ℝ) * θ)) + (momentErrorConstant L K * θ + ((2 : ℝ) ^ L * K ^ L) / ((k : ℝ) * θ)) := le_add_of_nonneg_right (add_nonneg (mul_nonneg hD hθ.le) (div_nonneg (by positivity) hden)) _ = _ := by ring _ = _ := by unfold calibrationErrorConstant; ring /-- CAL2 specialized to the actual scalar polynomial of the frozen manuscript. -/ theorem fixed_priorInterpolationMean_error (c v n q k : ℕ) {θ K : ℝ} (hc : c ≤ 10001) (hk : 0 < k) (hkn : (k : ℝ) ≤ 2 * (n : ℝ)) (hnk : n ≤ k) (hkv : (k : ℝ) ^ 2 ≤ 2 * (v : ℝ)) (hLn : 10001 ≤ n) (hnv : n ≤ v) (hqv : q ≤ v) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 1 ≤ K) (htK : scaledParameter v n q θ ≤ K) : |θ ^ c * priorInterpolationMean (Scalar.newtonCoeff 10001 100) 10001 θ c v n q - Scalar.poissonShift 10001 100 c (scaledParameter v n q θ)| ≤ calibrationErrorConstant 10001 K * (θ + 1 / ((k : ℝ) * θ)) := by simpa only [Scalar.poissonShift] using priorInterpolationMean_calibration_error (Scalar.newtonCoeff 10001 100) 10001 c v n q k (fun m => Scalar.abs_newtonCoeff_le_one (by decide) m) hc hk hkn hnk hkv hLn hnv hqv hθ hθ1 hK htK /-- The actual value `F(100)` appearing in the manuscript's zero-forced-count mean. -/ def calibrationBase : ℝ := Scalar.poissonShift 10001 100 0 100 theorem calibrationBase_pos : 0 < calibrationBase := by have h := Scalar.fixed_poissonShift_signed_pos (c := 0) (C := 100) (by decide) (by norm_num) le_rfl simpa only [calibrationBase, pow_zero, one_mul] using h theorem fixed_poisson_antitoneOn : AntitoneOn (Scalar.poissonShift 10001 100 0) (Set.Icc (0 : ℝ) 100) := by apply antitoneOn_of_deriv_nonpos (convex_Icc (0 : ℝ) 100) (Scalar.continuous_poissonShift 10001 100 0).continuousOn (Scalar.differentiable_poissonShift 10001 100 0).differentiableOn intro t ht have ht' : t ∈ Set.Icc (0 : ℝ) 100 := interior_subset ht have hsign := Scalar.fixed_poissonShift_signed_pos (c := 1) (by decide) ht'.1 ht'.2 rw [(Scalar.hasDerivAt_poissonShift 10001 100 0 t).deriv] simp only [pow_one, neg_one_mul] at hsign change Scalar.poissonShift 10001 100 1 t ≤ 0 linarith theorem calibrationBase_le_poisson {t : ℝ} (ht : 0 ≤ t) (ht100 : t ≤ 100) : calibrationBase ≤ Scalar.poissonShift 10001 100 0 t := fixed_poisson_antitoneOn ⟨ht, ht100⟩ ⟨by norm_num, le_rfl⟩ ht100 /-- The zero-order value retains three quarters of `F(100)` just beyond the endpoint. -/ theorem exists_extended_calibrationBase : ∃ ε : ℝ, 0 < ε ∧ ε ≤ 1 ∧ ∀ t : ℝ, 0 ≤ t → t ≤ 100 + ε → (3 / 4 : ℝ) * calibrationBase ≤ Scalar.poissonShift 10001 100 0 t := by have hstrict : (3 / 4 : ℝ) * calibrationBase < Scalar.poissonShift 10001 100 0 100 := by change (3 / 4 : ℝ) * calibrationBase < calibrationBase linarith [calibrationBase_pos] have hevent : ∀ᶠ t in nhds (100 : ℝ), (3 / 4 : ℝ) * calibrationBase < Scalar.poissonShift 10001 100 0 t := Filter.Tendsto.eventually_const_lt hstrict (Scalar.continuous_poissonShift 10001 100 0).continuousAt obtain ⟨δ, hδ, hcontrol⟩ := Metric.eventually_nhds_iff.mp hevent refine ⟨min (δ / 2) 1, lt_min (half_pos hδ) (by norm_num), min_le_right _ _, ?_⟩ intro t ht hupper by_cases ht100 : t ≤ 100 · have hbase := calibrationBase_le_poisson ht ht100 linarith [calibrationBase_pos] · have hdist : dist t (100 : ℝ) < δ := by rw [Real.dist_eq, abs_of_pos (sub_pos.mpr (lt_of_not_ge ht100))] have hmin := min_le_left (δ / 2) (1 : ℝ) linarith exact (hcontrol hdist).le /-- Fixed prior calibration gates, chosen before every input size and descriptor. `K=101` is used only for the finite error estimate; scalar positivity uses its separately proved smaller common extension interval. -/ theorem exists_fixed_prior_calibration_window : ∃ ε δ : ℝ, 0 < ε ∧ ε ≤ 1 ∧ 0 < δ ∧ ∀ v n q k : ℕ, ∀ θ : ℝ, 0 < k → (k : ℝ) ≤ 2 * (n : ℝ) → n ≤ k → (k : ℝ) ^ 2 ≤ 2 * (v : ℝ) → 10001 ≤ n → n ≤ v → q ≤ v → 0 < θ → θ ≤ 1 → scaledParameter v n q θ ≤ 100 + ε → θ + 1 / ((k : ℝ) * θ) ≤ δ → (∀ c : ℕ, c ≤ 10001 → Scalar.fixedMargin / 4 ≤ (-1 : ℝ) ^ c * (θ ^ c * priorInterpolationMean (Scalar.newtonCoeff 10001 100) 10001 θ c v n q)) ∧ calibrationBase / 2 ≤ priorInterpolationMean (Scalar.newtonCoeff 10001 100) 10001 θ 0 v n q := by obtain ⟨εs, hεs, hscalar⟩ := Scalar.exists_extended_fixed_margin obtain ⟨ε0, hε0, hε01, hbase⟩ := exists_extended_calibrationBase let D : ℝ := calibrationErrorConstant 10001 101 let budget : ℝ := min (Scalar.fixedMargin / 4) (calibrationBase / 4) have hD : 0 < D := calibrationErrorConstant_pos 10001 (by norm_num) have hbudget : 0 < budget := lt_min (div_pos Scalar.fixedMargin_pos (by norm_num)) (div_pos calibrationBase_pos (by norm_num)) refine ⟨min εs ε0, budget / D, lt_min hεs hε0, (min_le_right _ _).trans hε01, div_pos hbudget hD, ?_⟩ intro v n q k θ hk hkn hnk hkv hLn hnv hqv hθ hθ1 ht hsmall have ht0 := scaledParameter_nonneg v n q hθ.le have ht101 : scaledParameter v n q θ ≤ 101 := by have hmin := (min_le_right εs ε0).trans hε01 linarith have herrBudget : D * (θ + 1 / ((k : ℝ) * θ)) ≤ budget := by calc D * (θ + 1 / ((k : ℝ) * θ)) ≤ D * (budget / D) := mul_le_mul_of_nonneg_left hsmall hD.le _ = budget := by field_simp [hD.ne'] have herr (c : ℕ) (hc : c ≤ 10001) : |θ ^ c * priorInterpolationMean (Scalar.newtonCoeff 10001 100) 10001 θ c v n q - Scalar.poissonShift 10001 100 c (scaledParameter v n q θ)| ≤ budget := (fixed_priorInterpolationMean_error c v n q k hc hk hkn hnk hkv hLn hnv hqv hθ hθ1 (by norm_num : (1 : ℝ) ≤ 101) ht101).trans herrBudget have hbudgetS : budget ≤ Scalar.fixedMargin / 4 := min_le_left _ _ have hbudget0 : budget ≤ calibrationBase / 4 := min_le_right _ _ constructor · intro c hc have hmargin := hscalar c hc (scaledParameter v n q θ) ht0 (ht.trans (add_le_add le_rfl (min_le_left εs ε0))) have habs : |(-1 : ℝ) ^ c * (θ ^ c * priorInterpolationMean (Scalar.newtonCoeff 10001 100) 10001 θ c v n q) - (-1 : ℝ) ^ c * Scalar.poissonShift 10001 100 c (scaledParameter v n q θ)| ≤ budget := by rw [← mul_sub, abs_mul, abs_pow] simp only [abs_neg, abs_one, one_pow, one_mul] exact herr c hc have hlower := (abs_le.mp habs).1 linarith · have hmargin := hbase (scaledParameter v n q θ) ht0 (ht.trans (add_le_add le_rfl (min_le_right εs ε0))) have habs := herr 0 (by decide) simp only [pow_zero, one_mul] at habs have hlower := (abs_le.mp habs).1 linarith end Green39Submission.HypergeometricCalibration end end Green39AssemblyScope_a3f78f023e98d9a0 /- Source: Green39Submission.PrimeIntegration; SHA256 cc817e12cfd93a15e2e43d15eb449fced08bc59d980e863c7617822486d8a321 -/ section Green39AssemblyScope_667bcdd3ad8b96a1 /-! Literal parameter matching for the native probability. The rich-event premise is supplied unconditionally here. The sparse-event limit is still being assembled in its own module; no final refutation is declared at this stage. -/ namespace Green39Submission.PrimeIntegration open Filter Topology noncomputable def richThreshold (p : PrimeIndex) : ℝ := (Nat.sqrt (p : ℕ) : ℝ) ^ Parameters.alpha noncomputable def exceptionAllowance (p : PrimeIndex) : ℕ := Parameters.N (Nat.sqrt (p : ℕ)) noncomputable def holeMargin : ℝ := HypergeometricCalibration.calibrationBase / 128 theorem holeMargin_pos : 0 < holeMargin := div_pos HypergeometricCalibration.calibrationBase_pos (by norm_num) section Finite variable {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] theorem richTargets_agree (A T : Finset G) (k : ℕ) : Integration.richTargets A T ((k : ℝ) ^ Parameters.alpha) = RichObstruction.richTargets A T k := by classical ext x simp only [Integration.mem_richTargets, RichObstruction.richTargets, Finset.mem_filter, Finset.mem_univ, true_and] theorem richParent_iff_failure (p : ℕ) (A : Finset G) : RichObstruction.hasRichParent p A ↔ ¬ Integration.FewRichTargets A (100 * Nat.sqrt p) ((Nat.sqrt p : ℝ) ^ Parameters.alpha) (Parameters.N (Nat.sqrt p)) := by classical simp only [RichObstruction.hasRichParent, Integration.FewRichTargets, richTargets_agree, not_forall, not_lt, exists_prop] /-- A stronger profile cap in a proved sparse obstruction supplies every smaller cap with the same original exceptional set and the same hole margin. -/ theorem sparseHoleObstruction_mono_profile {A : Finset G} {c e : ℕ} {M M' γ : ℝ} (hMM' : M ≤ M') (h : Integration.SparseHoleObstruction A c M' e γ) : Integration.SparseHoleObstruction A c M e γ := by intro T hT X hX hprofile exact h T hT X hX (fun x hx => (hprofile x hx).trans hMM') end Finite theorem richFailureProbability_eq (p : PrimeIndex) : Integration.richFailureProbability richThreshold exceptionAllowance p = RichObstruction.primeRichFailure p := by unfold Integration.richFailureProbability RichObstruction.primeRichFailure apply uniformProb_congr intro A hA exact (richParent_iff_failure (p : ℕ) A).symm /-- FP06, now an unconditional theorem on the exact prime-indexed native slice. -/ theorem rich_failure_limit : Tendsto (Integration.richFailureProbability richThreshold exceptionAllowance) atTop (𝓝 (0 : ℝ)) := by exact RichObstruction.primeRichFailure_tendsto_zero.congr (fun p => (richFailureProbability_eq p).symm) end Green39Submission.PrimeIntegration end Green39AssemblyScope_667bcdd3ad8b96a1 /- Source: Green39Submission.WeightedJanson; SHA256 83d077efa811bb78075464e0249e48e745adf8b8f0e65d99924bbd2f91a54b76 -/ section Green39AssemblyScope_43c5ce84c67f1af8 /-! Finite weighted Harris association and a direct differential proof of weighted Janson. All product-law independence and tilted-moment premises are discharged at weighted_laplace_bound and weighted_lower_tail. Indexed supports may repeat; the overlap sum is ordered and retains diagonal contributions. -/ namespace Green39Submission namespace WeightedCleanup open scoped BigOperators FinsetFamily universe u v open SourceProbability section Association variable {α : Type u} [DecidableEq α] /-- The exact covariance identity for one independent Bernoulli coordinate. -/ theorem bernoulli_covariance_identity (p f₀ f₁ g₀ g₁ : ℝ) : ((1 - p) * (f₀ * g₀) + p * (f₁ * g₁)) - (((1 - p) * f₀ + p * f₁) * ((1 - p) * g₀ + p * g₁)) = p * (1 - p) * (f₁ - f₀) * (g₁ - g₀) := by ring /-- Harris association for one coordinate, with arbitrary real increasing values. -/ theorem bernoulli_covariance_nonneg {p f₀ f₁ g₀ g₁ : ℝ} (hp₀ : 0 ≤ p) (hp₁ : p ≤ 1) (hf : f₀ ≤ f₁) (hg : g₀ ≤ g₁) : ((1 - p) * f₀ + p * f₁) * ((1 - p) * g₀ + p * g₁) ≤ (1 - p) * (f₀ * g₀) + p * (f₁ * g₁) := by have hprod : 0 ≤ p * (1 - p) * (f₁ - f₀) * (g₁ - g₀) := mul_nonneg (mul_nonneg (mul_nonneg hp₀ (sub_nonneg.mpr hp₁)) (sub_nonneg.mpr hf)) (sub_nonneg.mpr hg) rw [← bernoulli_covariance_identity] at hprod linarith theorem bernoulliWeight_nonneg (U S : Finset α) {θ : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) : 0 ≤ bernoulliWeight U S θ := by exact mul_nonneg (pow_nonneg hθ₀ _) (pow_nonneg (sub_nonneg.mpr hθ₁) _) /-- The product measure's weight is exactly log-modular, including at θ=0 or θ=1. -/ theorem bernoulliWeight_modular (U S T : Finset α) (θ : ℝ) : bernoulliWeight U S θ * bernoulliWeight U T θ = bernoulliWeight U (S ∩ T) θ * bernoulliWeight U (S ∪ T) θ := by have hcard₁ := Finset.card_inter_add_card_union S T have hi : U \ (S ∩ T) = (U \ S) ∪ (U \ T) := by ext a simp only [Finset.mem_sdiff, Finset.mem_inter, Finset.mem_union] tauto have hu : U \ (S ∪ T) = (U \ S) ∩ (U \ T) := by ext a simp only [Finset.mem_sdiff, Finset.mem_inter, Finset.mem_union] tauto have hcard₂ : (U \ (S ∩ T)).card + (U \ (S ∪ T)).card = (U \ S).card + (U \ T).card := by rw [hi, hu] exact Finset.card_union_add_card_inter (U \ S) (U \ T) unfold bernoulliWeight calc _ = θ ^ (S.card + T.card) * (1 - θ) ^ ((U \ S).card + (U \ T).card) := by rw [pow_add, pow_add] ring _ = θ ^ ((S ∩ T).card + (S ∪ T).card) * (1 - θ) ^ ((U \ (S ∩ T)).card + (U \ (S ∪ T)).card) := by rw [hcard₁, hcard₂] _ = _ := by rw [pow_add, pow_add] ring /-- Finite Harris inequality with its normalization factor retained explicitly. -/ theorem weighted_harris (U : Finset α) (w f g : Finset α → ℝ) (hw : ∀ S, 0 ≤ w S) (hf₀ : ∀ S, 0 ≤ f S) (hg₀ : ∀ S, 0 ≤ g S) (hf : Monotone f) (hg : Monotone g) (hmod : ∀ S T, w S * w T ≤ w (S ∩ T) * w (S ∪ T)) : (∑ S ∈ U.powerset, w S * f S) * (∑ S ∈ U.powerset, w S * g S) ≤ (∑ S ∈ U.powerset, w S) * (∑ S ∈ U.powerset, w S * (f S * g S)) := by have hpoint : ∀ ⦃S⦄, S ⊆ U → ∀ ⦃T⦄, T ⊆ U → (w S * f S) * (w T * g T) ≤ w (S ∩ T) * (w (S ∪ T) * (f (S ∪ T) * g (S ∪ T))) := by intro S _ T _ calc (w S * f S) * (w T * g T) = (w S * w T) * (f S * g T) := by ring _ ≤ (w (S ∩ T) * w (S ∪ T)) * (f (S ∪ T) * g (S ∪ T)) := by exact mul_le_mul (hmod S T) (mul_le_mul (hf Finset.subset_union_left) (hg Finset.subset_union_right) (hg₀ T) (hf₀ (S ∪ T))) (mul_nonneg (hf₀ S) (hg₀ T)) (mul_nonneg (hw (S ∩ T)) (hw (S ∪ T))) _ = _ := by ring have hfour := U.four_functions_theorem (f₁ := fun S => w S * f S) (f₂ := fun S => w S * g S) (f₃ := w) (f₄ := fun S => w S * (f S * g S)) (fun S => mul_nonneg (hw S) (hf₀ S)) (fun S => mul_nonneg (hw S) (hg₀ S)) hw (fun S => mul_nonneg (hw S) (mul_nonneg (hf₀ S) (hg₀ S))) hpoint (𝒜 := U.powerset) (ℬ := U.powerset) (Finset.Subset.refl _) (Finset.Subset.refl _) simpa only [Finset.powerset_infs_powerset_self, Finset.powerset_sups_powerset_self] using hfour /-- The Bernoulli finite-weight instance of Harris; normalization is not assumed. -/ theorem bernoulli_harris_mass (U : Finset α) {θ : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (f g : Finset α → ℝ) (hf₀ : ∀ S, 0 ≤ f S) (hg₀ : ∀ S, 0 ≤ g S) (hf : Monotone f) (hg : Monotone g) : bernoulliMean U θ f * bernoulliMean U θ g ≤ (∑ S ∈ U.powerset, bernoulliWeight U S θ) * bernoulliMean U θ (fun S => f S * g S) := by exact weighted_harris U (fun S => bernoulliWeight U S θ) f g (fun S => bernoulliWeight_nonneg U S hθ₀ hθ₁) hf₀ hg₀ hf hg (fun S T => (bernoulliWeight_modular U S T θ).le) /-- A normalized corollary with the outstanding normalization identity explicit. -/ theorem bernoulli_harris_of_normalized (U : Finset α) {θ : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (hnorm : ∑ S ∈ U.powerset, bernoulliWeight U S θ = 1) (f g : Finset α → ℝ) (hf₀ : ∀ S, 0 ≤ f S) (hg₀ : ∀ S, 0 ≤ g S) (hf : Monotone f) (hg : Monotone g) : bernoulliMean U θ f * bernoulliMean U θ g ≤ bernoulliMean U θ (fun S => f S * g S) := by simpa only [hnorm, one_mul] using bernoulli_harris_mass U hθ₀ hθ₁ f g hf₀ hg₀ hf hg /-- Normalized finite Bernoulli Harris association. -/ theorem bernoulli_harris (U : Finset α) {θ : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (f g : Finset α → ℝ) (hf₀ : ∀ S, 0 ≤ f S) (hg₀ : ∀ S, 0 ≤ g S) (hf : Monotone f) (hg : Monotone g) : bernoulliMean U θ f * bernoulliMean U θ g ≤ bernoulliMean U θ (fun S => f S * g S) := bernoulli_harris_of_normalized U hθ₀ hθ₁ (bernoulliWeight_sum U θ) f g hf₀ hg₀ hf hg theorem bernoulliMean_sub (U : Finset α) (θ : ℝ) (f g : Finset α → ℝ) : bernoulliMean U θ (fun S => f S - g S) = bernoulliMean U θ f - bernoulliMean U θ g := by simp only [bernoulliMean, mul_sub, Finset.sum_sub_distrib] /-- Increasing/decreasing association, with the upper bound on the decreasing function explicit. This includes indicators and nonnegative Laplace factors. -/ theorem bernoulli_harris_antitone (U : Finset α) {θ : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (f g : Finset α → ℝ) (C : ℝ) (hf₀ : ∀ S, 0 ≤ f S) (hgC : ∀ S, g S ≤ C) (hf : Monotone f) (hg : Antitone g) : bernoulliMean U θ (fun S => f S * g S) ≤ bernoulliMean U θ f * bernoulliMean U θ g := by have hcomp : Monotone (fun S => C - g S) := by intro S T hST exact sub_le_sub_left (hg hST) C have harris := bernoulli_harris U hθ₀ hθ₁ f (fun S => C - g S) hf₀ (fun S => sub_nonneg.mpr (hgC S)) hf hcomp have hmean : bernoulliMean U θ (fun S => C - g S) = C - bernoulliMean U θ g := by rw [bernoulliMean_sub, bernoulliMean_const] have hprod : bernoulliMean U θ (fun S => f S * (C - g S)) = C * bernoulliMean U θ f - bernoulliMean U θ (fun S => f S * g S) := by calc _ = bernoulliMean U θ (fun S => C * f S - f S * g S) := by apply bernoulliMean_congr intro S _ ring _ = _ := by rw [bernoulliMean_sub, bernoulliMean_const_mul] rw [hmean, hprod] at harris nlinarith end Association section Selector variable {ι : Type v} /-- The exact conditional selector identity underlying the weighted Laplace transform. -/ theorem selector_avoidance_product (I : Finset ι) (w : ι → ℝ) (s : ℝ) (active : ι → Prop) [DecidablePred active] : (∏ i ∈ I, if active i then Real.exp (-s * w i) else 1) = Real.exp (-s * ∑ i ∈ I, if active i then w i else 0) := by calc _ = ∏ i ∈ I, Real.exp (-s * (if active i then w i else 0)) := by apply Finset.prod_congr rfl intro i _ split_ifs <;> simp _ = Real.exp (∑ i ∈ I, -s * (if active i then w i else 0)) := (Real.exp_sum I _).symm _ = _ := by rw [Finset.mul_sum] theorem selector_probability_nonneg {x : ℝ} (hx : 0 ≤ x) : 0 ≤ 1 - Real.exp (-x) := by exact sub_nonneg.mpr (Real.exp_le_one_iff.mpr (neg_nonpos.mpr hx)) theorem selector_probability_le_linear (x : ℝ) : 1 - Real.exp (-x) ≤ x := by have h := Real.one_sub_le_exp_neg x linarith /-- The exact quadratic selector estimate, proved by a derivative comparison. -/ theorem selector_probability_ge_quadratic {x : ℝ} (hx : 0 ≤ x) : x - x ^ 2 / 2 ≤ 1 - Real.exp (-x) := by let f : ℝ → ℝ := fun z => 1 - z + z ^ 2 / 2 - Real.exp (-z) have hf : ∀ z, HasDerivAt f (-1 + z + Real.exp (-z)) z := by intro z convert! (((hasDerivAt_const z (1 : ℝ)).sub (hasDerivAt_id z)).add (((hasDerivAt_id z).pow 2).div_const 2)).sub ((hasDerivAt_id z).neg.exp) using 1 <;> (try ext z) <;> simp [f, mul_comm] <;> ring have hm : Monotone f := monotone_of_hasDerivAt_nonneg hf (fun z => by change 0 ≤ -1 + z + Real.exp (-z) have hz := Real.one_sub_le_exp_neg z linarith) have h := hm hx dsimp [f] at h simp only [neg_zero, Real.exp_zero, zero_pow (by decide : 2 ≠ 0), zero_div, sub_zero, add_zero, sub_self] at h linarith end Selector section LaplaceCalculus variable {α : Type u} [DecidableEq α] /-- The one-monomial tilted estimate. Independence and the cross-term Harris bound are explicit finite identities here; the containment instance is below. -/ theorem laplace_component_lower_bound (U : Finset α) {θ s : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (hs : 0 ≤ s) (f Y V R : Finset α → ℝ) (p δ : ℝ) (hf : ∀ B, 0 ≤ f B) (hY : ∀ B, Y B = V B + R B) (hV : ∀ B, V B ≤ Y B) (hind : bernoulliMean U θ (fun B => f B * Real.exp (-s * V B)) = p * bernoulliMean U θ (fun B => Real.exp (-s * V B))) (hcross : bernoulliMean U θ (fun B => f B * R B * Real.exp (-s * V B)) ≤ δ * bernoulliMean U θ (fun B => Real.exp (-s * V B))) : (p - s * δ) * bernoulliMean U θ (fun B => Real.exp (-s * Y B)) ≤ bernoulliMean U θ (fun B => f B * Real.exp (-s * Y B)) := by have hpoint (B : Finset α) : f B * Real.exp (-s * V B) - s * (f B * R B * Real.exp (-s * V B)) ≤ f B * Real.exp (-s * Y B) := by have hexp := Real.one_sub_le_exp_neg (s * R B) have hnonneg : 0 ≤ f B * Real.exp (-s * V B) := mul_nonneg (hf B) (Real.exp_nonneg _) have hmul := mul_le_mul_of_nonneg_left hexp hnonneg have hexps : Real.exp (-s * Y B) = Real.exp (-s * V B) * Real.exp (-(s * R B)) := by rw [hY] rw [show -s * (V B + R B) = -s * V B + -(s * R B) by ring, Real.exp_add] rw [hexps] nlinarith only [hmul] have hmean := bernoulliMean_mono U hθ₀ hθ₁ (fun B _ => hpoint B) rw [bernoulliMean_sub, bernoulliMean_const_mul, hind] at hmean have hscross := mul_le_mul_of_nonneg_left hcross hs have hlocal : (p - s * δ) * bernoulliMean U θ (fun B => Real.exp (-s * V B)) ≤ bernoulliMean U θ (fun B => f B * Real.exp (-s * Y B)) := by nlinarith only [hmean, hscross] by_cases hc : 0 ≤ p - s * δ · have hmono : bernoulliMean U θ (fun B => Real.exp (-s * Y B)) ≤ bernoulliMean U θ (fun B => Real.exp (-s * V B)) := by apply bernoulliMean_mono U hθ₀ hθ₁ intro B _ apply Real.exp_le_exp.mpr exact mul_le_mul_of_nonpos_left (hV B) (neg_nonpos.mpr hs) exact (mul_le_mul_of_nonneg_left hmono hc).trans hlocal · have hL : 0 ≤ bernoulliMean U θ (fun B => Real.exp (-s * Y B)) := bernoulliMean_nonneg U hθ₀ hθ₁ (fun B _ => Real.exp_nonneg _) have hI : 0 ≤ bernoulliMean U θ (fun B => f B * Real.exp (-s * Y B)) := bernoulliMean_nonneg U hθ₀ hθ₁ (fun B _ => mul_nonneg (hf B) (Real.exp_nonneg _)) exact (mul_nonpos_of_nonpos_of_nonneg (le_of_not_ge hc) hL).trans hI /-- Differentiate the finite Laplace sum term by term. -/ theorem hasDerivAt_bernoulliLaplace (U : Finset α) (θ : ℝ) (Y : Finset α → ℝ) (s : ℝ) : HasDerivAt (fun t => bernoulliMean U θ (fun B => Real.exp (-t * Y B))) (-bernoulliMean U θ (fun B => Y B * Real.exp (-s * Y B))) s := by have hterm (B : Finset α) : HasDerivAt (fun t => bernoulliWeight U B θ * Real.exp (-t * Y B)) (-(bernoulliWeight U B θ * (Y B * Real.exp (-s * Y B)))) s := by convert! (((hasDerivAt_id s).neg.mul_const (Y B)).exp).const_mul (bernoulliWeight U B θ) using 1 <;> (try ext t) <;> simp [mul_comm] <;> ring simpa only [bernoulliMean, Finset.sum_neg_distrib] using (HasDerivAt.fun_sum (fun B (_ : B ∈ U.powerset) => hterm B)) /-- A finite tilted first-moment inequality implies the Gaussian-form Laplace bound. This is an ordinary derivative comparison on the nonnegative half-line. -/ theorem bernoulliLaplace_le_of_tilted (U : Finset α) (θ : ℝ) (Y : Finset α → ℝ) (μ Δ : ℝ) (htilt : ∀ s, 0 ≤ s → (μ - s * Δ) * bernoulliMean U θ (fun B => Real.exp (-s * Y B)) ≤ bernoulliMean U θ (fun B => Y B * Real.exp (-s * Y B))) {s : ℝ} (hs : 0 ≤ s) : bernoulliMean U θ (fun B => Real.exp (-s * Y B)) ≤ Real.exp (-s * μ + s ^ 2 * Δ / 2) := by let L : ℝ → ℝ := fun t => bernoulliMean U θ (fun B => Real.exp (-t * Y B)) let Q : ℝ → ℝ := fun t => t * μ - t ^ 2 * Δ / 2 let H : ℝ → ℝ := fun t => L t * Real.exp (Q t) let D : ℝ → ℝ := fun t => ((μ - t * Δ) * L t - bernoulliMean U θ (fun B => Y B * Real.exp (-t * Y B))) * Real.exp (Q t) have hH (t : ℝ) : HasDerivAt H (D t) t := by have hL := hasDerivAt_bernoulliLaplace U θ Y t have hQ : HasDerivAt Q (μ - t * Δ) t := by convert! ((hasDerivAt_id t).mul_const μ).sub ((((hasDerivAt_id t).pow 2).mul_const Δ).div_const 2) using 1 <;> (try ext x) <;> simp [Q, mul_comm] <;> ring convert! hL.mul hQ.exp using 1 <;> (try ext x) <;> simp [H, D, L, mul_comm] <;> ring have hanti : AntitoneOn H (Set.Ici 0) := by apply antitoneOn_of_hasDerivWithinAt_nonpos (convex_Ici 0) (fun t _ => (hH t).continuousAt.continuousWithinAt) (fun t _ => (hH t).hasDerivWithinAt) intro t ht have ht₀ : 0 ≤ t := Set.mem_Ici.mp (interior_subset ht) exact mul_nonpos_of_nonpos_of_nonneg (sub_nonpos.mpr (htilt t ht₀)) (Real.exp_nonneg _) have hH0 : H 0 = 1 := by simp [H, L, Q, bernoulliMean_one] have hbound : L s * Real.exp (Q s) ≤ 1 := by have h := hanti (Set.mem_Ici.mpr le_rfl) (Set.mem_Ici.mpr hs) hs simpa only [hH0] using h calc _ ≤ 1 / Real.exp (Q s) := (le_div_iff₀ (Real.exp_pos _)).mpr hbound _ = _ := by rw [one_div, ← Real.exp_neg] congr 1 dsimp [Q] ring /-- Exponential Markov and the exact optimizing choice s=t/Δ. The premise is an explicit MGF estimate, discharged by the containment theorem below. -/ theorem bernoulli_lower_tail_of_laplace (U : Finset α) {θ : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (Y : Finset α → ℝ) (μ Δ t : ℝ) (hΔ : 0 < Δ) (ht : 0 < t) (hLaplace : ∀ s, 0 ≤ s → bernoulliMean U θ (fun B => Real.exp (-s * Y B)) ≤ Real.exp (-s * μ + s ^ 2 * Δ / 2)) : bernoulliMean U θ (fun B => if Y B ≤ μ - t then 1 else 0) ≤ Real.exp (-(t ^ 2) / (2 * Δ)) := by classical let s : ℝ := t / Δ have hs : 0 ≤ s := (div_pos ht hΔ).le have hpoint (B : Finset α) : Real.exp (-s * (μ - t)) * (if Y B ≤ μ - t then 1 else 0) ≤ Real.exp (-s * Y B) := by split_ifs with hB · simp only [mul_one] apply Real.exp_le_exp.mpr exact mul_le_mul_of_nonpos_left hB (neg_nonpos.mpr hs) · simpa using Real.exp_nonneg (-s * Y B) have hmean := bernoulliMean_mono U hθ₀ hθ₁ (fun B _ => hpoint B) rw [bernoulliMean_const_mul] at hmean have hbound := hmean.trans (hLaplace s hs) have hratio : bernoulliMean U θ (fun B => if Y B ≤ μ - t then 1 else 0) ≤ Real.exp (-s * μ + s ^ 2 * Δ / 2) / Real.exp (-s * (μ - t)) := by apply (le_div_iff₀ (Real.exp_pos _)).mpr simpa only [mul_comm] using hbound calc _ ≤ _ := hratio _ = _ := by rw [← Real.exp_sub] congr 1 dsimp [s] field_simp ring end LaplaceCalculus section WeightedContainment variable {α : Type u} {ι : Type v} [DecidableEq α] /-- A containment indicator as a real-valued function. -/ noncomputable def monomial (S B : Finset α) : ℝ := if S ⊆ B then 1 else 0 theorem monomial_nonneg (S B : Finset α) : 0 ≤ monomial S B := by unfold monomial split_ifs <;> norm_num theorem monomial_mono (S : Finset α) : Monotone (monomial S) := by intro B C hBC by_cases hSB : S ⊆ B · simp [monomial, hSB, hSB.trans hBC] · simpa [monomial, hSB] using monomial_nonneg S C theorem monomial_union (S T B : Finset α) : monomial S B * monomial T B = monomial (S ∪ T) B := by classical simp only [monomial, Finset.union_subset_iff] split_ifs <;> simp_all theorem monomial_remove_of_disjoint (S T B : Finset α) (hST : Disjoint S T) : monomial T (B \ S) = monomial T B := by have hiff : T ⊆ B \ S ↔ T ⊆ B := by constructor · exact fun h => h.trans Finset.sdiff_subset · intro h a haT exact Finset.mem_sdiff.mpr ⟨h haT, fun haS => Finset.disjoint_left.mp hST haS haT⟩ simp only [monomial, hiff] theorem bernoulliMean_monomial {U S : Finset α} (hSU : S ⊆ U) (θ : ℝ) : bernoulliMean U θ (monomial S) = θ ^ S.card := bernoulliMean_selected hSU θ theorem monomial_independent {U S : Finset α} (hSU : S ⊆ U) (θ : ℝ) (f : Finset α → ℝ) (hremove : ∀ B, f (B \ S) = f B) : bernoulliMean U θ (fun B => monomial S B * f B) = θ ^ S.card * bernoulliMean U θ f := by have h := bernoulliMean_containing_independent hSU θ f simpa only [hremove, monomial] using h theorem containmentSum_eq_monomials (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (B : Finset α) : containmentSum I support weight B = ∑ i ∈ I, weight i * monomial (support i) B := by classical unfold containmentSum apply Finset.sum_congr rfl intro i _ by_cases h : support i ⊆ B <;> simp [monomial, h] private theorem containment_nonneg (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) (B : Finset α) : 0 ≤ containmentSum I support weight B := by rw [containmentSum_eq_monomials] exact Finset.sum_nonneg (fun i hi => mul_nonneg (hw i hi) (monomial_nonneg _ _)) private theorem containment_mono (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) {B C : Finset α} (hBC : B ⊆ C) : containmentSum I support weight B ≤ containmentSum I support weight C := by simp only [containmentSum_eq_monomials] exact Finset.sum_le_sum (fun i hi => mul_le_mul_of_nonneg_left (monomial_mono (support i) hBC) (hw i hi)) theorem bernoulliMean_containmentSum (U : Finset α) (θ : ℝ) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) : bernoulliMean U θ (containmentSum I support weight) = ∑ i ∈ I, weight i * θ ^ (support i).card := by calc _ = bernoulliMean U θ (fun B => ∑ i ∈ I, weight i * monomial (support i) B) := by apply bernoulliMean_congr intro B _ exact containmentSum_eq_monomials I support weight B _ = _ := by rw [bernoulliMean_sum] apply Finset.sum_congr rfl intro i hi rw [bernoulliMean_const_mul, bernoulliMean_monomial (hsub i hi)] theorem containmentSum_remove_of_disjoint (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (S B : Finset α) (hdis : ∀ i ∈ I, Disjoint S (support i)) : containmentSum I support weight (B \ S) = containmentSum I support weight B := by simp only [containmentSum_eq_monomials] apply Finset.sum_congr rfl intro i hi rw [monomial_remove_of_disjoint S (support i) B (hdis i hi)] /-- One row of the ordered overlap sum, with every intersecting label retained. -/ noncomputable def localOverlap (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (θ : ℝ) (S : Finset α) : ℝ := by classical exact ∑ j ∈ I.filter (fun j => ¬ Disjoint S (support j)), weight j * θ ^ (S ∪ support j).card /-- The denominator of weighted Janson, ordered and including diagonal labels. -/ noncomputable def weightedOverlap (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (θ : ℝ) : ℝ := ∑ i ∈ I, weight i * localOverlap I support weight θ (support i) theorem weightedOverlap_eq_sum (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (θ : ℝ) : weightedOverlap I support weight θ = ∑ i ∈ I, ∑ j ∈ I, if Disjoint (support i) (support j) then 0 else weight i * weight j * θ ^ (support i ∪ support j).card := by classical unfold weightedOverlap localOverlap apply Finset.sum_congr rfl intro i _ rw [Finset.mul_sum, Finset.sum_filter] apply Finset.sum_congr rfl intro j _ by_cases h : Disjoint (support i) (support j) <;> simp [h, mul_assoc] theorem weightedOverlap_nonneg (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) {θ : ℝ} (hθ : 0 ≤ θ) (hw : ∀ i ∈ I, 0 ≤ weight i) : 0 ≤ weightedOverlap I support weight θ := by classical unfold weightedOverlap localOverlap apply Finset.sum_nonneg intro i hi apply mul_nonneg (hw i hi) apply Finset.sum_nonneg intro j hj exact mul_nonneg (hw j (Finset.mem_filter.mp hj).1) (pow_nonneg hθ _) /-- The one-row estimate with all its product-law premises now discharged. -/ theorem containment_tilted_component (U : Finset α) {θ s : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (hs : 0 ≤ s) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (i : ι) (hi : i ∈ I) : (θ ^ (support i).card - s * localOverlap I support weight θ (support i)) * bernoulliMean U θ (fun B => Real.exp (-s * containmentSum I support weight B)) ≤ bernoulliMean U θ (fun B => monomial (support i) B * Real.exp (-s * containmentSum I support weight B)) := by classical let J := I.filter (fun j => Disjoint (support i) (support j)) let K := I.filter (fun j => ¬ Disjoint (support i) (support j)) let V : Finset α → ℝ := containmentSum J support weight let R : Finset α → ℝ := containmentSum K support weight have hwJ : ∀ j ∈ J, 0 ≤ weight j := fun j hj => hw j (Finset.mem_filter.mp hj).1 have hwK : ∀ j ∈ K, 0 ≤ weight j := fun j hj => hw j (Finset.mem_filter.mp hj).1 have hpartition (B : Finset α) : containmentSum I support weight B = V B + R B := by dsimp [V, R, J, K] simp only [containmentSum, Finset.sum_filter] rw [← Finset.sum_add_distrib] apply Finset.sum_congr rfl intro j _ by_cases h : Disjoint (support i) (support j) <;> simp [h] have hVle (B : Finset α) : V B ≤ containmentSum I support weight B := by rw [hpartition] exact le_add_of_nonneg_right (containment_nonneg K support weight hwK B) have hVind : ∀ B, V (B \ support i) = V B := by intro B apply containmentSum_remove_of_disjoint intro j hj exact (Finset.mem_filter.mp hj).2 have hind : bernoulliMean U θ (fun B => monomial (support i) B * Real.exp (-s * V B)) = θ ^ (support i).card * bernoulliMean U θ (fun B => Real.exp (-s * V B)) := by apply monomial_independent (hsub i hi) θ intro B rw [hVind] have hVnonneg (B : Finset α) : 0 ≤ V B := containment_nonneg J support weight hwJ B have hVmono : Monotone V := fun B C hBC => containment_mono J support weight hwJ hBC have hgC (B : Finset α) : Real.exp (-s * V B) ≤ 1 := by apply Real.exp_le_one_iff.mpr exact mul_nonpos_of_nonpos_of_nonneg (neg_nonpos.mpr hs) (hVnonneg B) have hg : Antitone (fun B => Real.exp (-s * V B)) := by intro B C hBC apply Real.exp_le_exp.mpr exact mul_le_mul_of_nonpos_left (hVmono hBC) (neg_nonpos.mpr hs) have hpair (j : ι) (hj : j ∈ K) : bernoulliMean U θ (fun B => monomial (support i ∪ support j) B * Real.exp (-s * V B)) ≤ θ ^ (support i ∪ support j).card * bernoulliMean U θ (fun B => Real.exp (-s * V B)) := by have harris := bernoulli_harris_antitone U hθ₀ hθ₁ (monomial (support i ∪ support j)) (fun B => Real.exp (-s * V B)) 1 (monomial_nonneg _) hgC (monomial_mono _) hg rwa [bernoulliMean_monomial (Finset.union_subset (hsub i hi) (hsub j (Finset.mem_filter.mp hj).1))] at harris have hcross : bernoulliMean U θ (fun B => monomial (support i) B * R B * Real.exp (-s * V B)) ≤ localOverlap I support weight θ (support i) * bernoulliMean U θ (fun B => Real.exp (-s * V B)) := by calc _ = bernoulliMean U θ (fun B => ∑ j ∈ K, weight j * (monomial (support i ∪ support j) B * Real.exp (-s * V B))) := by apply bernoulliMean_congr intro B _ dsimp [R] rw [containmentSum_eq_monomials, Finset.mul_sum, Finset.sum_mul] apply Finset.sum_congr rfl intro j _ rw [← monomial_union] ring _ = ∑ j ∈ K, weight j * bernoulliMean U θ (fun B => monomial (support i ∪ support j) B * Real.exp (-s * V B)) := by rw [bernoulliMean_sum] simp_rw [bernoulliMean_const_mul] _ ≤ ∑ j ∈ K, weight j * (θ ^ (support i ∪ support j).card * bernoulliMean U θ (fun B => Real.exp (-s * V B))) := by apply Finset.sum_le_sum intro j hj exact mul_le_mul_of_nonneg_left (hpair j hj) (hwK j hj) _ = _ := by dsimp [localOverlap, K] rw [Finset.sum_mul] apply Finset.sum_congr rfl intro j _ ring exact laplace_component_lower_bound U hθ₀ hθ₁ hs (monomial (support i)) (containmentSum I support weight) V R (θ ^ (support i).card) (localOverlap I support weight θ (support i)) (monomial_nonneg _) hpartition hVle hind hcross /-- The complete tilted first-moment inequality for a finite indexed weighted containment sum. Repeated labels and all diagonal overlaps remain in the sum. -/ theorem containment_tilted (U : Finset α) {θ s : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (hs : 0 ≤ s) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) : (bernoulliMean U θ (containmentSum I support weight) - s * weightedOverlap I support weight θ) * bernoulliMean U θ (fun B => Real.exp (-s * containmentSum I support weight B)) ≤ bernoulliMean U θ (fun B => containmentSum I support weight B * Real.exp (-s * containmentSum I support weight B)) := by let Z := bernoulliMean U θ (fun B => Real.exp (-s * containmentSum I support weight B)) calc _ = ∑ i ∈ I, weight i * ((θ ^ (support i).card - s * localOverlap I support weight θ (support i)) * Z) := by rw [bernoulliMean_containmentSum U θ I support weight hsub] unfold weightedOverlap simp only [sub_mul, Finset.sum_mul, Finset.mul_sum, mul_sub, Finset.sum_sub_distrib] congr 1 <;> apply Finset.sum_congr rfl <;> intro i _ <;> ring _ ≤ ∑ i ∈ I, weight i * bernoulliMean U θ (fun B => monomial (support i) B * Real.exp (-s * containmentSum I support weight B)) := by apply Finset.sum_le_sum intro i hi exact mul_le_mul_of_nonneg_left (containment_tilted_component U hθ₀ hθ₁ hs I support weight hsub hw i hi) (hw i hi) _ = bernoulliMean U θ (fun B => ∑ i ∈ I, weight i * (monomial (support i) B * Real.exp (-s * containmentSum I support weight B))) := by rw [bernoulliMean_sum] apply Finset.sum_congr rfl intro i _ rw [bernoulliMean_const_mul] _ = _ := by apply bernoulliMean_congr intro B _ rw [containmentSum_eq_monomials, Finset.sum_mul] apply Finset.sum_congr rfl intro i _ ring /-- Weighted Janson's Laplace inequality, derived entirely from finite product association, coordinate independence and a derivative comparison. -/ theorem weighted_laplace_bound (U : Finset α) {θ s : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (hs : 0 ≤ s) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) : bernoulliMean U θ (fun B => Real.exp (-s * containmentSum I support weight B)) ≤ Real.exp (-s * bernoulliMean U θ (containmentSum I support weight) + s ^ 2 * weightedOverlap I support weight θ / 2) := by apply bernoulliLaplace_le_of_tilted U θ (containmentSum I support weight) (bernoulliMean U θ (containmentSum I support weight)) (weightedOverlap I support weight θ) ?_ hs intro t ht exact containment_tilted U hθ₀ hθ₁ ht I support weight hsub hw /-- The quantitative weighted lower tail with any positive ordered-overlap upper bound. The bound is also valid when the actual overlap sum is zero. -/ theorem weighted_lower_tail (U : Finset α) {θ : ℝ} (hθ₀ : 0 ≤ θ) (hθ₁ : θ ≤ 1) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (D t : ℝ) (hD : 0 < D) (ht : 0 < t) (hoverlap : weightedOverlap I support weight θ ≤ D) : bernoulliMean U θ (fun B => if containmentSum I support weight B ≤ bernoulliMean U θ (containmentSum I support weight) - t then 1 else 0) ≤ Real.exp (-(t ^ 2) / (2 * D)) := by apply bernoulli_lower_tail_of_laplace U hθ₀ hθ₁ (containmentSum I support weight) (bernoulliMean U θ (containmentSum I support weight)) D t hD ht intro s hs refine (weighted_laplace_bound U hθ₀ hθ₁ hs I support weight hsub hw).trans ?_ apply Real.exp_le_exp.mpr have hmul := mul_le_mul_of_nonneg_left hoverlap (sq_nonneg s) linarith end WeightedContainment end WeightedCleanup end Green39Submission end Green39AssemblyScope_43c5ce84c67f1af8 /- Source: Green39Submission.BinomialMode; SHA256 04d901f52093b983c6bc1717de77c7a29d2b13d6ab94291b673744247a9bf5d4 -/ section Green39AssemblyScope_aeeefdf8fcd24e2f /-! Exact binomial mode arithmetic, including m=0, m=N and N=0. -/ namespace Green39Submission.WeightedCleanup open scoped BigOperators section BinomialMode /-- Integral numerator of a binomial mass at density m/N. Using natural arithmetic isolates the mode proof from all endpoint divisions. -/ def binomialNumerator (N m j : ℕ) : ℕ := N.choose j * m ^ j * (N - m) ^ (N - j) theorem binomialNumerator_recurrence (N m j : ℕ) (hj : j < N) : binomialNumerator N m (j + 1) * ((j + 1) * (N - m)) = binomialNumerator N m j * ((N - j) * m) := by have hpow : N - j = (N - (j + 1)) + 1 := by omega have hpowers : (N - m) ^ (N - j) = (N - m) ^ (N - (j + 1)) * (N - m) := by rw [hpow, pow_succ] have hc := Nat.choose_succ_right_eq N j unfold binomialNumerator rw [pow_succ, hpowers] calc _ = (N.choose (j + 1) * (j + 1)) * m ^ j * m * (N - m) ^ (N - (j + 1)) * (N - m) := by ring _ = _ := by rw [hc]; ring theorem binomialNumerator_max (N m j : ℕ) (hm : m ≤ N) (hj : j ≤ N) : binomialNumerator N m j ≤ binomialNumerator N m m := by by_cases hm0 : m = 0 · subst m by_cases hj0 : j = 0 · subst j exact le_rfl · simp [binomialNumerator, zero_pow hj0] by_cases hmN : m = N · subst m by_cases hjN : j = N · subst j exact le_rfl · have hsub : N - j ≠ 0 := by omega simp [binomialNumerator, zero_pow hsub] have hmpos : 0 < m := Nat.pos_of_ne_zero hm0 have hmlt : m < N := by omega have hNm : 0 < N - m := Nat.sub_pos_of_lt hmlt have hup (a : ℕ) (ha : a < m) : binomialNumerator N m a ≤ binomialNumerator N m (a + 1) := by have haN : a < N := ha.trans hmlt have hcoef : (a + 1) * (N - m) ≤ (N - a) * m := by have h₁ := congrArg (fun x : ℕ => x * m) (Nat.add_sub_of_le haN.le) have h₂ := congrArg (fun x : ℕ => (a + 1) * x) (Nat.add_sub_of_le hm) have h₃ := Nat.mul_le_mul_left N (Nat.succ_le_of_lt ha) nlinarith apply Nat.le_of_mul_le_mul_right _ (Nat.mul_pos (Nat.succ_pos a) hNm) calc _ ≤ binomialNumerator N m a * ((N - a) * m) := Nat.mul_le_mul_left _ hcoef _ = _ := (binomialNumerator_recurrence N m a haN).symm have hdown (a : ℕ) (hma : m ≤ a) (ha : a < N) : binomialNumerator N m (a + 1) ≤ binomialNumerator N m a := by have hcoef : (N - a) * m ≤ (a + 1) * (N - m) := by have h₁ := congrArg (fun x : ℕ => x * m) (Nat.add_sub_of_le ha.le) have h₂ := congrArg (fun x : ℕ => (a + 1) * x) (Nat.add_sub_of_le hm) have h₃ := Nat.mul_le_mul_left N hma nlinarith apply Nat.le_of_mul_le_mul_right _ (Nat.mul_pos (Nat.succ_pos a) hNm) calc _ = binomialNumerator N m a * ((N - a) * m) := binomialNumerator_recurrence N m a ha _ ≤ _ := Nat.mul_le_mul_left _ hcoef have hinc : ∀ a b, a ≤ b → b ≤ m → binomialNumerator N m a ≤ binomialNumerator N m b := by intro a b hab induction b, hab using Nat.le_induction with | base => intro _; exact le_rfl | succ b hab ih => intro hbm exact (ih (by omega)).trans (hup b (by omega)) have hdec : ∀ a b, m ≤ a → a ≤ b → b ≤ N → binomialNumerator N m b ≤ binomialNumerator N m a := by intro a b hma hab induction b, hab using Nat.le_induction with | base => intro _; exact le_rfl | succ b hab ih => intro hbN exact (hdown b (hma.trans hab) (by omega)).trans (ih (by omega)) by_cases hjm : j ≤ m · exact hinc j m hjm le_rfl · exact hdec m j le_rfl (by omega) hj theorem sum_binomialNumerator (N m : ℕ) (hm : m ≤ N) : (∑ j ∈ Finset.range (N + 1), binomialNumerator N m j) = N ^ N := by calc _ = ∑ j ∈ Finset.range (N + 1), m ^ j * (N - m) ^ (N - j) * N.choose j := by apply Finset.sum_congr rfl intro j _ unfold binomialNumerator ring _ = (m + (N - m)) ^ N := (add_pow m (N - m) N).symm _ = _ := by rw [Nat.add_sub_of_le hm] theorem binomialNumerator_mode_bound (N m : ℕ) (hm : m ≤ N) : N ^ N ≤ (N + 1) * binomialNumerator N m m := by calc _ = ∑ j ∈ Finset.range (N + 1), binomialNumerator N m j := (sum_binomialNumerator N m hm).symm _ ≤ ∑ _j ∈ Finset.range (N + 1), binomialNumerator N m m := by apply Finset.sum_le_sum intro j hj exact binomialNumerator_max N m j hm (by have := Finset.mem_range.mp hj; omega) _ = _ := by simp noncomputable def binomialMass (N m j : ℕ) : ℝ := (N.choose j : ℝ) * ((m : ℝ) / N) ^ j * (1 - (m : ℝ) / N) ^ (N - j) theorem binomialMass_eq_numerator (N m j : ℕ) (hN : 0 < N) (hm : m ≤ N) (hj : j ≤ N) : binomialMass N m j = (binomialNumerator N m j : ℝ) / (N : ℝ) ^ N := by have hN₀ : (N : ℝ) ≠ 0 := by exact_mod_cast hN.ne' have hsub : (1 : ℝ) - (m : ℝ) / N = ((N - m : ℕ) : ℝ) / N := by rw [Nat.cast_sub hm] field_simp [hN₀] unfold binomialMass rw [hsub, div_pow, div_pow] have hnum : (binomialNumerator N m j : ℝ) = (N.choose j : ℝ) * (m : ℝ) ^ j * ((N - m : ℕ) : ℝ) ^ (N - j) := by simp [binomialNumerator] rw [hnum] calc _ = ((N.choose j : ℝ) * (m : ℝ) ^ j * ((N - m : ℕ) : ℝ) ^ (N - j)) / ((N : ℝ) ^ j * (N : ℝ) ^ (N - j)) := by field_simp [hN₀] _ = _ := by rw [← pow_add, Nat.add_sub_of_le hj] /-- At density m/N, the exact-m slice has probability at least 1/(N+1). The multiplicative statement also treats the empty universe and both endpoints. -/ theorem binomial_mode_mass (N m : ℕ) (hm : m ≤ N) : 1 ≤ ((N + 1 : ℕ) : ℝ) * binomialMass N m m := by by_cases hN : N = 0 · subst N have hm0 : m = 0 := by omega subst m norm_num [binomialMass] have hNp : 0 < N := Nat.pos_of_ne_zero hN have hNreal : 0 < (N : ℝ) ^ N := pow_pos (by exact_mod_cast hNp) _ rw [binomialMass_eq_numerator N m m hNp hm hm] have hnum : (N : ℝ) ^ N ≤ ((N + 1 : ℕ) : ℝ) * (binomialNumerator N m m : ℝ) := by exact_mod_cast binomialNumerator_mode_bound N m hm have h : (1 : ℝ) ≤ (((N + 1 : ℕ) : ℝ) * (binomialNumerator N m m : ℝ)) / (N : ℝ) ^ N := (le_div_iff₀ hNreal).mpr (by simpa using hnum) simpa only [mul_div_assoc] using h end BinomialMode end Green39Submission.WeightedCleanup end Green39AssemblyScope_aeeefdf8fcd24e2f /- Source: Green39Submission.SliceDeletion; SHA256 21e717dbeed9d2fb8126f6c54431b46feb4e3cd43bda5f2fab4dfaae033905b5 -/ section Green39AssemblyScope_9ed6160acf2564f5 /-! Finite double counting for deletion from a uniform exact-cardinality sample. The factor is `n.choose b`, the number of deletions inside a sampled set, not the number of ambient b-subsets. This is the entropy factor used by WG. -/ namespace Green39Submission.SliceDeletion open scoped BigOperators Classical universe u variable {α : Type u} [DecidableEq α] def ContainsBadSubset (U : Finset α) (r : ℕ) (bad : Finset α → Prop) (B : Finset α) : Prop := ∃ C ∈ exactSlice U r, C ⊆ B ∧ bad C theorem bad_extension_card_le (U : Finset α) (n r : ℕ) (bad : Finset α → Prop) (hrn : r ≤ n) : ((exactSlice U n).filter (ContainsBadSubset U r bad)).card ≤ ((exactSlice U r).filter bad).card * (U.card - r).choose (n - r) := by classical let F := (exactSlice U r).filter bad let extensions := fun C : Finset α => (exactSlice U n).filter (fun B => C ⊆ B) have hsub : (exactSlice U n).filter (ContainsBadSubset U r bad) ⊆ F.biUnion extensions := by intro B hB rcases Finset.mem_filter.mp hB with ⟨hBn, C, hCr, hCB, hbad⟩ exact Finset.mem_biUnion.mpr ⟨C, Finset.mem_filter.mpr ⟨hCr, hbad⟩, Finset.mem_filter.mpr ⟨hBn, hCB⟩⟩ calc ((exactSlice U n).filter (ContainsBadSubset U r bad)).card ≤ (F.biUnion extensions).card := Finset.card_le_card hsub _ ≤ ∑ C ∈ F, (extensions C).card := Finset.card_biUnion_le _ = F.card * (U.card - r).choose (n - r) := by apply Finset.sum_const_nat intro C hC have hCr := mem_exactSlice.mp (Finset.mem_filter.mp hC).1 dsimp [extensions] rw [card_exactSlice_filter_subset U C n hCr.1 (by simpa [hCr.2] using hrn), hCr.2] theorem uniformProb_contains_bad_le (U : Finset α) (n r : ℕ) (bad : Finset α → Prop) (hrn : r ≤ n) (hnU : n ≤ U.card) : uniformProb (exactSlice U n) (ContainsBadSubset U r bad) ≤ (n.choose r : ℝ) * uniformProb (exactSlice U r) bad := by classical have hnpos : (0 : ℝ) < U.card.choose n := by exact_mod_cast Nat.choose_pos hnU have hrpos : (0 : ℝ) < U.card.choose r := by exact_mod_cast Nat.choose_pos (hrn.trans hnU) have hchoose : (U.card.choose n : ℝ) * (n.choose r : ℝ) = (U.card.choose r : ℝ) * ((U.card - r).choose (n - r) : ℝ) := by exact_mod_cast (Nat.choose_mul (n := U.card) (k := n) hrn) have hratio : ((U.card - r).choose (n - r) : ℝ) / (U.card.choose n : ℝ) = (n.choose r : ℝ) / (U.card.choose r : ℝ) := by apply (div_eq_div_iff hnpos.ne' hrpos.ne').2 nlinarith only [hchoose] have hcard : (((exactSlice U n).filter (ContainsBadSubset U r bad)).card : ℝ) ≤ (((exactSlice U r).filter bad).card : ℝ) * ((U.card - r).choose (n - r) : ℝ) := by exact_mod_cast bad_extension_card_le U n r bad hrn calc uniformProb (exactSlice U n) (ContainsBadSubset U r bad) ≤ ((((exactSlice U r).filter bad).card : ℝ) * ((U.card - r).choose (n - r) : ℝ)) / (U.card.choose n : ℝ) := by unfold uniformProb rw [card_exactSlice] exact div_le_div_of_nonneg_right hcard hnpos.le _ = (((exactSlice U r).filter bad).card : ℝ) * ((n.choose r : ℝ) / (U.card.choose r : ℝ)) := by rw [mul_div_assoc, hratio] _ = (n.choose r : ℝ) * uniformProb (exactSlice U r) bad := by simp only [uniformProb, card_exactSlice] ring theorem exact_deletion_iff_contains_bad_subset (U B : Finset α) (n b : ℕ) (bad : Finset α → Prop) (hB : B ∈ exactSlice U n) (hb : b ≤ n) : (∃ E ⊆ B, E.card = b ∧ bad (B \ E)) ↔ ContainsBadSubset U (n - b) bad B := by classical have hBn := mem_exactSlice.mp hB constructor · rintro ⟨E, hEB, hEcard, hbad⟩ refine ⟨B \ E, mem_exactSlice.mpr ⟨Finset.sdiff_subset.trans hBn.1, ?_⟩, Finset.sdiff_subset, hbad⟩ rw [Finset.card_sdiff_of_subset hEB, hBn.2, hEcard] · rintro ⟨C, hC, hCB, hbad⟩ have hCn := mem_exactSlice.mp hC refine ⟨B \ C, Finset.sdiff_subset, ?_, ?_⟩ · rw [Finset.card_sdiff_of_subset hCB, hBn.2, hCn.2] omega · have hdouble : B \ (B \ C) = C := by ext x simp only [Finset.mem_sdiff] constructor · rintro ⟨hxB, hx⟩ exact Classical.byContradiction (fun hxC => hx ⟨hxB, hxC⟩) · intro hxC exact ⟨hCB hxC, fun h => h.2 hxC⟩ simpa only [hdouble] using hbad theorem uniformProb_exists_exact_deletion_le (U : Finset α) (n b : ℕ) (bad : Finset α → Prop) (hb : b ≤ n) (hnU : n ≤ U.card) : uniformProb (exactSlice U n) (fun B => ∃ E ⊆ B, E.card = b ∧ bad (B \ E)) ≤ (n.choose b : ℝ) * uniformProb (exactSlice U (n - b)) bad := by have heq := uniformProb_congr (exactSlice U n) (fun B => ∃ E ⊆ B, E.card = b ∧ bad (B \ E)) (ContainsBadSubset U (n - b) bad) (fun B hB => exact_deletion_iff_contains_bad_subset U B n b bad hB hb) rw [heq] simpa only [Nat.choose_symm hb] using uniformProb_contains_bad_le U n (n - b) bad (Nat.sub_le _ _) hnU /-- A downward-closed failure witnessed by at most b deletions can be witnessed by exactly b deletions, so it pays the same internal deletion count. -/ theorem uniformProb_exists_le_deletion_le (U : Finset α) (n b : ℕ) (bad : Finset α → Prop) (hb : b ≤ n) (hnU : n ≤ U.card) (hdown : ∀ C B : Finset α, C ⊆ B → bad B → bad C) : uniformProb (exactSlice U n) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ bad (B \ E)) ≤ (n.choose b : ℝ) * uniformProb (exactSlice U (n - b)) bad := by apply le_trans ?_ (uniformProb_exists_exact_deletion_le U n b bad hb hnU) apply uniformProb_mono intro B hB hbad rcases hbad with ⟨E, hEB, hEcard, hbad⟩ have hBn := (mem_exactSlice.mp hB).2 obtain ⟨E', hEE', hE'B, hE'card⟩ := Finset.exists_subsuperset_card_eq hEB hEcard (by simpa [hBn] using hb) exact ⟨E', hE'B, hE'card, hdown (B \ E') (B \ E) (Finset.sdiff_subset_sdiff (Finset.Subset.refl _) hEE') hbad⟩ end Green39Submission.SliceDeletion end Green39AssemblyScope_9ed6160acf2564f5 /- Source: Green39Submission.SliceMean; SHA256 aaf3ecfe77425345aaf28b1d673b8ff4aa3ec3508e03198ff23ecde03da9c48c -/ section Green39AssemblyScope_b25243c565034856 /-! Exact transport between nested fixed-cardinality slices and the resulting mean drift of an indexed nonnegative containment polynomial. The transport is an equality for every real-valued finite observable. The drift estimate uses only the singleton union bound inside each sampled set; no independence or unproved mean-comparison premise is introduced. -/ namespace Green39Submission.SliceMean open scoped BigOperators Classical universe u v theorem uniformMean_congr {α : Type u} (sample : Finset α) (f g : α → ℝ) (h : ∀ a ∈ sample, f a = g a) : uniformMean sample f = uniformMean sample g := by unfold uniformMean congr 1 exact Finset.sum_congr rfl h theorem uniformMean_div_const {α : Type u} (sample : Finset α) (f : α → ℝ) (c : ℝ) : uniformMean sample (fun a => f a / c) = uniformMean sample f / c := by simp only [uniformMean, ← Finset.sum_div] ring theorem uniformMean_sub {α : Type u} (sample : Finset α) (f g : α → ℝ) : uniformMean sample (fun a => f a - g a) = uniformMean sample f - uniformMean sample g := by simp only [uniformMean, Finset.sum_sub_distrib, sub_div] variable {α : Type u} [DecidableEq α] theorem exactSlice_nested_filter (U B : Finset α) (r : ℕ) (hBU : B ⊆ U) : exactSlice B r = (exactSlice U r).filter (fun C => C ⊆ B) := by classical ext C simp only [mem_exactSlice, Finset.mem_filter] constructor · rintro ⟨hCB, hcard⟩ exact ⟨⟨hCB.trans hBU, hcard⟩, hCB⟩ · rintro ⟨⟨hCU, hcard⟩, hCB⟩ exact ⟨hCB, hcard⟩ /-- A uniform `r`-subset of a uniform `n`-subset has exactly the uniform `r`-slice marginal, for an arbitrary real-valued observable. -/ theorem nested_exactSlice_mean (U : Finset α) (n r : ℕ) (f : Finset α → ℝ) (hrn : r ≤ n) (hnU : n ≤ U.card) : uniformMean (exactSlice U n) (fun B => uniformMean (exactSlice B r) f) = uniformMean (exactSlice U r) f := by classical have hnr : (n.choose r : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hrn).ne' have hUr : (U.card.choose r : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos (hrn.trans hnU)).ne' have hrow (B : Finset α) (hB : B ∈ exactSlice U n) : uniformMean (exactSlice B r) f = (∑ C ∈ exactSlice U r, if C ⊆ B then f C else 0) / (n.choose r : ℝ) := by have hBn := mem_exactSlice.mp hB unfold uniformMean rw [card_exactSlice, hBn.2, exactSlice_nested_filter U B r hBn.1, Finset.sum_filter] calc uniformMean (exactSlice U n) (fun B => uniformMean (exactSlice B r) f) = uniformMean (exactSlice U n) (fun B => (∑ C ∈ exactSlice U r, if C ⊆ B then f C else 0) / (n.choose r : ℝ)) := uniformMean_congr _ _ _ hrow _ = (∑ C ∈ exactSlice U r, uniformMean (exactSlice U n) (fun B => if C ⊆ B then f C else 0)) / (n.choose r : ℝ) := by rw [uniformMean_div_const, uniformMean_sum] _ = (∑ C ∈ exactSlice U r, f C * ((n.choose r : ℝ) / (U.card.choose r : ℝ))) / (n.choose r : ℝ) := by congr 1 apply Finset.sum_congr rfl intro C hC have hCr := mem_exactSlice.mp hC rw [DisjointSupport.uniformMean_indicator_mul, DisjointSupport.exactSlice_containment_eq_fallingRatio U C n hCr.1 hnU, hCr.2, DisjointSupport.fallingRatio_eq_choose] _ = uniformMean (exactSlice U r) f := by rw [← Finset.sum_mul, uniformMean, card_exactSlice] field_simp [hnr, hUr] <;> ring theorem uniformProb_exactSlice_mem (B : Finset α) (r : ℕ) (x : α) (hx : x ∈ B) (hr : r ≤ B.card) : uniformProb (exactSlice B r) (fun C => x ∈ C) = (r : ℝ) / (B.card : ℝ) := by have h := DisjointSupport.exactSlice_containment_eq_fallingRatio B {x} r (Finset.singleton_subset_iff.mpr hx) hr simpa only [Finset.singleton_subset_iff, Finset.card_singleton, DisjointSupport.fallingRatio, Nat.descFactorial_one] using h theorem uniformProb_exactSlice_not_mem (B : Finset α) (b : ℕ) (x : α) (hx : x ∈ B) (hb : b ≤ B.card) : uniformProb (exactSlice B (B.card - b)) (fun C => x ∉ C) = (b : ℝ) / (B.card : ℝ) := by have hB : (B.card : ℝ) ≠ 0 := by exact_mod_cast (Finset.card_pos.mpr ⟨x, hx⟩).ne' rw [uniformProb_not _ _ (exactSlice_nonempty.mpr (Nat.sub_le _ _)), uniformProb_exactSlice_mem B (B.card - b) x hx (Nat.sub_le _ _), Nat.cast_sub hb] field_simp [hB] <;> ring /-- A fixed retained support is hit by uniform `b`-deletion with probability at most its cardinality times `b / B.card`. This is a union bound over actual input vertices, including the harmless empty-support case. -/ theorem support_loss_probability_le (B S : Finset α) (b : ℕ) (hSB : S ⊆ B) (hb : b ≤ B.card) : uniformProb (exactSlice B (B.card - b)) (fun C => ¬ S ⊆ C) ≤ (S.card : ℝ) * (b : ℝ) / (B.card : ℝ) := by classical have hevent : uniformProb (exactSlice B (B.card - b)) (fun C => ¬ S ⊆ C) = uniformProb (exactSlice B (B.card - b)) (fun C => ∃ x ∈ S, x ∉ C) := by apply uniformProb_congr intro C hC constructor · intro hnot by_contra! hnone exact hnot (fun x hx => hnone x hx) · rintro ⟨x, hxS, hxC⟩ hSC exact hxC (hSC hxS) rw [hevent] calc uniformProb (exactSlice B (B.card - b)) (fun C => ∃ x ∈ S, x ∉ C) ≤ ∑ x ∈ S, uniformProb (exactSlice B (B.card - b)) (fun C => x ∉ C) := uniformProb_exists_mem_le_sum _ S (fun x C => x ∉ C) _ = ∑ x ∈ S, (b : ℝ) / (B.card : ℝ) := by apply Finset.sum_congr rfl intro x hx exact uniformProb_exactSlice_not_mem B b x (hSB hx) hb _ = (S.card : ℝ) * (b : ℝ) / (B.card : ℝ) := by simp [mul_div_assoc] /-- Conditional mean loss inside one deterministic sampled set. Supports not contained in that set have nonpositive contribution to the upper bound. -/ theorem containment_mean_loss_le {ι : Type v} (B : Finset α) (b : ℕ) (hb : b ≤ B.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) (d : ℕ) (hd : ∀ i ∈ I, (support i).card ≤ d) : containmentSum I support weight B - uniformMean (exactSlice B (B.card - b)) (containmentSum I support weight) ≤ ((d : ℝ) * (b : ℝ) / (B.card : ℝ)) * containmentSum I support weight B := by classical have hs : (exactSlice B (B.card - b)).Nonempty := exactSlice_nonempty.mpr (Nat.sub_le _ _) rw [DisjointSupport.uniformMean_containmentSum] unfold containmentSum rw [← Finset.sum_sub_distrib, Finset.mul_sum] apply Finset.sum_le_sum intro i hi by_cases hiB : support i ⊆ B · simp only [hiB, ↓reduceIte] have hbad := support_loss_probability_le B (support i) b hiB hb have hcard : ((support i).card : ℝ) ≤ (d : ℝ) := by exact_mod_cast hd i hi have hrate : ((support i).card : ℝ) * (b : ℝ) / (B.card : ℝ) ≤ (d : ℝ) * (b : ℝ) / (B.card : ℝ) := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_right hcard (Nat.cast_nonneg b)) (Nat.cast_nonneg B.card) have hloss : 1 - uniformProb (exactSlice B (B.card - b)) (fun C => support i ⊆ C) ≤ (d : ℝ) * (b : ℝ) / (B.card : ℝ) := by rw [← uniformProb_not _ _ hs] exact hbad.trans hrate calc weight i - weight i * uniformProb (exactSlice B (B.card - b)) (fun C => support i ⊆ C) = weight i * (1 - uniformProb (exactSlice B (B.card - b)) (fun C => support i ⊆ C)) := by ring _ ≤ weight i * ((d : ℝ) * (b : ℝ) / (B.card : ℝ)) := mul_le_mul_of_nonneg_left hloss (hw i hi) _ = ((d : ℝ) * (b : ℝ) / (B.card : ℝ)) * weight i := mul_comm _ _ · simp only [hiB, ↓reduceIte, zero_sub, mul_zero] exact neg_nonpos.mpr (mul_nonneg (hw i hi) (uniformProb_nonneg _ _)) /-- Unconditional exact-slice mean drift. Together with the nested-slice identity this supplies WG's mean guard; it is not assumed as a premise. Physical supports may repeat and may be empty. -/ theorem containment_mean_drift_le {ι : Type v} (U : Finset α) (n b : ℕ) (_hn : 0 < n) (hb : b ≤ n) (hnU : n ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) (d : ℕ) (hd : ∀ i ∈ I, (support i).card ≤ d) : uniformMean (exactSlice U n) (containmentSum I support weight) - uniformMean (exactSlice U (n - b)) (containmentSum I support weight) ≤ ((d : ℝ) * (b : ℝ) / (n : ℝ)) * uniformMean (exactSlice U n) (containmentSum I support weight) := by classical have hnest := nested_exactSlice_mean U n (n - b) (containmentSum I support weight) (Nat.sub_le _ _) hnU calc uniformMean (exactSlice U n) (containmentSum I support weight) - uniformMean (exactSlice U (n - b)) (containmentSum I support weight) = uniformMean (exactSlice U n) (fun B => containmentSum I support weight B - uniformMean (exactSlice B (n - b)) (containmentSum I support weight)) := by rw [uniformMean_sub, hnest] _ ≤ uniformMean (exactSlice U n) (fun B => ((d : ℝ) * (b : ℝ) / (n : ℝ)) * containmentSum I support weight B) := by apply uniformMean_mono intro B hB have hBn := (mem_exactSlice.mp hB).2 have hbB : b ≤ B.card := by omega simpa only [hBn] using containment_mean_loss_le B b hbB I support weight hw d hd _ = ((d : ℝ) * (b : ℝ) / (n : ℝ)) * uniformMean (exactSlice U n) (containmentSum I support weight) := uniformMean_const_mul _ _ _ end Green39Submission.SliceMean end Green39AssemblyScope_b25243c565034856 /- Source: Green39Submission.WeightedCleanup; SHA256 6eae0b8e84850e40addc326b0ba09e572fd312a936322d821b61beed6ead04ea -/ section Green39AssemblyScope_713f73367671491c /-! Exact-slice weighted lower tails, every-deletion positive retention and signed cleanup. Generic retention interfaces display all mean and failure premises; the probabilistic ingredients are proved in the imported finite modules. -/ namespace Green39Submission namespace WeightedCleanup open scoped BigOperators FinsetFamily open SourceProbability universe u v section ExactSliceTransfer variable {α : Type u} {ι : Type v} [DecidableEq α] theorem sliceDensity_nonneg (N m : ℕ) : 0 ≤ (m : ℝ) / N := by positivity theorem sliceDensity_le_one (N m : ℕ) (hm : m ≤ N) : (m : ℝ) / N ≤ 1 := by by_cases hN : N = 0 · subst N simp · have hNpos : (0 : ℝ) < N := by exact_mod_cast Nat.pos_of_ne_zero hN exact (div_le_one hNpos).mpr (by exact_mod_cast hm) /-- Exact finite conditioning on a cardinality slice. The coefficient is the binomial slice mass; no approximate comparison of means is involved. -/ theorem bernoulliMean_card_restrict (U : Finset α) (m : ℕ) (hm : m ≤ U.card) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean U θ (fun B => if B.card = m then f B else 0) = ((U.card.choose m : ℝ) * θ ^ m * (1 - θ) ^ (U.card - m)) * uniformMean (exactSlice U m) f := by classical have hc : (U.card.choose m : ℝ) ≠ 0 := by exact_mod_cast (Nat.choose_pos hm).ne' calc _ = ∑ B ∈ exactSlice U m, bernoulliWeight U B θ * f B := by simp only [bernoulliMean, mul_ite, mul_zero] rw [← Finset.sum_filter, ← Finset.powersetCard_eq_filter] rfl _ = (θ ^ m * (1 - θ) ^ (U.card - m)) * ∑ B ∈ exactSlice U m, f B := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro B hB obtain ⟨hBU, hBm⟩ := mem_exactSlice.mp hB simp only [bernoulliWeight, Finset.card_sdiff_of_subset hBU, hBm] _ = _ := by rw [uniformMean, card_exactSlice] field_simp [hc] theorem bernoulli_slice_event_mass_le (U : Finset α) (m : ℕ) (hm : m ≤ U.card) (event : Finset α → Prop) [DecidablePred event] : binomialMass U.card m m * uniformProb (exactSlice U m) event ≤ bernoulliMean U ((m : ℝ) / U.card) (fun B => if event B then 1 else 0) := by classical let θ : ℝ := (m : ℝ) / U.card have hθ₀ : 0 ≤ θ := sliceDensity_nonneg U.card m have hθ₁ : θ ≤ 1 := sliceDensity_le_one U.card m hm have hrestrict := bernoulliMean_card_restrict U m hm θ (fun B => if event B then 1 else 0) rw [← uniformProb_eq_uniformMean_indicator] at hrestrict have hmono : bernoulliMean U θ (fun B => if B.card = m then (if event B then 1 else 0) else 0) ≤ bernoulliMean U θ (fun B => if event B then 1 else 0) := by apply bernoulliMean_mono U hθ₀ hθ₁ intro B _ split_ifs <;> norm_num rw [hrestrict] at hmono exact hmono /-- Uniform exact-m probabilities are bounded by N+1 times the product-law probability at density m/N, using the proved binomial-mode estimate. -/ theorem exactSlice_probability_le_bernoulli (U : Finset α) (m : ℕ) (hm : m ≤ U.card) (event : Finset α → Prop) [DecidablePred event] : uniformProb (exactSlice U m) event ≤ ((U.card + 1 : ℕ) : ℝ) * bernoulliMean U ((m : ℝ) / U.card) (fun B => if event B then 1 else 0) := by classical have hmodes := binomial_mode_mass U.card m hm have hP := uniformProb_nonneg (exactSlice U m) event have hmass := bernoulli_slice_event_mass_le U m hm event calc _ = 1 * uniformProb (exactSlice U m) event := by ring _ ≤ (((U.card + 1 : ℕ) : ℝ) * binomialMass U.card m m) * uniformProb (exactSlice U m) event := mul_le_mul_of_nonneg_right hmodes hP _ = ((U.card + 1 : ℕ) : ℝ) * (binomialMass U.card m m * uniformProb (exactSlice U m) event) := by ring _ ≤ _ := mul_le_mul_of_nonneg_left hmass (Nat.cast_nonneg _) theorem exactSlice_mean_le_bernoulli (U : Finset α) (m : ℕ) (hm : m ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) : uniformMean (exactSlice U m) (containmentSum I support weight) ≤ bernoulliMean U ((m : ℝ) / U.card) (containmentSum I support weight) := by rw [DisjointSupport.uniformMean_containmentSum, bernoulliMean_containmentSum U ((m : ℝ) / U.card) I support weight hsub] apply Finset.sum_le_sum intro i hi exact mul_le_mul_of_nonneg_left (DisjointSupport.exactSlice_containment_le_pow U (support i) m (hsub i hi) hm) (hw i hi) /-- WG11 in exact finite form: the original input has exactly m elements and the centering is its exact-slice mean. -/ theorem exactSlice_weighted_lower_tail (U : Finset α) (m : ℕ) (hm : m ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (D t : ℝ) (hD : 0 < D) (ht : 0 < t) (hoverlap : weightedOverlap I support weight ((m : ℝ) / U.card) ≤ D) : uniformProb (exactSlice U m) (fun B => containmentSum I support weight B ≤ uniformMean (exactSlice U m) (containmentSum I support weight) - t) ≤ ((U.card + 1 : ℕ) : ℝ) * Real.exp (-(t ^ 2) / (2 * D)) := by classical let θ : ℝ := (m : ℝ) / U.card let Y := containmentSum I support weight have hθ₀ : 0 ≤ θ := sliceDensity_nonneg U.card m have hθ₁ : θ ≤ 1 := sliceDensity_le_one U.card m hm have hμ := exactSlice_mean_le_bernoulli U m hm I support weight hsub hw have hmean : bernoulliMean U θ (fun B => if Y B ≤ uniformMean (exactSlice U m) Y - t then 1 else 0) ≤ bernoulliMean U θ (fun B => if Y B ≤ bernoulliMean U θ Y - t then 1 else 0) := by apply bernoulliMean_mono U hθ₀ hθ₁ intro B _ by_cases hB : Y B ≤ uniformMean (exactSlice U m) Y - t · have hB' : Y B ≤ bernoulliMean U θ Y - t := hB.trans (sub_le_sub_right hμ t) simp [hB, hB'] · simp only [if_neg hB] split_ifs <;> norm_num calc _ ≤ ((U.card + 1 : ℕ) : ℝ) * bernoulliMean U θ (fun B => if Y B ≤ uniformMean (exactSlice U m) Y - t then 1 else 0) := exactSlice_probability_le_bernoulli U m hm _ _ ≤ ((U.card + 1 : ℕ) : ℝ) * bernoulliMean U θ (fun B => if Y B ≤ bernoulliMean U θ Y - t then 1 else 0) := mul_le_mul_of_nonneg_left hmean (Nat.cast_nonneg _) _ ≤ _ := mul_le_mul_of_nonneg_left (weighted_lower_tail U hθ₀ hθ₁ I support weight hsub hw D t hD ht hoverlap) (Nat.cast_nonneg _) end ExactSliceTransfer section PositiveRetention variable {α : Type u} {ι : Type v} [DecidableEq α] theorem weightedOverlap_mono_density (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hw : ∀ i ∈ I, 0 ≤ weight i) {ρ θ : ℝ} (hρ : 0 ≤ ρ) (hρθ : ρ ≤ θ) : weightedOverlap I support weight ρ ≤ weightedOverlap I support weight θ := by classical unfold weightedOverlap localOverlap apply Finset.sum_le_sum intro i hi apply mul_le_mul_of_nonneg_left _ (hw i hi) apply Finset.sum_le_sum intro j hj apply mul_le_mul_of_nonneg_left _ (hw j (Finset.mem_filter.mp hj).1) exact pow_le_pow_left₀ hρ hρθ _ /-- A single positive block retains its threshold after every deletion except with the displayed finite bound. The only mean guard concerns the smallest remaining slice n-b; the deletion count is binomial(n,b). -/ theorem every_deletion_retention_failure_le (U : Finset α) (n b : ℕ) (hb : b ≤ n) (hn : n ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (target D t : ℝ) (hD : 0 < D) (ht : 0 < t) (hmean : target ≤ uniformMean (exactSlice U (n - b)) (containmentSum I support weight) - t) (hoverlap : weightedOverlap I support weight ((n : ℝ) / U.card) ≤ D) : uniformProb (exactSlice U n) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ containmentSum I support weight (B \ E) < target) ≤ (n.choose b : ℝ) * ((U.card + 1 : ℕ) : ℝ) * Real.exp (-(t ^ 2) / (2 * D)) := by have hnb : n - b ≤ U.card := (Nat.sub_le _ _).trans hn have hdensity : ((n - b : ℕ) : ℝ) / U.card ≤ (n : ℝ) / U.card := by apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) exact_mod_cast Nat.sub_le n b have hoverlap' : weightedOverlap I support weight (((n - b : ℕ) : ℝ) / U.card) ≤ D := (weightedOverlap_mono_density I support weight hw (sliceDensity_nonneg U.card (n - b)) hdensity).trans hoverlap calc _ ≤ (n.choose b : ℝ) * uniformProb (exactSlice U (n - b)) (fun B => containmentSum I support weight B < target) := by exact SliceDeletion.uniformProb_exists_le_deletion_le U n b (fun B => containmentSum I support weight B < target) hb hn (fun C B hCB hbad => (DisjointSupport.containmentSum_mono I support weight hw hCB).trans_lt hbad) _ ≤ (n.choose b : ℝ) * uniformProb (exactSlice U (n - b)) (fun B => containmentSum I support weight B ≤ uniformMean (exactSlice U (n - b)) (containmentSum I support weight) - t) := by apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) apply uniformProb_mono intro B _ hB exact hB.le.trans hmean _ ≤ (n.choose b : ℝ) * (((U.card + 1 : ℕ) : ℝ) * Real.exp (-(t ^ 2) / (2 * D))) := by apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) exact exactSlice_weighted_lower_tail U (n - b) hnb I support weight hsub hw D t hD ht hoverlap' _ = _ := by ring /-- The positive-retention theorem with its former bottom-slice mean guard discharged by the exact nested-slice drift theorem. -/ theorem every_deletion_retention_with_drift (U : Finset α) (n b : ℕ) (hnpos : 0 < n) (hb : b ≤ n) (hn : n ≤ U.card) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (d : ℕ) (hd : ∀ i ∈ I, (support i).card ≤ d) (D t : ℝ) (hD : 0 < D) (ht : 0 < t) (hoverlap : weightedOverlap I support weight ((n : ℝ) / U.card) ≤ D) : uniformProb (exactSlice U n) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ containmentSum I support weight (B \ E) < uniformMean (exactSlice U n) (containmentSum I support weight) - (((d : ℝ) * (b : ℝ) / (n : ℝ)) * uniformMean (exactSlice U n) (containmentSum I support weight) + t)) ≤ (n.choose b : ℝ) * ((U.card + 1 : ℕ) : ℝ) * Real.exp (-(t ^ 2) / (2 * D)) := by apply every_deletion_retention_failure_le U n b hb hn I support weight hsub hw _ D t hD ht ?_ hoverlap have hmean := SliceMean.containment_mean_drift_le U n b hnpos hb hn I support weight hw d hd linarith only [hmean] /-- Union the positive blocks before combining with the one negative deletion. The same deletion occurs in every block; no independence is used. -/ theorem sum_retention_failure_le {κ : Type v} (sample : Finset (Finset α)) (blocks : Finset κ) (b : ℕ) (Y : κ → Finset α → ℝ) (target : κ → ℝ) : uniformProb sample (fun B => ∃ E ⊆ B, E.card ≤ b ∧ (∑ i ∈ blocks, Y i (B \ E)) < ∑ i ∈ blocks, target i) ≤ ∑ i ∈ blocks, uniformProb sample (fun B => ∃ E ⊆ B, E.card ≤ b ∧ Y i (B \ E) < target i) := by refine le_trans ?_ (uniformProb_exists_mem_le_sum sample blocks (fun i B => ∃ E ⊆ B, E.card ≤ b ∧ Y i (B \ E) < target i)) apply uniformProb_mono intro B _ hB obtain ⟨E, hEB, hcard, hsum⟩ := hB obtain ⟨i, hi, hvalue⟩ := Finset.exists_lt_of_sum_lt hsum exact ⟨i, hi, E, hEB, hcard, hvalue⟩ end PositiveRetention section NegativeRate /-- Convert the exact D1 ratio into an exponential rate without logarithms. -/ theorem deletion_ratio_pow_le_exp (μ a : ℝ) (r : ℕ) (hμ : 0 ≤ μ) (ha : 0 < a) : (μ / (μ + a)) ^ r ≤ Real.exp (-(r : ℝ) * a / (μ + a)) := by have hden : 0 < μ + a := add_pos_of_nonneg_of_pos hμ ha have hratio : μ / (μ + a) = 1 - a / (μ + a) := by field_simp [hden.ne'] ring have hbase : μ / (μ + a) ≤ Real.exp (-(a / (μ + a))) := by rw [hratio] exact Real.one_sub_le_exp_neg _ calc _ ≤ (Real.exp (-(a / (μ + a)))) ^ r := pow_le_pow_left₀ (div_nonneg hμ hden.le) hbase r _ = _ := by rw [← Real.exp_nat_mul] congr 1 ring /-- An observable upper bound M for the negative mean gives a uniform rate. -/ theorem deletion_ratio_pow_le_exp_of_mean_le (μ M a : ℝ) (r : ℕ) (hμ : 0 ≤ μ) (hM : μ ≤ M) (ha : 0 < a) : (μ / (μ + a)) ^ r ≤ Real.exp (-(r : ℝ) * a / (M + a)) := by refine (deletion_ratio_pow_le_exp μ a r hμ ha).trans ?_ apply Real.exp_le_exp.mpr have hratio : a / (M + a) ≤ a / (μ + a) := div_le_div_of_nonneg_left ha.le (add_pos_of_nonneg_of_pos hμ ha) (by linarith only [hM]) have hmul := mul_le_mul_of_nonneg_left hratio (Nat.cast_nonneg r) simpa only [neg_mul, neg_div, mul_div_assoc] using neg_le_neg hmul end NegativeRate section SignedCleanup variable {α : Type u} [DecidableEq α] /-- Exact algebraic interface: every positive retention plus one negative cleanup gives one lower bound for the same signed minorant. All retention hypotheses are explicit; this lemma supplies no probability estimate. -/ theorem exists_deletion_signed_lower_bound (B : Finset α) (b : ℕ) (Ypos Yneg W : Finset α → ℝ) (C μpos μneg errPos errNeg : ℝ) (hW : ∀ S, W S = C + Ypos S - Yneg S) (hpos : ∀ E, E ⊆ B → E.card ≤ b → μpos - errPos ≤ Ypos (B \ E)) (hneg : ∃ E, E ⊆ B ∧ E.card ≤ b ∧ Yneg (B \ E) ≤ μneg + errNeg) : ∃ E, E ⊆ B ∧ E.card ≤ b ∧ C + μpos - μneg - (errPos + errNeg) ≤ W (B \ E) := by obtain ⟨E, hEB, hcard, hnegative⟩ := hneg refine ⟨E, hEB, hcard, ?_⟩ rw [hW] have hpositive := hpos E hEB hcard linarith theorem exists_deletion_fullScore_lower_bound (B : Finset α) (b : ℕ) (Ypos Yneg W fullScore : Finset α → ℝ) (C μpos μneg errPos errNeg : ℝ) (hW : ∀ S, W S = C + Ypos S - Yneg S) (hminor : ∀ S, W S ≤ fullScore S) (hpos : ∀ E, E ⊆ B → E.card ≤ b → μpos - errPos ≤ Ypos (B \ E)) (hneg : ∃ E, E ⊆ B ∧ E.card ≤ b ∧ Yneg (B \ E) ≤ μneg + errNeg) : ∃ E, E ⊆ B ∧ E.card ≤ b ∧ C + μpos - μneg - (errPos + errNeg) ≤ fullScore (B \ E) := by obtain ⟨E, hEB, hcard, hlower⟩ := exists_deletion_signed_lower_bound B b Ypos Yneg W C μpos μneg errPos errNeg hW hpos hneg exact ⟨E, hEB, hcard, hlower.trans (hminor _)⟩ /-- Quantitative signed cleanup: every positive retention estimate is combined with one negative deletion using D1. The positive failure bound is an explicit input, supplied blockwise by every_deletion_retention_failure_le. -/ theorem signed_cleanup_failure_probability_le {ι : Type v} (U : Finset α) (n b d r : ℕ) (hn : n ≤ U.card) (hbudget : d * r ≤ b) (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (hsub : ∀ i ∈ I, support i ⊆ U) (hw : ∀ i ∈ I, 0 ≤ weight i) (hd : ∀ i ∈ I, (support i).card ≤ d) (Ypos W fullScore : Finset α → ℝ) (C μpos errPos errNeg εpos : ℝ) (hW : ∀ B, W B = C + Ypos B - containmentSum I support weight B) (hminor : ∀ B, W B ≤ fullScore B) (hthreshold : 0 < uniformMean (exactSlice U n) (containmentSum I support weight) + errNeg) (hpositive : uniformProb (exactSlice U n) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ Ypos (B \ E) < μpos - errPos) ≤ εpos) : uniformProb (exactSlice U n) (fun B => ¬ ∃ E ⊆ B, E.card ≤ b ∧ C + μpos - uniformMean (exactSlice U n) (containmentSum I support weight) - (errPos + errNeg) ≤ fullScore (B \ E)) ≤ εpos + (uniformMean (exactSlice U n) (containmentSum I support weight) / (uniformMean (exactSlice U n) (containmentSum I support weight) + errNeg)) ^ r := by classical let μneg := uniformMean (exactSlice U n) (containmentSum I support weight) let posBad : Finset α → Prop := fun B => ∃ E ⊆ B, E.card ≤ b ∧ Ypos (B \ E) < μpos - errPos let negBad : Finset α → Prop := fun B => ∀ E ⊆ B, E.card ≤ d * r → μneg + errNeg < containmentSum I support weight (B \ E) have hnegProb : uniformProb (exactSlice U n) negBad ≤ (μneg / (μneg + errNeg)) ^ r := DisjointSupport.weighted_deletion_bound U n hn I support weight hsub hw d hd r (μneg + errNeg) hthreshold have hfailure : ∀ B, (¬ ∃ E ⊆ B, E.card ≤ b ∧ C + μpos - μneg - (errPos + errNeg) ≤ fullScore (B \ E)) → posBad B ∨ negBad B := by intro B hbad by_cases hpos : ∀ E, E ⊆ B → E.card ≤ b → μpos - errPos ≤ Ypos (B \ E) · right intro E hEB hcard by_contra hneg have hnegative : containmentSum I support weight (B \ E) ≤ μneg + errNeg := le_of_not_gt hneg exact hbad (exists_deletion_fullScore_lower_bound B b Ypos (containmentSum I support weight) W fullScore C μpos μneg errPos errNeg hW hminor hpos ⟨E, hEB, hcard.trans hbudget, hnegative⟩) · left push Not at hpos exact hpos calc _ ≤ uniformProb (exactSlice U n) (fun B => posBad B ∨ negBad B) := by apply uniformProb_mono intro B _ hB exact hfailure B hB _ ≤ uniformProb (exactSlice U n) posBad + uniformProb (exactSlice U n) negBad := uniformProb_union_le _ _ _ _ ≤ _ := add_le_add hpositive hnegProb end SignedCleanup end WeightedCleanup end Green39Submission end Green39AssemblyScope_713f73367671491c /- Source: Green39Submission.SourceCanonicalMask; SHA256 25a121f8f584830ae0da8d783848971ab3ba2df402cdf098c50f6acaeb48bd41 -/ section Green39AssemblyScope_b88e491f6f96072e /-! Concrete descriptor-only masks, signed containment polynomials and prior tests. The descriptor is exactly `(D,E₀,P,S)`. All label families, coefficients, masks, and guard tests below are computed from those four sets and fixed scalar parameters. No realized input remainder is an argument of the passing test. The remaining source-extraction and analytic guard obligations are not assumed as a principal theorem: they must establish that the actual extracted candidate passes these explicit tests and that the constructed polynomial is a minorant. -/ namespace Green39Submission namespace SourceCanonicalMask open scoped BigOperators Pointwise open DescriptorPrior CanonicalMask universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] def forcedSources (d : Finset G × Finset G × Finset G × Finset G) (x : G) : Finset G := d.2.2.2.filter (fun t => x - t ∈ sourceForcedSet d) theorem mem_forcedSources (d : Finset G × Finset G × Finset G × Finset G) (x t : G) : t ∈ forcedSources d x ↔ t ∈ d.2.2.2 ∧ x - t ∈ sourceForcedSet d := by simp [forcedSources] theorem card_forcedSources (d : Finset G × Finset G × Finset G × Finset G) (x : G) : (forcedSources d x).card = sourceForcedCount d x := rfl /-- Selected alias loops, restricted to forced representations. -/ noncomputable def loopTargets (d : Finset G × Finset G × Finset G × Finset G) : Finset G := by classical exact Finset.univ.filter (fun x => ∃ t ∈ forcedSources d x, t + t - x ∈ d.1) /-- Selected internal wedges; all three source labels are distinct forced sources. -/ noncomputable def wedgeTargets (d : Finset G × Finset G × Finset G × Finset G) : Finset G := by classical exact Finset.univ.filter (fun x => ∃ t ∈ forcedSources d x, ∃ q ∈ forcedSources d x, ∃ r ∈ forcedSources d x, t ≠ q ∧ t ≠ r ∧ q ≠ r ∧ t + q - x ∈ d.1 ∧ t + r - x ∈ d.1) noncomputable def badTargets (d : Finset G × Finset G × Finset G × Finset G) : Finset G := loopTargets d ∪ wedgeTargets d /-- EX3, including the requirement that the external mate is not forced. -/ noncomputable def externalTargets (d : Finset G × Finset G × Finset G × Finset G) : Finset G := by classical exact Finset.univ.filter (fun x => ∃ t ∈ forcedSources d x, ∃ q ∈ d.2.2.2, q - (x - t) ∈ d.1 ∧ x - q ∉ sourceForcedSet d) theorem external_has_forced_count (d : Finset G × Finset G × Finset G × Finset G) (x : G) (hx : x ∈ externalTargets d) : 0 < sourceForcedCount d x := by classical obtain ⟨t, ht, q, hq, hD, hnot⟩ := (Finset.mem_filter.mp hx).2 rw [← card_forcedSources] exact Finset.card_pos.mpr ⟨t, ht⟩ theorem external_witness_distinct (d : Finset G × Finset G × Finset G × Finset G) (x t q : G) (ht : t ∈ forcedSources d x) (hq : x - q ∉ sourceForcedSet d) : t ≠ q := by intro heq apply hq simpa only [heq] using ((mem_forcedSources d x t).mp ht).2 /-- The available free input points at one target, determined by the descriptor. -/ def rowInputs (d : Finset G × Finset G × Finset G × Finset G) (x : G) : Finset G := (d.2.2.2.image (fun t => x - t)) ∩ sourceFreeUniverse d theorem rowInputs_subset_free (d : Finset G × Finset G × Finset G × Finset G) (x : G) : rowInputs d x ⊆ sourceFreeUniverse d := Finset.inter_subset_right /-- The free row cardinality is the actual free representation count. -/ theorem card_rowInputs_inter (d : Finset G × Finset G × Finset G × Finset G) (x : G) (B : Finset G) (hBU : B ⊆ sourceFreeUniverse d) : (rowInputs d x ∩ B).card = representationCount B d.2.2.2 x := by classical unfold representationCount apply Finset.card_bij (fun u _ => x - u) · intro u hu rcases Finset.mem_inter.mp hu with ⟨hrow, huB⟩ rcases Finset.mem_image.mp (Finset.mem_inter.mp hrow).1 with ⟨t, ht, rfl⟩ simpa using (Finset.mem_filter.mpr ⟨ht, huB⟩ : t ∈ d.2.2.2.filter (fun s => x - s ∈ B)) · intro u hu v hv huv exact sub_right_inj.mp huv · intro t ht rcases Finset.mem_filter.mp ht with ⟨htS, hxtB⟩ refine ⟨x - t, Finset.mem_inter.mpr ⟨?_, hxtB⟩, by simp⟩ exact Finset.mem_inter.mpr ⟨Finset.mem_image.mpr ⟨t, htS, rfl⟩, hBU hxtB⟩ theorem sourceForced_disjoint_free_subset (d : Finset G × Finset G × Finset G × Finset G) (B : Finset G) (hBU : B ⊆ sourceFreeUniverse d) : Disjoint (sourceForcedSet d) B := by apply Finset.disjoint_of_subset_left Finset.sdiff_subset exact Finset.disjoint_of_subset_right hBU (protected_disjoint_freeUniverse Finset.univ d.2.2.1 (sourceForbidden d)) /-- Forced and free counts add on every possible remainder, including deletions. -/ theorem representationCount_source_union (d : Finset G × Finset G × Finset G × Finset G) (B : Finset G) (hBU : B ⊆ sourceFreeUniverse d) (x : G) : representationCount (sourceForcedSet d ∪ B) d.2.2.2 x = sourceForcedCount d x + (rowInputs d x ∩ B).card := by rw [card_rowInputs_inter d x B hBU] unfold sourceForcedCount rw [RichStarGeometry.representationCount_comm (sourceForcedSet d ∪ B), RichStarGeometry.representationCount_comm (sourceForcedSet d), RichStarGeometry.representationCount_comm B] unfold representationCount rw [Finset.filter_union, Finset.card_union_of_disjoint] exact Finset.disjoint_filter_filter (sourceForced_disjoint_free_subset d B hBU) /-- The supports in one row, with the same nonconstant rank restriction as labels. -/ def nonemptyRankSubsets (Q : Finset G) (c L : ℕ) : Finset (Finset G) := Q.powerset.filter (fun J => 1 ≤ J.card ∧ c + J.card ≤ L) theorem sum_rankSubsets (Q : Finset G) (c L : ℕ) (w : ℕ → ℝ) : (∑ J ∈ Q.powerset.filter (fun J => c + J.card ≤ L), w J.card) = if c ≤ L then ∑ j ∈ Finset.range (L - c + 1), w j * (Q.card.choose j : ℝ) else 0 := by classical by_cases hc : c ≤ L · rw [if_pos hc] let F := Q.powerset.filter (fun J => c + J.card ≤ L) have hmap : ∀ J ∈ F, J.card ∈ Finset.range (L - c + 1) := by intro J hJ have hbound := (Finset.mem_filter.mp hJ).2 exact Finset.mem_range.mpr (by omega) change (∑ J ∈ F, w J.card) = _ rw [← Finset.sum_fiberwise_of_maps_to hmap (fun J => w J.card)] apply Finset.sum_congr rfl intro j hj have hjc : c + j ≤ L := by have := Finset.mem_range.mp hj omega have hf : F.filter (fun J => J.card = j) = Q.powersetCard j := by ext J simp only [F, Finset.mem_filter, Finset.mem_powerset, Finset.mem_powersetCard] constructor · rintro ⟨⟨hJQ, hbound⟩, hcard⟩ exact ⟨hJQ, hcard⟩ · rintro ⟨hJQ, hcard⟩ exact ⟨⟨hJQ, by omega⟩, hcard⟩ rw [hf, Finset.sum_powersetCard] simp [nsmul_eq_mul, mul_comm] · have hF : Q.powerset.filter (fun J => c + J.card ≤ L) = ∅ := by apply Finset.eq_empty_of_forall_notMem intro J hJ have := (Finset.mem_filter.mp hJ).2 omega simp [hF, hc] /-- Splitting off the empty support preserves the constant, including its sign. -/ theorem constant_add_sum_nonemptyRankSubsets (Q : Finset G) (c L : ℕ) (w : ℕ → ℝ) : (if c ≤ L then w 0 else 0) + (∑ J ∈ nonemptyRankSubsets Q c L, w J.card) = if c ≤ L then ∑ j ∈ Finset.range (L - c + 1), w j * (Q.card.choose j : ℝ) else 0 := by classical rw [← sum_rankSubsets Q c L w] by_cases hc : c ≤ L · rw [if_pos hc] let F := Q.powerset.filter (fun J => c + J.card ≤ L) have he : (∅ : Finset G) ∈ F := by simp [F, hc] have hnonempty : nonemptyRankSubsets Q c L = F.erase ∅ := by ext J simp only [nonemptyRankSubsets, F, Finset.mem_filter, Finset.mem_powerset, Finset.mem_erase] have hcard : 1 ≤ J.card ↔ J ≠ ∅ := by rw [Finset.one_le_card, Finset.nonempty_iff_ne_empty] rw [hcard] tauto rw [hnonempty] simpa [add_comm] using Finset.sum_erase_add F (fun J => w J.card) he · have hF : Q.powerset.filter (fun J => c + J.card ≤ L) = ∅ := by apply Finset.eq_empty_of_forall_notMem intro J hJ have := (Finset.mem_filter.mp hJ).2 omega have hN : nonemptyRankSubsets Q c L = ∅ := by apply Finset.eq_empty_of_forall_notMem intro J hJ have := (Finset.mem_filter.mp hJ).2.2 omega simp [hc, hF, hN] /-- Each nonconstant label retains both its target and its input support. Equal supports at distinct targets remain distinct labels. -/ def nonconstantLabels (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) : Finset (G × Finset G) := ((Finset.univ : Finset G).product (sourceFreeUniverse d).powerset).filter (fun i => i.2 ⊆ rowInputs d i.1 ∧ 1 ≤ i.2.card ∧ sourceForcedCount d i.1 + i.2.card ≤ L) theorem mem_nonconstantLabels (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (i : G × Finset G) : i ∈ nonconstantLabels d L ↔ i.2 ⊆ sourceFreeUniverse d ∧ i.2 ⊆ rowInputs d i.1 ∧ 1 ≤ i.2.card ∧ sourceForcedCount d i.1 + i.2.card ≤ L := by simp [nonconstantLabels, and_assoc] theorem label_support_subset (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (i : G × Finset G) (hi : i ∈ nonconstantLabels d L) : i.2 ⊆ sourceFreeUniverse d := ((mem_nonconstantLabels d L i).mp hi).1 theorem label_support_nonempty (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (i : G × Finset G) (hi : i ∈ nonconstantLabels d L) : i.2.Nonempty := by have hc := ((mem_nonconstantLabels d L i).mp hi).2.2.1 exact Finset.card_pos.mp (Nat.lt_of_lt_of_le (by decide : 0 < 1) hc) theorem label_support_rank (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (i : G × Finset G) (hi : i ∈ nonconstantLabels d L) : i.2.card ≤ L := by have hc := ((mem_nonconstantLabels d L i).mp hi).2.2.2 omega theorem label_markers_subset (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (i : G × Finset G) (hi : i ∈ nonconstantLabels d L) : i.2.image (fun u => i.1 - u) ⊆ d.2.2.2 := by intro t ht rcases Finset.mem_image.mp ht with ⟨u, hu, rfl⟩ have hrow := ((mem_nonconstantLabels d L i).mp hi).2.1 hu rcases Finset.mem_image.mp (Finset.mem_inter.mp hrow).1 with ⟨s, hs, hsu⟩ rw [← hsu] simpa using hs /-- This identity keeps targets as distinct labels while counting their supports. -/ theorem containmentSum_eq_rows (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (w : G × Finset G → ℝ) (B : Finset G) : containmentSum (nonconstantLabels d L) Prod.snd w B = ∑ x : G, ∑ J ∈ nonemptyRankSubsets (rowInputs d x ∩ B) (sourceForcedCount d x) L, w (x, J) := by classical unfold containmentSum nonconstantLabels rw [Finset.sum_filter] refine (Finset.sum_product (Finset.univ : Finset G) (sourceFreeUniverse d).powerset _).trans ?_ apply Finset.sum_congr rfl intro x hx let F := (sourceFreeUniverse d).powerset.filter (fun J => (J ⊆ rowInputs d x ∧ 1 ≤ J.card ∧ sourceForcedCount d x + J.card ≤ L) ∧ J ⊆ B) have hF : F = nonemptyRankSubsets (rowInputs d x ∩ B) (sourceForcedCount d x) L := by ext J simp only [F, nonemptyRankSubsets, Finset.mem_filter, Finset.mem_powerset, Finset.subset_inter_iff] constructor · rintro ⟨hJU, ⟨hJrow, hpos, hbound⟩, hJB⟩ exact ⟨⟨hJrow, hJB⟩, hpos, hbound⟩ · rintro ⟨⟨hJrow, hJB⟩, hpos, hbound⟩ exact ⟨hJrow.trans (rowInputs_subset_free d x), ⟨hJrow, hpos, hbound⟩, hJB⟩ rw [← hF] simp only [F, Finset.sum_filter] apply Finset.sum_congr rfl intro J hJ by_cases hrow : J ⊆ rowInputs d x ∧ 1 ≤ J.card ∧ sourceForcedCount d x + J.card ≤ L · by_cases hJB : J ⊆ B · simp only [hrow, true_and, if_true, if_pos hJB] · simp only [hrow, true_and, if_true, if_neg hJB] · simp only [hrow, false_and, if_false] /-- Signed coefficient after masking and removing external positive terms. -/ noncomputable def signedWeight (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : ℝ := by classical let w := ProtectedScores.shiftedCoeff a θ (sourceForcedCount d i.1) i.2.card exact if i.1 ∈ Y ∪ badTargets d then 0 else if i.1 ∈ externalTargets d then min w 0 else w noncomputable def positiveWeight (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : ℝ := max (signedWeight a θ d Y i) 0 noncomputable def negativeWeight (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : ℝ := max (-signedWeight a θ d Y i) 0 theorem positiveWeight_nonneg (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : 0 ≤ positiveWeight a θ d Y i := le_max_right _ _ theorem negativeWeight_nonneg (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : 0 ≤ negativeWeight a θ d Y i := le_max_right _ _ theorem signedWeight_split (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : positiveWeight a θ d Y i - negativeWeight a θ d Y i = signedWeight a θ d Y i := by unfold positiveWeight negativeWeight by_cases h : 0 ≤ signedWeight a θ d Y i · rw [max_eq_left h, max_eq_right (neg_nonpos.mpr h), sub_zero] · have hn : signedWeight a θ d Y i ≤ 0 := le_of_lt (lt_of_not_ge h) rw [max_eq_right hn, max_eq_left (neg_nonneg.mpr hn)] simp theorem abs_signedWeight_le (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : |signedWeight a θ d Y i| ≤ |ProtectedScores.shiftedCoeff a θ (sourceForcedCount d i.1) i.2.card| := by classical unfold signedWeight split_ifs · simpa using abs_nonneg (ProtectedScores.shiftedCoeff a θ (sourceForcedCount d i.1) i.2.card) · by_cases hw : 0 ≤ ProtectedScores.shiftedCoeff a θ (sourceForcedCount d i.1) i.2.card · rw [min_eq_right hw, abs_zero] exact abs_nonneg _ · rw [min_eq_left (le_of_not_ge hw)] · exact le_rfl theorem positiveWeight_le_abs_shiftedCoeff (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : positiveWeight a θ d Y i ≤ |ProtectedScores.shiftedCoeff a θ (sourceForcedCount d i.1) i.2.card| := by exact (max_le (le_abs_self _) (abs_nonneg _)).trans (abs_signedWeight_le a θ d Y i) theorem negativeWeight_le_abs_shiftedCoeff (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (i : G × Finset G) : negativeWeight a θ d Y i ≤ |ProtectedScores.shiftedCoeff a θ (sourceForcedCount d i.1) i.2.card| := by exact (max_le (neg_le_abs _) (abs_nonneg _)).trans (abs_signedWeight_le a θ d Y i) /-- Rank-zero terms are retained here, including all negative constants. -/ noncomputable def constantAt (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) : ℝ := by classical let c := sourceForcedCount d x exact if x ∈ Y ∪ badTargets d then -bound else if c ≤ L then if x ∈ externalTargets d then min (ProtectedScores.shiftedCoeff a θ c 0) 0 else ProtectedScores.shiftedCoeff a θ c 0 else 0 noncomputable def constantTerm (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) : ℝ := ∑ x : G, constantAt a L θ bound d Y x noncomputable def positivePart (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : ℝ := containmentSum (nonconstantLabels d L) Prod.snd (positiveWeight a θ d Y) B noncomputable def negativePart (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : ℝ := containmentSum (nonconstantLabels d L) Prod.snd (negativeWeight a θ d Y) B noncomputable def maskedPolynomial (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : ℝ := constantTerm a L θ bound d Y + positivePart a L θ d Y B - negativePart a L θ d Y B noncomputable def sourceFullScore (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (B : Finset G) : ℝ := ProtectedScores.fullScore a L θ (sourceForcedSet d ∪ B) d.2.2.2 theorem actual_fullScore_eq_source (a : ℕ → ℝ) (k L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (A E : Finset G) (hA : sourceConsistent k d A) (hE₀ : d.2.1 ⊆ d.2.2.1) (hE : E ⊆ A \ d.2.2.1) : ProtectedScores.fullScore a L θ ((A \ d.2.1) \ E) d.2.2.2 = sourceFullScore a L θ d ((A \ d.2.2.1) \ E) := by exact congrArg (fun C : Finset G => ProtectedScores.fullScore a L θ C d.2.2.2) (sourceConsistent_score_input_after_deletion k d A E hA hE₀ hE) theorem maskedPolynomial_eq_signedContainment (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : maskedPolynomial a L θ bound d Y B = constantTerm a L θ bound d Y + containmentSum (nonconstantLabels d L) Prod.snd (signedWeight a θ d Y) B := by classical have hsum : positivePart a L θ d Y B - negativePart a L θ d Y B = containmentSum (nonconstantLabels d L) Prod.snd (signedWeight a θ d Y) B := by unfold positivePart negativePart containmentSum rw [← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro i hi by_cases hsub : i.2 ⊆ B · simp only [if_pos hsub, signedWeight_split] · simp only [if_neg hsub, sub_self] unfold maskedPolynomial linarith theorem maskedPolynomial_priorMean (a : ℕ → ℝ) (k L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (hprior : (sourcePrior k d).Nonempty) : uniformMean (sourcePrior k d) (maskedPolynomial a L θ bound d Y) = constantTerm a L θ bound d Y + uniformMean (sourcePrior k d) (positivePart a L θ d Y) - uniformMean (sourcePrior k d) (negativePart a L θ d Y) := by have hlin : uniformMean (sourcePrior k d) (maskedPolynomial a L θ bound d Y) = uniformMean (sourcePrior k d) (fun _ => constantTerm a L θ bound d Y) + uniformMean (sourcePrior k d) (positivePart a L θ d Y) - uniformMean (sourcePrior k d) (negativePart a L θ d Y) := by simp only [maskedPolynomial, uniformMean, Finset.sum_sub_distrib, Finset.sum_add_distrib, add_div, sub_div] rw [hlin, uniformMean_const (sourcePrior k d) hprior] theorem positivePart_nonneg (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : 0 ≤ positivePart a L θ d Y B := by unfold positivePart containmentSum apply Finset.sum_nonneg intro i hi split_ifs · exact positiveWeight_nonneg _ _ _ _ _ · exact le_rfl theorem negativePart_nonneg (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : 0 ≤ negativePart a L θ d Y B := by unfold negativePart containmentSum apply Finset.sum_nonneg intro i hi split_ifs · exact negativeWeight_nonneg _ _ _ _ _ · exact le_rfl theorem maskedPolynomial_eq_sum_rows (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : maskedPolynomial a L θ bound d Y B = ∑ x : G, (constantAt a L θ bound d Y x + ∑ J ∈ nonemptyRankSubsets (rowInputs d x ∩ B) (sourceForcedCount d x) L, signedWeight a θ d Y (x, J)) := by rw [maskedPolynomial_eq_signedContainment, containmentSum_eq_rows] exact (Finset.sum_add_distrib).symm theorem signedWeight_le_shiftedCoeff_of_not_masked (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) (J : Finset G) (hx : x ∉ Y ∪ badTargets d) : signedWeight a θ d Y (x, J) ≤ ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) J.card := by classical unfold signedWeight simp only [hx, if_false] split_ifs · exact min_le_left _ _ · exact le_rfl theorem constantAt_le_shiftedCoeff_of_not_masked (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) (hx : x ∉ Y ∪ badTargets d) : constantAt a L θ bound d Y x ≤ if sourceForcedCount d x ≤ L then ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) 0 else 0 := by classical unfold constantAt simp only [hx, if_false] split_ifs · exact min_le_left _ _ · exact le_rfl · exact le_rfl /-- The implemented labelled polynomial is a minorant on every subset of the fixed free universe. No extraction law or realized-input guard is needed here. -/ theorem maskedPolynomial_le_sourceFullScore (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) (hBU : B ⊆ sourceFreeUniverse d) (hbound : ProtectedScores.inverseNewtonBound a L θ ≤ bound) (hscalar : ∀ c n : ℕ, ProtectedScores.shiftedInterpolation a L θ c n ≤ ProtectedScores.clippedInverseNewton a L θ (c + n)) : maskedPolynomial a L θ bound d Y B ≤ sourceFullScore a L θ d B := by classical rw [maskedPolynomial_eq_sum_rows] unfold sourceFullScore ProtectedScores.fullScore apply Finset.sum_le_sum intro x hx by_cases hmask : x ∈ Y ∪ badTargets d · have hlow := (abs_le.mp (ProtectedScores.abs_clippedInverseNewton_le a L θ (representationCount (sourceForcedSet d ∪ B) d.2.2.2 x))).1 simpa [constantAt, signedWeight, hmask] using (neg_le_neg hbound).trans hlow · calc constantAt a L θ bound d Y x + (∑ J ∈ nonemptyRankSubsets (rowInputs d x ∩ B) (sourceForcedCount d x) L, signedWeight a θ d Y (x, J)) ≤ (if sourceForcedCount d x ≤ L then ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) 0 else 0) + (∑ J ∈ nonemptyRankSubsets (rowInputs d x ∩ B) (sourceForcedCount d x) L, ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) J.card) := by apply add_le_add · exact constantAt_le_shiftedCoeff_of_not_masked a L θ bound d Y x hmask · exact Finset.sum_le_sum (fun J _ => signedWeight_le_shiftedCoeff_of_not_masked a θ d Y x J hmask) _ = ProtectedScores.shiftedInterpolation a L θ (sourceForcedCount d x) (rowInputs d x ∩ B).card := by exact constant_add_sum_nonemptyRankSubsets (rowInputs d x ∩ B) (sourceForcedCount d x) L (ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x)) _ ≤ ProtectedScores.clippedInverseNewton a L θ (sourceForcedCount d x + (rowInputs d x ∩ B).card) := hscalar _ _ _ = _ := by rw [representationCount_source_union d B hBU x] /-- A negative leading coefficient gives the required minorant for all descriptors, masks and possible remainders at one common positive radius. -/ theorem exists_maskedPolynomial_minorant_radius (a : ℕ → ℝ) (L : ℕ) (haL : a L < 0) : ∃ δ : ℝ, 0 < δ ∧ ∀ θ : ℝ, 0 < θ → θ ≤ δ → ∀ bound : ℝ, ProtectedScores.inverseNewtonBound a L θ ≤ bound → ∀ (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G), B ⊆ sourceFreeUniverse d → maskedPolynomial a L θ bound d Y B ≤ sourceFullScore a L θ d B := by obtain ⟨δ, hδ, hminor⟩ := ProtectedScores.exists_shiftedInterpolation_minorant_radius a L haL refine ⟨δ, hδ, ?_⟩ intro θ hθ hθδ bound hbound d Y B hBU exact maskedPolynomial_le_sourceFullScore a L θ bound d Y B hBU hbound (hminor θ hθ hθδ) /-- Block indices are the forced count and nonempty free-support rank. -/ def positiveBlockLabels (d : Finset G × Finset G × Finset G × Finset G) (L c j : ℕ) : Finset (G × Finset G) := (nonconstantLabels d L).filter (fun i => sourceForcedCount d i.1 = c ∧ i.2.card = j) def positiveBlocks (L : ℕ) : Finset (ℕ × ℕ) := ((Finset.range (L + 1)).product (Finset.range (L + 1))).filter (fun b => 1 ≤ b.2 ∧ b.1 + b.2 ≤ L) theorem mem_positiveBlocks (L : ℕ) (b : ℕ × ℕ) : b ∈ positiveBlocks L ↔ b.1 ∈ Finset.range (L + 1) ∧ b.2 ∈ Finset.range (L + 1) ∧ 1 ≤ b.2 ∧ b.1 + b.2 ≤ L := by simp [positiveBlocks, and_assoc] theorem positiveBlocks_card_le (L : ℕ) : (positiveBlocks L).card ≤ (L + 1) ^ 2 := by calc _ ≤ ((Finset.range (L + 1)).product (Finset.range (L + 1))).card := Finset.card_filter_le _ _ _ = _ := by simp [pow_two] noncomputable def positiveBlockPart (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (b : ℕ × ℕ) (B : Finset G) : ℝ := containmentSum (positiveBlockLabels d L b.1 b.2) Prod.snd (positiveWeight a θ d Y) B /-- The block split is an exact partition, even with zero mask weights. -/ theorem positivePart_eq_sum_blocks (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : positivePart a L θ d Y B = ∑ b ∈ positiveBlocks L, positiveBlockPart a L θ d Y b B := by classical let f : G × Finset G → ℕ × ℕ := fun i => (sourceForcedCount d i.1, i.2.card) have hmap : ∀ i ∈ nonconstantLabels d L, f i ∈ positiveBlocks L := by intro i hi obtain ⟨hU, hrow, hpos, hbound⟩ := (mem_nonconstantLabels d L i).mp hi apply (mem_positiveBlocks L (f i)).mpr dsimp [f] exact ⟨Finset.mem_range.mpr (by omega), Finset.mem_range.mpr (by omega), hpos, hbound⟩ have hf (b : ℕ × ℕ) : (nonconstantLabels d L).filter (fun i => f i = b) = positiveBlockLabels d L b.1 b.2 := by ext i simp [f, positiveBlockLabels, Prod.ext_iff] unfold positivePart positiveBlockPart containmentSum rw [← Finset.sum_fiberwise_of_maps_to hmap] apply Finset.sum_congr rfl intro b hb rw [hf] theorem positivePart_priorMean_eq_sum (a : ℕ → ℝ) (k L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) : uniformMean (sourcePrior k d) (positivePart a L θ d Y) = ∑ b ∈ positiveBlocks L, uniformMean (sourcePrior k d) (positiveBlockPart a L θ d Y b) := by change uniformMean (sourcePrior k d) (fun B => positivePart a L θ d Y B) = _ simp_rw [positivePart_eq_sum_blocks] exact uniformMean_sum _ _ _ noncomputable def positiveFailureBound (k L b : ℕ) (overlapBound t : ℝ) (d : Finset G × Finset G × Finset G × Finset G) : ℝ := ((positiveBlocks L).card : ℝ) * (((k - d.2.2.1.card).choose b : ℝ) * (((sourceFreeUniverse d).card + 1 : ℕ) : ℝ) * Real.exp (-(t ^ 2) / (2 * overlapBound))) /-- Exact WG7 and WG8 tests on the fixed necessary prior. Zero-weight blocks are included harmlessly; ordered overlaps retain repeated supports and diagonals. -/ def observableGuards (a : ℕ → ℝ) (k L : ℕ) (θ meanBound overlapBound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) : Prop := uniformMean (sourcePrior k d) (positivePart a L θ d Y) ≤ meanBound ∧ uniformMean (sourcePrior k d) (negativePart a L θ d Y) ≤ meanBound ∧ ∀ c ∈ Finset.range (L + 1), ∀ j ∈ Finset.range (L + 1), 1 ≤ j → c + j ≤ L → WeightedCleanup.weightedOverlap (positiveBlockLabels d L c j) Prod.snd (positiveWeight a θ d Y) (((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ)) ≤ overlapBound /-- The actual positive labelled polynomial retains its mean after every budgeted deletion, with the block overlap and mean tests as its only guards. -/ theorem positive_retention_failure_probability_le (a : ℕ → ℝ) (k L b : ℕ) (θ meanBound overlapBound t errPos : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (hnpos : 0 < k - d.2.2.1.card) (hb : b ≤ k - d.2.2.1.card) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) (hD : 0 < overlapBound) (ht : 0 < t) (hguards : observableGuards a k L θ meanBound overlapBound d Y) (hmargin : ((L : ℝ) * (b : ℝ) / ((k - d.2.2.1.card : ℕ) : ℝ)) * meanBound + ((positiveBlocks L).card : ℝ) * t ≤ errPos) : uniformProb (sourcePrior k d) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ positivePart a L θ d Y (B \ E) < uniformMean (sourcePrior k d) (positivePart a L θ d Y) - errPos) ≤ positiveFailureBound k L b overlapBound t d := by classical let q : ℝ := (L : ℝ) * (b : ℝ) / ((k - d.2.2.1.card : ℕ) : ℝ) let μ : (ℕ × ℕ) → ℝ := fun i => uniformMean (sourcePrior k d) (positiveBlockPart a L θ d Y i) let target : (ℕ × ℕ) → ℝ := fun i => μ i - (q * μ i + t) let ε : ℝ := ((k - d.2.2.1.card).choose b : ℝ) * (((sourceFreeUniverse d).card + 1 : ℕ) : ℝ) * Real.exp (-(t ^ 2) / (2 * overlapBound)) have hq : 0 ≤ q := by dsimp [q]; positivity have hsumμ : (∑ i ∈ positiveBlocks L, μ i) = uniformMean (sourcePrior k d) (positivePart a L θ d Y) := (positivePart_priorMean_eq_sum a k L θ d Y).symm have hsumtarget : (∑ i ∈ positiveBlocks L, target i) = uniformMean (sourcePrior k d) (positivePart a L θ d Y) - (q * uniformMean (sourcePrior k d) (positivePart a L θ d Y) + ((positiveBlocks L).card : ℝ) * t) := by simp only [target, Finset.sum_sub_distrib, Finset.sum_add_distrib, ← Finset.mul_sum, Finset.sum_const, nsmul_eq_mul, hsumμ] have hdrift : q * uniformMean (sourcePrior k d) (positivePart a L θ d Y) + ((positiveBlocks L).card : ℝ) * t ≤ errPos := (add_le_add (mul_le_mul_of_nonneg_left hguards.1 hq) le_rfl).trans hmargin have hblock : ∀ i ∈ positiveBlocks L, uniformProb (sourcePrior k d) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ positiveBlockPart a L θ d Y i (B \ E) < target i) ≤ ε := by intro i hi obtain ⟨hc, hj, hjpos, hcj⟩ := (mem_positiveBlocks L i).mp hi exact WeightedCleanup.every_deletion_retention_with_drift (sourceFreeUniverse d) (k - d.2.2.1.card) b hnpos hb hn (positiveBlockLabels d L i.1 i.2) Prod.snd (positiveWeight a θ d Y) (fun z hz => label_support_subset d L z (Finset.mem_filter.mp hz).1) (fun z _ => positiveWeight_nonneg a θ d Y z) L (fun z hz => label_support_rank d L z (Finset.mem_filter.mp hz).1) overlapBound t hD ht (hguards.2.2 i.1 hc i.2 hj hjpos hcj) calc _ ≤ uniformProb (sourcePrior k d) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ (∑ i ∈ positiveBlocks L, positiveBlockPart a L θ d Y i (B \ E)) < ∑ i ∈ positiveBlocks L, target i) := by apply uniformProb_mono intro B hB hbad obtain ⟨E, hEB, hcard, hbad⟩ := hbad refine ⟨E, hEB, hcard, ?_⟩ rw [← positivePart_eq_sum_blocks, hsumtarget] exact hbad.trans_le (sub_le_sub_left hdrift _) _ ≤ ∑ i ∈ positiveBlocks L, uniformProb (sourcePrior k d) (fun B => ∃ E ⊆ B, E.card ≤ b ∧ positiveBlockPart a L θ d Y i (B \ E) < target i) := WeightedCleanup.sum_retention_failure_le _ _ _ _ _ _ ≤ ∑ _i ∈ positiveBlocks L, ε := Finset.sum_le_sum hblock _ = _ := by simp [positiveFailureBound, ε] /-- A concrete fixed-descriptor tail for the same signed polynomial used by the canonical passing test. The only analytic guards are its observable means and positive block overlaps; all deletion estimates are proved upstream. -/ theorem signed_cleanup_failure_probability_le (a : ℕ → ℝ) (k L b r : ℕ) (θ bound meanBound overlapBound t errPos errNeg : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (hnpos : 0 < k - d.2.2.1.card) (hb : b ≤ k - d.2.2.1.card) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) (hbudget : L * r ≤ b) (hD : 0 < overlapBound) (ht : 0 < t) (herrNeg : 0 < errNeg) (hguards : observableGuards a k L θ meanBound overlapBound d Y) (hmargin : ((L : ℝ) * (b : ℝ) / ((k - d.2.2.1.card : ℕ) : ℝ)) * meanBound + ((positiveBlocks L).card : ℝ) * t ≤ errPos) : uniformProb (sourcePrior k d) (fun B => ¬ ∃ E ⊆ B, E.card ≤ b ∧ uniformMean (sourcePrior k d) (maskedPolynomial a L θ bound d Y) - (errPos + errNeg) ≤ maskedPolynomial a L θ bound d Y (B \ E)) ≤ positiveFailureBound k L b overlapBound t d + Real.exp (-(r : ℝ) * errNeg / (meanBound + errNeg)) := by have hprior : (sourcePrior k d).Nonempty := exactSlice_nonempty.mpr hn have hneg0 : 0 ≤ uniformMean (sourcePrior k d) (negativePart a L θ d Y) := uniformMean_nonneg _ _ (fun B _ => negativePart_nonneg a L θ d Y B) have hpositive := positive_retention_failure_probability_le a k L b θ meanBound overlapBound t errPos d Y hnpos hb hn hD ht hguards hmargin have hprob := WeightedCleanup.signed_cleanup_failure_probability_le (sourceFreeUniverse d) (k - d.2.2.1.card) b L r hn hbudget (nonconstantLabels d L) Prod.snd (negativeWeight a θ d Y) (fun i hi => label_support_subset d L i hi) (fun i _ => negativeWeight_nonneg a θ d Y i) (fun i hi => label_support_rank d L i hi) (positivePart a L θ d Y) (maskedPolynomial a L θ bound d Y) (maskedPolynomial a L θ bound d Y) (constantTerm a L θ bound d Y) (uniformMean (sourcePrior k d) (positivePart a L θ d Y)) errPos errNeg (positiveFailureBound k L b overlapBound t d) (fun _ => rfl) (fun _ => le_rfl) (add_pos_of_nonneg_of_pos hneg0 herrNeg) hpositive rw [maskedPolynomial_priorMean a k L θ bound d Y hprior] exact hprob.trans (add_le_add le_rfl (WeightedCleanup.deletion_ratio_pow_le_exp_of_mean_le (uniformMean (sourcePrior k d) (negativePart a L θ d Y)) meanBound errNeg r hneg0 hguards.2.1 herrNeg)) def priorAdmissible (k : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : Prop := d.2.1 ⊆ d.2.2.1 ∧ sourceForcedSet d ⊆ sourceForbidden d ∧ d.2.2.1.card ≤ k ∧ k - d.2.2.1.card ≤ (sourceFreeUniverse d).card /-- This is the concrete SE11 passing predicate; no realized remainder is used. -/ def passingMask (a : ℕ → ℝ) (k L : ℕ) (θ bound meanFloor meanBound overlapBound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) : Prop := passesPriorTests (sourcePrior k) (maskedPolynomial a L θ bound) (fun d Y => priorAdmissible k d ∧ observableGuards a k L θ meanBound overlapBound d Y) meanFloor d Y noncomputable def chosenMask (a : ℕ → ℝ) (k L allowance : ℕ) (θ bound meanFloor meanBound overlapBound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) : Finset G := canonical (boundedMasks Finset.univ allowance) (passingMask a k L θ bound meanFloor meanBound overlapBound) d theorem chosenMask_passes (a : ℕ → ℝ) (k L allowance : ℕ) (θ bound meanFloor meanBound overlapBound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (he : Eligible (boundedMasks Finset.univ allowance) (passingMask a k L θ bound meanFloor meanBound overlapBound) d) : passingMask a k L θ bound meanFloor meanBound overlapBound d (chosenMask a k L allowance θ bound meanFloor meanBound overlapBound d) := (canonical_spec _ _ _ he).2 theorem chosenMask_card_le (a : ℕ → ℝ) (k L allowance : ℕ) (θ bound meanFloor meanBound overlapBound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (he : Eligible (boundedMasks Finset.univ allowance) (passingMask a k L θ bound meanFloor meanBound overlapBound) d) : (chosenMask a k L allowance θ bound meanFloor meanBound overlapBound d).card ≤ allowance := (canonical_bounded _ _ _ _ he).2 theorem prior_nonempty_of_passing (a : ℕ → ℝ) (k L : ℕ) (θ bound meanFloor meanBound overlapBound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (hpass : passingMask a k L θ bound meanFloor meanBound overlapBound d Y) : (sourcePrior k d).Nonempty := by exact exactSlice_nonempty.mpr hpass.2.1.2.2.2 /-- The actual-source score and the canonical polynomial use the same deletion. The pointwise minorant and cleanup premises remain explicit analytic obligations. -/ theorem concrete_cleanup_contradiction (a : ℕ → ℝ) (k L allowance budget : ℕ) (θ bound meanFloor meanBound overlapBound margin upper : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (A X : Finset G) (hA : sourceConsistent k d A) (hX : X.card ≤ allowance) (hpass : passingMask a k L θ bound meanFloor meanBound overlapBound d X) (hgap : upper < meanFloor - margin) (hminorant : ∀ Y ∈ boundedMasks Finset.univ allowance, ∀ R ⊆ sourceFreeUniverse d, maskedPolynomial a L θ bound d Y R ≤ sourceFullScore a L θ d R) (hupper : ∀ E ⊆ A \ d.2.2.1, E.card ≤ budget → ProtectedScores.fullScore a L θ ((A \ d.2.1) \ E) d.2.2.2 ≤ upper) (hcleanup : ∃ E ⊆ A \ d.2.2.1, E.card ≤ budget ∧ uniformMean (sourcePrior k d) (maskedPolynomial a L θ bound d (chosenMask a k L allowance θ bound meanFloor meanBound overlapBound d)) - margin ≤ maskedPolynomial a L θ bound d (chosenMask a k L allowance θ bound meanFloor meanBound overlapBound d) ((A \ d.2.2.1) \ E)) : False := by have hBU : A \ d.2.2.1 ⊆ sourceFreeUniverse d := (mem_exactSlice.mp (sourceConsistent_remainder_mem k d A hA)).1 have hupper' : ∀ E ⊆ A \ d.2.2.1, E.card ≤ budget → sourceFullScore a L θ d ((A \ d.2.2.1) \ E) ≤ upper := by intro E hEB hcard have h := hupper E hEB hcard rwa [actual_fullScore_eq_source a k L θ d A E hA hpass.2.1.1 hEB] at h have hmask : X ∈ boundedMasks Finset.univ allowance := (mem_boundedMasks _ _ _).mpr ⟨Finset.subset_univ _, hX⟩ exact canonical_mask_contradiction_of_subset (boundedMasks Finset.univ allowance) (sourcePrior k) (maskedPolynomial a L θ bound) (fun d Y => priorAdmissible k d ∧ observableGuards a k L θ meanBound overlapBound d Y) meanFloor margin upper d (sourceFreeUniverse d) (A \ d.2.2.1) budget (sourceFullScore a L θ d) hBU X hmask hpass hgap hminorant hupper' hcleanup end SourceCanonicalMask end Green39Submission end Green39AssemblyScope_b88e491f6f96072e /- Source: Green39Submission.CanonicalInputTail; SHA256 19ba07943963304b0591b347f981bb60ba80d4d08fb7c3d2ccd5a186dd6eb6a0 -/ section Green39AssemblyScope_79c772615422287a /-! Original-input tails for the concrete canonical source polynomial. The source-extraction witness is stated explicitly: one actual consistent descriptor, one bounded passing mask, and the full-score upper bound after every allowed free deletion. The proved fixed-prior cleanup forces such an input into the canonical descriptor's failure event. The union charges exactly the descriptor cardinality; the adaptive witness mask is never counted. This finite connector does not supply the extraction witness or its numerical source/mean/overlap hypotheses. Those remain separate source and asymptotic obligations, not assumptions of a claimed final Green39 refutation. -/ namespace Green39Submission namespace CanonicalInputTail open scoped BigOperators Pointwise open DescriptorPrior CanonicalMask SourceCanonicalMask universe u /-- A common upper bound for the positive tail of every descriptor. -/ noncomputable def uniformPositiveFailureBound (p k L b : ℕ) (overlapBound t : ℝ) : ℝ := (((L + 1) ^ 2 : ℕ) : ℝ) * ((k.choose b : ℝ) * ((p + 1 : ℕ) : ℝ) * Real.exp (-(t ^ 2) / (2 * overlapBound))) theorem uniformPositiveFailureBound_nonneg (p k L b : ℕ) (overlapBound t : ℝ) : 0 ≤ uniformPositiveFailureBound p k L b overlapBound t := by unfold uniformPositiveFailureBound positivity variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] theorem positiveFailureBound_le_uniform (k L b : ℕ) (overlapBound t : ℝ) (d : Finset G × Finset G × Finset G × Finset G) : positiveFailureBound k L b overlapBound t d ≤ uniformPositiveFailureBound (Fintype.card G) k L b overlapBound t := by unfold positiveFailureBound uniformPositiveFailureBound refine mul_le_mul ?_ ?_ (by positivity) (by positivity) · exact_mod_cast positiveBlocks_card_le L · apply mul_le_mul_of_nonneg_right _ (Real.exp_nonneg _) refine mul_le_mul ?_ ?_ (Nat.cast_nonneg _) (Nat.cast_nonneg _) · exact_mod_cast Nat.choose_le_choose b (Nat.sub_le k d.2.2.1.card) · exact_mod_cast Nat.succ_le_succ (Finset.card_le_univ (sourceFreeUniverse d)) /-- A fixed-descriptor witness on a good input forces the one canonical cleanup failure, giving an original exact-input bound with no adaptive-mask entropy. -/ theorem original_input_probability_le_card_mul (a : ℕ → ℝ) (k L allowance b r : ℕ) (θ bound meanFloor meanBound overlapBound t errPos errNeg upper : ℝ) (descriptors : Finset (Finset G × Finset G × Finset G × Finset G)) (good bad : Finset G → Prop) (hbound : ProtectedScores.inverseNewtonBound a L θ ≤ bound) (hscalar : ∀ c n : ℕ, ProtectedScores.shiftedInterpolation a L θ c n ≤ ProtectedScores.clippedInverseNewton a L θ (c + n)) (hbudget : L * r ≤ b) (hD : 0 < overlapBound) (ht : 0 < t) (herrNeg : 0 < errNeg) (hgap : upper < meanFloor - (errPos + errNeg)) (hparameters : ∀ d ∈ descriptors, Eligible (boundedMasks Finset.univ allowance) (passingMask a k L θ bound meanFloor meanBound overlapBound) d → 0 < k - d.2.2.1.card ∧ b ≤ k - d.2.2.1.card ∧ ((L : ℝ) * (b : ℝ) / ((k - d.2.2.1.card : ℕ) : ℝ)) * meanBound + ((positiveBlocks L).card : ℝ) * t ≤ errPos) (hExtract : ∀ A ∈ exactSlice Finset.univ k, good A → bad A → ∃ d ∈ descriptors, ∃ X : Finset G, sourceConsistent k d A ∧ X.card ≤ allowance ∧ passingMask a k L θ bound meanFloor meanBound overlapBound d X ∧ ∀ E ⊆ A \ d.2.2.1, E.card ≤ b → ProtectedScores.fullScore a L θ ((A \ d.2.1) \ E) d.2.2.2 ≤ upper) : uniformProb (exactSlice Finset.univ k) bad ≤ uniformProb (exactSlice Finset.univ k) (fun A => ¬ good A) + (descriptors.card : ℝ) * (uniformPositiveFailureBound (Fintype.card G) k L b overlapBound t + Real.exp (-(r : ℝ) * errNeg / (meanBound + errNeg))) := by classical let masks : Finset (Finset G) := boundedMasks Finset.univ allowance let passes : (Finset G × Finset G × Finset G × Finset G) → Finset G → Prop := passingMask a k L θ bound meanFloor meanBound overlapBound let W := fun d : Finset G × Finset G × Finset G × Finset G => maskedPolynomial a L θ bound d (chosenMask a k L allowance θ bound meanFloor meanBound overlapBound d) let failure := fun (d : Finset G × Finset G × Finset G × Finset G) (B : Finset G) => ¬ ∃ E ⊆ B, E.card ≤ b ∧ uniformMean (sourcePrior k d) (W d) - (errPos + errNeg) ≤ W d (B \ E) let observable := fun d B => Eligible masks passes d ∧ failure d B let joint := fun d A => sourceConsistent k d A ∧ observable d (A \ d.2.2.1) let tail := uniformPositiveFailureBound (Fintype.card G) k L b overlapBound t + Real.exp (-(r : ℝ) * errNeg / (meanBound + errNeg)) have htail0 : 0 ≤ tail := add_nonneg (uniformPositiveFailureBound_nonneg _ _ _ _ _ _) (Real.exp_nonneg _) apply DescriptorUnion.probability_le_gate_failure_add_card_mul (exactSlice Finset.univ k) descriptors good bad joint tail · intro A hA hgood hbad obtain ⟨d, hd, X, hconsistent, hX, hpass, hupper⟩ := hExtract A hA hgood hbad have hmask : X ∈ masks := (mem_boundedMasks _ _ _).mpr ⟨Finset.subset_univ _, hX⟩ have he : Eligible masks passes d := ⟨X, hmask, hpass⟩ refine ⟨d, hd, hconsistent, he, ?_⟩ intro hcleanup exact concrete_cleanup_contradiction a k L allowance b θ bound meanFloor meanBound overlapBound (errPos + errNeg) upper d A X hconsistent hX hpass hgap (fun Y _ R hR => maskedPolynomial_le_sourceFullScore a L θ bound d Y R hR hbound hscalar) hupper hcleanup · intro d hd by_cases he : Eligible masks passes d · have hpass := chosenMask_passes a k L allowance θ bound meanFloor meanBound overlapBound d he obtain ⟨hnpos, hb, hmargin⟩ := hparameters d hd he have hcleanup : uniformProb (sourcePrior k d) (failure d) ≤ positiveFailureBound k L b overlapBound t d + Real.exp (-(r : ℝ) * errNeg / (meanBound + errNeg)) := SourceCanonicalMask.signed_cleanup_failure_probability_le a k L b r θ bound meanBound overlapBound t errPos errNeg d (chosenMask a k L allowance θ bound meanFloor meanBound overlapBound d) hnpos hb hpass.2.1.2.2.2 hbudget hD ht herrNeg hpass.2.2 hmargin calc uniformProb (exactSlice Finset.univ k) (joint d) ≤ uniformProb (sourcePrior k d) (observable d) := source_joint_probability_le k d hpass.2.1.2.2.1 (observable d) _ = uniformProb (sourcePrior k d) (failure d) := by apply uniformProb_congr intro B hB exact and_iff_right he _ ≤ positiveFailureBound k L b overlapBound t d + Real.exp (-(r : ℝ) * errNeg / (meanBound + errNeg)) := hcleanup _ ≤ tail := add_le_add (positiveFailureBound_le_uniform k L b overlapBound t d) le_rfl · calc uniformProb (exactSlice Finset.univ k) (joint d) = uniformProb (exactSlice Finset.univ k) (fun _ => False) := by apply uniformProb_congr intro A hA simp only [joint, observable, he, false_and, and_false] _ = 0 := uniformProb_false _ _ ≤ tail := htail0 end CanonicalInputTail end Green39Submission end Green39AssemblyScope_79c772615422287a /- Source: Green39Submission.SparseSourceData; SHA256 1456dc8970319b5e875ae08b59580a5d42c4229dcb8e3c98a432ef38a9e95d91 -/ section Green39AssemblyScope_1d7561bdfedea062 /-! Pure source-certificate data for the actual sparse-hole obstruction. The four-set descriptors and all tests are fixed before the original input is sampled. Certificate existence remains a separate source-construction theorem. -/ namespace Green39Submission namespace SparseObstruction open scoped BigOperators Pointwise open Filter Topology open DescriptorPrior DescriptorCounting DescriptorAsymptotics open CanonicalMask SourceCanonicalMask CanonicalInputTail CodegreeMultiplicity universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- Exactly the two common input gates proved on the original exact slice. -/ def CommonInputGate (A : Finset G) (J H : ℕ) : Prop := NonzeroCodegreeBound A J ∧ UniformMultiplicityCleanup A 6 (30 * H) H theorem exists_clean_input_of_gate (A D : Finset G) (J H : ℕ) (hgate : CommonInputGate A J H) (hD : D.card ≤ H) : ∃ E₀ : Finset G, E₀ ⊆ A ∧ E₀.card ≤ 30 * H ∧ NonzeroCodegreeBound (A \ E₀) J ∧ ∀ x : G, representationCount (A \ E₀) D x ≤ 5 := by obtain ⟨E₀, hEA, hEcard, hcap⟩ := hgate.2 D hD refine ⟨E₀, hEA, hEcard, nonzeroCodegreeBound_mono_input Finset.sdiff_subset hgate.1, ?_⟩ intro x have := hcap x omega /-- Actual protection gives a nonempty necessary prior without an asymptotic size assumption: the realized remainder itself witnesses that nonemptiness. -/ theorem actual_prior_admissible (k : ℕ) (A E₀ S D : Finset G) (hA : A.card = k) (hE₀ : E₀ ⊆ A) : priorAdmissible k (D, E₀, protectedInputs A E₀ S D, S) := by let d := (D, E₀, protectedInputs A E₀ S D, S) have hconsistent : sourceConsistent k d A := sourceConsistent_protectedInputs k A E₀ S D hA hE₀ have hprior : (sourcePrior k d).Nonempty := ⟨A \ d.2.2.1, sourceConsistent_remainder_mem k d A hconsistent⟩ refine ⟨Finset.subset_union_left, ?_, ?_, exactSlice_nonempty.mp hprior⟩ · rw [sourceForcedSet_protectedInputs] exact Finset.inter_subset_right · calc (protectedInputs A E₀ S D).card ≤ A.card := Finset.card_le_card (ProtectedScores.protectedInputs_subset hE₀) _ = k := hA theorem actual_descriptor_mem_protectedFamily (A E₀ S D : Finset G) (H s : ℕ) (hD : D.card ≤ H) (hE₀ : E₀.card ≤ 30 * H) (hcap : ∀ x : G, representationCount (A \ E₀) D x ≤ 5) (hS : S.card ≤ s) : (D, E₀, protectedInputs A E₀ S D, S) ∈ protectedDescriptorFamily Finset.univ H s := by exact mem_protectedDescriptorFamily_of_bounds Finset.univ D E₀ (protectedInputs A E₀ S D) S H s (Finset.subset_univ _) (Finset.subset_univ _) (Finset.subset_univ _) (Finset.subset_univ _) hD hE₀ (ProtectedScores.card_protectedInputs_le A E₀ S D 5 (fun x _ => hcap x)) hS theorem actual_descriptor_sizeCaps (ε C : ℝ) (k : ℕ) (A E₀ S D : Finset G) (hD : D.card ≤ Parameters.H k) (hE₀ : E₀.card ≤ 30 * Parameters.H k) (hcap : ∀ x : G, representationCount (A \ E₀) D x ≤ 5) (hS : (S.card : ℝ) ≤ C * sourceScale ε k) : SizeCaps ε C k (D, E₀, protectedInputs A E₀ S D, S) := by exact SizeCaps.of_actual_protection hD hE₀ (ProtectedScores.card_protectedInputs_le A E₀ S D 5 (fun x _ => hcap x)) hS /-- These restrictions depend only on the four encoded sets and fixed parameters; they add no source-parent or adaptive-mask information. -/ noncomputable def candidateDescriptors (ε C : ℝ) (k s : ℕ) : Finset (Finset G × Finset G × Finset G × Finset G) := by classical exact (protectedDescriptorFamily Finset.univ (Parameters.H k) s).filter (fun d => SizeCaps ε C k d ∧ UpperWindow ε k d) theorem mem_candidateDescriptors (ε C : ℝ) (k s : ℕ) (d : Finset G × Finset G × Finset G × Finset G) : d ∈ candidateDescriptors ε C k s ↔ d ∈ protectedDescriptorFamily Finset.univ (Parameters.H k) s ∧ SizeCaps ε C k d ∧ UpperWindow ε k d := by classical simp only [candidateDescriptors, Finset.mem_filter] theorem candidateDescriptors_card_le (ε C : ℝ) (k s : ℕ) : (candidateDescriptors (G := G) ε C k s).card ≤ (protectedDescriptorFamily (Finset.univ : Finset G) (Parameters.H k) s).card := by classical exact Finset.card_filter_le _ _ theorem candidateDescriptors_card_le_power (ε C : ℝ) (k s : ℕ) : (candidateDescriptors (G := G) ε C k s).card ≤ (2 * max 1 (Fintype.card G)) ^ (61 * Parameters.H k + 6 * s) := by exact (candidateDescriptors_card_le (G := G) ε C k s).trans (by simpa only [Finset.card_univ] using protectedDescriptorFamily_card_le (Finset.univ : Finset G) (Parameters.H k) s) theorem actual_descriptor_mem_candidates (ε C : ℝ) (k s : ℕ) (A E₀ S D : Finset G) (hD : D.card ≤ Parameters.H k) (hE₀ : E₀.card ≤ 30 * Parameters.H k) (hcap : ∀ x : G, representationCount (A \ E₀) D x ≤ 5) (hScard : S.card ≤ s) (hS : (S.card : ℝ) ≤ C * sourceScale ε k) (hupper : (S.card : ℝ) ≤ sourceUpper ε k) : (D, E₀, protectedInputs A E₀ S D, S) ∈ candidateDescriptors ε C k s := by exact (mem_candidateDescriptors _ _ _ _ _).mpr ⟨actual_descriptor_mem_protectedFamily A E₀ S D (Parameters.H k) s hD hE₀ hcap hScard, actual_descriptor_sizeCaps ε C k A E₀ S D hD hE₀ hcap hS, hupper⟩ /-- Explicit data to be supplied by the actual source construction. This is a development certificate, not an assertion that such data exist. -/ structure SourceCertificate (a : ℕ → ℝ) (ε C : ℝ) (k L s b : ℕ) (θ bound meanFloor meanBound overlapBound upper : ℝ) (A X D E₀ S : Finset G) : Prop where centers_card : D.card ≤ Parameters.H k exceptions_subset : E₀ ⊆ A exceptions_card : E₀.card ≤ 30 * Parameters.H k multiplicity : ∀ x : G, representationCount (A \ E₀) D x ≤ 5 sources_card : S.card ≤ s sources_coarse : (S.card : ℝ) ≤ C * sourceScale ε k sources_upper : (S.card : ℝ) ≤ sourceUpper ε k prior_mean : meanFloor ≤ uniformMean (sourcePrior k (D, E₀, protectedInputs A E₀ S D, S)) (maskedPolynomial a L θ bound (D, E₀, protectedInputs A E₀ S D, S) X) observable_guards : observableGuards a k L θ meanBound overlapBound (D, E₀, protectedInputs A E₀ S D, S) X score_upper : ∀ E ⊆ A \ protectedInputs A E₀ S D, E.card ≤ b → ProtectedScores.fullScore a L θ ((A \ E₀) \ E) S ≤ upper theorem SourceCertificate.passing {a : ℕ → ℝ} {ε C : ℝ} {k L s b : ℕ} {θ bound meanFloor meanBound overlapBound upper : ℝ} {A X D E₀ S : Finset G} (h : SourceCertificate a ε C k L s b θ bound meanFloor meanBound overlapBound upper A X D E₀ S) (hA : A.card = k) : passingMask a k L θ bound meanFloor meanBound overlapBound (D, E₀, protectedInputs A E₀ S D, S) X := ⟨h.prior_mean, actual_prior_admissible k A E₀ S D hA h.exceptions_subset, h.observable_guards⟩ theorem SourceCertificate.mem_candidates {a : ℕ → ℝ} {ε C : ℝ} {k L s b : ℕ} {θ bound meanFloor meanBound overlapBound upper : ℝ} {A X D E₀ S : Finset G} (h : SourceCertificate a ε C k L s b θ bound meanFloor meanBound overlapBound upper A X D E₀ S) : (D, E₀, protectedInputs A E₀ S D, S) ∈ candidateDescriptors ε C k s := actual_descriptor_mem_candidates ε C k s A E₀ S D h.centers_card h.exceptions_card h.multiplicity h.sources_card h.sources_coarse h.sources_upper end SparseObstruction end Green39Submission end Green39AssemblyScope_1d7561bdfedea062 /- Source: Green39Submission.SparseCleanupAsymptotics; SHA256 2cc395ff7d81a50a0e15af24f288ac32013681728a3bf74a1b8da0209d2a07c9 -/ section Green39AssemblyScope_b8c1b03a4b1fc542 /-! The literal sparse cleanup budgets and the full descriptor-counted finite tail. All constants are fixed before the limiting parameter. No comparison between entropy and the cleanup rates is assumed in the concrete limit theorems. -/ namespace Green39Submission.SparseCleanupAsymptotics open Filter Topology Parameters Green39Submission.Asymptotics open DescriptorAsymptotics CanonicalInputTail noncomputable section def blockBound : ℕ := (L + 1) ^ 2 def cleanupMean (C : ℝ) (p k : ℕ) : ℝ := C * (p : ℝ) * (M0 k : ℝ) ^ (L + 1) def cleanupOverlap (C : ℝ) (k : ℕ) : ℝ := C * (k : ℝ) ^ (3 : ℕ) * (M0 k : ℝ) ^ (2 * L + 1) def cleanupError (a : ℝ) (p : ℕ) : ℝ := a * (p : ℝ) / 32 def blockError (a : ℝ) (p : ℕ) : ℝ := a * (p : ℝ) / (64 * (blockBound : ℝ)) def cleanupDrift (C : ℝ) (k : ℕ) : ℝ := 2 * (L : ℝ) * C / (M0 k : ℝ) ^ (L + 1) def positiveConstant (a C : ℝ) : ℝ := a ^ 2 / (8192 * (blockBound : ℝ) ^ 2 * C) def negativeConstant (a C : ℝ) : ℝ := sparseCleanupConstant C (a / 32) def sourceCap (k : ℕ) : ℕ := ⌊200 * sourceScale epsilon0 k⌋₊ def descriptorCost (k : ℕ) : ℝ := 100000 * descriptorEntropy epsilon0 k def positiveCost (k : ℕ) : ℝ := descriptorCost k + ((sparseBudget k : ℝ) + 6) * Real.log (k : ℝ) theorem blockBound_pos : 0 < blockBound := by unfold blockBound positivity theorem one_le_M0 {k : ℕ} (hk : 1 ≤ k) : (1 : ℝ) ≤ M0 k := by have hk' : (1 : ℝ) ≤ k := by exact_mod_cast hk have hpow := Real.one_le_rpow hk' alpha_pos.le have hM := (M0_bounds hk).1 linarith theorem M0_pos {k : ℕ} (hk : 1 ≤ k) : (0 : ℝ) < M0 k := zero_lt_one.trans_le (one_le_M0 hk) theorem cleanup_order_budget (k : ℕ) : L * sparseCleanupOrder k ≤ sparseBudget k := by simpa only [sparseCleanupOrder, Nat.mul_comm] using Nat.div_mul_le_self (sparseBudget k) L theorem cleanupDrift_tendsto_zero (C : ℝ) : Tendsto (cleanupDrift C) atTop (𝓝 0) := by change Tendsto (fun k : ℕ => cleanupDrift C k) atTop (𝓝 0) have hM : Tendsto (fun k : ℕ => (M0 k : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp M0_tendsto_atTop have hpow : Tendsto (fun k : ℕ => (M0 k : ℝ) ^ (L + 1)) atTop atTop := (tendsto_pow_atTop (by omega : L + 1 ≠ 0)).comp hM simpa only [cleanupDrift, div_eq_mul_inv, mul_zero, Pi.inv_apply] using hpow.inv_tendsto_atTop.const_mul (2 * (L : ℝ) * C) theorem drift_le {C : ℝ} (hC : 0 ≤ C) {k n p : ℕ} (hk : 1 ≤ k) (hn : (k : ℝ) / 2 ≤ (n : ℝ)) : ((L : ℝ) * (sparseBudget k : ℝ) / (n : ℝ)) * cleanupMean C p k ≤ cleanupDrift C k * (p : ℝ) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hn0 : (0 : ℝ) < n := by linarith have hM := M0_pos hk have hMq : (0 : ℝ) < (M0 k : ℝ) ^ (2 * L + 2) := pow_pos hM _ have hb : (sparseBudget k : ℝ) ≤ (k : ℝ) / (M0 k : ℝ) ^ (2 * L + 2) := Nat.floor_le (div_nonneg hk0.le hMq.le) have hbm := (le_div_iff₀ hMq).mp hb have hbn : (sparseBudget k : ℝ) / (n : ℝ) ≤ 2 / (M0 k : ℝ) ^ (2 * L + 2) := by apply (div_le_div_iff₀ hn0 hMq).mpr linarith calc ((L : ℝ) * (sparseBudget k : ℝ) / (n : ℝ)) * cleanupMean C p k = ((sparseBudget k : ℝ) / (n : ℝ)) * ((L : ℝ) * C * (p : ℝ) * (M0 k : ℝ) ^ (L + 1)) := by unfold cleanupMean ring _ ≤ (2 / (M0 k : ℝ) ^ (2 * L + 2)) * ((L : ℝ) * C * (p : ℝ) * (M0 k : ℝ) ^ (L + 1)) := mul_le_mul_of_nonneg_right hbn (by positivity) _ = cleanupDrift C k * (p : ℝ) := by unfold cleanupDrift rw [show 2 * L + 2 = (L + 1) + (L + 1) by omega, pow_add] field_simp [hM.ne'] theorem block_error_le {a : ℝ} (ha : 0 ≤ a) (p : ℕ) : ((SourceCanonicalMask.positiveBlocks L).card : ℝ) * blockError a p ≤ a * (p : ℝ) / 64 := by have hB : (0 : ℝ) < blockBound := by exact_mod_cast blockBound_pos have hb : ((SourceCanonicalMask.positiveBlocks L).card : ℝ) ≤ blockBound := by exact_mod_cast SourceCanonicalMask.positiveBlocks_card_le L calc _ ≤ (blockBound : ℝ) * blockError a p := mul_le_mul_of_nonneg_right hb (by unfold blockError; positivity) _ = a * (p : ℝ) / 64 := by unfold blockError; field_simp /-- Uniformity in the exact remainder size and ambient order is explicit. -/ theorem eventually_cleanup_parameters {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) : ∀ᶠ k : ℕ in atTop, ∀ n p : ℕ, 0 < p → (k : ℝ) / 2 ≤ (n : ℝ) → 0 < n ∧ sparseBudget k ≤ n ∧ 0 < cleanupOverlap Cdelta k ∧ 0 < blockError a p ∧ 0 < cleanupError a p ∧ ((L : ℝ) * (sparseBudget k : ℝ) / (n : ℝ)) * cleanupMean Cmu p k + ((SourceCanonicalMask.positiveBlocks L).card : ℝ) * blockError a p ≤ cleanupError a p := by have hsmall := (tendsto_order.1 (cleanupDrift_tendsto_zero Cmu)).2 (a / 64) (by positivity) have hbudget := (tendsto_order.1 sparseBudget_div_k_tendsto_zero).2 (1 / 2) (by norm_num) filter_upwards [hsmall, hbudget, eventually_ge_atTop (1 : ℕ)] with k hs hb hk intro n p hp hn have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hn0 : (0 : ℝ) < n := by linarith have hp0 : (0 : ℝ) < p := by exact_mod_cast hp have hb' : (sparseBudget k : ℝ) ≤ (n : ℝ) := ((div_le_iff₀ hk0).mp hb.le).trans (by linarith) have hM := M0_pos hk have hB : (0 : ℝ) < blockBound := by exact_mod_cast blockBound_pos refine ⟨by exact_mod_cast hn0, by exact_mod_cast hb', ?_, ?_, ?_, ?_⟩ · unfold cleanupOverlap positivity · unfold blockError positivity · unfold cleanupError positivity · have hd := (drift_le hCmu hk hn).trans (mul_le_mul_of_nonneg_right hs.le hp0.le) have ht := block_error_le ha.le p unfold cleanupError linarith theorem positiveConstant_pos {a C : ℝ} (ha : 0 < a) (hC : 0 < C) : 0 < positiveConstant a C := by have hB : (0 : ℝ) < blockBound := by exact_mod_cast blockBound_pos unfold positiveConstant positivity theorem negativeConstant_pos {a C : ℝ} (ha : 0 < a) (hC : 0 ≤ C) : 0 < negativeConstant a C := sparseCleanupConstant_pos hC (by positivity) theorem descriptorCost_nonneg (k : ℕ) : 0 ≤ descriptorCost k := by unfold descriptorCost descriptorEntropy exact mul_nonneg (by norm_num) (mul_nonneg (add_nonneg (Nat.cast_nonneg _) (by positivity)) (Real.log_natCast_nonneg _)) theorem descriptorCost_sparse_ratio_tendsto_zero : Tendsto (fun k : ℕ => descriptorCost k / sparseRate k) atTop (𝓝 0) := by simpa only [descriptorCost, mul_div_assoc, mul_zero] using sparse_descriptorEntropy_ratio_tendsto_zero.const_mul 100000 theorem descriptorCost_positive_ratio_tendsto_zero : Tendsto (fun k : ℕ => descriptorCost k / positiveRate k) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => descriptorEntropy epsilon0 k / positiveRate k) (fun k : ℕ => descriptorEntropy epsilon0 k / ((k : ℝ) ^ positiveRatePower / (2 : ℝ) ^ (2 * L + 1))) := _root_.Asymptotics.IsEquivalent.refl.div positiveRate_equivalent have hbase := descriptorEntropy_div_rpow_tendsto_zero (lt_trans sparse_rate_gt_H sparse_rate_lt_positive_rate) (lt_trans sparse_rate_gt_source sparse_rate_lt_positive_rate) have hlim : Tendsto (fun k : ℕ => descriptorEntropy epsilon0 k / positiveRate k) atTop (𝓝 0) := by apply he.symm.tendsto_nhds simpa only [zero_mul, div_div_eq_mul_div, mul_div_right_comm] using hbase.mul_const ((2 : ℝ) ^ (2 * L + 1)) simpa only [descriptorCost, mul_div_assoc, mul_zero] using hlim.const_mul 100000 theorem log_positive_ratio_tendsto_zero : Tendsto (fun k : ℕ => Real.log (k : ℝ) / positiveRate k) atTop (𝓝 0) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => Real.log (k : ℝ) / positiveRate k) (fun k : ℕ => Real.log (k : ℝ) / ((k : ℝ) ^ positiveRatePower / (2 : ℝ) ^ (2 * L + 1))) := _root_.Asymptotics.IsEquivalent.refl.div positiveRate_equivalent apply he.symm.tendsto_nhds simpa only [zero_mul, div_div_eq_mul_div, mul_div_right_comm] using (log_div_rpow_tendsto_zero positive_rate_pos).mul_const ((2 : ℝ) ^ (2 * L + 1)) theorem positiveCost_ratio_tendsto_zero : Tendsto (fun k : ℕ => positiveCost k / positiveRate k) atTop (𝓝 0) := by simpa only [positiveCost, add_mul, add_div, mul_div_assoc, mul_zero, zero_add, add_zero] using descriptorCost_positive_ratio_tendsto_zero.add (sparse_deletionEntropy_ratio_tendsto_zero.add (log_positive_ratio_tendsto_zero.const_mul 6)) /-- A reusable absorption lemma; the concrete cost/rate inputs above are proved. -/ theorem exp_cost_sub_rate_tendsto_zero {E R : ℕ → ℝ} (hR : Tendsto R atTop atTop) (hER : Tendsto (fun k => E k / R k) atTop (𝓝 0)) {c : ℝ} (hc : 0 < c) : Tendsto (fun k => Real.exp (E k - c * R k)) atTop (𝓝 0) := by have hsmall := (tendsto_order.1 hER).2 (c / 2) (by positivity) apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (exp_neg_mul_tendsto_zero hR (show 0 < c / 2 by positivity)) · exact Eventually.of_forall fun k => Real.exp_nonneg _ · filter_upwards [hsmall, hR.eventually_ge_atTop 1] with k hk hRk apply Real.exp_le_exp.mpr have h := (div_le_iff₀ (show 0 < R k by linarith)).mp hk.le linarith theorem positive_exponent_lower {a C : ℝ} (ha : 0 < a) (hC : 0 < C) {k p : ℕ} (hk : 1 ≤ k) (hkp : k ^ 2 ≤ p) : positiveConstant a C * positiveRate k ≤ (blockError a p) ^ 2 / (2 * cleanupOverlap C k) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hM := M0_pos hk have hB : (0 : ℝ) < blockBound := by exact_mod_cast blockBound_pos have hkp' : (k : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast hkp have hpow : (k : ℝ) ^ (4 : ℕ) ≤ (p : ℝ) ^ (2 : ℕ) := by calc (k : ℝ) ^ (4 : ℕ) = ((k : ℝ) ^ (2 : ℕ)) ^ (2 : ℕ) := by ring _ ≤ (p : ℝ) ^ (2 : ℕ) := pow_le_pow_left₀ (sq_nonneg _) hkp' _ have hfactor : 0 ≤ positiveConstant a C / ((k : ℝ) ^ (3 : ℕ) * (M0 k : ℝ) ^ (2 * L + 1)) := by exact div_nonneg (positiveConstant_pos ha hC).le (by positivity) calc positiveConstant a C * positiveRate k = (positiveConstant a C / ((k : ℝ) ^ (3 : ℕ) * (M0 k : ℝ) ^ (2 * L + 1))) * (k : ℝ) ^ (4 : ℕ) := by unfold positiveRate field_simp [hk0.ne', hM.ne'] _ ≤ (positiveConstant a C / ((k : ℝ) ^ (3 : ℕ) * (M0 k : ℝ) ^ (2 * L + 1))) * (p : ℝ) ^ (2 : ℕ) := mul_le_mul_of_nonneg_left hpow hfactor _ = (blockError a p) ^ 2 / (2 * cleanupOverlap C k) := by unfold positiveConstant blockError cleanupOverlap field_simp [hB.ne', hC.ne', hk0.ne', hM.ne'] <;> ring theorem negative_exponent_eq (a C : ℝ) (k : ℕ) {p : ℕ} (hp : 0 < p) : (sparseCleanupOrder k : ℝ) * cleanupError a p / (cleanupMean C p k + cleanupError a p) = (sparseCleanupOrder k : ℝ) * (a / 32) / (C * (M0 k : ℝ) ^ (L + 1) + a / 32) := by have hp0 : (p : ℝ) ≠ 0 := by exact_mod_cast (ne_of_gt hp) unfold cleanupError cleanupMean calc _ = ((sparseCleanupOrder k : ℝ) * (a / 32) * (p : ℝ)) / ((C * (M0 k : ℝ) ^ (L + 1) + a / 32) * (p : ℝ)) := by ring _ = _ := mul_div_mul_right _ _ hp0 theorem eventually_negative_tail_le {a C : ℝ} (ha : 0 < a) (hC : 0 ≤ C) : ∀ᶠ k : ℕ in atTop, ∀ p : ℕ, 0 < p → Real.exp (-(sparseCleanupOrder k : ℝ) * cleanupError a p / (cleanupMean C p k + cleanupError a p)) ≤ Real.exp (-negativeConstant a C * sparseRate k) := by filter_upwards [eventually_sparse_cleanup_exponent_lower hC (show 0 < a / 32 by positivity)] with k hk intro p hp have he := negative_exponent_eq a C k hp apply Real.exp_le_exp.mpr have he' : -(sparseCleanupOrder k : ℝ) * cleanupError a p / (cleanupMean C p k + cleanupError a p) = -((sparseCleanupOrder k : ℝ) * (a / 32) / (C * (M0 k : ℝ) ^ (L + 1) + a / 32)) := by rw [← he] ring rw [he'] simpa only [negativeConstant, neg_mul] using neg_le_neg hk theorem sourceCap_le (k : ℕ) : (sourceCap k : ℝ) ≤ 200 * sourceScale epsilon0 k := Nat.floor_le (mul_nonneg (by norm_num) (sourceScale_nonneg _ _)) theorem descriptor_power_le_exp {k p : ℕ} (hp : 2 ≤ p) (hpk : p ≤ k ^ 4) : (p : ℝ) ^ (122 * H k + 12 * sourceCap k) ≤ Real.exp (descriptorCost k) := by have hp0 : (0 : ℝ) < p := by exact_mod_cast (show 0 < p by omega) have hpk' : (p : ℝ) ≤ (k : ℝ) ^ (4 : ℕ) := by exact_mod_cast hpk have hlog : Real.log (p : ℝ) ≤ 4 * Real.log (k : ℝ) := by simpa only [Real.log_pow, Nat.cast_ofNat] using Real.log_le_log hp0 hpk' have hs := sourceCap_le k have hs0 := sourceScale_nonneg epsilon0 k have hH0 : (0 : ℝ) ≤ H k := Nat.cast_nonneg _ have hcoeff : 4 * ((122 * H k + 12 * sourceCap k : ℕ) : ℝ) ≤ 100000 * ((H k : ℝ) + sourceScale epsilon0 k) := by push_cast linarith have hexp : ((122 * H k + 12 * sourceCap k : ℕ) : ℝ) * Real.log (p : ℝ) ≤ descriptorCost k := by calc _ ≤ ((122 * H k + 12 * sourceCap k : ℕ) : ℝ) * (4 * Real.log (k : ℝ)) := mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg _) _ = (4 * ((122 * H k + 12 * sourceCap k : ℕ) : ℝ)) * Real.log (k : ℝ) := by ring _ ≤ (100000 * ((H k : ℝ) + sourceScale epsilon0 k)) * Real.log (k : ℝ) := mul_le_mul_of_nonneg_right hcoeff (Real.log_natCast_nonneg _) _ = descriptorCost k := by unfold descriptorCost descriptorEntropy sourceScale; ring calc _ = Real.exp (((122 * H k + 12 * sourceCap k : ℕ) : ℝ) * Real.log (p : ℝ)) := by rw [Real.exp_nat_mul, Real.exp_log hp0] _ ≤ Real.exp (descriptorCost k) := Real.exp_le_exp.mpr hexp theorem prefactor_le {k p : ℕ} (hk : 2 ≤ k) (hB : blockBound ≤ k) (hpk : p ≤ k ^ 4) : (blockBound : ℝ) * (k.choose (sparseBudget k) : ℝ) * ((p + 1 : ℕ) : ℝ) ≤ (k : ℝ) ^ (sparseBudget k + 6) := by have h4 : 1 ≤ k ^ 4 := one_le_pow₀ (by omega : 1 ≤ k) have hp : p + 1 ≤ k ^ 5 := by calc p + 1 ≤ k ^ 4 + k ^ 4 := Nat.add_le_add hpk h4 _ = 2 * k ^ 4 := by ring _ ≤ k * k ^ 4 := Nat.mul_le_mul_right _ hk _ = k ^ 5 := by ring have h := Nat.mul_le_mul (Nat.mul_le_mul hB (Nat.choose_le_pow k (sparseBudget k))) hp have he : k * k ^ sparseBudget k * k ^ 5 = k ^ (sparseBudget k + 6) := by rw [show sparseBudget k + 6 = (sparseBudget k + 5) + 1 by omega, pow_succ, pow_add] ring rw [he] at h exact_mod_cast h theorem positive_tail_le {a C : ℝ} (ha : 0 < a) (hC : 0 < C) {k p : ℕ} (hk : 2 ≤ k) (hB : blockBound ≤ k) (hkp : k ^ 2 ≤ p) (hpk : p ≤ k ^ 4) : uniformPositiveFailureBound p k L (sparseBudget k) (cleanupOverlap C k) (blockError a p) ≤ Real.exp (((sparseBudget k : ℝ) + 6) * Real.log (k : ℝ) - positiveConstant a C * positiveRate k) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast (show 0 < k by omega) have he := positive_exponent_lower ha hC (show 1 ≤ k by omega) hkp have he' : Real.exp (-(blockError a p) ^ 2 / (2 * cleanupOverlap C k)) ≤ Real.exp (-positiveConstant a C * positiveRate k) := by apply Real.exp_le_exp.mpr simpa only [neg_div, neg_mul] using neg_le_neg he calc _ = ((blockBound : ℝ) * (k.choose (sparseBudget k) : ℝ) * ((p + 1 : ℕ) : ℝ)) * Real.exp (-(blockError a p) ^ 2 / (2 * cleanupOverlap C k)) := by unfold uniformPositiveFailureBound blockBound ring _ ≤ (k : ℝ) ^ (sparseBudget k + 6) * Real.exp (-positiveConstant a C * positiveRate k) := mul_le_mul (prefactor_le hk hB hpk) he' (Real.exp_nonneg _) (by positivity) _ = Real.exp (((sparseBudget k : ℝ) + 6) * Real.log (k : ℝ) - positiveConstant a C * positiveRate k) := by have hpow : (k : ℝ) ^ (sparseBudget k + 6) = Real.exp (((sparseBudget k : ℝ) + 6) * Real.log (k : ℝ)) := by simpa only [Nat.cast_add, Nat.cast_ofNat, Real.exp_log hk0] using (Real.exp_nat_mul (Real.log (k : ℝ)) (sparseBudget k + 6)).symm rw [hpow, ← Real.exp_add] congr 1 ring /-- Exactly the common finite tail charged by `CanonicalInputTail`. -/ def finiteTail (a Cmu Cdelta : ℝ) (p k : ℕ) : ℝ := uniformPositiveFailureBound p k L (sparseBudget k) (cleanupOverlap Cdelta k) (blockError a p) + Real.exp (-(sparseCleanupOrder k : ℝ) * cleanupError a p / (cleanupMean Cmu p k + cleanupError a p)) /-- The proved finite descriptor power bound times the complete cleanup tail. -/ def fullFiniteTail (a Cmu Cdelta : ℝ) (p k : ℕ) : ℝ := (p : ℝ) ^ (122 * H k + 12 * sourceCap k) * finiteTail a Cmu Cdelta p k def cleanupEnvelope (a Cmu Cdelta : ℝ) (k : ℕ) : ℝ := Real.exp (positiveCost k - positiveConstant a Cdelta * positiveRate k) + Real.exp (descriptorCost k - negativeConstant a Cmu * sparseRate k) theorem finiteTail_nonneg (a Cmu Cdelta : ℝ) (p k : ℕ) : 0 ≤ finiteTail a Cmu Cdelta p k := add_nonneg (uniformPositiveFailureBound_nonneg _ _ _ _ _ _) (Real.exp_nonneg _) theorem fullFiniteTail_nonneg (a Cmu Cdelta : ℝ) (p k : ℕ) : 0 ≤ fullFiniteTail a Cmu Cdelta p k := mul_nonneg (pow_nonneg (Nat.cast_nonneg _) _) (finiteTail_nonneg _ _ _ _ _) theorem cleanupEnvelope_tendsto_zero {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) : Tendsto (cleanupEnvelope a Cmu Cdelta) atTop (𝓝 0) := by change Tendsto (fun k : ℕ => cleanupEnvelope a Cmu Cdelta k) atTop (𝓝 0) simpa only [cleanupEnvelope, add_zero] using (exp_cost_sub_rate_tendsto_zero positiveRate_tendsto_atTop positiveCost_ratio_tendsto_zero (positiveConstant_pos ha hCdelta)).add (exp_cost_sub_rate_tendsto_zero sparseRate_tendsto_atTop descriptorCost_sparse_ratio_tendsto_zero (negativeConstant_pos ha hCmu)) theorem eventually_fullFiniteTail_le {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) : ∀ᶠ k : ℕ in atTop, ∀ p : ℕ, k ^ 2 ≤ p → p ≤ k ^ 4 → fullFiniteTail a Cmu Cdelta p k ≤ cleanupEnvelope a Cmu Cdelta k := by filter_upwards [eventually_negative_tail_le ha hCmu, eventually_ge_atTop (max 2 blockBound)] with k hneg hk intro p hkp hpk have hk2 : 2 ≤ k := (le_max_left _ _).trans hk have hB : blockBound ≤ k := (le_max_right _ _).trans hk have hp2 : 2 ≤ p := by nlinarith have hc := descriptor_power_le_exp hp2 hpk have hpos := positive_tail_le ha hCdelta hk2 hB hkp hpk have hn := hneg p (by omega) unfold fullFiniteTail finiteTail rw [mul_add] calc _ ≤ Real.exp (descriptorCost k) * Real.exp (((sparseBudget k : ℝ) + 6) * Real.log (k : ℝ) - positiveConstant a Cdelta * positiveRate k) + Real.exp (descriptorCost k) * Real.exp (-negativeConstant a Cmu * sparseRate k) := add_le_add (mul_le_mul hc hpos (uniformPositiveFailureBound_nonneg _ _ _ _ _ _) (Real.exp_nonneg _)) (mul_le_mul hc hn (Real.exp_nonneg _) (Real.exp_nonneg _)) _ = cleanupEnvelope a Cmu Cdelta k := by unfold cleanupEnvelope positiveCost rw [← Real.exp_add, ← Real.exp_add] congr 1 <;> congr 1 <;> ring /-- The full counted finite expression tends to zero with the literal square root. -/ theorem fullFiniteTail_sqrt_tendsto_zero {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) : Tendsto (fun p : ℕ => fullFiniteTail a Cmu Cdelta p (Nat.sqrt p)) atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds ((cleanupEnvelope_tendsto_zero ha hCmu hCdelta).comp nat_sqrt_tendsto_atTop) · exact Eventually.of_forall fun p => fullFiniteTail_nonneg _ _ _ _ _ · filter_upwards [nat_sqrt_tendsto_atTop.eventually (eventually_fullFiniteTail_le ha hCmu hCdelta), nat_sqrt_tendsto_atTop.eventually_ge_atTop 2] with p hp hk exact hp p (Nat.sqrt_le' p) (le_sqrt_fourth_power hk) theorem fullFiniteTail_primes_tendsto_zero {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) : Tendsto (fun p : {p : ℕ // p.Prime} => fullFiniteTail a Cmu Cdelta p.val (Nat.sqrt p.val)) atTop (𝓝 0) := (fullFiniteTail_sqrt_tendsto_zero ha hCmu hCdelta).comp prime_val_tendsto_atTop universe u theorem score_gap {a : ℝ} (ha : 0 < a) {p : ℕ} (hp : 0 < p) : a * (p : ℝ) / 16 < a * (p : ℝ) / 4 - (cleanupError a p + cleanupError a p) := by have hp0 : (0 : ℝ) < p := by exact_mod_cast hp have hap := mul_pos ha hp0 unfold cleanupError linarith /-- The actual sparse descriptor caps supply the exact prior and every numeric cleanup premise uniformly, with the group quantified after the threshold. -/ theorem eventually_uniform_prior_cleanup_parameters {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, Fintype.card G = p → SizeCaps epsilon0 200 (Nat.sqrt p) d → PriorSizeBounds (Nat.sqrt p) d ∧ 0 < remainderSize (Nat.sqrt p) d ∧ sparseBudget (Nat.sqrt p) ≤ remainderSize (Nat.sqrt p) d ∧ 0 < cleanupOverlap Cdelta (Nat.sqrt p) ∧ 0 < blockError a p ∧ 0 < cleanupError a p ∧ ((L : ℝ) * (sparseBudget (Nat.sqrt p) : ℝ) / (remainderSize (Nat.sqrt p) d : ℝ)) * cleanupMean Cmu p (Nat.sqrt p) + ((SourceCanonicalMask.positiveBlocks L).card : ℝ) * blockError a p ≤ cleanupError a p := by filter_upwards [eventually_uniform_sqrt_prior_size_bounds epsilon0_pos (show (0 : ℝ) ≤ 200 by norm_num), nat_sqrt_tendsto_atTop.eventually (eventually_cleanup_parameters ha hCmu hCdelta), eventually_ge_atTop (1 : ℕ)] with p hp hnumeric hp1 intro G _ _ _ d hcard hd have hprior := hp G d hcard hd exact ⟨hprior, hnumeric (remainderSize (Nat.sqrt p) d) p (by omega) hprior.remainder_half⟩ /-- The actual finite descriptor cardinality, including any eligibility filter, is covered by the same fully discharged tail. -/ theorem actual_counted_tail_le_fullFiniteTail {G : Type u} [DecidableEq G] [Fintype G] (a Cmu Cdelta : ℝ) (p k : ℕ) (hp : 2 ≤ p) (hcard : Fintype.card G = p) (family : Finset (Finset G × Finset G × Finset G × Finset G)) (hfamily : family ⊆ DescriptorCounting.protectedDescriptorFamily Finset.univ (H k) (sourceCap k)) : (family.card : ℝ) * finiteTail a Cmu Cdelta p k ≤ fullFiniteTail a Cmu Cdelta p k := by have hc : family.card ≤ p ^ (122 * H k + 12 * sourceCap k) := by calc family.card ≤ (DescriptorCounting.protectedDescriptorFamily Finset.univ (H k) (sourceCap k)).card := Finset.card_le_card hfamily _ ≤ p ^ (122 * H k + 12 * sourceCap k) := by simpa only [Finset.card_univ, hcard] using DescriptorCounting.protectedDescriptorFamily_card_le_ambient_power (Finset.univ : Finset G) (H k) (sourceCap k) (by simpa only [Finset.card_univ, hcard] using hp) have hc' : (family.card : ℝ) ≤ (p : ℝ) ^ (122 * H k + 12 * sourceCap k) := by exact_mod_cast hc exact mul_le_mul_of_nonneg_right hc' (finiteTail_nonneg _ _ _ _ _) theorem eventually_uniform_actual_counted_tail_le {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [DecidableEq G] [Fintype G], Fintype.card G = p → ∀ family : Finset (Finset G × Finset G × Finset G × Finset G), family ⊆ DescriptorCounting.protectedDescriptorFamily Finset.univ (H (Nat.sqrt p)) (sourceCap (Nat.sqrt p)) → (family.card : ℝ) * finiteTail a Cmu Cdelta p (Nat.sqrt p) ≤ cleanupEnvelope a Cmu Cdelta (Nat.sqrt p) := by filter_upwards [nat_sqrt_tendsto_atTop.eventually (eventually_fullFiniteTail_le ha hCmu hCdelta), nat_sqrt_tendsto_atTop.eventually_ge_atTop 2, eventually_ge_atTop (2 : ℕ)] with p hp hk hp2 intro G _ _ hcard family hfamily exact (actual_counted_tail_le_fullFiniteTail a Cmu Cdelta p (Nat.sqrt p) hp2 hcard family hfamily).trans (hp p (Nat.sqrt_le' p) (le_sqrt_fourth_power hk)) /-- The actual descriptor cardinality times the actual finite tail tends to zero for every prime-indexed family of finite ambient types and subfamilies. -/ theorem actual_counted_tail_primes_tendsto_zero {a Cmu Cdelta : ℝ} (ha : 0 < a) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) (G : {p : ℕ // p.Prime} → Type u) [∀ p, DecidableEq (G p)] [∀ p, Fintype (G p)] (hcard : ∀ p, Fintype.card (G p) = p.val) (family : ∀ p, Finset (Finset (G p) × Finset (G p) × Finset (G p) × Finset (G p))) (hfamily : ∀ p, family p ⊆ DescriptorCounting.protectedDescriptorFamily Finset.univ (H (Nat.sqrt p.val)) (sourceCap (Nat.sqrt p.val))) : Tendsto (fun p : {p : ℕ // p.Prime} => ((family p).card : ℝ) * finiteTail a Cmu Cdelta p.val (Nat.sqrt p.val)) atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (fullFiniteTail_primes_tendsto_zero ha hCmu hCdelta) · exact Eventually.of_forall fun p => mul_nonneg (Nat.cast_nonneg _) (finiteTail_nonneg _ _ _ _ _) · exact Eventually.of_forall fun p => actual_counted_tail_le_fullFiniteTail a Cmu Cdelta p.val (Nat.sqrt p.val) p.property.two_le (hcard p) (family p) (hfamily p) end end Green39Submission.SparseCleanupAsymptotics end Green39AssemblyScope_b8c1b03a4b1fc542 /- Source: Green39Submission.SparseObstruction; SHA256 6420b239ea1b9531b1c2576ca0dad9f32105088187dbe0d107814d5e6c9030b6 -/ section Green39AssemblyScope_49a239b870e9c2f4 /-! The literal sparse-hole event used by the native probability bridge, together with its finite source-certificate transfer. Source-certificate existence and the final asymptotic rate remain explicit until proved by the extraction and numerical modules. -/ namespace Green39Submission namespace SparseObstruction open scoped BigOperators Pointwise open Filter Topology open DescriptorPrior DescriptorCounting DescriptorAsymptotics open CanonicalMask SourceCanonicalMask CanonicalInputTail CodegreeMultiplicity universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The exact bad event has an adaptive parent and an adaptive bounded mask, with strict failure of the literal linear hole bound. -/ theorem not_sparseHoleObstruction_iff (A : Finset G) (c : ℕ) (M : ℝ) (e : ℕ) (γ : ℝ) : ¬ Integration.SparseHoleObstruction A c M e γ ↔ ∃ T : Finset G, T.card ≤ c ∧ ∃ X : Finset G, X.card ≤ e ∧ (∀ x : G, x ∉ X → (representationCount A T x : ℝ) ≤ M) ∧ ((holeSet A T).card : ℝ) < γ * (Fintype.card G : ℝ) := by classical simp only [Integration.SparseHoleObstruction, not_forall, _root_.not_imp, not_le, exists_prop] /-- Finite sparse-event transfer. The displayed source-certificate existence is the remaining extraction obligation; no sparse theorem is assumed. -/ theorem failure_probability_le_of_source_certificates (a : ℕ → ℝ) (ε C M γ : ℝ) (k L s e b r J : ℕ) (θ bound meanFloor meanBound overlapBound t errPos errNeg upper : ℝ) (hbound : ProtectedScores.inverseNewtonBound a L θ ≤ bound) (hscalar : ∀ c n : ℕ, ProtectedScores.shiftedInterpolation a L θ c n ≤ ProtectedScores.clippedInverseNewton a L θ (c + n)) (hbudget : L * r ≤ b) (hD : 0 < overlapBound) (ht : 0 < t) (herrNeg : 0 < errNeg) (hgap : upper < meanFloor - (errPos + errNeg)) (hparameters : ∀ d ∈ candidateDescriptors (G := G) ε C k s, Eligible (boundedMasks Finset.univ e) (passingMask a k L θ bound meanFloor meanBound overlapBound) d → 0 < k - d.2.2.1.card ∧ b ≤ k - d.2.2.1.card ∧ ((L : ℝ) * (b : ℝ) / ((k - d.2.2.1.card : ℕ) : ℝ)) * meanBound + ((positiveBlocks L).card : ℝ) * t ≤ errPos) (hSource : ∀ A : Finset G, A.card = k → CommonInputGate A J (Parameters.H k) → ∀ T : Finset G, T.card ≤ 100 * k → ∀ X : Finset G, X.card ≤ e → (∀ x : G, x ∉ X → (representationCount A T x : ℝ) ≤ M) → ((holeSet A T).card : ℝ) < γ * (Fintype.card G : ℝ) → ∃ D E₀ S : Finset G, SourceCertificate a ε C k L s b θ bound meanFloor meanBound overlapBound upper A X D E₀ S) : uniformProb (exactSlice Finset.univ k) (fun A : Finset G => ¬ Integration.SparseHoleObstruction A (100 * k) M e γ) ≤ uniformProb (exactSlice Finset.univ k) (fun A : Finset G => ¬ CommonInputGate A J (Parameters.H k)) + ((protectedDescriptorFamily (Finset.univ : Finset G) (Parameters.H k) s).card : ℝ) * (uniformPositiveFailureBound (Fintype.card G) k L b overlapBound t + Real.exp (-(r : ℝ) * errNeg / (meanBound + errNeg))) := by have hfinite := original_input_probability_le_card_mul a k L e b r θ bound meanFloor meanBound overlapBound t errPos errNeg upper (candidateDescriptors (G := G) ε C k s) (fun A => CommonInputGate A J (Parameters.H k)) (fun A => ¬ Integration.SparseHoleObstruction A (100 * k) M e γ) hbound hscalar hbudget hD ht herrNeg hgap hparameters have hextract : ∀ A ∈ exactSlice Finset.univ k, CommonInputGate A J (Parameters.H k) → (¬ Integration.SparseHoleObstruction A (100 * k) M e γ) → ∃ d ∈ candidateDescriptors (G := G) ε C k s, ∃ X : Finset G, sourceConsistent k d A ∧ X.card ≤ e ∧ passingMask a k L θ bound meanFloor meanBound overlapBound d X ∧ ∀ E ⊆ A \ d.2.2.1, E.card ≤ b → ProtectedScores.fullScore a L θ ((A \ d.2.1) \ E) d.2.2.2 ≤ upper := by intro A hA hgate hbad have hcard : A.card = k := (mem_exactSlice.mp hA).2 obtain ⟨T, hT, X, hX, hprofile, hholes⟩ := (not_sparseHoleObstruction_iff A (100 * k) M e γ).mp hbad obtain ⟨D, E₀, S, hsource⟩ := hSource A hcard hgate T hT X hX hprofile hholes exact ⟨(D, E₀, protectedInputs A E₀ S D, S), hsource.mem_candidates, X, sourceConsistent_protectedInputs k A E₀ S D hcard hsource.exceptions_subset, hX, hsource.passing hcard, hsource.score_upper⟩ refine (hfinite hextract).trans (add_le_add le_rfl ?_) apply mul_le_mul_of_nonneg_right _ (add_nonneg (uniformPositiveFailureBound_nonneg _ _ _ _ _ _) (Real.exp_nonneg _)) exact_mod_cast candidateDescriptors_card_le (G := G) ε C k s theorem prime_common_gate_failure_eq (p : PrimeIndex) : uniformProb (exactSlice (Finset.univ : Finset (ZMod (p : ℕ))) (Nat.sqrt (p : ℕ))) (fun A => ¬ CommonInputGate A (Parameters.J (p : ℕ)) (Parameters.H (Nat.sqrt (p : ℕ)))) = CodegreeMultiplicityTail.primeCommonInputFailure p := rfl section PrimeLimit open Parameters Green39Submission.Asymptotics SparseCleanupAsymptotics /-- The actual sparse-event limit, with every analytic and probability-tail premise discharged. The remaining premise is exactly eventual existence of the fielded finite source certificates; it is not a sparse-event or limit assumption. -/ theorem sparseFailureProbability_tendsto_zero_of_eventual_source_certificates (a : ℕ → ℝ) (haL : a L < 0) (M : PrimeIndex → ℝ) (N : PrimeIndex → ℕ) (γ base Cmu Cdelta : ℝ) (hbase : 0 < base) (hCmu : 0 ≤ Cmu) (hCdelta : 0 < Cdelta) (hSource : ∀ᶠ p : PrimeIndex in atTop, ∀ A : Finset (ZMod (p : ℕ)), A.card = Nat.sqrt (p : ℕ) → CommonInputGate A (J (p : ℕ)) (H (Nat.sqrt (p : ℕ))) → ∀ T : Finset (ZMod (p : ℕ)), T.card ≤ 100 * Nat.sqrt (p : ℕ) → ∀ X : Finset (ZMod (p : ℕ)), X.card ≤ N p → (∀ x : ZMod (p : ℕ), x ∉ X → (representationCount A T x : ℝ) ≤ M p) → ((holeSet A T).card : ℝ) < γ * ((p : ℕ) : ℝ) → ∃ D E₀ S : Finset (ZMod (p : ℕ)), SourceCertificate a epsilon0 200 (Nat.sqrt (p : ℕ)) L (sourceCap (Nat.sqrt (p : ℕ))) (sparseBudget (Nat.sqrt (p : ℕ))) (theta0 (Nat.sqrt (p : ℕ))) (ProtectedScores.inverseNewtonBound a L (theta0 (Nat.sqrt (p : ℕ)))) (base * ((p : ℕ) : ℝ) / 4) (cleanupMean Cmu (p : ℕ) (Nat.sqrt (p : ℕ))) (cleanupOverlap Cdelta (Nat.sqrt (p : ℕ))) (base * ((p : ℕ) : ℝ) / 16) A X D E₀ S) : Tendsto (Integration.sparseFailureProbability M N γ) atTop (𝓝 (0 : ℝ)) := by obtain ⟨δ, hδ, hminor⟩ := ProtectedScores.exists_shiftedInterpolation_minorant_radius a L haL have hsmall : ∀ᶠ p : PrimeIndex in atTop, theta0 (Nat.sqrt (p : ℕ)) < δ := (tendsto_order.1 (theta0_tendsto_zero.comp prime_sqrt_tendsto_atTop)).2 δ hδ have huniform := prime_val_tendsto_atTop.eventually (eventually_uniform_prior_cleanup_parameters.{0} hbase hCmu hCdelta) have hnumeric := prime_sqrt_tendsto_atTop.eventually (eventually_cleanup_parameters hbase hCmu hCdelta) have hfinite : ∀ᶠ p : PrimeIndex in atTop, Integration.sparseFailureProbability M N γ p ≤ CodegreeMultiplicityTail.primeCommonInputFailure p + fullFiniteTail base Cmu Cdelta (p : ℕ) (Nat.sqrt (p : ℕ)) := by filter_upwards [hSource, hsmall, huniform, hnumeric, prime_sqrt_tendsto_atTop.eventually_ge_atTop 1] with p hsource hθsmall hp hnum hk have hk0 : (0 : ℝ) < Nat.sqrt (p : ℕ) := by exact_mod_cast (lt_of_lt_of_le Nat.zero_lt_one hk) have hθ : 0 < theta0 (Nat.sqrt (p : ℕ)) := Real.rpow_pos_of_pos hk0 _ have hnum' := hnum (Nat.sqrt (p : ℕ)) (p : ℕ) p.property.pos (show ((Nat.sqrt (p : ℕ) : ℕ) : ℝ) / 2 ≤ (Nat.sqrt (p : ℕ) : ℝ) by linarith) have hparameters : ∀ d ∈ candidateDescriptors (G := ZMod (p : ℕ)) epsilon0 200 (Nat.sqrt (p : ℕ)) (sourceCap (Nat.sqrt (p : ℕ))), Eligible (boundedMasks Finset.univ (N p)) (passingMask a (Nat.sqrt (p : ℕ)) L (theta0 (Nat.sqrt (p : ℕ))) (ProtectedScores.inverseNewtonBound a L (theta0 (Nat.sqrt (p : ℕ)))) (base * ((p : ℕ) : ℝ) / 4) (cleanupMean Cmu (p : ℕ) (Nat.sqrt (p : ℕ))) (cleanupOverlap Cdelta (Nat.sqrt (p : ℕ)))) d → 0 < Nat.sqrt (p : ℕ) - d.2.2.1.card ∧ sparseBudget (Nat.sqrt (p : ℕ)) ≤ Nat.sqrt (p : ℕ) - d.2.2.1.card ∧ ((L : ℝ) * (sparseBudget (Nat.sqrt (p : ℕ)) : ℝ) / ((Nat.sqrt (p : ℕ) - d.2.2.1.card : ℕ) : ℝ)) * cleanupMean Cmu (p : ℕ) (Nat.sqrt (p : ℕ)) + ((positiveBlocks L).card : ℝ) * blockError base (p : ℕ) ≤ cleanupError base (p : ℕ) := by intro d hd _ have hsize := ((mem_candidateDescriptors epsilon0 200 (Nat.sqrt (p : ℕ)) (sourceCap (Nat.sqrt (p : ℕ))) d).mp hd).2.1 have h := hp (ZMod (p : ℕ)) d (ZMod.card (p : ℕ)) hsize exact ⟨h.2.1, h.2.2.1, h.2.2.2.2.2.2⟩ have htransfer := failure_probability_le_of_source_certificates (G := ZMod (p : ℕ)) a epsilon0 200 (M p) γ (Nat.sqrt (p : ℕ)) L (sourceCap (Nat.sqrt (p : ℕ))) (N p) (sparseBudget (Nat.sqrt (p : ℕ))) (sparseCleanupOrder (Nat.sqrt (p : ℕ))) (J (p : ℕ)) (theta0 (Nat.sqrt (p : ℕ))) (ProtectedScores.inverseNewtonBound a L (theta0 (Nat.sqrt (p : ℕ)))) (base * ((p : ℕ) : ℝ) / 4) (cleanupMean Cmu (p : ℕ) (Nat.sqrt (p : ℕ))) (cleanupOverlap Cdelta (Nat.sqrt (p : ℕ))) (blockError base (p : ℕ)) (cleanupError base (p : ℕ)) (cleanupError base (p : ℕ)) (base * ((p : ℕ) : ℝ) / 16) le_rfl (hminor _ hθ hθsmall.le) (cleanup_order_budget _) hnum'.2.2.1 hnum'.2.2.2.1 hnum'.2.2.2.2.1 (score_gap hbase p.property.pos) hparameters (by intro A hA hgate T hT X hX hprofile hholes exact hsource A hA hgate T hT X hX hprofile (by simpa only [ZMod.card] using hholes)) have htransfer' : Integration.sparseFailureProbability M N γ p ≤ CodegreeMultiplicityTail.primeCommonInputFailure p + ((protectedDescriptorFamily (Finset.univ : Finset (ZMod (p : ℕ))) (H (Nat.sqrt (p : ℕ))) (sourceCap (Nat.sqrt (p : ℕ)))).card : ℝ) * finiteTail base Cmu Cdelta (p : ℕ) (Nat.sqrt (p : ℕ)) := by simpa only [Integration.sparseFailureProbability, prime_common_gate_failure_eq, finiteTail, ZMod.card] using htransfer exact htransfer'.trans (add_le_add le_rfl (actual_counted_tail_le_fullFiniteTail base Cmu Cdelta (p : ℕ) (Nat.sqrt (p : ℕ)) p.property.two_le (ZMod.card (p : ℕ)) _ Finset.Subset.rfl)) apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (show Tendsto (fun p : PrimeIndex => CodegreeMultiplicityTail.primeCommonInputFailure p + fullFiniteTail base Cmu Cdelta (p : ℕ) (Nat.sqrt (p : ℕ))) atTop (𝓝 0) from by simpa only [zero_add] using CodegreeMultiplicityTail.primeCommonInputFailure_tendsto_zero.add (fullFiniteTail_primes_tendsto_zero hbase hCmu hCdelta)) · exact Eventually.of_forall (fun p => uniformProb_nonneg _ _) · exact hfinite end PrimeLimit end SparseObstruction end Green39Submission end Green39AssemblyScope_49a239b870e9c2f4 /- Source: Green39Submission.ForcedParity; SHA256 2840f3550f35a68e692810bb27a14d6733d1a69b2a76b7225e96cffd4b4b7e87 -/ section Green39AssemblyScope_5ff5df9c58193b17 /-! Deterministic forced-source pairing and exceptional-target geometry. All sets used in the parity statement are computed from the four-set descriptor. The actual protected-input construction supplies the only extra containment needed to ensure every forced representation has a selected ordinary mate. -/ namespace Green39Submission.ForcedParity open scoped BigOperators Pointwise Classical open DescriptorPrior section FinitePairing variable {α : Type*} [DecidableEq α] /-- A finite set preserved by an involution with no fixed points has even cardinality. The proof removes a complete pair at each induction step. -/ theorem even_card_of_fixedPointFree_involution (F : Finset α) (f : α → α) (hmem : ∀ a ∈ F, f a ∈ F) (hinv : ∀ a ∈ F, f (f a) = a) (hfree : ∀ a ∈ F, f a ≠ a) : Even F.card := by revert hmem hinv hfree refine Finset.strongInductionOn F ?_ intro F ih hmem hinv hfree rcases F.eq_empty_or_nonempty with rfl | hF · exact ⟨0, rfl⟩ · obtain ⟨a, ha⟩ := hF let b := f a have hb : b ∈ F := hmem a ha have hba : b ≠ a := hfree a ha let R := (F.erase a).erase b have hRsub : R ⊂ F := lt_of_le_of_lt (Finset.erase_subset _ _) (Finset.erase_ssubset ha) have hinj (r : α) (hr : r ∈ F) (s : α) (hs : s ∈ F) (hrs : f r = f s) : r = s := by calc r = f (f r) := (hinv r hr).symm _ = f (f s) := congrArg f hrs _ = s := hinv s hs have hRmem (r : α) (hr : r ∈ R) : f r ∈ R := by obtain ⟨hrb, hraF⟩ := Finset.mem_erase.mp hr obtain ⟨hra, hrF⟩ := Finset.mem_erase.mp hraF have hfrb : f r ≠ b := fun h => hra (hinj r hrF a ha h) have hfra : f r ≠ a := by intro h apply hrb apply hinj r hrF b hb exact h.trans (hinv a ha).symm exact Finset.mem_erase.mpr ⟨hfrb, Finset.mem_erase.mpr ⟨hfra, hmem r hrF⟩⟩ have hRtoF : R ⊆ F := (Finset.erase_subset _ _).trans (Finset.erase_subset _ _) have hEvenR := ih R hRsub hRmem (fun r hr => hinv r (hRtoF hr)) (fun r hr => hfree r (hRtoF hr)) have hcard : R.card + 2 = F.card := by have h₁ := Finset.card_erase_add_one ha have h₂ := Finset.card_erase_add_one (Finset.mem_erase.mpr ⟨hba, hb⟩ : b ∈ F.erase a) change ((F.erase a).erase b).card + 2 = F.card omega rw [← hcard] exact hEvenR.add (show Even (2 : ℕ) from ⟨1, rfl⟩) end FinitePairing universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] theorem alias_eq_mate_difference (x t q : G) : t + q - x = q - (x - t) := by abel /-- Every ordinary mate of a forced source is forced outside EX3. -/ theorem mate_forced_of_not_external (d : Finset G × Finset G × Finset G × Finset G) {x t q : G} (hx : x ∉ SourceCanonicalMask.externalTargets d) (ht : t ∈ SourceCanonicalMask.forcedSources d x) (hq : q ∈ d.2.2.2) (hD : t + q - x ∈ d.1) : q ∈ SourceCanonicalMask.forcedSources d x := by apply (SourceCanonicalMask.mem_forcedSources d x q).mpr refine ⟨hq, ?_⟩ by_contra hnot apply hx apply Finset.mem_filter.mpr refine ⟨Finset.mem_univ _, t, ht, q, hq, ?_, hnot⟩ rwa [← alias_eq_mate_difference] /-- The descriptor containment supplies an actual selected mate, rather than presuming that every forced source has a neighbor. -/ theorem exists_forced_mate (d : Finset G × Finset G × Finset G × Finset G) (hF : sourceForcedSet d ⊆ sourceForbidden d) {x t : G} (hx : x ∉ SourceCanonicalMask.externalTargets d) (ht : t ∈ SourceCanonicalMask.forcedSources d x) : ∃ q ∈ SourceCanonicalMask.forcedSources d x, t + q - x ∈ d.1 := by have hxt := hF ((SourceCanonicalMask.mem_forcedSources d x t).mp ht).2 obtain ⟨q, hq, e, he, heq⟩ := Finset.mem_sub.mp hxt have hcenter : q - (x - t) ∈ d.1 := by have hidentity : q - (x - t) = e := by rw [← heq]; abel rwa [hidentity] have halias : t + q - x ∈ d.1 := by rwa [alias_eq_mate_difference] exact ⟨q, mate_forced_of_not_external d hx ht hq halias, halias⟩ theorem no_forced_loop (d : Finset G × Finset G × Finset G × Finset G) {x t : G} (hx : x ∉ SourceCanonicalMask.badTargets d) (ht : t ∈ SourceCanonicalMask.forcedSources d x) : t + t - x ∉ d.1 := by intro hloop apply hx exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, hloop⟩) /-- Outside descriptor loops and wedges, the forced ordinary mate is unique. -/ theorem forced_mate_unique (d : Finset G × Finset G × Finset G × Finset G) {x t q r : G} (hx : x ∉ SourceCanonicalMask.badTargets d) (ht : t ∈ SourceCanonicalMask.forcedSources d x) (hq : q ∈ SourceCanonicalMask.forcedSources d x) (hr : r ∈ SourceCanonicalMask.forcedSources d x) (htq : t + q - x ∈ d.1) (htr : t + r - x ∈ d.1) : q = r := by by_contra hqr have htne_q : t ≠ q := by intro h apply no_forced_loop d hx ht simpa only [← h] using htq have htne_r : t ≠ r := by intro h apply no_forced_loop d hx ht simpa only [← h] using htr apply hx exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, ht, q, hq, r, hr, htne_q, htne_r, hqr, htq, htr⟩) theorem existsUnique_forced_mate (d : Finset G × Finset G × Finset G × Finset G) (hF : sourceForcedSet d ⊆ sourceForbidden d) {x t : G} (hx : x ∉ SourceCanonicalMask.badTargets d ∪ SourceCanonicalMask.externalTargets d) (ht : t ∈ SourceCanonicalMask.forcedSources d x) : ∃! q, q ∈ SourceCanonicalMask.forcedSources d x ∧ t + q - x ∈ d.1 := by have hbad : x ∉ SourceCanonicalMask.badTargets d := fun h => hx (Finset.mem_union_left _ h) have hext : x ∉ SourceCanonicalMask.externalTargets d := fun h => hx (Finset.mem_union_right _ h) obtain ⟨q, hq, hD⟩ := exists_forced_mate d hF hext ht refine ⟨q, ⟨hq, hD⟩, ?_⟩ intro r hr exact forced_mate_unique d hbad ht hr.1 hq hr.2 hD /-- The selected forced sources form reciprocal pairs. Neither a matching property nor an even-count hypothesis is assumed. -/ theorem forced_source_pairing (d : Finset G × Finset G × Finset G × Finset G) (hF : sourceForcedSet d ⊆ sourceForbidden d) (x : G) (hx : x ∉ SourceCanonicalMask.badTargets d ∪ SourceCanonicalMask.externalTargets d) : ∃ mate : SourceCanonicalMask.forcedSources d x → SourceCanonicalMask.forcedSources d x, Function.Involutive mate ∧ ∀ t, mate t ≠ t := by classical have hex (t : SourceCanonicalMask.forcedSources d x) : ∃! q : SourceCanonicalMask.forcedSources d x, (t : G) + (q : G) - x ∈ d.1 := by obtain ⟨q, hq, hu⟩ := existsUnique_forced_mate d hF hx t.property refine ⟨⟨q, hq.1⟩, hq.2, ?_⟩ intro r hr apply Subtype.ext exact hu r.val ⟨r.property, hr⟩ let mate : SourceCanonicalMask.forcedSources d x → SourceCanonicalMask.forcedSources d x := fun t => Classical.choose (hex t).exists have hmate (t : SourceCanonicalMask.forcedSources d x) : (t : G) + (mate t : G) - x ∈ d.1 := Classical.choose_spec (hex t).exists refine ⟨mate, ?_, ?_⟩ · intro t exact (hex (mate t)).unique (hmate (mate t)) (by simpa only [add_comm] using hmate t) · intro t hfix have h := hmate t rw [hfix] at h exact no_forced_loop d (fun hbad => hx (Finset.mem_union_left _ hbad)) t.property h /-- Descriptor-only forced parity, including zero forced count. -/ theorem even_sourceForcedCount (d : Finset G × Finset G × Finset G × Finset G) (hF : sourceForcedSet d ⊆ sourceForbidden d) (x : G) (hx : x ∉ SourceCanonicalMask.badTargets d ∪ SourceCanonicalMask.externalTargets d) : Even (sourceForcedCount d x) := by obtain ⟨mate, hinv, hfree⟩ := forced_source_pairing d hF x hx have heven := even_card_of_fixedPointFree_involution (Finset.univ : Finset (SourceCanonicalMask.forcedSources d x)) mate (fun _ _ => Finset.mem_univ _) (fun t _ => hinv t) (fun t _ => hfree t) rw [← SourceCanonicalMask.card_forcedSources d x] simpa only [Finset.card_univ, Fintype.card_coe] using heven theorem forced_subset_forbidden_protectedInputs (A E0 S D : Finset G) : sourceForcedSet (D, E0, protectedInputs A E0 S D, S) ⊆ sourceForbidden (D, E0, protectedInputs A E0 S D, S) := by change sourceForcedSet (D, E0, protectedInputs A E0 S D, S) ⊆ S - D rw [sourceForcedSet_protectedInputs] exact Finset.inter_subset_right /-- Actual protected descriptors satisfy the parity theorem without any additional sampling or input-law premise. -/ theorem even_sourceForcedCount_protectedInputs (A E0 S D : Finset G) (x : G) (hx : x ∉ SourceCanonicalMask.badTargets (D, E0, protectedInputs A E0 S D, S) ∪ SourceCanonicalMask.externalTargets (D, E0, protectedInputs A E0 S D, S)) : Even (sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x) := even_sourceForcedCount _ (forced_subset_forbidden_protectedInputs A E0 S D) x hx /-- Descriptor bad targets are covered by the whole-parent alias geometry. -/ theorem badTargets_subset_parent (d : Finset G × Finset G × Finset G × Finset G) {A T : Finset G} (hFA : sourceForcedSet d ⊆ A) (hST : d.2.2.2 ⊆ T) : SourceCanonicalMask.badTargets d ⊆ RichStarGeometry.loopTargets A T d.1 ∪ RichStarGeometry.wedgeTargets A T d.1 := by intro x hx rcases Finset.mem_union.mp hx with hloop | hwedge · obtain ⟨t, ht, hD⟩ := (Finset.mem_filter.mp hloop).2 obtain ⟨htS, hxt⟩ := (SourceCanonicalMask.mem_forcedSources d x t).mp ht exact Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, t, hST htS, hFA hxt, hD⟩) · obtain ⟨t, ht, q, hq, r, hr, _htq, _htr, hqr, hDq, hDr⟩ := (Finset.mem_filter.mp hwedge).2 obtain ⟨htS, hxt⟩ := (SourceCanonicalMask.mem_forcedSources d x t).mp ht obtain ⟨hqS, hxq⟩ := (SourceCanonicalMask.mem_forcedSources d x q).mp hq obtain ⟨hrS, hxr⟩ := (SourceCanonicalMask.mem_forcedSources d x r).mp hr apply Finset.mem_union_right apply Finset.mem_filter.mpr refine ⟨Finset.mem_univ _, t, hST htS, hFA hxt, q, hST hqS, hFA hxq, r, hST hrS, hFA hxr, hqr, ?_, ?_⟩ · simpa only [RichStarGeometry.InternalAlias, add_comm] using hDq · simpa only [RichStarGeometry.InternalAlias, add_comm] using hDr theorem badTargets_protectedInputs_subset_parent (A E0 S T D : Finset G) (hST : S ⊆ T) : SourceCanonicalMask.badTargets (D, E0, protectedInputs A E0 S D, S) ⊆ RichStarGeometry.loopTargets (A \ E0) T D ∪ RichStarGeometry.wedgeTargets (A \ E0) T D := by apply badTargets_subset_parent _ ?_ hST rw [sourceForcedSet_protectedInputs] exact Finset.inter_subset_left /-- The actual codegree/multiplicity budget for the descriptor-computable bad set; the original parent is used only for a proved superset bound. -/ theorem card_badTargets_le (d : Finset G × Finset G × Finset G × Finset G) {A T : Finset G} {K J : ℕ} (hFA : sourceForcedSet d ⊆ A) (hST : d.2.2.2 ⊆ T) (hK : ∀ t ∈ T, representationCount A d.1 t ≤ K) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) : (SourceCanonicalMask.badTargets d).card ≤ (T.card * K) * (1 + d.1.card * J) := by apply (Finset.card_le_card (badTargets_subset_parent d hFA hST)).trans apply RichStarGeometry.card_badAliasTargets_le hK intro e₁ _he₁ e₂ _he₂ hne exact CodegreeMultiplicity.filtered_common_target_card_le_codegree hJ T hne theorem card_badTargets_protectedInputs_le (A E0 S T D : Finset G) {K J : ℕ} (hST : S ⊆ T) (hK : ∀ t ∈ T, representationCount (A \ E0) D t ≤ K) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) : (SourceCanonicalMask.badTargets (D, E0, protectedInputs A E0 S D, S)).card ≤ (T.card * K) * (1 + D.card * J) := by apply card_badTargets_le _ (A := A \ E0) (T := T) ?_ hST hK (CodegreeMultiplicity.nonzeroCodegreeBound_mono_input Finset.sdiff_subset hJ) rw [sourceForcedSet_protectedInputs] exact Finset.inter_subset_left theorem sourceForcedCount_ne_zero_iff_mem_sumset (d : Finset G × Finset G × Finset G × Finset G) (x : G) : sourceForcedCount d x ≠ 0 ↔ x ∈ sourceForcedSet d + d.2.2.2 := by constructor · intro h have hpos : 0 < (SourceCanonicalMask.forcedSources d x).card := Nat.pos_of_ne_zero h obtain ⟨t, ht⟩ := Finset.card_pos.mp hpos obtain ⟨htS, hxt⟩ := (SourceCanonicalMask.mem_forcedSources d x t).mp ht exact Finset.mem_add.mpr ⟨x - t, hxt, t, htS, sub_add_cancel _ _⟩ · intro h obtain ⟨a, ha, t, ht, hat⟩ := Finset.mem_add.mp h apply Nat.ne_of_gt apply Finset.card_pos.mpr refine ⟨t, Finset.mem_filter.mpr ⟨ht, ?_⟩⟩ rw [← hat, add_sub_cancel_right] exact ha /-- The set of targets with positive forced count is exactly the forced input/source sumset, so its size has the elementary incidence upper bound. -/ theorem forced_targets_eq_sumset (d : Finset G × Finset G × Finset G × Finset G) : Finset.univ.filter (fun x => sourceForcedCount d x ≠ 0) = sourceForcedSet d + d.2.2.2 := by ext x simp only [Finset.mem_filter, Finset.mem_univ, true_and, sourceForcedCount_ne_zero_iff_mem_sumset] theorem card_forced_targets_le (d : Finset G × Finset G × Finset G × Finset G) : (Finset.univ.filter (fun x => sourceForcedCount d x ≠ 0)).card ≤ (sourceForcedSet d).card * d.2.2.2.card := by rw [forced_targets_eq_sumset] exact Finset.card_add_le theorem card_positive_forced_targets_le (d : Finset G × Finset G × Finset G × Finset G) : (Finset.univ.filter (fun x => 0 < sourceForcedCount d x)).card ≤ (d.2.2.1 \ d.2.1).card * d.2.2.2.card := by simpa only [Nat.pos_iff_ne_zero, sourceForcedSet] using card_forced_targets_le d end Green39Submission.ForcedParity end Green39AssemblyScope_5ff5df9c58193b17 /- Source: Green39Submission.ConditionalMean; SHA256 bf25c5ad008b925647759249e24c457facb59c53c4feed464867d1fafd519b88 -/ section Green39AssemblyScope_9abfef194b26cffd /-! The actual descriptor-prior mean in EX12, OP14 and SE12. All expectations below use the exact necessary-constraint prior. External losses include rank-zero terms. The source and geometry budgets remain explicit; no assertion about an adaptively selected descriptor's posterior is used. The fixed-polynomial application obtains its row bounds from CAL2. -/ noncomputable section namespace Green39Submission namespace ConditionalMean open scoped BigOperators open DescriptorPrior SourceCanonicalMask ProtectedScores HypergeometricCalibration universe u /-- Absolute sum of the exact conditional means of all interpolation terms, including the constant. -/ def absolutePriorMean (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (c v n q : ℕ) : ℝ := if c ≤ L then ∑ j ∈ Finset.range (L - c + 1), |ProtectedScores.shiftedCoeff a θ c j| * (q.choose j : ℝ) * DisjointSupport.fallingRatio v n j else 0 /-- A fixed EX12 constant; factorial improvements are unnecessary here. -/ def absoluteRowConstant (L : ℕ) (K : ℝ) : ℝ := ((L + 1 : ℕ) : ℝ) * (2 : ℝ) ^ L * K ^ L theorem absoluteRowConstant_nonneg (L : ℕ) {K : ℝ} (hK : 0 ≤ K) : 0 ≤ absoluteRowConstant L K := by unfold absoluteRowConstant positivity /-- EX12 from the actual coefficient estimate and exact hypergeometric moments. No row-mean estimate is assumed. -/ theorem absolutePriorMean_le (a : ℕ → ℝ) (L c v n q : ℕ) {θ K : ℝ} (ha : ∀ j : ℕ, |a j| ≤ 1) (hnv : n ≤ v) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 1 ≤ K) (htK : scaledParameter v n q θ ≤ K) : absolutePriorMean a L θ c v n q ≤ absoluteRowConstant L K * (if c ≤ L then (θ⁻¹) ^ c else 0) := by by_cases hc : c ≤ L · rw [absolutePriorMean, if_pos hc, if_pos hc] have hterm (j : ℕ) (hj : j ∈ Finset.range (L - c + 1)) : |ProtectedScores.shiftedCoeff a θ c j| * (q.choose j : ℝ) * DisjointSupport.fallingRatio v n j ≤ (2 : ℝ) ^ L * (θ⁻¹) ^ c * K ^ L := by have hcj : c + j ≤ L := by have := Finset.mem_range.mp hj; omega have hcoeff : |ProtectedScores.shiftedCoeff a θ c j| ≤ (2 : ℝ) ^ L * (θ⁻¹) ^ (c + j) := by simpa only [one_mul] using abs_shiftedCoeff_le_fixed_amplitude a L hθ hθ1 (by norm_num : (0 : ℝ) ≤ 1) (fun m _ => ha m) c j hcj calc |ProtectedScores.shiftedCoeff a θ c j| * (q.choose j : ℝ) * DisjointSupport.fallingRatio v n j ≤ ((2 : ℝ) ^ L * (θ⁻¹) ^ (c + j)) * (q.choose j : ℝ) * DisjointSupport.fallingRatio v n j := mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right hcoeff (Nat.cast_nonneg _)) (DisjointSupport.fallingRatio_nonneg _ _ _) _ = ((2 : ℝ) ^ L * (θ⁻¹) ^ c) * scaledBinomialMoment v n q θ j := by rw [scaledBinomialMoment, pow_add] ring _ ≤ _ := mul_le_mul_of_nonneg_left (scaledBinomialMoment_le_uniform v n q L j hnv hθ.le hK htK (by omega)) (by positivity) calc (∑ j ∈ Finset.range (L - c + 1), |ProtectedScores.shiftedCoeff a θ c j| * (q.choose j : ℝ) * DisjointSupport.fallingRatio v n j) ≤ ∑ _j ∈ Finset.range (L - c + 1), (2 : ℝ) ^ L * (θ⁻¹) ^ c * K ^ L := Finset.sum_le_sum hterm _ = ((L - c + 1 : ℕ) : ℝ) * ((2 : ℝ) ^ L * (θ⁻¹) ^ c * K ^ L) := by simp [nsmul_eq_mul] _ ≤ ((L + 1 : ℕ) : ℝ) * ((2 : ℝ) ^ L * (θ⁻¹) ^ c * K ^ L) := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr (by omega)) (by positivity) _ = absoluteRowConstant L K * (θ⁻¹) ^ c := by unfold absoluteRowConstant ring · simp [absolutePriorMean, hc] section Descriptor variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The scalar weight paid by EX12, zero beyond the interpolation degree. -/ def externalFactor (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (θ : ℝ) (x : G) : ℝ := if sourceForcedCount d x ≤ L then (θ⁻¹) ^ (sourceForcedCount d x) else 0 /-- The global external-weight guard used for the ordinary profile route. -/ def externalWeight (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) (θ : ℝ) : ℝ := ∑ x ∈ externalTargets d, externalFactor d L θ x /-- The sparse route charges external terms only outside its candidate mask. -/ def externalWeightOutside (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (L : ℕ) (θ : ℝ) : ℝ := ∑ x ∈ externalTargets d \ Y, externalFactor d L θ x theorem externalFactor_nonneg (d : Finset G × Finset G × Finset G × Finset G) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (x : G) : 0 ≤ externalFactor d L θ x := by unfold externalFactor split_ifs <;> positivity theorem externalWeightOutside_le (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : externalWeightOutside d Y L θ ≤ externalWeight d L θ := by apply Finset.sum_le_sum_of_subset_of_nonneg Finset.sdiff_subset intro x _ _ exact externalFactor_nonneg d L hθ x /-- Unmasked targets having no forced source representation. -/ def zeroTargets (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) : Finset G := by classical exact Finset.univ.filter (fun x => x ∉ Y ∪ badTargets d ∧ sourceForcedCount d x = 0) /-- The actual class that the geometric support-count bound must control. -/ def forcedTargets (d : Finset G × Finset G × Finset G × Finset G) : Finset G := by classical exact Finset.univ.filter (fun x => sourceForcedCount d x ≠ 0) /-- The actual masked row in its binomial-coefficient form. -/ def rowValue (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) (B : Finset G) : ℝ := by classical let c := sourceForcedCount d x exact if x ∈ Y ∪ badTargets d then -bound else if c ≤ L then ∑ j ∈ Finset.range (L - c + 1), (if x ∈ externalTargets d then min (ProtectedScores.shiftedCoeff a θ c j) 0 else ProtectedScores.shiftedCoeff a θ c j) * ((rowInputs d x ∩ B).card.choose j : ℝ) else 0 /-- Absolute interpolation used only to bound the adverse external rows. -/ def absoluteRow (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (x : G) (B : Finset G) : ℝ := if sourceForcedCount d x ≤ L then ∑ j ∈ Finset.range (L - sourceForcedCount d x + 1), |ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) j| * ((rowInputs d x ∩ B).card.choose j : ℝ) else 0 theorem maskedPolynomial_eq_sum_rowValue (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y B : Finset G) : maskedPolynomial a L θ bound d Y B = ∑ x : G, rowValue a L θ bound d Y x B := by classical rw [maskedPolynomial_eq_sum_rows] apply Finset.sum_congr rfl intro x _ by_cases hx : x ∈ Y ∪ badTargets d · simp [rowValue, constantAt, signedWeight, hx] · simpa only [rowValue, constantAt, signedWeight, hx, if_false, Prod.fst, Prod.snd] using (constant_add_sum_nonemptyRankSubsets (rowInputs d x ∩ B) (sourceForcedCount d x) L (fun j => if x ∈ externalTargets d then min (ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) j) 0 else ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) j)) theorem rowValue_mean_masked (a : ℕ → ℝ) (k L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) (hprior : (sourcePrior k d).Nonempty) (hx : x ∈ Y ∪ badTargets d) : uniformMean (sourcePrior k d) (rowValue a L θ bound d Y x) = -bound := by have hf : rowValue a L θ bound d Y x = fun _ => -bound := by funext B simp [rowValue, hx] rw [hf, uniformMean_const _ hprior] /-- The row mean really is CAL2's exact hypergeometric expression. -/ theorem rowValue_mean_ordinary (a : ℕ → ℝ) (k L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) (hx : x ∉ Y ∪ badTargets d) (hext : x ∉ externalTargets d) : uniformMean (sourcePrior k d) (rowValue a L θ bound d Y x) = priorInterpolationMean a L θ (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card := by unfold rowValue simpa only [sourcePrior, hx, hext, if_false, Finset.inter_comm, ProtectedScores.shiftedCoeff] using (uniformMean_explicit_interpolation (sourceFreeUniverse d) (rowInputs d x) (k - d.2.2.1.card) L (sourceForcedCount d x) a θ (rowInputs_subset_free d x) hn) theorem absoluteRow_mean (a : ℕ → ℝ) (k L : ℕ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (x : G) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) : uniformMean (sourcePrior k d) (absoluteRow a L θ d x) = absolutePriorMean a L θ (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card := by unfold absoluteRow by_cases hc : sourceForcedCount d x ≤ L · simpa only [sourcePrior, absolutePriorMean, hc, if_true, Finset.inter_comm] using (uniformMean_factorial_polynomial (sourceFreeUniverse d) (rowInputs d x) (k - d.2.2.1.card) (L - sourceForcedCount d x + 1) (fun j => |ProtectedScores.shiftedCoeff a θ (sourceForcedCount d x) j|) (rowInputs_subset_free d x) hn) · simp [absolutePriorMean, hc, uniformMean_zero] /-- Dropping positive external terms preserves the lower bound by the full absolute row, including its deterministic constant. -/ theorem neg_absoluteRow_le_rowValue (a : ℕ → ℝ) (L : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) (hx : x ∉ Y ∪ badTargets d) (B : Finset G) : -absoluteRow a L θ d x B ≤ rowValue a L θ bound d Y x B := by classical unfold absoluteRow rowValue simp only [hx, if_false] by_cases hc : sourceForcedCount d x ≤ L · simp only [hc, if_true] rw [← Finset.sum_neg_distrib] apply Finset.sum_le_sum intro j _ rw [← neg_mul] apply mul_le_mul_of_nonneg_right _ (Nat.cast_nonneg _) split_ifs · exact le_min (neg_abs_le _) (neg_nonpos.mpr (abs_nonneg _)) · exact neg_abs_le _ · simp [hc] theorem rowValue_mean_ge_external_loss (a : ℕ → ℝ) (k L : ℕ) {θ K : ℝ} (bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (x : G) (ha : ∀ j : ℕ, |a j| ≤ 1) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 1 ≤ K) (htK : scaledParameter (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card θ ≤ K) (hx : x ∉ Y ∪ badTargets d) : -absoluteRowConstant L K * externalFactor d L θ x ≤ uniformMean (sourcePrior k d) (rowValue a L θ bound d Y x) := by have hmono := uniformMean_mono (sourcePrior k d) (fun B => -absoluteRow a L θ d x B) (rowValue a L θ bound d Y x) (fun B _ => neg_absoluteRow_le_rowValue a L θ bound d Y x hx B) have hneg : uniformMean (sourcePrior k d) (fun B => -absoluteRow a L θ d x B) = -uniformMean (sourcePrior k d) (absoluteRow a L θ d x) := by simp only [uniformMean, Finset.sum_neg_distrib, neg_div] rw [hneg, absoluteRow_mean a k L θ d x hn] at hmono have habs := absolutePriorMean_le a L (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card ha hn hθ hθ1 hK htK unfold externalFactor nlinarith /-- Finite indicator sum in the normalization used by the mean budgets. -/ theorem sum_indicator (S : Finset G) (b : ℝ) : (∑ x : G, if x ∈ S then b else 0) = b * (S.card : ℝ) := by classical have hf : (Finset.univ : Finset G).filter (fun x => x ∈ S) = S := by ext x simp rw [← Finset.sum_filter, hf] simp [nsmul_eq_mul, mul_comm] theorem sum_external_indicator (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (L : ℕ) (θ : ℝ) : (∑ x : G, if x ∈ externalTargets d \ Y then externalFactor d L θ x else 0) = externalWeightOutside d Y L θ := by classical have hf : (Finset.univ : Finset G).filter (fun x => x ∈ externalTargets d \ Y) = externalTargets d \ Y := by ext x simp rw [← Finset.sum_filter, hf] rfl /-- Exact bookkeeping for the classes lost from the zero-forced baseline. -/ theorem card_zeroTargets_complement (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) : Fintype.card G ≤ (zeroTargets d Y).card + (Y ∪ badTargets d).card + (forcedTargets d).card := by classical have hcover : (Finset.univ : Finset G) ⊆ (zeroTargets d Y ∪ (Y ∪ badTargets d)) ∪ forcedTargets d := by intro x _ by_cases hm : x ∈ Y ∪ badTargets d · exact Finset.mem_union_left _ (Finset.mem_union_right _ hm) · by_cases hc : sourceForcedCount d x = 0 · exact Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨Finset.mem_univ _, hm, hc⟩)) · exact Finset.mem_union_right _ (by simp [forcedTargets, hc]) calc Fintype.card G = (Finset.univ : Finset G).card := Finset.card_univ.symm _ ≤ ((zeroTargets d Y ∪ (Y ∪ badTargets d)) ∪ forcedTargets d).card := Finset.card_le_card hcover _ ≤ (zeroTargets d Y ∪ (Y ∪ badTargets d)).card + (forcedTargets d).card := Finset.card_union_le _ _ _ ≤ (zeroTargets d Y).card + (Y ∪ badTargets d).card + (forcedTargets d).card := Nat.add_le_add_right (Finset.card_union_le _ _) _ /-- Finite actual-mean assembly. Individual calibrated row bounds are modular inputs here; the fixed-polynomial theorem below supplies them from CAL2. -/ theorem maskedPolynomial_mean_lower (a : ℕ → ℝ) (k L : ℕ) {θ K : ℝ} (bound μ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (ha : ∀ j : ℕ, |a j| ≤ 1) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 1 ≤ K) (htK : ∀ x : G, scaledParameter (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card θ ≤ K) (hOrdinary : ∀ x : G, x ∉ Y ∪ badTargets d → x ∉ externalTargets d → 0 ≤ priorInterpolationMean a L θ (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card) (hZero : ∀ x : G, sourceForcedCount d x = 0 → μ ≤ priorInterpolationMean a L θ (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card) : μ * ((zeroTargets d Y).card : ℝ) - bound * ((Y ∪ badTargets d).card : ℝ) - absoluteRowConstant L K * externalWeightOutside d Y L θ ≤ uniformMean (sourcePrior k d) (maskedPolynomial a L θ bound d Y) := by classical have hprior : (sourcePrior k d).Nonempty := exactSlice_nonempty.mpr hn have hC : 0 ≤ absoluteRowConstant L K := absoluteRowConstant_nonneg L (by linarith) have hrow (x : G) : (if x ∈ zeroTargets d Y then μ else 0) - (if x ∈ Y ∪ badTargets d then bound else 0) - absoluteRowConstant L K * (if x ∈ externalTargets d \ Y then externalFactor d L θ x else 0) ≤ uniformMean (sourcePrior k d) (rowValue a L θ bound d Y x) := by by_cases hm : x ∈ Y ∪ badTargets d · have hz : x ∉ zeroTargets d Y := by intro hx exact (Finset.mem_filter.mp hx).2.1 hm rw [if_neg hz, if_pos hm, rowValue_mean_masked a k L θ bound d Y x hprior hm] have he : 0 ≤ if x ∈ externalTargets d \ Y then externalFactor d L θ x else 0 := by split_ifs · exact externalFactor_nonneg d L hθ.le x · exact le_rfl nlinarith [mul_nonneg hC he] · by_cases hext : x ∈ externalTargets d · have hcpos : 0 < sourceForcedCount d x := external_has_forced_count d x hext have hz : x ∉ zeroTargets d Y := by simp [zeroTargets, Nat.ne_of_gt hcpos] have hxY : x ∉ Y := fun hx => hm (Finset.mem_union_left _ hx) have he : x ∈ externalTargets d \ Y := Finset.mem_sdiff.mpr ⟨hext, hxY⟩ rw [if_neg hz, if_neg hm, if_pos he] simpa only [sub_zero, zero_sub, neg_mul] using rowValue_mean_ge_external_loss a k L bound d Y x ha hn hθ hθ1 hK (htK x) hm · have he : x ∉ externalTargets d \ Y := fun hx => hext (Finset.mem_sdiff.mp hx).1 rw [if_neg hm, if_neg he, mul_zero, sub_zero, sub_zero, rowValue_mean_ordinary a k L θ bound d Y x hn hm hext] by_cases hc : sourceForcedCount d x = 0 · have hz : x ∈ zeroTargets d Y := Finset.mem_filter.mpr ⟨Finset.mem_univ _, hm, hc⟩ rw [if_pos hz] exact hZero x hc · have hz : x ∉ zeroTargets d Y := by simp [zeroTargets, hc] rw [if_neg hz] exact hOrdinary x hm hext have hsum := Finset.sum_le_sum (fun x (_ : x ∈ (Finset.univ : Finset G)) => hrow x) have hleft : (∑ x : G, ((if x ∈ zeroTargets d Y then μ else 0) - (if x ∈ Y ∪ badTargets d then bound else 0) - absoluteRowConstant L K * (if x ∈ externalTargets d \ Y then externalFactor d L θ x else 0))) = μ * ((zeroTargets d Y).card : ℝ) - bound * ((Y ∪ badTargets d).card : ℝ) - absoluteRowConstant L K * externalWeightOutside d Y L θ := by simp only [Finset.sum_sub_distrib, ← Finset.mul_sum] rw [sum_indicator, sum_indicator, sum_external_indicator] have hright : (∑ x : G, uniformMean (sourcePrior k d) (rowValue a L θ bound d Y x)) = uniformMean (sourcePrior k d) (maskedPolynomial a L θ bound d Y) := by rw [← uniformMean_sum] congr 1 funext B exact (maskedPolynomial_eq_sum_rowValue a L θ bound d Y B).symm rw [hleft, hright] at hsum exact hsum /-- The final numerical margin only needs explicit class-size and raw-loss budgets. These budgets are to be discharged by the source and size lemmas. -/ theorem maskedPolynomial_mean_quarter_of_rows (a : ℕ → ℝ) (k L : ℕ) {θ K base : ℝ} (bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G) (ha : ∀ j : ℕ, |a j| ≤ 1) (hbase : 0 ≤ base) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 1 ≤ K) (htK : ∀ x : G, scaledParameter (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card θ ≤ K) (hOrdinary : ∀ x : G, x ∉ Y ∪ badTargets d → x ∉ externalTargets d → 0 ≤ priorInterpolationMean a L θ (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card) (hZero : ∀ x : G, sourceForcedCount d x = 0 → base / 2 ≤ priorInterpolationMean a L θ (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card) (hExcluded : ((Y ∪ badTargets d).card : ℝ) + ((forcedTargets d).card : ℝ) ≤ (Fintype.card G : ℝ) / 4) (hCost : bound * ((Y ∪ badTargets d).card : ℝ) + absoluteRowConstant L K * externalWeightOutside d Y L θ ≤ base * (Fintype.card G : ℝ) / 8) : base * (Fintype.card G : ℝ) / 4 ≤ uniformMean (sourcePrior k d) (maskedPolynomial a L θ bound d Y) := by have hcard : (Fintype.card G : ℝ) ≤ ((zeroTargets d Y).card : ℝ) + ((Y ∪ badTargets d).card : ℝ) + ((forcedTargets d).card : ℝ) := by exact_mod_cast card_zeroTargets_complement d Y have hzero : (3 / 4 : ℝ) * (Fintype.card G : ℝ) ≤ ((zeroTargets d Y).card : ℝ) := by linarith have hpositive := mul_le_mul_of_nonneg_left hzero (div_nonneg hbase (by norm_num : (0 : ℝ) ≤ 2)) have hmean := maskedPolynomial_mean_lower a k L bound (base / 2) d Y ha hn hθ hθ1 hK htK hOrdinary hZero nlinarith /-- Every size and parameter gate used by the actual CAL2 application. There is no lower bound on the source-set or row cardinality. -/ structure FixedPriorConditions (k : ℕ) (θ ε δ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) : Prop where k_pos : 0 < k half_sample : (k : ℝ) ≤ 2 * ((k - d.2.2.1.card : ℕ) : ℝ) ambient_size : (k : ℝ) ^ 2 ≤ 2 * ((sourceFreeUniverse d).card : ℝ) degree_le : 10001 ≤ k - d.2.2.1.card prior_size : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card theta_pos : 0 < θ theta_le_one : θ ≤ 1 parameter_le : ∀ x : G, scaledParameter (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card θ ≤ 100 + ε error_le : θ + 1 / ((k : ℝ) * θ) ≤ δ end Descriptor /-- OP14/SE12 for the actual masked polynomial. The common scalar window is chosen before the group, input size, descriptor and candidate mask. CAL2 is instantiated in the proof; only geometric/source size and loss budgets remain. The pointwise minorant comparison is supplied separately by SourceCanonicalMask. -/ theorem exists_fixed_masked_mean_window : ∃ ε δ : ℝ, 0 < ε ∧ ε ≤ 1 ∧ 0 < δ ∧ ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ (k : ℕ) (θ bound : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G), FixedPriorConditions k θ ε δ d → (∀ x : G, x ∉ badTargets d ∪ externalTargets d → Even (sourceForcedCount d x)) → (((Y ∪ badTargets d).card : ℝ) + ((forcedTargets d).card : ℝ) ≤ (Fintype.card G : ℝ) / 4) → (bound * ((Y ∪ badTargets d).card : ℝ) + absoluteRowConstant 10001 101 * externalWeightOutside d Y 10001 θ ≤ calibrationBase * (Fintype.card G : ℝ) / 8) → calibrationBase * (Fintype.card G : ℝ) / 4 ≤ uniformMean (sourcePrior k d) (maskedPolynomial (Scalar.newtonCoeff 10001 100) 10001 θ bound d Y) := by obtain ⟨ε, δ, hε, hε1, hδ, hcal⟩ := exists_fixed_prior_calibration_window refine ⟨ε, δ, hε, hε1, hδ, ?_⟩ intro G _ _ _ k θ bound d Y hs hparity hExcluded hCost have hrow (x : G) := hcal (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card k θ hs.k_pos hs.half_sample (Nat.sub_le _ _) hs.ambient_size hs.degree_le hs.prior_size (Finset.card_le_card (rowInputs_subset_free d x)) hs.theta_pos hs.theta_le_one (hs.parameter_le x) hs.error_le have ht101 : ∀ x : G, scaledParameter (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card θ ≤ 101 := by intro x have ht := hs.parameter_le x linarith refine maskedPolynomial_mean_quarter_of_rows (Scalar.newtonCoeff 10001 100) k 10001 (K := 101) (base := calibrationBase) bound d Y (fun j => Scalar.abs_newtonCoeff_le_one (by decide) j) calibrationBase_pos.le hs.prior_size hs.theta_pos hs.theta_le_one (by norm_num) ht101 ?_ ?_ hExcluded hCost · intro x hmask hext by_cases hc : sourceForcedCount d x ≤ 10001 · have heven : Even (sourceForcedCount d x) := hparity x (by intro hx rcases Finset.mem_union.mp hx with hbad | he · exact hmask (Finset.mem_union_right _ hbad) · exact hext he) have hmargin := (hrow x).1 (sourceForcedCount d x) hc rw [heven.neg_one_pow, one_mul] at hmargin by_contra hneg have hnegative := mul_neg_of_pos_of_neg (pow_pos hs.theta_pos (sourceForcedCount d x)) (lt_of_not_ge hneg) linarith [Scalar.fixedMargin_pos] · rw [priorInterpolationMean_eq_zero (Scalar.newtonCoeff 10001 100) 10001 θ (sourceForcedCount d x) (sourceFreeUniverse d).card (k - d.2.2.1.card) (rowInputs d x).card (Nat.lt_of_not_ge hc)] · intro x hc simpa only [hc] using (hrow x).2 /-- The geometry version discharges parity and the forced-target support count using ForcedParity. The remaining inputs are actual source and size budgets, with external weights restricted to the candidate mask's complement. -/ theorem exists_fixed_masked_mean_window_of_source_geometry : ∃ ε δ : ℝ, 0 < ε ∧ ε ≤ 1 ∧ 0 < δ ∧ ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ (k : ℕ) (θ bound budgetExt : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (Y : Finset G), FixedPriorConditions k θ ε δ d → sourceForcedSet d ⊆ sourceForbidden d → 0 ≤ bound → externalWeightOutside d Y 10001 θ ≤ budgetExt → (((Y.card : ℝ) + ((badTargets d).card : ℝ)) + ((sourceForcedSet d).card : ℝ) * (d.2.2.2.card : ℝ) ≤ (Fintype.card G : ℝ) / 4) → (bound * ((Y.card : ℝ) + ((badTargets d).card : ℝ)) + absoluteRowConstant 10001 101 * budgetExt ≤ calibrationBase * (Fintype.card G : ℝ) / 8) → calibrationBase * (Fintype.card G : ℝ) / 4 ≤ uniformMean (sourcePrior k d) (maskedPolynomial (Scalar.newtonCoeff 10001 100) 10001 θ bound d Y) := by obtain ⟨ε, δ, hε, hε1, hδ, hmean⟩ := exists_fixed_masked_mean_window refine ⟨ε, δ, hε, hε1, hδ, ?_⟩ intro G _ _ _ k θ bound budgetExt d Y hs hF hbound hExt hExcluded hCost have hmask : ((Y ∪ badTargets d).card : ℝ) ≤ (Y.card : ℝ) + ((badTargets d).card : ℝ) := by exact_mod_cast Finset.card_union_le Y (badTargets d) have hforced : ((forcedTargets d).card : ℝ) ≤ ((sourceForcedSet d).card : ℝ) * (d.2.2.2.card : ℝ) := by exact_mod_cast ForcedParity.card_forced_targets_le d have hC : 0 ≤ absoluteRowConstant 10001 101 := absoluteRowConstant_nonneg _ (by norm_num) apply hmean G k θ bound d Y hs (ForcedParity.even_sourceForcedCount d hF) · linarith · have hm := mul_le_mul_of_nonneg_left hmask hbound have he := mul_le_mul_of_nonneg_left hExt hC linarith end ConditionalMean end Green39Submission end end Green39AssemblyScope_9abfef194b26cffd /- Source: Green39Submission.SparseSourceAsymptotics; SHA256 c385597d61d28478016e98318014d13c4ce5a5b72bf29b3ca5caea4fd65c8d5f -/ section Green39AssemblyScope_07dfa13fba595b9a /-! Concrete vanishing error scales for the sparse-source extraction. These limits retain the manuscript's literal floors and binomial prefix. Their finite probabilistic applications are supplied by ScoreExtraction and ScoreInfluence. -/ noncomputable section namespace Green39Submission.SparseSourceAsymptotics open Filter Topology open scoped BigOperators open Parameters Green39Submission.Asymptotics def binomialPrefix (M d : ℕ) : ℝ := ∑ j ∈ Finset.range d, ((M - 1).choose j : ℝ) def varianceScale (k : ℕ) : ℝ := theta0 k / ((k : ℝ) * theta0 k ^ (2 * L)) def initialDeletionScale (k : ℕ) : ℝ := (H k : ℝ) * theta0 k / ((k : ℝ) * theta0 k ^ L) def exceptionScale (k : ℕ) : ℝ := (N k : ℝ) / ((k : ℝ) ^ 2 * theta0 k ^ L) def aliasScale (p : ℕ) : ℝ := ((J p : ℝ) + 1) * (H (Nat.sqrt p) : ℝ) / ((Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) ^ L) def collisionScale (p : ℕ) : ℝ := ((J p : ℝ) + 1) / ((Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) ^ (2 * L)) def retentionScale (k : ℕ) : ℝ := (sparseBudget k : ℝ) * binomialPrefix (M0 k) L / (k : ℝ) def externalScale (k : ℕ) : ℝ := theta0 k * binomialPrefix (M0 k) L theorem binomialPrefix_nonneg (M d : ℕ) : 0 ≤ binomialPrefix M d := by exact Finset.sum_nonneg (fun j _ => Nat.cast_nonneg _) theorem binomialPrefix_le (M d : ℕ) (hM : 1 ≤ M) (hd : 1 ≤ d) : binomialPrefix M d ≤ (d : ℝ) * (M : ℝ) ^ (d - 1) := by have hM' : (1 : ℝ) ≤ M := by exact_mod_cast hM calc binomialPrefix M d ≤ ∑ _j ∈ Finset.range d, (M : ℝ) ^ (d - 1) := by apply Finset.sum_le_sum intro j hj have hjd : j ≤ d - 1 := by have := Finset.mem_range.mp hj omega have hchoose : (M - 1).choose j ≤ M ^ j := (Nat.choose_le_pow _ _).trans (Nat.pow_le_pow_left (Nat.sub_le M 1) j) exact (show ((M - 1).choose j : ℝ) ≤ (M : ℝ) ^ j by exact_mod_cast hchoose).trans (pow_le_pow_right₀ hM' hjd) _ = _ := by simp theorem theta0_pos {k : ℕ} (hk : 0 < k) : 0 < theta0 k := Real.rpow_pos_of_pos (by exact_mod_cast hk) _ /-- Normalization of every fixed natural theta power, with no asymptotic step. -/ theorem rpow_theta0_ratio {k : ℕ} (hk : 0 < k) (a : ℝ) (b c : ℕ) : (k : ℝ) ^ a * theta0 k ^ b / theta0 k ^ c = (k : ℝ) ^ (a + epsilon0 * ((c : ℝ) - (b : ℝ))) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk simp only [theta0] rw [← Real.rpow_mul_natCast hk0.le, ← Real.rpow_mul_natCast hk0.le, ← Real.rpow_add hk0, ← Real.rpow_sub hk0] congr 1 ring theorem theta0_div_k_mul_pow {k : ℕ} (hk : 0 < k) (r : ℕ) : theta0 k / ((k : ℝ) * theta0 k ^ r) = (k : ℝ) ^ (-1 + epsilon0 * ((r : ℝ) - 1)) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk calc theta0 k / ((k : ℝ) * theta0 k ^ r) = (k : ℝ) ^ (-1 : ℝ) * theta0 k ^ 1 / theta0 k ^ r := by rw [Real.rpow_neg_one, pow_one] ring _ = _ := by simpa using rpow_theta0_ratio hk (-1) 1 r theorem one_div_k_mul_pow {k : ℕ} (hk : 0 < k) (r : ℕ) : 1 / ((k : ℝ) * theta0 k ^ r) = (k : ℝ) ^ (-1 + epsilon0 * (r : ℝ)) := by calc 1 / ((k : ℝ) * theta0 k ^ r) = (k : ℝ) ^ (-1 : ℝ) * theta0 k ^ 0 / theta0 k ^ r := by rw [Real.rpow_neg_one, pow_zero] ring _ = _ := by simpa using rpow_theta0_ratio hk (-1) 0 r theorem varianceScale_eq {k : ℕ} (hk : 0 < k) : varianceScale k = (k : ℝ) ^ (-1 + epsilon0 * (2 * (L : ℝ) - 1)) := by simpa only [varianceScale, Nat.cast_mul, Nat.cast_ofNat] using theta0_div_k_mul_pow hk (2 * L) theorem varianceScale_tendsto_zero : Tendsto varianceScale atTop (𝓝 0) := by apply (nat_rpow_tendsto_zero sparse_variance_neg).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk exact (varianceScale_eq (lt_of_lt_of_le Nat.zero_lt_one hk)).symm theorem initialDeletionScale_le {k : ℕ} (hk : 0 < k) : initialDeletionScale k ≤ (k : ℝ) ^ (-3 / 8 + epsilon0 * ((L : ℝ) - 1)) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hH : (H k : ℝ) ≤ (k : ℝ) ^ (5 / 8 : ℝ) := Nat.floor_le (Real.rpow_nonneg hk0.le _) calc initialDeletionScale k = (H k : ℝ) * (theta0 k / ((k : ℝ) * theta0 k ^ L)) := by unfold initialDeletionScale ring _ = (H k : ℝ) * (k : ℝ) ^ (-1 + epsilon0 * ((L : ℝ) - 1)) := by rw [theta0_div_k_mul_pow hk] _ ≤ (k : ℝ) ^ (5 / 8 : ℝ) * (k : ℝ) ^ (-1 + epsilon0 * ((L : ℝ) - 1)) := mul_le_mul_of_nonneg_right hH (Real.rpow_nonneg hk0.le _) _ = _ := by rw [← Real.rpow_add hk0]; congr 1; ring theorem initialDeletionScale_tendsto_zero : Tendsto initialDeletionScale atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (nat_rpow_tendsto_zero sparse_E0_cost_neg) · exact Eventually.of_forall fun k => by unfold initialDeletionScale theta0; positivity · filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk exact initialDeletionScale_le (lt_of_lt_of_le Nat.zero_lt_one hk) theorem exceptionScale_le {k : ℕ} (hk : 0 < k) : exceptionScale k ≤ (k : ℝ) ^ (-delta + (L : ℝ) * epsilon0) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have ht := theta0_pos hk have hN : (N k : ℝ) ≤ (k : ℝ) ^ (2 - delta) := Nat.floor_le (Real.rpow_nonneg hk0.le _) calc exceptionScale k ≤ (k : ℝ) ^ (2 - delta) / ((k : ℝ) ^ 2 * theta0 k ^ L) := div_le_div_of_nonneg_right hN (by positivity) _ = _ := by rw [theta0, ← Real.rpow_mul_natCast hk0.le, ← Real.rpow_natCast (k : ℝ) 2, ← Real.rpow_add hk0, ← Real.rpow_sub hk0] congr 1 push_cast ring theorem exceptionScale_tendsto_zero : Tendsto exceptionScale atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (nat_rpow_tendsto_zero weighted_allowance_neg) · exact Eventually.of_forall fun k => by unfold exceptionScale theta0; positivity · filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk exact exceptionScale_le (lt_of_lt_of_le Nat.zero_lt_one hk) theorem aliasScale_le {p : ℕ} (hp : 0 < p) : aliasScale p ≤ ((J p : ℝ) + 1) * (Nat.sqrt p : ℝ) ^ (-3 / 8 + epsilon0 * (L : ℝ)) := by have hk : 0 < Nat.sqrt p := Nat.sqrt_pos.mpr hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hk have hH : (H (Nat.sqrt p) : ℝ) ≤ (Nat.sqrt p : ℝ) ^ (5 / 8 : ℝ) := Nat.floor_le (Real.rpow_nonneg hk0.le _) have hinner : (H (Nat.sqrt p) : ℝ) / ((Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) ^ L) ≤ (Nat.sqrt p : ℝ) ^ (-3 / 8 + epsilon0 * (L : ℝ)) := by calc _ = (H (Nat.sqrt p) : ℝ) * (1 / ((Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) ^ L)) := by ring _ = (H (Nat.sqrt p) : ℝ) * (Nat.sqrt p : ℝ) ^ (-1 + epsilon0 * (L : ℝ)) := by rw [one_div_k_mul_pow hk] _ ≤ (Nat.sqrt p : ℝ) ^ (5 / 8 : ℝ) * (Nat.sqrt p : ℝ) ^ (-1 + epsilon0 * (L : ℝ)) := mul_le_mul_of_nonneg_right hH (Real.rpow_nonneg hk0.le _) _ = _ := by rw [← Real.rpow_add hk0]; congr 1; ring simpa only [aliasScale, mul_div_assoc] using mul_le_mul_of_nonneg_left hinner (show 0 ≤ (J p : ℝ) + 1 by positivity) theorem aliasScale_tendsto_zero : Tendsto aliasScale atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds (J_add_one_mul_sqrt_rpow_tendsto_zero sparse_wedge_cost_neg) · exact Eventually.of_forall fun p => by unfold aliasScale theta0; positivity · filter_upwards [eventually_ge_atTop (1 : ℕ)] with p hp exact aliasScale_le (lt_of_lt_of_le Nat.zero_lt_one hp) theorem collisionScale_eq {p : ℕ} (hp : 0 < p) : collisionScale p = ((J p : ℝ) + 1) * (Nat.sqrt p : ℝ) ^ (-1 + 2 * (L : ℝ) * epsilon0) := by have hk : 0 < Nat.sqrt p := Nat.sqrt_pos.mpr hp calc collisionScale p = ((J p : ℝ) + 1) * (1 / ((Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) ^ (2 * L))) := by unfold collisionScale ring _ = ((J p : ℝ) + 1) * (Nat.sqrt p : ℝ) ^ (-1 + epsilon0 * (((2 * L : ℕ) : ℝ))) := by rw [one_div_k_mul_pow hk] _ = _ := by congr 2; push_cast; ring theorem collisionScale_tendsto_zero : Tendsto collisionScale atTop (𝓝 0) := by apply (J_add_one_mul_sqrt_rpow_tendsto_zero FG_collision_neg).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with p hp exact (collisionScale_eq (lt_of_lt_of_le Nat.zero_lt_one hp)).symm theorem M0_one_le {k : ℕ} (hk : 1 ≤ k) : 1 ≤ M0 k := by have hkR : (1 : ℝ) ≤ k := by exact_mod_cast hk have hpow := Real.one_le_rpow hkR alpha_pos.le have hlow := (M0_bounds hk).1 have hreal : (1 : ℝ) ≤ M0 k := by linarith exact_mod_cast hreal theorem retentionScale_le {k : ℕ} (hk : 1 ≤ k) : retentionScale k ≤ (L : ℝ) / (M0 k : ℝ) ^ (L + 3) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk have hM : 0 < (M0 k : ℝ) := by exact_mod_cast Nat.zero_lt_one.trans_le (M0_one_le hk) have hb : (sparseBudget k : ℝ) ≤ (k : ℝ) / (M0 k : ℝ) ^ (2 * L + 2) := Nat.floor_le (by positivity) have hpre := binomialPrefix_le (M0 k) L (M0_one_le hk) L_pos calc retentionScale k ≤ ((k : ℝ) / (M0 k : ℝ) ^ (2 * L + 2)) * ((L : ℝ) * (M0 k : ℝ) ^ (L - 1)) / (k : ℝ) := by exact div_le_div_of_nonneg_right (mul_le_mul hb hpre (binomialPrefix_nonneg _ _) (by positivity)) hk0.le _ = (L : ℝ) / (M0 k : ℝ) ^ (L + 3) := by have hexp : 2 * L + 2 = (L - 1) + (L + 3) := by have := L_pos; omega rw [hexp, pow_add] field_simp [hk0.ne', hM.ne'] theorem retentionScale_tendsto_zero : Tendsto retentionScale atTop (𝓝 0) := by have hM : Tendsto (fun k : ℕ => (M0 k : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp M0_tendsto_atTop have hpow : Tendsto (fun k : ℕ => (M0 k : ℝ) ^ (L + 3)) atTop atTop := by simpa only [Function.comp_def, Real.rpow_natCast] using (_root_.tendsto_rpow_atTop (by positivity : (0 : ℝ) < ((L + 3 : ℕ) : ℝ))).comp hM have hlim : Tendsto (fun k : ℕ => (L : ℝ) / (M0 k : ℝ) ^ (L + 3)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop hpow apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hlim · exact Eventually.of_forall fun k => div_nonneg (mul_nonneg (Nat.cast_nonneg _) (binomialPrefix_nonneg _ _)) (Nat.cast_nonneg _) · filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk exact retentionScale_le hk theorem externalScale_le {k : ℕ} (hk : 1 ≤ k) : externalScale k ≤ ((L : ℝ) * (3 : ℝ) ^ (L - 1)) * (k : ℝ) ^ (-epsilon0 + alpha * ((L : ℝ) - 1)) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk have ht := theta0_pos (Nat.zero_lt_one.trans_le hk) have hpre := binomialPrefix_le (M0 k) L (M0_one_le hk) L_pos calc externalScale k ≤ theta0 k * ((L : ℝ) * (M0 k : ℝ) ^ (L - 1)) := mul_le_mul_of_nonneg_left hpre ht.le _ ≤ theta0 k * ((L : ℝ) * (3 * (k : ℝ) ^ alpha) ^ (L - 1)) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (Nat.cast_nonneg _) (M0_bounds hk).2 _) (Nat.cast_nonneg _)) ht.le _ = _ := by rw [mul_pow, theta0, ← Real.rpow_mul_natCast hk0.le, Real.rpow_add hk0, Nat.cast_sub L_pos, Nat.cast_one] ring theorem externalScale_tendsto_zero : Tendsto externalScale atTop (𝓝 0) := by have hlim : Tendsto (fun k : ℕ => ((L : ℝ) * (3 : ℝ) ^ (L - 1)) * (k : ℝ) ^ (-epsilon0 + alpha * ((L : ℝ) - 1))) atTop (𝓝 0) := by simpa only [mul_zero] using (nat_rpow_tendsto_zero EX_error_neg).const_mul ((L : ℝ) * (3 : ℝ) ^ (L - 1)) apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds hlim · exact Eventually.of_forall fun k => mul_nonneg (by unfold theta0; positivity) (binomialPrefix_nonneg _ _) · filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk exact externalScale_le hk end Green39Submission.SparseSourceAsymptotics end end Green39AssemblyScope_07dfa13fba595b9a /- Source: Green39Submission.SparseInfluenceAsymptotics; SHA256 f5a1ecc598b9bca58b359335df34497290c24bf6f0bd5bf909a741fd06df203e -/ section Green39AssemblyScope_89104d7dc55d9ad2 /-! Degreewise exact-binomial rooted influence calibration at the literal sparse parameters. The eventual gate is uniform in every degree `1 ≤ d ≤ L` and in all finite root/overlap/codegree caps. The positive scalar amplitude cancels exactly from each raw-moment tail ratio. -/ noncomputable section namespace Green39Submission.SparseInfluenceAsymptotics open Filter Topology open scoped BigOperators open Parameters Green39Submission.Asymptotics open RichStarAsymptotics (rpow_mul_div_equivalent monomial_mul_equivalent tendsto_zero_of_monomial_equivalent J_mul_tendsto_zero_of_monomial_equivalent ordinaryCap ordinaryCap_equivalent rooted_profile_mono_caps) def chooseConstant (r : ℕ) : ℝ := (2 : ℝ) ^ r / (r.factorial : ℝ) theorem chooseConstant_pos (r : ℕ) : 0 < chooseConstant r := by unfold chooseConstant exact div_pos (pow_pos (by norm_num) _) (by exact_mod_cast Nat.factorial_pos r) def rootScale (k d : ℕ) : ℝ := 100 * (k : ℝ) * ((M0 k - 1).choose (d - 1) : ℝ) def momentOrder (k : ℕ) : ℕ := ⌊(k : ℝ) ^ eta0⌋₊ def momentChoose (k d j : ℕ) : ℝ := ((d * momentOrder k).choose j : ℝ) theorem shifted_M0_tendsto_atTop (s : ℕ) : Tendsto (fun k => M0 k - s) atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [M0_tendsto_atTop.eventually_ge_atTop (b + s)] with k hk omega theorem shifted_M0_equivalent (s : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((M0 k - s : ℕ) : ℝ)) (fun k : ℕ => 2 * (k : ℝ) ^ alpha) := by have hM : Tendsto (fun k : ℕ => (M0 k : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp M0_tendsto_atTop have hsmall : Tendsto (fun k : ℕ => (s : ℝ) / (M0 k : ℝ)) atTop (𝓝 0) := tendsto_const_nhds.div_atTop hM have hratio : Tendsto (fun k : ℕ => ((M0 k - s : ℕ) : ℝ) / (M0 k : ℝ)) atTop (𝓝 1) := by apply (show Tendsto (fun k : ℕ => 1 - (s : ℝ) / (M0 k : ℝ)) atTop (𝓝 1) by simpa only [sub_zero] using tendsto_const_nhds.sub hsmall).congr' filter_upwards [M0_tendsto_atTop.eventually_ge_atTop (max s 1)] with k hk have hs : s ≤ M0 k := (le_max_left _ _).trans hk have hm : (0 : ℝ) < M0 k := by exact_mod_cast Nat.zero_lt_one.trans_le ((le_max_right s 1).trans hk) rw [Nat.cast_sub hs] field_simp [hm.ne'] exact (_root_.Asymptotics.isEquivalent_of_tendsto_one hratio).trans M0_equivalent theorem shifted_choose_M0_equivalent (s r : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((M0 k - s).choose r : ℝ)) (fun k : ℕ => chooseConstant r * (k : ℝ) ^ (alpha * (r : ℝ))) := by have hc := (isEquivalent_choose r).comp_tendsto (shifted_M0_tendsto_atTop s) have hs := ((shifted_M0_equivalent s).pow r).div (_root_.Asymptotics.IsEquivalent.refl (u := fun _ : ℕ => (r.factorial : ℝ))) apply (hc.trans hs).congr_right exact Eventually.of_forall fun k => by change (2 * (k : ℝ) ^ alpha) ^ r / (r.factorial : ℝ) = _ rw [mul_pow, ← Real.rpow_mul_natCast (Nat.cast_nonneg k)] unfold chooseConstant ring theorem rootScale_equivalent (d : ℕ) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => rootScale k d) (fun k : ℕ => (100 * chooseConstant (d - 1)) * (k : ℝ) ^ (1 + alpha * ((d - 1 : ℕ) : ℝ))) := by have he : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => rootScale k d) (fun k : ℕ => 100 * (k : ℝ) * (chooseConstant (d - 1) * (k : ℝ) ^ (alpha * ((d - 1 : ℕ) : ℝ)))) := _root_.Asymptotics.IsEquivalent.refl.mul (shifted_choose_M0_equivalent 1 (d - 1)) apply he.congr_right filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.zero_lt_one.trans_le hk rw [Real.rpow_add hk0, Real.rpow_one] ring theorem inv_theta0_pow {k : ℕ} (_hk : 0 < k) (j : ℕ) : (theta0 k ^ j)⁻¹ = (k : ℝ) ^ (epsilon0 * (j : ℝ)) := by unfold theta0 rw [← Real.rpow_mul_natCast (Nat.cast_nonneg k), ← Real.rpow_neg (Nat.cast_nonneg k)] congr 1 ring theorem momentOrder_tendsto_atTop : Tendsto momentOrder atTop atTop := nat_floor_tendsto_atTop.comp (nat_rpow_tendsto_atTop eta0_pos) theorem momentOrder_equivalent : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => (momentOrder k : ℝ)) (fun k : ℕ => (k : ℝ) ^ eta0) := _root_.Asymptotics.isEquivalent_nat_floor.comp_tendsto (nat_rpow_tendsto_atTop eta0_pos) theorem degree_mul_momentOrder_tendsto_atTop (d : ℕ) (hd : 0 < d) : Tendsto (fun k => d * momentOrder k) atTop atTop := by apply tendsto_atTop.2 intro b filter_upwards [momentOrder_tendsto_atTop.eventually_ge_atTop b] with k hk have hd' : 1 ≤ d := hd nlinarith [Nat.mul_le_mul_right (momentOrder k) hd'] theorem momentChoose_equivalent (d j : ℕ) (hd : 0 < d) : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => momentChoose k d j) (fun k : ℕ => ((d : ℝ) ^ j / (j.factorial : ℝ)) * (k : ℝ) ^ (eta0 * (j : ℝ))) := by have hbase : _root_.Asymptotics.IsEquivalent atTop (fun k : ℕ => ((d * momentOrder k : ℕ) : ℝ)) (fun k : ℕ => (d : ℝ) * (k : ℝ) ^ eta0) := by convert (_root_.Asymptotics.IsEquivalent.refl (u := fun _ : ℕ => (d : ℝ))).mul momentOrder_equivalent using 1 <;> funext k <;> simp only [Nat.cast_mul, Pi.mul_apply] have hc := (isEquivalent_choose j).comp_tendsto (degree_mul_momentOrder_tendsto_atTop d hd) have hp := (hbase.pow j).div (_root_.Asymptotics.IsEquivalent.refl (u := fun _ : ℕ => (j.factorial : ℝ))) apply (hc.trans hp).congr_right exact Eventually.of_forall fun k => by change ((d : ℝ) * (k : ℝ) ^ eta0) ^ j / (j.factorial : ℝ) = _ rw [mul_pow, ← Real.rpow_mul_natCast (Nat.cast_nonneg k)] ring def distinguishedTerm (k d j : ℕ) : ℝ := (j : ℝ) * momentChoose k d j * ((theta0 k ^ j)⁻¹ * ((M0 k - j).choose (d - j) : ℝ) / rootScale k d) theorem distinguishedTerm_tendsto_zero (d j : ℕ) (hd : 0 < d) (hdL : d ≤ L) (hj : 1 ≤ j) (hjd : j ≤ d) : Tendsto (fun k : ℕ => distinguishedTerm k d j) atTop (𝓝 0) := by have hr := rpow_mul_div_equivalent (shifted_choose_M0_equivalent j (d - j)) (rootScale_equivalent d) (epsilon0 * (j : ℝ)) have he := monomial_mul_equivalent (momentChoose_equivalent d j hd) hr have hexp : eta0 * (j : ℝ) + (epsilon0 * (j : ℝ) + alpha * ((d - j : ℕ) : ℝ) - (1 + alpha * ((d - 1 : ℕ) : ℝ))) < 0 := by rw [Nat.cast_sub hjd, Nat.cast_sub (show 1 ≤ d from hd), Nat.cast_one] have hj' : (1 : ℝ) ≤ j := by exact_mod_cast hj nlinarith [sparse_moment_exponent_neg (hjd.trans hdL), mul_nonneg alpha_pos.le (sub_nonneg.mpr hj')] have hz := (tendsto_zero_of_monomial_equivalent he hexp).const_mul (j : ℝ) apply (show Tendsto (fun k : ℕ => (j : ℝ) * (momentChoose k d j * ((k : ℝ) ^ (epsilon0 * (j : ℝ)) * ((M0 k - j).choose (d - j) : ℝ) / rootScale k d))) atTop (𝓝 0) by simpa only [mul_zero] using hz).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk rw [distinguishedTerm, inv_theta0_pow (Nat.zero_lt_one.trans_le hk)] ring def ordinaryFirstTerm (k d : ℕ) : ℝ := momentChoose k d 1 * (ordinaryCap k : ℝ) * ((theta0 k ^ 1)⁻¹ * ((M0 k - 2).choose (d - 2) : ℝ) / rootScale k d) theorem ordinaryFirstTerm_tendsto_zero (d : ℕ) (hd : 2 ≤ d) : Tendsto (fun k : ℕ => ordinaryFirstTerm k d) atTop (𝓝 0) := by have hr := rpow_mul_div_equivalent (shifted_choose_M0_equivalent 2 (d - 2)) (rootScale_equivalent d) epsilon0 have he := monomial_mul_equivalent (monomial_mul_equivalent (momentChoose_equivalent d 1 (by omega)) ordinaryCap_equivalent) hr have hexp : (eta0 * (1 : ℝ) + 3 / 4) + (epsilon0 + alpha * ((d - 2 : ℕ) : ℝ) - (1 + alpha * ((d - 1 : ℕ) : ℝ))) < 0 := by rw [Nat.cast_sub hd, Nat.cast_sub (show 1 ≤ d by omega)] norm_num only [Nat.cast_ofNat, Nat.cast_one, mul_one] nlinarith [sparse_moment_partner_neg] apply (tendsto_zero_of_monomial_equivalent he (by simpa only [Nat.cast_one] using hexp)).congr' filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk rw [ordinaryFirstTerm, inv_theta0_pow (Nat.zero_lt_one.trans_le hk)] simp only [Nat.cast_one, mul_one] def ordinaryHigherTerm (p d j : ℕ) : ℝ := momentChoose (Nat.sqrt p) d j * (J p : ℝ) * ((theta0 (Nat.sqrt p) ^ j)⁻¹ * ((M0 (Nat.sqrt p) - (j + 1)).choose (d - (j + 1)) : ℝ) / rootScale (Nat.sqrt p) d) theorem ordinaryHigherTerm_tendsto_zero (d j : ℕ) (hd : 0 < d) (hdL : d ≤ L) (hjd : j < d) : Tendsto (fun p : ℕ => ordinaryHigherTerm p d j) atTop (𝓝 0) := by have hr := rpow_mul_div_equivalent (shifted_choose_M0_equivalent (j + 1) (d - (j + 1))) (rootScale_equivalent d) (epsilon0 * (j : ℝ)) have he := monomial_mul_equivalent (momentChoose_equivalent d j hd) hr have hexp : eta0 * (j : ℝ) + (epsilon0 * (j : ℝ) + alpha * ((d - (j + 1) : ℕ) : ℝ) - (1 + alpha * ((d - 1 : ℕ) : ℝ))) < 0 := by rw [Nat.cast_sub (by omega : j + 1 ≤ d), Nat.cast_sub (show 1 ≤ d from hd), Nat.cast_add, Nat.cast_one] nlinarith [sparse_moment_exponent_neg (hjd.le.trans hdL), mul_nonneg alpha_pos.le (Nat.cast_nonneg j : (0 : ℝ) ≤ j)] apply (J_mul_tendsto_zero_of_monomial_equivalent he hexp).congr' filter_upwards [nat_sqrt_tendsto_atTop.eventually_ge_atTop 1] with p hp rw [ordinaryHigherTerm, inv_theta0_pow (Nat.zero_lt_one.trans_le hp)] ring theorem rooted_profile_ratio_tendsto_zero (d j : ℕ) (hd : 0 < d) (hdL : d ≤ L) (hj : 1 ≤ j) (hjd : j ≤ d) : Tendsto (fun p : ℕ => momentChoose (Nat.sqrt p) d j * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M0 (Nat.sqrt p)) d (theta0 (Nat.sqrt p)) j / rootScale (Nat.sqrt p) d) atTop (𝓝 0) := by have hdist := (distinguishedTerm_tendsto_zero d j hd hdL hj hjd).comp nat_sqrt_tendsto_atTop have hj0 : j ≠ 0 := by omega by_cases hlt : j < d · by_cases hj1 : j = 1 · subst j have hsum := hdist.add ((ordinaryFirstTerm_tendsto_zero d (by omega)).comp nat_sqrt_tendsto_atTop) apply (show Tendsto (fun p : ℕ => distinguishedTerm (Nat.sqrt p) d 1 + ordinaryFirstTerm (Nat.sqrt p) d) atTop (𝓝 0) by simpa only [Function.comp_def, add_zero] using hsum).congr intro p simp only [distinguishedTerm, ordinaryFirstTerm, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, hj0, if_false, if_pos hjd, if_pos hlt, if_true, Nat.cast_add, Nat.cast_mul, Nat.cast_one, one_mul] norm_num only [show (1 + 1 : ℕ) = 2 by decide] ring · have hsum := hdist.add (ordinaryHigherTerm_tendsto_zero d j hd hdL hlt) apply (show Tendsto (fun p : ℕ => distinguishedTerm (Nat.sqrt p) d j + ordinaryHigherTerm p d j) atTop (𝓝 0) by simpa only [Function.comp_def, add_zero] using hsum).congr intro p simp only [distinguishedTerm, ordinaryHigherTerm, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, hj0, hj1, if_false, if_pos hjd, if_pos hlt, Nat.cast_add, Nat.cast_mul] ring · apply hdist.congr intro p simp only [Function.comp_def, distinguishedTerm, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, hj0, hlt, if_false, if_pos hjd, Nat.add_zero, Nat.cast_mul] ring def rootedCorrection (p d : ℕ) : ℝ := ∑ j ∈ Finset.range d, momentChoose (Nat.sqrt p) d (j + 1) * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M0 (Nat.sqrt p)) d (theta0 (Nat.sqrt p)) (j + 1) theorem rootedCorrection_ratio_tendsto_zero (d : ℕ) (hd : 0 < d) (hdL : d ≤ L) : Tendsto (fun p : ℕ => rootedCorrection p d / rootScale (Nat.sqrt p) d) atTop (𝓝 0) := by have hsum : Tendsto (fun p : ℕ => ∑ j ∈ Finset.range d, momentChoose (Nat.sqrt p) d (j + 1) * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M0 (Nat.sqrt p)) d (theta0 (Nat.sqrt p)) (j + 1) / rootScale (Nat.sqrt p) d) atTop (𝓝 (∑ _j ∈ Finset.range d, (0 : ℝ))) := by apply tendsto_finsetSum intro j hj exact rooted_profile_ratio_tendsto_zero d (j + 1) hd hdL (by omega) (by have := Finset.mem_range.mp hj; omega) simpa only [rootedCorrection, Finset.sum_div, Finset.sum_const_zero] using hsum theorem rootScale_nonneg (k d : ℕ) : 0 ≤ rootScale k d := by unfold rootScale positivity theorem eventually_rootScale_pos (d : ℕ) : ∀ᶠ k in atTop, 0 < rootScale k d := by filter_upwards [eventually_ge_atTop (1 : ℕ), M0_tendsto_atTop.eventually_ge_atTop d] with k hk hM unfold rootScale exact mul_pos (mul_pos (by norm_num) (by exact_mod_cast Nat.zero_lt_one.trans_le hk)) (by exact_mod_cast Nat.choose_pos (Nat.sub_le_sub_right hM 1)) def rawBase (p d n Q J' : ℕ) : ℝ := ∑ j ∈ Finset.range (d + 1), momentChoose (Nat.sqrt p) d j * RootedDerivativeBounds.rootedDerivativeBound n Q J' (M0 (Nat.sqrt p)) d (theta0 (Nat.sqrt p)) j theorem rawBase_eq (p d : ℕ) : rawBase p d (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) = rootScale (Nat.sqrt p) d + rootedCorrection p d := by unfold rawBase rw [Finset.sum_range_succ'] have hz : momentChoose (Nat.sqrt p) d 0 * RootedDerivativeBounds.rootedDerivativeBound (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) (M0 (Nat.sqrt p)) d (theta0 (Nat.sqrt p)) 0 = rootScale (Nat.sqrt p) d := by simp [momentChoose, RootedDerivativeBounds.rootedDerivativeBound, RootedDerivativeBounds.rootedExtensionBound, rootScale, Nat.cast_mul] change rootedCorrection p d + _ = _ rw [hz, add_comm] theorem rawBase_le (p d n Q J' : ℕ) (hn : n ≤ 100 * Nat.sqrt p) (hQ : Q ≤ ordinaryCap (Nat.sqrt p)) (hJ : J' ≤ J p) : rawBase p d n Q J' ≤ rootScale (Nat.sqrt p) d + rootedCorrection p d := by rw [← rawBase_eq] unfold rawBase apply Finset.sum_le_sum intro j _hj apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _) exact rooted_profile_mono_caps hn hQ hJ (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon0)) theorem rawBase_nonneg (p d n Q J' : ℕ) : 0 ≤ rawBase p d n Q J' := by unfold rawBase apply Finset.sum_nonneg intro j _hj apply mul_nonneg (Nat.cast_nonneg _) unfold RootedDerivativeBounds.rootedDerivativeBound exact mul_nonneg (inv_nonneg.mpr (pow_nonneg (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon0)) _)) (Nat.cast_nonneg _) theorem eventually_degree_base_ratio (d : ℕ) (hd : 0 < d) (hdL : d ≤ L) : ∀ᶠ p : ℕ in atTop, 0 < rootScale (Nat.sqrt p) d ∧ ∀ n Q J' : ℕ, n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → rawBase p d n Q J' / (2 * rootScale (Nat.sqrt p) d) ≤ (3 / 4 : ℝ) := by filter_upwards [nat_sqrt_tendsto_atTop.eventually (eventually_rootScale_pos d), (rootedCorrection_ratio_tendsto_zero d hd hdL).eventually_lt_const (by norm_num : (0 : ℝ) < 1 / 2)] with p hroot hsmall refine ⟨hroot, ?_⟩ intro n Q J' hn hQ hJ apply (div_le_iff₀ (mul_pos (by norm_num) hroot)).2 have hc := (div_lt_iff₀ hroot).1 hsmall have hb := rawBase_le p d n Q J' hn hQ hJ linarith /-- One common eventual size gate for every degree in the fixed finite range. -/ theorem eventually_all_degree_base_ratio : ∀ᶠ p : ℕ in atTop, ∀ d : ℕ, 1 ≤ d → d ≤ L → 0 < rootScale (Nat.sqrt p) d ∧ ∀ n Q J' : ℕ, n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → rawBase p d n Q J' / (2 * rootScale (Nat.sqrt p) d) ≤ (3 / 4 : ℝ) := by have hall : ∀ᶠ p : ℕ in atTop, ∀ d ∈ Finset.Icc 1 L, 0 < rootScale (Nat.sqrt p) d ∧ ∀ n Q J' : ℕ, n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → rawBase p d n Q J' / (2 * rootScale (Nat.sqrt p) d) ≤ (3 / 4 : ℝ) := by apply (eventually_all_finset (Finset.Icc 1 L)).2 intro d hd exact eventually_degree_base_ratio d (Finset.mem_Icc.mp hd).1 (Finset.mem_Icc.mp hd).2 exact hall.mono fun p hp d hd hdL => hp d (Finset.mem_Icc.mpr ⟨hd, hdL⟩) /-- The exact ratio in worker07's degreewise raw-moment tail, including its amplitude. -/ def scaledMomentRatio (p d n Q J' : ℕ) (Kf : ℝ) : ℝ := (∑ j ∈ Finset.range (d + 1), momentChoose (Nat.sqrt p) d j * (Kf * RootedDerivativeBounds.rootedDerivativeBound n Q J' (M0 (Nat.sqrt p)) d (theta0 (Nat.sqrt p)) j)) / (2 * Kf * rootScale (Nat.sqrt p) d) theorem scaledMomentRatio_eq (p d n Q J' : ℕ) {Kf : ℝ} (hKf : 0 < Kf) (hroot : 0 < rootScale (Nat.sqrt p) d) : scaledMomentRatio p d n Q J' Kf = rawBase p d n Q J' / (2 * rootScale (Nat.sqrt p) d) := by have hsum : (∑ j ∈ Finset.range (d + 1), momentChoose (Nat.sqrt p) d j * (Kf * RootedDerivativeBounds.rootedDerivativeBound n Q J' (M0 (Nat.sqrt p)) d (theta0 (Nat.sqrt p)) j)) = Kf * rawBase p d n Q J' := by unfold rawBase rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _hj ring unfold scaledMomentRatio rw [hsum] field_simp [hKf.ne', hroot.ne'] theorem scaledMomentRatio_nonneg (p d n Q J' : ℕ) {Kf : ℝ} (hKf : 0 ≤ Kf) : 0 ≤ scaledMomentRatio p d n Q J' Kf := by unfold scaledMomentRatio apply div_nonneg · apply Finset.sum_nonneg intro j _hj apply mul_nonneg (Nat.cast_nonneg _) apply mul_nonneg hKf unfold RootedDerivativeBounds.rootedDerivativeBound exact mul_nonneg (inv_nonneg.mpr (pow_nonneg (Real.rpow_nonneg (Nat.cast_nonneg (Nat.sqrt p)) (-epsilon0)) _)) (Nat.cast_nonneg _) · exact mul_nonneg (mul_nonneg (by norm_num) hKf) (rootScale_nonneg _ _) theorem eventually_all_degree_scaled_ratio : ∀ᶠ p : ℕ in atTop, ∀ d : ℕ, 1 ≤ d → d ≤ L → 0 < rootScale (Nat.sqrt p) d ∧ ∀ n Q J' : ℕ, ∀ Kf : ℝ, n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → 0 < Kf → scaledMomentRatio p d n Q J' Kf ≤ (3 / 4 : ℝ) := by filter_upwards [eventually_all_degree_base_ratio] with p hp intro d hd hdL obtain ⟨hroot, hratio⟩ := hp d hd hdL refine ⟨hroot, ?_⟩ intro n Q J' Kf hn hQ hJ hKf rw [scaledMomentRatio_eq p d n Q J' hKf hroot] exact hratio n Q J' hn hQ hJ def degreeTailBudget (p n Q J' : ℕ) (Kf : ℝ) : ℝ := ∑ j ∈ Finset.range L, scaledMomentRatio p (j + 1) n Q J' Kf ^ momentOrder (Nat.sqrt p) theorem degreeTailBudget_nonneg (p n Q J' : ℕ) {Kf : ℝ} (hKf : 0 ≤ Kf) : 0 ≤ degreeTailBudget p n Q J' Kf := by unfold degreeTailBudget exact Finset.sum_nonneg fun j _ => pow_nonneg (scaledMomentRatio_nonneg _ _ _ _ _ hKf) _ theorem eventually_degreeTailBudget_le : ∀ᶠ p : ℕ in atTop, ∀ n Q J' : ℕ, ∀ Kf : ℝ, n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → 0 < Kf → degreeTailBudget p n Q J' Kf ≤ (L : ℝ) * (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) := by filter_upwards [eventually_all_degree_scaled_ratio] with p hp intro n Q J' Kf hn hQ hJ hKf calc degreeTailBudget p n Q J' Kf ≤ ∑ _j ∈ Finset.range L, (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) := by apply Finset.sum_le_sum intro j hj have hdL : j + 1 ≤ L := by have := Finset.mem_range.mp hj; omega exact pow_le_pow_left₀ (scaledMomentRatio_nonneg _ _ _ _ _ hKf.le) ((hp (j + 1) (by omega) hdL).2 n Q J' Kf hn hQ hJ hKf) _ _ = _ := by simp [nsmul_eq_mul] theorem rich_momentOrder_le {k : ℕ} (hk : 1 ≤ k) : RichStarAsymptotics.momentOrder k ≤ momentOrder k := by have heta : eta1 ≤ eta0 := by norm_num [eta1, eta0, ell, L] exact Nat.floor_mono (Real.rpow_le_rpow_of_exponent_le (by exact_mod_cast hk) heta) theorem k_mul_three_quarters_pow_tendsto_zero : Tendsto (fun k : ℕ => (k : ℝ) * (3 / 4 : ℝ) ^ momentOrder k) atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds RichStarAsymptotics.k_mul_three_quarters_pow_tendsto_zero · exact Eventually.of_forall fun k => mul_nonneg (Nat.cast_nonneg _) (by positivity) · filter_upwards [eventually_ge_atTop (1 : ℕ)] with k hk have hz : (RichStarAsymptotics.momentOrder k : ℝ) ≤ momentOrder k := by exact_mod_cast rich_momentOrder_le hk have hp : (3 / 4 : ℝ) ^ momentOrder k ≤ (3 / 4 : ℝ) ^ RichStarAsymptotics.momentOrder k := by simpa only [Real.rpow_natCast] using (Real.antitone_rpow_of_base_le_one (by norm_num : (0 : ℝ) < 3 / 4) (by norm_num : (3 / 4 : ℝ) ≤ 1)) hz exact mul_le_mul_of_nonneg_left hp (Nat.cast_nonneg k) /-- Explicit uniform envelope after union over every degree and every input. -/ def inputTailEnvelope (p : ℕ) : ℝ := (Nat.sqrt p : ℝ) * (L : ℝ) * (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p) theorem inputTailEnvelope_tendsto_zero : Tendsto inputTailEnvelope atTop (𝓝 0) := by change Tendsto (fun p : ℕ => (Nat.sqrt p : ℝ) * (L : ℝ) * (3 / 4 : ℝ) ^ momentOrder (Nat.sqrt p)) atTop (𝓝 0) simpa only [Function.comp_def, mul_assoc, mul_comm, mul_left_comm, mul_zero] using (k_mul_three_quarters_pow_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul (L : ℝ) theorem eventually_input_tailBudget_le : ∀ᶠ p : ℕ in atTop, ∀ a n Q J' : ℕ, ∀ Kf : ℝ, a ≤ Nat.sqrt p → n ≤ 100 * Nat.sqrt p → Q ≤ ordinaryCap (Nat.sqrt p) → J' ≤ J p → 0 < Kf → (a : ℝ) * degreeTailBudget p n Q J' Kf ≤ inputTailEnvelope p := by filter_upwards [eventually_degreeTailBudget_le] with p hp intro a n Q J' Kf ha hn hQ hJ hKf have ha' : (a : ℝ) ≤ Nat.sqrt p := by exact_mod_cast ha have hh := mul_le_mul ha' (hp n Q J' Kf hn hQ hJ hKf) (degreeTailBudget_nonneg p n Q J' hKf.le) (Nat.cast_nonneg (Nat.sqrt p)) simpa only [inputTailEnvelope, mul_assoc] using hh theorem inputTailBudget_tendsto_zero {Kf : ℝ} (hKf : 0 < Kf) : Tendsto (fun p : ℕ => (Nat.sqrt p : ℝ) * degreeTailBudget p (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) Kf) atTop (𝓝 0) := by apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds inputTailEnvelope_tendsto_zero · exact Eventually.of_forall fun p => mul_nonneg (Nat.cast_nonneg _) (degreeTailBudget_nonneg _ _ _ _ hKf.le) · filter_upwards [eventually_input_tailBudget_le] with p hp exact hp (Nat.sqrt p) (100 * Nat.sqrt p) (ordinaryCap (Nat.sqrt p)) (J p) Kf le_rfl le_rfl le_rfl le_rfl hKf /-- The sum of degree thresholds matches the exact binomial influence allowance. -/ theorem sum_degree_thresholds (k : ℕ) (Kf : ℝ) : (∑ j ∈ Finset.range L, 2 * Kf * rootScale k (j + 1)) = 200 * Kf * (k : ℝ) * (∑ j ∈ Finset.range L, ((M0 k - 1).choose j : ℝ)) := by rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _hj simp only [rootScale, Nat.add_sub_cancel] ring end Green39Submission.SparseInfluenceAsymptotics end end Green39AssemblyScope_89104d7dc55d9ad2 /- Source: Green39Submission.MaskedScoreDeletion; SHA256 489f46db84c71d4003c0bb28cf8a554317ed92a77fd55ddd6dc05722b7614544 -/ section Green39AssemblyScope_2ac9a6855386a0ef /-! The sparse-exception deletion estimate SE6. The exceptional targets are charged once by their total score range; only the complementary score is telescoped over deleted inputs. No distribution is assigned to the cleaned input. -/ namespace Green39Submission.MaskedScoreDeletion open scoped BigOperators Pointwise open ProtectedScores universe u variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- Score on the original targets outside the fixed parent's exceptional set. -/ noncomputable def restrictedScore (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A S X : Finset G) : ℝ := ∑ x ∈ Finset.univ \ X, clippedInverseNewton a L θ (representationCount A S x) /-- The original-parent influence with the exceptional targets omitted. -/ noncomputable def restrictedInputInfluence (L : ℕ) (θ K : ℝ) (A S X : Finset G) (u : G) : ℝ := ∑ t ∈ S.filter (fun t => u + t ∉ X), jumpEnvelope L θ K (representationCount A S (u + t) - 1) theorem restrictedInputInfluence_nonneg (L : ℕ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (A S X : Finset G) (u : G) : 0 ≤ restrictedInputInfluence L θ K A S X u := by exact Finset.sum_nonneg (fun t _ => jumpEnvelope_nonneg L hθ hK _) theorem fullScore_eq_restricted_add_mask (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A S X : Finset G) : fullScore a L θ A S = restrictedScore a L θ A S X + ∑ x ∈ X, clippedInverseNewton a L θ (representationCount A S x) := by exact (Finset.sum_sdiff (Finset.subset_univ X)).symm /-- Any two input sets incur the exceptional-target cost just once. -/ theorem mask_score_difference_le (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (A B S X : Finset G) : |(∑ x ∈ X, clippedInverseNewton a L θ (representationCount B S x)) - ∑ x ∈ X, clippedInverseNewton a L θ (representationCount A S x)| ≤ 2 * inverseNewtonBound a L θ * (X.card : ℝ) := by rw [← Finset.sum_sub_distrib] calc _ ≤ ∑ x ∈ X, |clippedInverseNewton a L θ (representationCount B S x) - clippedInverseNewton a L θ (representationCount A S x)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ _x ∈ X, 2 * inverseNewtonBound a L θ := Finset.sum_le_sum (fun x _ => abs_clippedInverseNewton_sub_le a L θ _ _) _ = _ := by simp [mul_comm] /-- An insertion into any descendant is bounded using the original parent's restricted influence. The extra one in the representation count removes the distinguished source before applying the monotone jump envelope. -/ theorem abs_restrictedScore_insert_le_influence (a : ℕ → ℝ) (L : ℕ) (hL : 1 ≤ L) {θ C : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hC : 0 ≤ C) (ha : ∀ j, j ≤ L → |a j| ≤ C) (A B S X : Finset G) (u : G) (hBA : B ⊆ A) (huA : u ∈ A) (huB : u ∉ B) : |restrictedScore a L θ (insert u B) S X - restrictedScore a L θ B S X| ≤ restrictedInputInfluence L θ (2 * C) A S X u := by classical have hrepr (x : G) : representationCount (insert u B) S x = if x - u ∈ S then representationCount B S x + 1 else representationCount B S x := by rw [RichStarGeometry.representationCount_comm (insert u B) S, representationCount_insert_source S B u x huB, RichStarGeometry.representationCount_comm S B] have hscalar (n : ℕ) : |clippedInverseNewton a L θ (n + 1) - clippedInverseNewton a L θ n| ≤ jumpEnvelope L θ (2 * C) n := by have h := abs_clippedInverseNewton_succ_sub_le a (L - 1) hθ hθ1 hC (fun j hj => ha j (by omega)) n simpa only [Nat.sub_add_cancel hL] using h have hK : 0 ≤ 2 * C := mul_nonneg (by norm_num) hC unfold restrictedScore rw [← Finset.sum_sub_distrib] calc _ ≤ ∑ x ∈ Finset.univ \ X, |clippedInverseNewton a L θ (representationCount (insert u B) S x) - clippedInverseNewton a L θ (representationCount B S x)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x ∈ Finset.univ \ X, if x - u ∈ S then jumpEnvelope L θ (2 * C) (representationCount A S x - 1) else 0 := by apply Finset.sum_le_sum intro x _ rw [hrepr] by_cases hx : x - u ∈ S · rw [if_pos hx, if_pos hx] have hcount : representationCount B S x + 1 ≤ representationCount A S x := by have h := representationCount_mono (Finset.insert_subset_iff.mpr ⟨huA, hBA⟩) (Finset.Subset.refl S) x rw [hrepr, if_pos hx] at h exact h exact (hscalar _).trans (jumpEnvelope_mono L hθ.le hK (by omega)) · rw [if_neg hx, if_neg hx, sub_self, abs_zero] _ = restrictedInputInfluence L θ (2 * C) A S X u := by unfold restrictedInputInfluence rw [← Finset.sum_filter] refine Finset.sum_bij (fun x _ => x - u) ?_ ?_ ?_ ?_ · intro x hx rcases Finset.mem_filter.mp hx with ⟨hxX, hxuS⟩ apply Finset.mem_filter.mpr refine ⟨hxuS, ?_⟩ have hcancel : u + (x - u) = x := by abel rw [hcancel] exact (Finset.mem_sdiff.mp hxX).2 · intro x _ y _ hxy exact sub_left_inj.mp hxy · intro t ht rcases Finset.mem_filter.mp ht with ⟨htS, hutX⟩ refine ⟨u + t, Finset.mem_filter.mpr ⟨?_, ?_⟩, ?_⟩ · exact Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, hutX⟩ · simpa only [add_sub_cancel_left] using htS · exact add_sub_cancel_left u t · intro x _ have hx : u + (x - u) = x := by abel rw [hx] theorem abs_restrictedScore_delete_le_influence (a : ℕ → ℝ) (L : ℕ) (hL : 1 ≤ L) {θ C : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hC : 0 ≤ C) (ha : ∀ j, j ≤ L → |a j| ≤ C) (A E S X : Finset G) (hEA : E ⊆ A) : |restrictedScore a L θ (A \ E) S X - restrictedScore a L θ A S X| ≤ ∑ u ∈ E, restrictedInputInfluence L θ (2 * C) A S X u := by exact abs_delete_sub_le_sum A E (fun B => restrictedScore a L θ B S X) (restrictedInputInfluence L θ (2 * C) A S X) (fun u hu B hBA huB => abs_restrictedScore_insert_le_influence a L hL hθ hθ1 hC ha A B S X u hBA hu huB) hEA /-- SE6 with its original exceptional set: the full score remains on both sides, and the mask contributes only `2 B_h |X|`, independent of deletion size. -/ theorem abs_fullScore_delete_le_restrictedInfluence (a : ℕ → ℝ) (L : ℕ) (hL : 1 ≤ L) {θ C : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hC : 0 ≤ C) (ha : ∀ j, j ≤ L → |a j| ≤ C) (A E S X : Finset G) (hEA : E ⊆ A) : |fullScore a L θ (A \ E) S - fullScore a L θ A S| ≤ (∑ u ∈ E, restrictedInputInfluence L θ (2 * C) A S X u) + 2 * inverseNewtonBound a L θ * (X.card : ℝ) := by rw [fullScore_eq_restricted_add_mask a L θ (A \ E) S X, fullScore_eq_restricted_add_mask a L θ A S X] have hsplit : (restrictedScore a L θ (A \ E) S X + ∑ x ∈ X, clippedInverseNewton a L θ (representationCount (A \ E) S x)) - (restrictedScore a L θ A S X + ∑ x ∈ X, clippedInverseNewton a L θ (representationCount A S x)) = (restrictedScore a L θ (A \ E) S X - restrictedScore a L θ A S X) + ((∑ x ∈ X, clippedInverseNewton a L θ (representationCount (A \ E) S x)) - ∑ x ∈ X, clippedInverseNewton a L θ (representationCount A S x)) := by ring rw [hsplit] exact (abs_add_le _ _).trans (add_le_add (abs_restrictedScore_delete_le_influence a L hL hθ hθ1 hC ha A E S X hEA) (mask_score_difference_le a L θ A (A \ E) S X)) theorem fullScore_delete_upper_of_restricted_bounds (a : ℕ → ℝ) (L : ℕ) (hL : 1 ≤ L) {θ C K : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hC : 0 ≤ C) (hK : 0 ≤ K) (ha : ∀ j, j ≤ L → |a j| ≤ C) (A E S X : Finset G) (b : ℕ) (hEA : E ⊆ A) (hEb : E.card ≤ b) (hinf : ∀ u ∈ E, restrictedInputInfluence L θ (2 * C) A S X u ≤ K) : fullScore a L θ (A \ E) S ≤ fullScore a L θ A S + (b : ℝ) * K + 2 * inverseNewtonBound a L θ * (X.card : ℝ) := by have h := (le_abs_self (fullScore a L θ (A \ E) S - fullScore a L θ A S)).trans (abs_fullScore_delete_le_restrictedInfluence a L hL hθ hθ1 hC ha A E S X hEA) have hsum : (∑ u ∈ E, restrictedInputInfluence L θ (2 * C) A S X u) ≤ (b : ℝ) * K := by calc _ ≤ ∑ _u ∈ E, K := Finset.sum_le_sum hinf _ = (E.card : ℝ) * K := by simp _ ≤ (b : ℝ) * K := mul_le_mul_of_nonneg_right (by exact_mod_cast hEb) hK linarith end Green39Submission.MaskedScoreDeletion end Green39AssemblyScope_2ac9a6855386a0ef /- Source: Green39Submission.ScoreInfluence; SHA256 4e9558e93b7be3cb5504b83e6b50e523b200588865a3d3d4cc6e5021e6eb3921 -/ section Green39AssemblyScope_b84342c37e639069 /-! Actual sparse score influences as labelled rooted source polynomials. The parent exceptional target set is fixed before source thinning. A source support keeps its distinguished root label, even when another root gives the same physical support. The source tail will be applied jointly with the event that the input is unprotected. -/ namespace Green39Submission.ScoreInfluence open scoped BigOperators Pointwise Classical open ProtectedScores SourceProbability RootedDerivativeBounds variable {G : Type*} [AddCommGroup G] [DecidableEq G] /-- Full parent rows at retained targets, and empty rows at masked targets. -/ def scoreRows (A T X : Finset G) (u t : G) : Finset G := if u + t ∈ X then ∅ else T.filter (fun q => u + t - q ∈ A) theorem scoreRows_card_le (A T X : Finset G) (u : G) (M : ℕ) (hM : ∀ x : G, x ∉ X → representationCount A T x ≤ M) (t : G) : (scoreRows A T X u t).card ≤ M := by by_cases hx : u + t ∈ X · simp [scoreRows, hx] · simpa only [scoreRows, if_neg hx, representationCount] using hM (u + t) hx theorem scoreRows_geometry (A T X : Finset G) (u t q : G) (hq : q ∈ scoreRows A T X u t) : u + t - q ∈ A := by by_cases hx : u + t ∈ X · simp [scoreRows, hx] at hq · have hq' : q ∈ T.filter (fun q => u + t - q ∈ A) := by simpa only [scoreRows, if_neg hx] using hq exact (Finset.mem_filter.mp hq').2 theorem scoreRows_inter (A T X S : Finset G) (u t : G) (hST : S ⊆ T) (hx : u + t ∉ X) : scoreRows A T X u t ∩ S = S.filter (fun q => u + t - q ∈ A) := by ext q simp only [scoreRows, if_neg hx, Finset.mem_inter, Finset.mem_filter] constructor · rintro ⟨⟨_, hrow⟩, hS⟩ exact ⟨hS, hrow⟩ · rintro ⟨hS, hrow⟩ exact ⟨⟨hST hS, hrow⟩, hS⟩ /-- Selecting all support bits turns the original eligible rooted family exactly into the rooted family on the selected set. -/ theorem selected_rootedStars_eq (E S : Finset G) (W : G → Finset G) (d : ℕ) (hSE : S ⊆ E) : (rootedStars E W d).filter (fun i => i.2 ⊆ S) = rootedStars S W d := by ext i simp only [Finset.mem_filter, mem_rootedStars] constructor · rintro ⟨⟨_htE, hQWE, hcard, htQ⟩, hQS⟩ exact ⟨hQS htQ, Finset.subset_inter (hQWE.trans Finset.inter_subset_left) hQS, hcard, htQ⟩ · rintro ⟨htS, hQWS, hcard, htQ⟩ exact ⟨⟨hSE htS, Finset.subset_inter (hQWS.trans Finset.inter_subset_left) ((hQWS.trans Finset.inter_subset_right).trans hSE), hcard, htQ⟩, hQWS.trans Finset.inter_subset_right⟩ /-- The degree-(j+1) labelled count is the exact adjacent-jump binomial coefficient, summed over retained selected roots. -/ theorem card_score_rootedStars (A T X S : Finset G) (u : G) (j : ℕ) (hST : S ⊆ T) (hu : u ∈ A) : (rootedStars S (scoreRows A T X u) (j + 1)).card = ∑ t ∈ S.filter (fun t => u + t ∉ X), (representationCount A S (u + t) - 1).choose j := by have hroot : (rootedStars S (scoreRows A T X u) (j + 1)).card = ∑ t ∈ S, (((scoreRows A T X u t ∩ S).powersetCard (j + 1)).filter (fun Q => {t} ⊆ Q)).card := by have heq : rootedStars S (scoreRows A T X u) (j + 1) = RichStar.labelledRows S (fun t => ((scoreRows A T X u t ∩ S).powersetCard (j + 1)).filter (fun Q => {t} ⊆ Q)) := by ext ⟨t, Q⟩ simp only [mem_rootedStars, RichStar.mem_labelledRows, Finset.mem_filter, Finset.mem_powersetCard, Finset.singleton_subset_iff] tauto rw [heq, RichStar.card_labelledRows] rw [hroot, Finset.sum_filter] apply Finset.sum_congr rfl intro t ht by_cases hx : u + t ∈ X · simp [scoreRows, hx] · rw [if_pos hx] have htrow : {t} ⊆ scoreRows A T X u t ∩ S := by apply Finset.singleton_subset_iff.mpr rw [scoreRows_inter A T X S u t hST hx] exact Finset.mem_filter.mpr ⟨ht, by simpa only [add_sub_cancel_right] using hu⟩ rw [Finset.card_filter_powersetCard_subset {t} (scoreRows A T X u t ∩ S) (j + 1) htrow (by simp)] rw [scoreRows_inter A T X S u t hST hx] simp only [Finset.card_singleton, Nat.add_sub_cancel] rfl /-- A single homogeneous degree of the actual source influence. -/ noncomputable def scoreDegree (E A T X : Finset G) (u : G) (d : ℕ) (θ K : ℝ) (S : Finset G) : ℝ := containmentSum (rootedStars E (scoreRows A T X u) d) (fun i => i.2) (fun _ => K * (θ⁻¹) ^ d) S theorem scoreDegree_nonneg (E A T X : Finset G) (u : G) (d : ℕ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (S : Finset G) : 0 ≤ scoreDegree E A T X u d θ K S := by unfold scoreDegree containmentSum apply Finset.sum_nonneg intro i _ split_ifs · exact mul_nonneg hK (pow_nonneg (inv_nonneg.mpr hθ) d) · exact le_rfl theorem scoreDegree_eq_sum (E A T X S : Finset G) (u : G) (j : ℕ) (θ K : ℝ) (hSE : S ⊆ E) (hST : S ⊆ T) (hu : u ∈ A) : scoreDegree E A T X u (j + 1) θ K S = ∑ t ∈ S.filter (fun t => u + t ∉ X), K * (θ⁻¹) ^ (j + 1) * ((representationCount A S (u + t) - 1).choose j : ℝ) := by have hconst : scoreDegree E A T X u (j + 1) θ K S = (((rootedStars E (scoreRows A T X u) (j + 1)).filter (fun i => i.2 ⊆ S)).card : ℝ) * (K * (θ⁻¹) ^ (j + 1)) := by exact RichStar.containmentSum_const_eq_card (rootedStars E (scoreRows A T X u) (j + 1)) (fun i => i.2) (K * (θ⁻¹) ^ (j + 1)) S rw [hconst, selected_rootedStars_eq E S _ _ hSE, card_score_rootedStars A T X S u j hST hu, Nat.cast_sum, Finset.sum_mul] apply Finset.sum_congr rfl intro t _ ring variable [Fintype G] /-- Removing exceptional input points only decreases the fixed-parent influence envelope. Thus a source bound proved using original A also controls the clean parent A\\E0 used by the deletion comparison. -/ theorem restrictedInputInfluence_mono_input (A B S X : Finset G) (u : G) (L : ℕ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hBA : B ⊆ A) : MaskedScoreDeletion.restrictedInputInfluence L θ K B S X u ≤ MaskedScoreDeletion.restrictedInputInfluence L θ K A S X u := by apply Finset.sum_le_sum intro t _ exact jumpEnvelope_mono L hθ hK (Nat.sub_le_sub_right (representationCount_mono hBA (Finset.Subset.refl S) (u + t)) 1) /-- The actual restricted score influence is exactly a finite sum of the rooted homogeneous source polynomials; there is no extra support multiplicity. -/ theorem restrictedInputInfluence_eq_sum_degrees (E A T X S : Finset G) (u : G) (L : ℕ) (θ K : ℝ) (hSE : S ⊆ E) (hST : S ⊆ T) (hu : u ∈ A) : MaskedScoreDeletion.restrictedInputInfluence L θ K A S X u = ∑ j ∈ Finset.range L, scoreDegree E A T X u (j + 1) θ K S := by simp_rw [scoreDegree_eq_sum E A T X S u _ θ K hSE hST hu] rw [Finset.sum_comm] unfold MaskedScoreDeletion.restrictedInputInfluence apply Finset.sum_congr rfl intro t _ unfold jumpEnvelope rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _ rw [pow_succ] ring omit [Fintype G] in /-- PS14 for one homogeneous degree, on the eligible source universe. The normalizing root bound may be the fixed 100k even when T is smaller or empty. -/ theorem scoreDegree_derivative_bound {A T D X : Finset G} {M d Q J nRoots : ℕ} {θ K : ℝ} (hT : T.card ≤ nRoots) (hM : ∀ x : G, x ∉ X → representationCount A T x ≤ M) (hQ : ∀ v : G, v ∉ D → (T.filter (fun t => t - v ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hθ : 0 < θ) (hK : 0 ≤ K) (u : G) (B : Finset G) : RawMoments.sourceDerivative (rootedStars (RichStar.eligibleSources T D u) (scoreRows A T X u) d) (fun i => i.2) (fun _ => K * (θ⁻¹) ^ d) θ B ≤ K * rootedDerivativeBound nRoots Q J M d θ B.card := by have hc : (RichStar.eligibleSources T D u).card ≤ nRoots := (Finset.card_le_card (RichStar.eligibleSources_subset T D u)).trans hT exact (sourceDerivative_scaled_subfamily_le_profile (Finset.Subset.refl _) (fun t _ => scoreRows_card_le A T X u M hM t) (fun t _ q hq => scoreRows_geometry A T X u t q hq) (RichStar.eligible_root_overlap_cap hQ u) hJ B hK hθ).trans (mul_le_mul_of_nonneg_left (RichStar.rootedDerivativeBound_mono_roots hc Q J M d B.card hθ.le) hK) omit [Fintype G] in /-- A homogeneous score degree has the actual joint tail with an unprotected input. No division by the probability of being unprotected occurs. -/ theorem free_scoreDegree_tail {A E0 T D X : Finset G} {M d Q J nRoots z : ℕ} {θ K t : ℝ} (hT : T.card ≤ nRoots) (hM : ∀ x : G, x ∉ X → representationCount A T x ≤ M) (hQ : ∀ v : G, v ∉ D → (T.filter (fun s => s - v ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) (ht : 0 < t) (hz : 1 ≤ z) {u : G} (hu : u ∈ A \ E0) : bernoulliMean T θ (fun S => if u ∉ protectedInputs A E0 S D ∧ t < scoreDegree (RichStar.eligibleSources T D u) A T X u d θ K S then 1 else 0) ≤ ((∑ j ∈ Finset.range (d + 1), ((d * z).choose j : ℝ) * (K * rootedDerivativeBound nRoots Q J M d θ j)) / t) ^ z := by let V := RichStarGeometry.ordinarySources T D u let E := RichStar.eligibleSources T D u let Z := scoreDegree E A T X u d θ K have hVT : V ⊆ T := Finset.filter_subset _ _ have hpoint : ∀ S, S ⊆ T → (if u ∉ protectedInputs A E0 S D ∧ t < Z S then (1 : ℝ) else 0) ≤ (if Disjoint V S ∧ t < Z S then 1 else 0) := by intro S hST by_cases hbad : u ∉ protectedInputs A E0 S D ∧ t < Z S · have havoid : Disjoint V S := (RichStar.free_input_iff_ordinary_absent hST (Finset.mem_sdiff.mp hu).1 (Finset.mem_sdiff.mp hu).2).mp hbad.1 simp only [if_pos hbad, if_pos (And.intro havoid hbad.2), le_refl] · rw [if_neg hbad] split_ifs <;> norm_num calc _ ≤ bernoulliMean T θ (fun S => if Disjoint V S ∧ t < Z S then 1 else 0) := bernoulliMean_mono T hθ.le hθ1 hpoint _ ≤ bernoulliMean E θ (fun S => if t < Z S then 1 else 0) := RichStar.source_joint_avoid_event_le hVT hθ.le hθ1 (fun S => t < Z S) _ ≤ _ := by apply RichStar.source_raw_moment_tail E (rootedStars E (scoreRows A T X u) d) (fun i => i.2) (fun _ => K * (θ⁻¹) ^ d) hθ.le hθ1 ht (fun _i hi => rooted_support_subset hi) (fun _i _hi => mul_nonneg hK (pow_nonneg (inv_nonneg.mpr hθ.le) d)) d z hz (fun _i hi => le_of_eq (mem_rootedStars.mp hi).2.2.1) · intro j exact mul_nonneg hK (RichStar.rootedDerivativeBound_nonneg _ _ _ _ _ _ hθ.le) · intro j hj rw [RichStar.rootedDerivativeBound_eq_zero_of_lt _ _ _ _ _ _ _ hj, mul_zero] · intro B exact scoreDegree_derivative_bound hT hM hQ hJ hθ hK u B /-- The complete restricted influence tail follows by a finite degree union. Each degree may retain its own exact binomial normalizer. -/ theorem free_restrictedInputInfluence_tail {A E0 T D X : Finset G} {L M Q J nRoots z : ℕ} {θ K : ℝ} (threshold : ℕ → ℝ) (hT : T.card ≤ nRoots) (hM : ∀ x : G, x ∉ X → representationCount A T x ≤ M) (hQ : ∀ v : G, v ∉ D → (T.filter (fun s => s - v ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) (ht : ∀ j ∈ Finset.range L, 0 < threshold (j + 1)) (hz : 1 ≤ z) {u : G} (hu : u ∈ A \ E0) : bernoulliMean T θ (fun S => if u ∉ protectedInputs A E0 S D ∧ (∑ j ∈ Finset.range L, threshold (j + 1)) < MaskedScoreDeletion.restrictedInputInfluence L θ K A S X u then 1 else 0) ≤ ∑ j ∈ Finset.range L, ((∑ r ∈ Finset.range (j + 1 + 1), (((j + 1) * z).choose r : ℝ) * (K * rootedDerivativeBound nRoots Q J M (j + 1) θ r)) / threshold (j + 1)) ^ z := by let E := RichStar.eligibleSources T D u let degreeEvent (j : ℕ) (S : Finset G) := u ∉ protectedInputs A E0 S D ∧ threshold (j + 1) < scoreDegree E A T X u (j + 1) θ K S have hpoint : ∀ S, S ⊆ T → (if u ∉ protectedInputs A E0 S D ∧ (∑ j ∈ Finset.range L, threshold (j + 1)) < MaskedScoreDeletion.restrictedInputInfluence L θ K A S X u then (1 : ℝ) else 0) ≤ ∑ j ∈ Finset.range L, if degreeEvent j S then 1 else 0 := by intro S hST by_cases hbad : u ∉ protectedInputs A E0 S D ∧ (∑ j ∈ Finset.range L, threshold (j + 1)) < MaskedScoreDeletion.restrictedInputInfluence L θ K A S X u · rw [if_pos hbad] have havoid := (RichStar.free_input_iff_ordinary_absent hST (Finset.mem_sdiff.mp hu).1 (Finset.mem_sdiff.mp hu).2).mp hbad.1 have hSE : S ⊆ E := RichStar.source_subset_eligible_of_avoid hST havoid have hsum := hbad.2 rw [restrictedInputInfluence_eq_sum_degrees E A T X S u L θ K hSE hST (Finset.mem_sdiff.mp hu).1] at hsum obtain ⟨j, hj, hhigh⟩ : ∃ j ∈ Finset.range L, threshold (j + 1) < scoreDegree E A T X u (j + 1) θ K S := by by_contra! h exact (not_le_of_gt hsum) (Finset.sum_le_sum h) have hjbad : degreeEvent j S := ⟨hbad.1, hhigh⟩ simpa only [if_pos hjbad] using (Finset.single_le_sum (f := fun j => if degreeEvent j S then (1 : ℝ) else 0) (fun j _ => by split_ifs <;> norm_num) hj) · rw [if_neg hbad] exact Finset.sum_nonneg (fun j _ => by split_ifs <;> norm_num) calc _ ≤ bernoulliMean T θ (fun S => ∑ j ∈ Finset.range L, if degreeEvent j S then 1 else 0) := bernoulliMean_mono T hθ.le hθ1 hpoint _ = ∑ j ∈ Finset.range L, bernoulliMean T θ (fun S => if degreeEvent j S then 1 else 0) := bernoulliMean_sum _ _ _ _ _ ≤ _ := by apply Finset.sum_le_sum intro j hj exact free_scoreDegree_tail hT hM hQ hJ hθ hθ1 hK (ht j hj) hz hu /-- The exact finite sum of the degreewise raw-moment tails. -/ noncomputable def influenceTailBudget (L M Q J nRoots z : ℕ) (θ K : ℝ) (threshold : ℕ → ℝ) : ℝ := ∑ j ∈ Finset.range L, ((∑ r ∈ Finset.range (j + 1 + 1), (((j + 1) * z).choose r : ℝ) * (K * rootedDerivativeBound nRoots Q J M (j + 1) θ r)) / threshold (j + 1)) ^ z theorem influenceTailBudget_nonneg (L M Q J nRoots z : ℕ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (threshold : ℕ → ℝ) (ht : ∀ j ∈ Finset.range L, 0 < threshold (j + 1)) : 0 ≤ influenceTailBudget L M Q J nRoots z θ K threshold := by apply Finset.sum_nonneg intro j hj apply pow_nonneg apply div_nonneg _ (ht j hj).le apply Finset.sum_nonneg intro r _ exact mul_nonneg (Nat.cast_nonneg _) (mul_nonneg hK (RichStar.rootedDerivativeBound_nonneg _ _ _ _ _ _ hθ)) /-- Union over the actual input set. Its cost is at most |A| times the degreewise tail sum, uniformly for every deterministic parent. -/ theorem all_free_restrictedInputInfluence_tail {A E0 T D X : Finset G} {L M Q J nRoots z : ℕ} {θ K : ℝ} (threshold : ℕ → ℝ) (hT : T.card ≤ nRoots) (hM : ∀ x : G, x ∉ X → representationCount A T x ≤ M) (hQ : ∀ v : G, v ∉ D → (T.filter (fun s => s - v ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) (ht : ∀ j ∈ Finset.range L, 0 < threshold (j + 1)) (hz : 1 ≤ z) : bernoulliMean T θ (fun S => if ∃ u ∈ A \ E0, u ∉ protectedInputs A E0 S D ∧ (∑ j ∈ Finset.range L, threshold (j + 1)) < MaskedScoreDeletion.restrictedInputInfluence L θ K A S X u then 1 else 0) ≤ (A.card : ℝ) * influenceTailBudget L M Q J nRoots z θ K threshold := by let bad (u : G) (S : Finset G) := u ∉ protectedInputs A E0 S D ∧ (∑ j ∈ Finset.range L, threshold (j + 1)) < MaskedScoreDeletion.restrictedInputInfluence L θ K A S X u have hpoint : ∀ S, S ⊆ T → (if ∃ u ∈ A \ E0, bad u S then (1 : ℝ) else 0) ≤ ∑ u ∈ A \ E0, if bad u S then 1 else 0 := by intro S _hS by_cases hbad : ∃ u ∈ A \ E0, bad u S · rw [if_pos hbad] obtain ⟨u, hu, hbad⟩ := hbad simpa only [if_pos hbad] using (Finset.single_le_sum (f := fun u => if bad u S then (1 : ℝ) else 0) (fun u _ => by split_ifs <;> norm_num) hu) · rw [if_neg hbad] exact Finset.sum_nonneg (fun u _ => by split_ifs <;> norm_num) calc _ ≤ bernoulliMean T θ (fun S => ∑ u ∈ A \ E0, if bad u S then 1 else 0) := bernoulliMean_mono T hθ.le hθ1 hpoint _ = ∑ u ∈ A \ E0, bernoulliMean T θ (fun S => if bad u S then 1 else 0) := bernoulliMean_sum _ _ _ _ _ ≤ ∑ _u ∈ A \ E0, influenceTailBudget L M Q J nRoots z θ K threshold := by apply Finset.sum_le_sum intro u hu exact free_restrictedInputInfluence_tail threshold hT hM hQ hJ hθ hθ1 hK ht hz hu _ = ((A \ E0).card : ℝ) * influenceTailBudget L M Q J nRoots z θ K threshold := by simp only [Finset.sum_const, nsmul_eq_mul] _ ≤ _ := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr (Finset.card_le_card Finset.sdiff_subset)) (influenceTailBudget_nonneg _ _ _ _ _ _ hθ.le hK threshold ht) end Green39Submission.ScoreInfluence end Green39AssemblyScope_b84342c37e639069 /- Source: Green39Submission.ScalarThinning; SHA256 f2a9491c0e05585f1df065a158c0bad617b05ae171cbc1d798428f82a10cf608 -/ section Green39AssemblyScope_73371f9e144ee61a /-! The uniform scalar thinning estimate PS4. Cancellation of the inverse thinning powers gives a polynomial expression for the exact Bernoulli mean. Beyond the fixed Newton degree this expression is a nonnegative factor times a Newton polynomial with coefficients continuous at zero. A quantitative binomial comparison makes its negative leading term dominate uniformly at every sufficiently large representation count. The remaining counts form a fixed finite family. -/ noncomputable section namespace Green39Submission namespace ScalarThinning open scoped BigOperators Topology open Filter ProtectedScores SourceProbability universe u /-- The inverse powers disappear after multiplication by the cardinal weight. -/ def cancelledNewton (a : ℕ → ℝ) (θ : ℝ) (n : ℕ) : ℝ := ∑ j ∈ Finset.range (n + 1), a j * θ ^ (n - j) * (n.choose j : ℝ) /-- Exact polynomial extension of the clipped-score expectation to theta zero. -/ def meanPolynomial (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (r : ℕ) : ℝ := ∑ n ∈ Finset.range (L + 1), cancelledNewton a θ n * (1 - θ) ^ (r - n) * (r.choose n : ℝ) /-- The fixed-degree coefficients after extracting the large-count power. -/ def factoredCoeff (a : ℕ → ℝ) (L : ℕ) (θ : ℝ) (n : ℕ) : ℝ := cancelledNewton a θ n * (1 - θ) ^ (L - n) theorem cancelledNewton_zero (a : ℕ → ℝ) (n : ℕ) : cancelledNewton a 0 n = a n := by unfold cancelledNewton rw [Finset.sum_range_succ] have hz : (∑ j ∈ Finset.range n, a j * (0 : ℝ) ^ (n - j) * (n.choose j : ℝ)) = 0 := by apply Finset.sum_eq_zero intro j hj have hnj : n - j ≠ 0 := Nat.ne_of_gt (Nat.sub_pos_of_lt (Finset.mem_range.mp hj)) simp [zero_pow hnj] simp [hz] theorem factoredCoeff_zero (a : ℕ → ℝ) (L n : ℕ) : factoredCoeff a L 0 n = a n := by simp [factoredCoeff, cancelledNewton_zero] theorem meanPolynomial_zero (a : ℕ → ℝ) (L r : ℕ) : meanPolynomial a L 0 r = newtonValue a L r := by simp [meanPolynomial, newtonValue, cancelledNewton_zero] theorem continuous_cancelledNewton (a : ℕ → ℝ) (n : ℕ) : Continuous (fun θ => cancelledNewton a θ n) := by unfold cancelledNewton fun_prop theorem continuous_factoredCoeff (a : ℕ → ℝ) (L n : ℕ) : Continuous (fun θ => factoredCoeff a L θ n) := by exact (continuous_cancelledNewton a n).mul ((continuous_const.sub continuous_id).pow _) theorem continuous_meanPolynomial (a : ℕ → ℝ) (L r : ℕ) : Continuous (fun θ => meanPolynomial a L θ r) := by unfold meanPolynomial apply continuous_finsetSum intro n _ exact ((continuous_cancelledNewton a n).mul ((continuous_const.sub continuous_id).pow _)).mul continuous_const theorem pow_mul_inverseNewton (a : ℕ → ℝ) (L n : ℕ) {θ : ℝ} (hθ : θ ≠ 0) (hnL : n ≤ L) : θ ^ n * inverseNewton a L θ n = cancelledNewton a θ n := by rw [inverseNewton, newtonValue_truncate _ hnL] unfold newtonValue cancelledNewton rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j hj have hjn : j ≤ n := Nat.le_of_lt_succ (Finset.mem_range.mp hj) calc θ ^ n * (a j * (θ⁻¹) ^ j * (n.choose j : ℝ)) = a j * (θ ^ n * (θ⁻¹) ^ j) * (n.choose j : ℝ) := by ring _ = _ := by rw [pow_mul_inv_pow_of_le θ hθ hjn] /-- The cardinality distribution of the finite independent source law. -/ theorem bernoulliMean_card {α : Type u} [DecidableEq α] (T : Finset α) (θ : ℝ) (f : ℕ → ℝ) : bernoulliMean T θ (fun S => f S.card) = ∑ n ∈ Finset.range (T.card + 1), (T.card.choose n : ℝ) * (θ ^ n * (1 - θ) ^ (T.card - n) * f n) := by classical unfold bernoulliMean calc (∑ S ∈ T.powerset, bernoulliWeight T S θ * f S.card) = ∑ S ∈ T.powerset, θ ^ S.card * (1 - θ) ^ (T.card - S.card) * f S.card := by apply Finset.sum_congr rfl intro S hS rw [bernoulliWeight, Finset.card_sdiff_of_subset (Finset.mem_powerset.mp hS)] _ = _ := by rw [Finset.sum_powerset] apply Finset.sum_congr rfl intro n _ simpa only [nsmul_eq_mul] using (Finset.sum_powersetCard n T (fun j => θ ^ j * (1 - θ) ^ (T.card - j) * f j)) /-- No inverse powers remain in the actual mean, for positive thinning rates. -/ theorem bernoulliMean_clipped_eq_meanPolynomial {α : Type u} [DecidableEq α] (T : Finset α) (a : ℕ → ℝ) (L : ℕ) {θ : ℝ} (hθ : θ ≠ 0) : bernoulliMean T θ (fun S => clippedInverseNewton a L θ S.card) = meanPolynomial a L θ T.card := by classical rw [bernoulliMean_card] let term : ℕ → ℝ := fun n => (T.card.choose n : ℝ) * (θ ^ n * (1 - θ) ^ (T.card - n) * clippedInverseNewton a L θ n) have hterm (n : ℕ) (hn : n ≤ L) : term n = cancelledNewton a θ n * (1 - θ) ^ (T.card - n) * (T.card.choose n : ℝ) := by dsimp [term] rw [clippedInverseNewton, if_pos hn] calc (T.card.choose n : ℝ) * (θ ^ n * (1 - θ) ^ (T.card - n) * inverseNewton a L θ n) = (θ ^ n * inverseNewton a L θ n) * (1 - θ) ^ (T.card - n) * (T.card.choose n : ℝ) := by ring _ = _ := by rw [pow_mul_inverseNewton a L n hθ hn] have hsum : (∑ n ∈ Finset.range (T.card + 1), term n) = ∑ n ∈ Finset.range (L + 1), term n := by calc (∑ n ∈ Finset.range (T.card + 1), term n) = ∑ n ∈ Finset.range (max T.card L + 1), term n := by apply Finset.sum_subset (Finset.range_mono (Nat.succ_le_succ (Nat.le_max_left _ _))) intro n _ hn have hcn : T.card < n := by have hnot : ¬n < T.card + 1 := fun h => hn (Finset.mem_range.mpr h) omega simp [term, Nat.choose_eq_zero_of_lt hcn] _ = ∑ n ∈ Finset.range (L + 1), term n := by symm apply Finset.sum_subset (Finset.range_mono (Nat.succ_le_succ (Nat.le_max_right _ _))) intro n _ hn have hLn : L < n := by have hnot : ¬n < L + 1 := fun h => hn (Finset.mem_range.mpr h) omega simp [term, clippedInverseNewton_eq_zero a L θ hLn] change (∑ n ∈ Finset.range (T.card + 1), term n) = meanPolynomial a L θ T.card rw [hsum] apply Finset.sum_congr rfl intro n hn exact hterm n (Nat.le_of_lt_succ (Finset.mem_range.mp hn)) /-- The only large-count dependence outside the Newton polynomial is nonnegative when the thinning rate lies in the probability interval. -/ theorem meanPolynomial_factor (a : ℕ → ℝ) (L r : ℕ) (θ : ℝ) (hLr : L ≤ r) : meanPolynomial a L θ r = (1 - θ) ^ (r - L) * newtonValue (factoredCoeff a L θ) L r := by unfold meanPolynomial newtonValue factoredCoeff rw [Finset.mul_sum] apply Finset.sum_congr rfl intro n hn have hnL : n ≤ L := Nat.le_of_lt_succ (Finset.mem_range.mp hn) have hsplit : r - n = (r - L) + (L - n) := by omega rw [hsplit, pow_add] ring /-- A lower-degree binomial loses a factor of at least `r-L+1` against the leading binomial. This is the uniform large-count gain. -/ theorem lower_choose_mul_le {j L r : ℕ} (hjL : j < L) (hLr : L ≤ r) : ((r - L + 1 : ℕ) : ℝ) * (r.choose j : ℝ) ≤ ((j + 1 : ℕ) : ℝ) * (L.choose (j + 1) : ℝ) * (r.choose L : ℝ) := by have hdiff : r - L + 1 ≤ r - j := by omega have hstep : (r.choose (j + 1) : ℝ) * ((j + 1 : ℕ) : ℝ) = (r.choose j : ℝ) * ((r - j : ℕ) : ℝ) := by exact_mod_cast Nat.choose_succ_right_eq r j calc ((r - L + 1 : ℕ) : ℝ) * (r.choose j : ℝ) ≤ ((r - j : ℕ) : ℝ) * (r.choose j : ℝ) := mul_le_mul_of_nonneg_right (Nat.cast_le.mpr hdiff) (Nat.cast_nonneg _) _ = ((j + 1 : ℕ) : ℝ) * (r.choose (j + 1) : ℝ) := by nlinarith [hstep] _ ≤ ((j + 1 : ℕ) : ℝ) * ((L.choose (j + 1) : ℝ) * (r.choose L : ℝ)) := mul_le_mul_of_nonneg_left (choose_le_choose_mul (by omega) hLr) (Nat.cast_nonneg _) _ = _ := by ring /-- A fixed lower-coefficient mass controls every lower-degree term. -/ def lowerMass (a : ℕ → ℝ) (L : ℕ) : ℝ := ∑ j ∈ Finset.range L, (|a j| + 1) * ((j + 1 : ℕ) : ℝ) * (L.choose (j + 1) : ℝ) theorem lowerMass_nonneg (a : ℕ → ℝ) (L : ℕ) : 0 ≤ lowerMass a L := by unfold lowerMass exact Finset.sum_nonneg (fun j _ => mul_nonneg (mul_nonneg (by positivity) (Nat.cast_nonneg _)) (Nat.cast_nonneg _)) /-- Leading-coefficient domination, uniformly for every count beyond a fixed threshold. The lower coefficients are allowed a unit perturbation. -/ theorem newtonValue_nonpos_of_uniform_bounds (a b : ℕ → ℝ) (L r : ℕ) {c : ℝ} (hc : 0 < c) (hLr : L ≤ r) (hTop : b L ≤ -c) (hLower : ∀ j ∈ Finset.range L, |b j| ≤ |a j| + 1) (hMass : lowerMass a L ≤ ((r - L + 1 : ℕ) : ℝ) * c) : newtonValue b L r ≤ 0 := by let q : ℝ := ((r - L + 1 : ℕ) : ℝ) have hq : 0 < q := by dsimp [q]; positivity have hterm (j : ℕ) (hj : j ∈ Finset.range L) : q * (b j * (r.choose j : ℝ)) ≤ ((|a j| + 1) * ((j + 1 : ℕ) : ℝ) * (L.choose (j + 1) : ℝ)) * (r.choose L : ℝ) := by calc q * (b j * (r.choose j : ℝ)) ≤ q * (|b j| * (r.choose j : ℝ)) := mul_le_mul_of_nonneg_left (mul_le_mul_of_nonneg_right (le_abs_self _) (Nat.cast_nonneg _)) hq.le _ = |b j| * (q * (r.choose j : ℝ)) := by ring _ ≤ |b j| * (((j + 1 : ℕ) : ℝ) * (L.choose (j + 1) : ℝ) * (r.choose L : ℝ)) := mul_le_mul_of_nonneg_left (lower_choose_mul_le (Finset.mem_range.mp hj) hLr) (abs_nonneg _) _ ≤ (|a j| + 1) * (((j + 1 : ℕ) : ℝ) * (L.choose (j + 1) : ℝ) * (r.choose L : ℝ)) := mul_le_mul_of_nonneg_right (hLower j hj) (by positivity) _ = _ := by ring have hdom : lowerMass a L + q * b L ≤ 0 := by have ht := mul_le_mul_of_nonneg_left hTop hq.le change lowerMass a L ≤ q * c at hMass nlinarith have hscaled : q * newtonValue b L r ≤ 0 := by unfold newtonValue rw [Finset.sum_range_succ, mul_add, Finset.mul_sum] calc (∑ j ∈ Finset.range L, q * (b j * (r.choose j : ℝ))) + q * (b L * (r.choose L : ℝ)) ≤ (∑ j ∈ Finset.range L, ((|a j| + 1) * ((j + 1 : ℕ) : ℝ) * (L.choose (j + 1) : ℝ)) * (r.choose L : ℝ)) + q * (b L * (r.choose L : ℝ)) := add_le_add (Finset.sum_le_sum hterm) le_rfl _ = (lowerMass a L + q * b L) * (r.choose L : ℝ) := by rw [lowerMass, add_mul, Finset.sum_mul] ring _ ≤ 0 := mul_nonpos_of_nonpos_of_nonneg hdom (Nat.cast_nonneg _) by_contra hpos exact (not_lt_of_ge hscaled) (mul_pos hq (lt_of_not_ge hpos)) /-- A single finite cutoff works for all sufficiently small thinning parameters. This is stronger than separate convergence statements at each fixed count. -/ theorem eventually_nonpos_large_counts (a : ℕ → ℝ) (L : ℕ) (hTop : a L < 0) : ∃ R : ℕ, L ≤ R ∧ ∀ᶠ θ in 𝓝 (0 : ℝ), ∀ r : ℕ, R ≤ r → newtonValue (factoredCoeff a L θ) L r ≤ 0 := by let c : ℝ := -(a L) / 2 have hc : 0 < c := by dsimp [c]; linarith have hgap : a L < -c := by dsimp [c]; linarith obtain ⟨N, hN⟩ := exists_nat_ge (lowerMass a L / c) have hNmass : lowerMass a L ≤ (N : ℝ) * c := (div_le_iff₀ hc).mp hN have htopLimit : Tendsto (fun θ => factoredCoeff a L θ L) (𝓝 (0 : ℝ)) (𝓝 (a L)) := by simpa only [factoredCoeff_zero] using ((continuous_factoredCoeff a L L).continuousAt (x := (0 : ℝ))).tendsto have htopEvent : ∀ᶠ θ in 𝓝 (0 : ℝ), factoredCoeff a L θ L ≤ -c := (htopLimit.eventually (eventually_lt_nhds hgap)).mono (fun _ h => h.le) have hlowerEvent : ∀ᶠ θ in 𝓝 (0 : ℝ), ∀ j ∈ Finset.range L, |factoredCoeff a L θ j| ≤ |a j| + 1 := by apply (Filter.eventually_all_finset (Finset.range L)).2 intro j _ have hlimit : Tendsto (fun θ => |factoredCoeff a L θ j|) (𝓝 (0 : ℝ)) (𝓝 |a j|) := by simpa only [factoredCoeff_zero] using (((continuous_factoredCoeff a L j).abs).continuousAt (x := (0 : ℝ))).tendsto exact (hlimit.eventually (eventually_lt_nhds (show |a j| < |a j| + 1 by linarith))).mono (fun _ h => h.le) refine ⟨L + N + 1, by omega, ?_⟩ filter_upwards [htopEvent, hlowerEvent] with θ htop hlower intro r hr apply newtonValue_nonpos_of_uniform_bounds a (factoredCoeff a L θ) L r hc (by omega) htop hlower have hNr : (N : ℝ) ≤ ((r - L + 1 : ℕ) : ℝ) := by exact_mod_cast (show N ≤ r - L + 1 by omega) exact hNmass.trans (mul_le_mul_of_nonneg_right hNr hc.le) /-- Uniform scalar upper error near theta zero, after cancellation of inverse powers. Large counts use one common cutoff; small counts use one finite event. -/ theorem eventually_meanPolynomial_le (a : ℕ → ℝ) (L : ℕ) (hZero : a 0 = 1) (hTop : a L < 0) (hSign : ∀ r : ℕ, 1 ≤ r → newtonValue a L r ≤ 0) {ε : ℝ} (hε : 0 < ε) : ∀ᶠ θ in 𝓝 (0 : ℝ), θ ≤ 1 → ∀ r : ℕ, meanPolynomial a L θ r ≤ (if r = 0 then 1 else 0) + ε := by obtain ⟨R, hLR, hlarge⟩ := eventually_nonpos_large_counts a L hTop have hsmall : ∀ᶠ θ in 𝓝 (0 : ℝ), ∀ r ∈ Finset.range R, meanPolynomial a L θ r < (if r = 0 then 1 else 0) + ε := by apply (Filter.eventually_all_finset (Finset.range R)).2 intro r _ have hbase : newtonValue a L r ≤ (if r = 0 then 1 else 0) := by by_cases hr : r = 0 · subst r simp [ProtectedScores.newtonValue_zero, hZero] · simpa only [if_neg hr] using hSign r (Nat.one_le_iff_ne_zero.mpr hr) have hstrict : newtonValue a L r < (if r = 0 then 1 else 0) + ε := by linarith have hlimit : Tendsto (fun θ => meanPolynomial a L θ r) (𝓝 (0 : ℝ)) (𝓝 (newtonValue a L r)) := by simpa only [meanPolynomial_zero] using ((continuous_meanPolynomial a L r).continuousAt (x := (0 : ℝ))).tendsto exact hlimit.eventually (eventually_lt_nhds hstrict) filter_upwards [hlarge, hsmall] with θ htail hfinite intro hθ1 r by_cases hr : r < R · exact (hfinite r (Finset.mem_range.mpr hr)).le · have hRr : R ≤ r := Nat.le_of_not_gt hr rw [meanPolynomial_factor a L r θ (hLR.trans hRr)] have hnonpos := mul_nonpos_of_nonneg_of_nonpos (pow_nonneg (sub_nonneg.mpr hθ1) (r - L)) (htail r hRr) exact hnonpos.trans (by split_ifs <;> linarith) /-- PS4 with a single positive threshold valid for every natural count. -/ theorem meanPolynomial_uniform (a : ℕ → ℝ) (L : ℕ) (hZero : a 0 = 1) (hTop : a L < 0) (hSign : ∀ r : ℕ, 1 ≤ r → newtonValue a L r ≤ 0) {ε : ℝ} (hε : 0 < ε) : ∃ δ : ℝ, 0 < δ ∧ δ ≤ 1 ∧ ∀ θ : ℝ, 0 < θ → θ ≤ δ → ∀ r : ℕ, meanPolynomial a L θ r ≤ (if r = 0 then 1 else 0) + ε := by obtain ⟨η, hη, hball⟩ := Metric.eventually_nhds_iff.mp (eventually_meanPolynomial_le a L hZero hTop hSign hε) refine ⟨min 1 (η / 2), lt_min zero_lt_one (half_pos hη), min_le_left _ _, ?_⟩ intro θ hθ hθδ r have hθ1 : θ ≤ 1 := hθδ.trans (min_le_left _ _) have hdist : dist θ 0 < η := by rw [Real.dist_eq, sub_zero, abs_of_pos hθ] exact (hθδ.trans (min_le_right _ _)).trans_lt (half_lt_self hη) exact hball hdist hθ1 r /-- The actual finite-source PS4 endpoint. The threshold depends on the fixed coefficient data and error, and is uniform over all finite source sets. -/ theorem clippedInverseNewton_mean_uniform {α : Type u} [DecidableEq α] (a : ℕ → ℝ) (L : ℕ) (hZero : a 0 = 1) (hTop : a L < 0) (hSign : ∀ r : ℕ, 1 ≤ r → newtonValue a L r ≤ 0) {ε : ℝ} (hε : 0 < ε) : ∃ δ : ℝ, 0 < δ ∧ δ ≤ 1 ∧ ∀ θ : ℝ, 0 < θ → θ ≤ δ → ∀ T : Finset α, bernoulliMean T θ (fun S => clippedInverseNewton a L θ S.card) ≤ (if T = ∅ then 1 else 0) + ε := by obtain ⟨δ, hδ, hδ1, hbound⟩ := meanPolynomial_uniform a L hZero hTop hSign hε refine ⟨δ, hδ, hδ1, ?_⟩ intro θ hθ hθδ T rw [bernoulliMean_clipped_eq_meanPolynomial T a L hθ.ne'] simpa only [Finset.card_eq_zero] using hbound θ hθ hθδ T.card /-- The compiled consecutive-root polynomial supplies every PS2 hypothesis. No uniform thinning bound is assumed in this specialization. -/ theorem ep_clippedInverseNewton_mean_uniform {α : Type u} [DecidableEq α] (L d : ℕ) (hL : Odd L) {ε : ℝ} (hε : 0 < ε) : ∃ δ : ℝ, 0 < δ ∧ δ ≤ 1 ∧ ∀ θ : ℝ, 0 < θ → θ ≤ δ → ∀ T : Finset α, bernoulliMean T θ (fun S => clippedInverseNewton (Scalar.newtonCoeff L d) L θ S.card) ≤ (if T = ∅ then 1 else 0) + ε := by apply clippedInverseNewton_mean_uniform (Scalar.newtonCoeff L d) L (Scalar.newtonCoeff_zero hL.pos) (Scalar.newtonCoeff_top_neg hL) · intro r hr have hvalue : newtonValue (Scalar.newtonCoeff L d) L r = Scalar.integerValue L d r := (Scalar.integerValue_eq_newton_sum hL.pos d r).symm rw [hvalue] exact Scalar.integerValue_nonpos hL hr · exact hε end ScalarThinning end Green39Submission end end Green39AssemblyScope_73371f9e144ee61a /- Source: Green39Submission.SourceConcentration; SHA256 85ee6148bb9bc090c06148ff4d0ea1683388cc990ad49f7d1abfd2853a1830d5 -/ section Green39AssemblyScope_3f0a34f31d85cec4 /-! Exact finite source concentration, shared by size windows and score extraction. -/ namespace Green39Submission.ScoreExtraction open scoped BigOperators Pointwise Classical open SourceProbability ProtectedScores universe u section SourceTail variable {α : Type u} [DecidableEq α] theorem mean_centered_square (T : Finset α) (θ : ℝ) (f : Finset α → ℝ) : bernoulliMean T θ (fun S => (f S - bernoulliMean T θ f) ^ 2) = bernoulliVariance T θ f := by calc _ = bernoulliMean T θ (fun S => (f S) ^ 2 + (-2 * bernoulliMean T θ f) * f S + (bernoulliMean T θ f) ^ 2) := by apply bernoulliMean_congr intro S _ ring _ = _ := by rw [bernoulliMean_add, bernoulliMean_add, bernoulliMean_const_mul, bernoulliMean_const] unfold bernoulliVariance ring theorem bernoulliVariance_nonneg (T : Finset α) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (f : Finset α → ℝ) : 0 ≤ bernoulliVariance T θ f := by rw [← mean_centered_square] exact bernoulliMean_nonneg T hθ hθ1 (fun _ _ => sq_nonneg _) /-- Source Chebyshev, as an exact finite weighted inequality. -/ theorem source_deviation_square (T : Finset α) {θ a : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 ≤ a) (f : Finset α → ℝ) : a ^ 2 * bernoulliMean T θ (fun S => if a < |f S - bernoulliMean T θ f| then 1 else 0) ≤ bernoulliVariance T θ f := by have hpoint : ∀ S, S ⊆ T → a ^ 2 * (if a < |f S - bernoulliMean T θ f| then 1 else 0) ≤ (f S - bernoulliMean T θ f) ^ 2 := by intro S _ by_cases h : a < |f S - bernoulliMean T θ f| · rw [if_pos h, mul_one] simpa only [sq_abs] using pow_le_pow_left₀ ha h.le 2 · rw [if_neg h, mul_zero] exact sq_nonneg _ have hm := bernoulliMean_mono T hθ hθ1 hpoint simpa only [bernoulliMean_const_mul, mean_centered_square] using hm theorem source_deviation_tail (T : Finset α) {θ a : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 < a) (f : Finset α → ℝ) : bernoulliMean T θ (fun S => if a < |f S - bernoulliMean T θ f| then 1 else 0) ≤ bernoulliVariance T θ f / a ^ 2 := by apply (le_div_iff₀ (sq_pos_of_pos ha)).mpr simpa only [mul_comm] using source_deviation_square T hθ hθ1 ha.le f /-- A deterministic mean upper bound can be used without changing the source law. -/ theorem source_upper_tail_of_mean_le (T : Finset α) {θ a m : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 < a) (f : Finset α → ℝ) (hmean : bernoulliMean T θ f ≤ m) : bernoulliMean T θ (fun S => if m + a < f S then 1 else 0) ≤ bernoulliVariance T θ f / a ^ 2 := by refine (bernoulliMean_mono T hθ hθ1 ?_).trans (source_deviation_tail T hθ hθ1 ha f) intro S _ by_cases h : m + a < f S · have hdev : a < |f S - bernoulliMean T θ f| := by exact lt_of_lt_of_le (by linarith) (le_abs_self _) simp only [if_pos h, if_pos hdev, le_refl] · simp only [if_neg h] split_ifs <;> norm_num end SourceTail end Green39Submission.ScoreExtraction end Green39AssemblyScope_3f0a34f31d85cec4 /- Source: Green39Submission.ScoreExtraction; SHA256 d23cd32498a596fd08a4ce1c45a23a18cd046dd51a0509366cd36ce7cf772e0e -/ section Green39AssemblyScope_f009c35d9f79583e /-! Actual score extraction and external-alias charges for a fixed original parent. All source probabilities are finite Bernoulli means. No law is assigned to an adaptively selected descriptor or to the input after cleanup. -/ namespace Green39Submission.ScoreExtraction open scoped BigOperators Pointwise Classical open SourceProbability ProtectedScores universe u v section ParentScoreMean variable {α : Type u} [DecidableEq α] /-- Bits irrelevant to a fixed target row can be removed exactly from the source law. This is a finite identity, not a distributional approximation. -/ theorem mean_filter_card (T : Finset α) (p : α → Prop) [DecidablePred p] (θ : ℝ) (f : ℕ → ℝ) : bernoulliMean T θ (fun S => f (S.filter p).card) = bernoulliMean (T.filter p) θ (fun S => f S.card) := by let W := T.filter p have hWT : W ⊆ T := Finset.filter_subset _ _ have hfilter (S : Finset α) (hS : S ⊆ T) : S.filter p = S \ (T \ W) := by ext t have hST : t ∈ S → t ∈ T := fun h => hS h simp only [W, Finset.mem_filter, Finset.mem_sdiff] tauto calc _ = bernoulliMean T θ (fun S => f (S \ (T \ W)).card) := by apply bernoulliMean_congr intro S hS rw [hfilter S hS] _ = bernoulliMean (T \ (T \ W)) θ (fun S => f S.card) := bernoulliMean_remove T (T \ W) θ (fun S => f S.card) _ = _ := by rw [Finset.sdiff_sdiff_eq_self hWT] end ParentScoreMean section FullScoreMean variable {G : Type v} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- PS5 from the type-independent scalar bound. Its threshold can be chosen before the prime/group and before every adaptive parent pair. -/ theorem fullScore_mean_le_of_scalar_bound (a : ℕ → ℝ) (L : ℕ) {θ ε : ℝ} (hθ : θ ≠ 0) (hscalar : ∀ r : ℕ, ScalarThinning.meanPolynomial a L θ r ≤ (if r = 0 then 1 else 0) + ε) (A T : Finset G) : bernoulliMean T θ (fullScore a L θ A) ≤ (holeSet A T).card + ε * (Fintype.card G : ℝ) := by classical have hrow (x : G) : bernoulliMean T θ (fun S => clippedInverseNewton a L θ (representationCount A S x)) ≤ (if representationCount A T x = 0 then 1 else 0) + ε := by change bernoulliMean T θ (fun S => clippedInverseNewton a L θ (S.filter (fun t => x - t ∈ A)).card) ≤ _ rw [mean_filter_card T (fun t => x - t ∈ A) θ (clippedInverseNewton a L θ), ScalarThinning.bernoulliMean_clipped_eq_meanPolynomial _ a L hθ] exact hscalar (representationCount A T x) have hholes : (∑ x : G, if representationCount A T x = 0 then (1 : ℝ) else 0) = ((holeSet A T).card : ℝ) := by rw [← Finset.sum_filter, ← holeSet_eq_filter_zero] simp calc bernoulliMean T θ (fullScore a L θ A) = ∑ x : G, bernoulliMean T θ (fun S => clippedInverseNewton a L θ (representationCount A S x)) := bernoulliMean_sum T θ Finset.univ _ _ ≤ ∑ x : G, ((if representationCount A T x = 0 then 1 else 0) + ε) := Finset.sum_le_sum (fun x _ => hrow x) _ = _ := by rw [Finset.sum_add_distrib, hholes] simp only [Finset.sum_const, Finset.card_univ, nsmul_eq_mul] ring /-- The actual score upper tail, ready to intersect with all other source requirements. No global parent multiplicity cap is used here. -/ theorem fullScore_upper_tail_le (a : ℕ → ℝ) (L : ℕ) {θ ε margin : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hmargin : 0 < margin) (hscalar : ∀ r : ℕ, ScalarThinning.meanPolynomial a L θ r ≤ (if r = 0 then 1 else 0) + ε) (A T : Finset G) : bernoulliMean T θ (fun S => if (holeSet A T).card + ε * (Fintype.card G : ℝ) + margin < fullScore a L θ A S then 1 else 0) ≤ ((T.card : ℝ) * θ * (1 - θ) * ((A.card : ℝ) * (2 * inverseNewtonBound a L θ)) ^ 2) / margin ^ 2 := by exact (source_upper_tail_of_mean_le T hθ.le hθ1 hmargin (fullScore a L θ A) (fullScore_mean_le_of_scalar_bound a L (ne_of_gt hθ) hscalar A T)).trans (div_le_div_of_nonneg_right (fullScore_variance_le a L hθ.le hθ1 A T) (sq_nonneg _)) end FullScoreMean section ExternalCharge variable {α : Type u} [DecidableEq α] /-- A selected external witness has two distinct paid source bits. The free subset excludes both; in the application it is the target row with the distinguished internal source removed. -/ noncomputable def twoSourceCharge (t q : α) (F : Finset α) (L : ℕ) (θ : ℝ) (S : Finset α) : ℝ := ∑ j ∈ Finset.range L, ∑ Q ∈ F.powersetCard j, if insert t (insert q Q) ⊆ S then (θ⁻¹) ^ (j + 1) else 0 theorem twoSourceCharge_nonneg (t q : α) (F : Finset α) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (S : Finset α) : 0 ≤ twoSourceCharge t q F L θ S := by apply Finset.sum_nonneg intro j _ apply Finset.sum_nonneg intro Q _ split_ifs · exact pow_nonneg (inv_nonneg.mpr hθ) _ · exact le_rfl /-- The complete finite two-source cancellation, including the extra theta. No independence between different witnesses is required. -/ theorem mean_twoSourceCharge (T F : Finset α) (t q : α) (ht : t ∈ T) (hq : q ∈ T) (hF : F ⊆ T) (htq : t ≠ q) (htF : t ∉ F) (hqF : q ∉ F) (L : ℕ) {θ : ℝ} (hθ : θ ≠ 0) : bernoulliMean T θ (twoSourceCharge t q F L θ) = θ * ∑ j ∈ Finset.range L, (F.card.choose j : ℝ) := by unfold twoSourceCharge rw [bernoulliMean_sum] calc (∑ j ∈ Finset.range L, bernoulliMean T θ (fun S => ∑ Q ∈ F.powersetCard j, if insert t (insert q Q) ⊆ S then (θ⁻¹) ^ (j + 1) else 0)) = ∑ j ∈ Finset.range L, ∑ Q ∈ F.powersetCard j, θ := by apply Finset.sum_congr rfl intro j _ rw [bernoulliMean_sum] apply Finset.sum_congr rfl intro Q hQ obtain ⟨hQF, hQcard⟩ := Finset.mem_powersetCard.mp hQ have hqQ : q ∉ Q := fun h => hqF (hQF h) have htQ : t ∉ insert q Q := by simp only [Finset.mem_insert, not_or] exact ⟨htq, fun h => htF (hQF h)⟩ have hsub : insert t (insert q Q) ⊆ T := Finset.insert_subset_iff.mpr ⟨ht, Finset.insert_subset_iff.mpr ⟨hq, hQF.trans hF⟩⟩ calc bernoulliMean T θ (fun S => if insert t (insert q Q) ⊆ S then (θ⁻¹) ^ (j + 1) else 0) = (θ⁻¹) ^ (j + 1) * bernoulliMean T θ (fun S => if insert t (insert q Q) ⊆ S then 1 else 0) := by rw [← bernoulliMean_const_mul] apply bernoulliMean_congr intro S _ split_ifs <;> simp _ = (θ⁻¹) ^ (j + 1) * θ ^ (j + 2) := by rw [bernoulliMean_selected hsub, Finset.card_insert_of_notMem htQ, Finset.card_insert_of_notMem hqQ, hQcard] _ = θ := by rw [show j + 2 = (j + 1) + 1 by omega, pow_succ θ (j + 1), ← mul_assoc, ← mul_pow, inv_mul_cancel₀ hθ, one_pow, one_mul] _ = θ * ∑ j ∈ Finset.range L, (F.card.choose j : ℝ) := by simp only [Finset.sum_const, Finset.card_powersetCard, nsmul_eq_mul] rw [Finset.mul_sum] apply Finset.sum_congr rfl intro j _ ring /-- One suitable witness pays the full theta^(-c) target weight, with its distinguished source excluded from the additional free source subset. -/ theorem inv_pow_le_twoSourceCharge (t q : α) (F S : Finset α) (L c : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (hc : 1 ≤ c) (hcL : c ≤ L) (ht : t ∈ S) (hq : q ∈ S) (hroom : c - 1 ≤ (F ∩ S).card) : (θ⁻¹) ^ c ≤ twoSourceCharge t q F L θ S := by obtain ⟨Q, hQ⟩ : ((F ∩ S).powersetCard (c - 1)).Nonempty := Finset.powersetCard_nonempty.mpr hroom obtain ⟨hQFS, hQcard⟩ := Finset.mem_powersetCard.mp hQ have hQF : Q ∈ F.powersetCard (c - 1) := Finset.mem_powersetCard.mpr ⟨hQFS.trans Finset.inter_subset_left, hQcard⟩ have hsupport : insert t (insert q Q) ⊆ S := Finset.insert_subset_iff.mpr ⟨ht, Finset.insert_subset_iff.mpr ⟨hq, hQFS.trans Finset.inter_subset_right⟩⟩ have hinner : (θ⁻¹) ^ c ≤ ∑ Q' ∈ F.powersetCard (c - 1), if insert t (insert q Q') ⊆ S then (θ⁻¹) ^ ((c - 1) + 1) else 0 := by have hn (Q' : Finset α) (_ : Q' ∈ F.powersetCard (c - 1)) : 0 ≤ (if insert t (insert q Q') ⊆ S then (θ⁻¹) ^ ((c - 1) + 1) else 0) := by split_ifs · exact pow_nonneg (inv_nonneg.mpr hθ) _ · exact le_rfl simpa only [if_pos hsupport, Nat.sub_add_cancel hc] using (Finset.single_le_sum hn hQF) unfold twoSourceCharge have hjmem : c - 1 ∈ Finset.range L := Finset.mem_range.mpr (by omega) refine hinner.trans (Finset.single_le_sum (f := fun j => ∑ Q' ∈ F.powersetCard j, if insert t (insert q Q') ⊆ S then (θ⁻¹) ^ (j + 1) else 0) ?_ hjmem) intro j _ apply Finset.sum_nonneg intro Q' _ split_ifs · exact pow_nonneg (inv_nonneg.mpr hθ) _ · exact le_rfl end ExternalCharge section ActualInfluence variable {G : Type v} [AddCommGroup G] [DecidableEq G] [Fintype G] theorem representationCount_insert_input (B S : Finset G) (u x : G) (hu : u ∉ B) : representationCount (insert u B) S x = if x - u ∈ S then representationCount B S x + 1 else representationCount B S x := by rw [RichStarGeometry.representationCount_comm (insert u B) S, representationCount_insert_source S B u x hu, RichStarGeometry.representationCount_comm S B] /-- The PS13 input envelope is computed from the fixed parent and the chosen source set; every later input deletion uses this same function. -/ noncomputable def inputInfluence (L : ℕ) (θ K : ℝ) (A S : Finset G) (u : G) : ℝ := ∑ t ∈ S, jumpEnvelope L θ K (representationCount A S (u + t) - 1) theorem inputInfluence_nonneg (L : ℕ) {θ K : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (A S : Finset G) (u : G) : 0 ≤ inputInfluence L θ K A S u := by exact Finset.sum_nonneg (fun t _ => jumpEnvelope_nonneg L hθ hK _) /-- The sharper scalar envelope applies uniformly to every descendant input of the original parent. No maximum-profile hypothesis is used in this step. -/ theorem abs_fullScore_insert_input_le_influence (a : ℕ → ℝ) (L : ℕ) (hL : 1 ≤ L) {θ C : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hC : 0 ≤ C) (ha : ∀ j, j ≤ L → |a j| ≤ C) (A B S : Finset G) (u : G) (hBA : B ⊆ A) (huA : u ∈ A) (huB : u ∉ B) : |fullScore a L θ (insert u B) S - fullScore a L θ B S| ≤ inputInfluence L θ (2 * C) A S u := by classical have hscalar (n : ℕ) : |clippedInverseNewton a L θ (n + 1) - clippedInverseNewton a L θ n| ≤ jumpEnvelope L θ (2 * C) n := by have h := abs_clippedInverseNewton_succ_sub_le a (L - 1) hθ hθ1 hC (fun j hj => ha j (by omega)) n simpa only [Nat.sub_add_cancel hL] using h have hK : 0 ≤ 2 * C := mul_nonneg (by norm_num) hC unfold fullScore rw [← Finset.sum_sub_distrib] calc |∑ x : G, (clippedInverseNewton a L θ (representationCount (insert u B) S x) - clippedInverseNewton a L θ (representationCount B S x))| ≤ ∑ x : G, |clippedInverseNewton a L θ (representationCount (insert u B) S x) - clippedInverseNewton a L θ (representationCount B S x)| := Finset.abs_sum_le_sum_abs _ _ _ ≤ ∑ x : G, if x - u ∈ S then jumpEnvelope L θ (2 * C) (representationCount A S x - 1) else 0 := by apply Finset.sum_le_sum intro x _ rw [representationCount_insert_input B S u x huB] by_cases hx : x - u ∈ S · rw [if_pos hx, if_pos hx] have hcount : representationCount B S x + 1 ≤ representationCount A S x := by have h := representationCount_mono (Finset.insert_subset_iff.mpr ⟨huA, hBA⟩) (Finset.Subset.refl S) x rw [representationCount_insert_input B S u x huB, if_pos hx] at h exact h exact (hscalar _).trans (jumpEnvelope_mono L hθ.le hK (by omega)) · rw [if_neg hx, if_neg hx, sub_self, abs_zero] _ = inputInfluence L θ (2 * C) A S u := by unfold inputInfluence rw [← Finset.sum_filter] refine Finset.sum_bij (fun x _ => x - u) ?_ ?_ ?_ ?_ · intro x hx exact (Finset.mem_filter.mp hx).2 · intro x _ y _ hxy have h := congrArg (fun z : G => z + u) hxy simpa only [sub_add_cancel] using h · intro t ht refine ⟨u + t, Finset.mem_filter.mpr ⟨Finset.mem_univ _, ?_⟩, ?_⟩ · simpa only [add_sub_cancel_left] using ht · exact add_sub_cancel_left u t · intro x _ have hx : u + (x - u) = x := by abel rw [hx] /-- PS13 for all deletions, using the original input's influence envelopes. -/ theorem abs_fullScore_delete_le_influence (a : ℕ → ℝ) (L : ℕ) (hL : 1 ≤ L) {θ C : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hC : 0 ≤ C) (ha : ∀ j, j ≤ L → |a j| ≤ C) (A E S : Finset G) (hEA : E ⊆ A) : |fullScore a L θ (A \ E) S - fullScore a L θ A S| ≤ ∑ u ∈ E, inputInfluence L θ (2 * C) A S u := by exact abs_delete_sub_le_sum A E (fun B => fullScore a L θ B S) (inputInfluence L θ (2 * C) A S) (fun u hu B hBA huB => abs_fullScore_insert_input_le_influence a L hL hθ hθ1 hC ha A B S u hBA hu huB) hEA end ActualInfluence section ActualExternalWitnesses variable {G : Type v} [AddCommGroup G] [DecidableEq G] /-- The ordinary input/source incidences of a fixed deterministic parent. -/ def aliasIncidences (A T D : Finset G) : Finset (G × G) := (A.product T).filter (fun i => i.2 - i.1 ∈ D) /-- A witness label is `(t,u,q)`, with target `u+t`; q is outside that target's parent row. Distinct target labels are never identified. -/ def externalWitnesses (A T D : Finset G) : Finset (G × G × G) := (T.product (aliasIncidences A T D)).filter (fun i => i.2.1 + i.1 - i.2.2 ∉ A) theorem mem_externalWitnesses (A T D : Finset G) (i : G × G × G) : i ∈ externalWitnesses A T D ↔ i.1 ∈ T ∧ i.2.1 ∈ A ∧ i.2.2 ∈ T ∧ i.2.2 - i.2.1 ∈ D ∧ i.2.1 + i.1 - i.2.2 ∉ A := by simp only [externalWitnesses, aliasIncidences, Finset.product_eq_sprod, Finset.mem_filter, Finset.mem_product] tauto theorem card_aliasIncidences (A T D : Finset G) : (aliasIncidences A T D).card = ∑ u ∈ A, (RichStarGeometry.ordinarySources T D u).card := by simp only [aliasIncidences, RichStarGeometry.ordinarySources, Finset.card_eq_sum_ones, Finset.sum_filter, Finset.product_eq_sprod, Finset.sum_product] /-- EX6: the actual ordered potential witness list has at most K|T|² members. -/ theorem card_externalWitnesses_le (A T D : Finset G) (K : ℕ) (hK : ∀ q ∈ T, representationCount A D q ≤ K) : (externalWitnesses A T D).card ≤ K * T.card ^ 2 := by calc (externalWitnesses A T D).card ≤ (T.product (aliasIncidences A T D)).card := Finset.card_filter_le _ _ _ = T.card * ∑ u ∈ A, (RichStarGeometry.ordinarySources T D u).card := by rw [Finset.product_eq_sprod, Finset.card_product, card_aliasIncidences] _ ≤ T.card * (T.card * K) := Nat.mul_le_mul_left _ (RichStarGeometry.sum_card_ordinarySources_le hK) _ = K * T.card ^ 2 := by ring def witnessRow (A T : Finset G) (i : G × G × G) : Finset G := T.filter (fun r => i.2.1 + i.1 - r ∈ A) def witnessFree (A T : Finset G) (i : G × G × G) : Finset G := witnessRow A T i \ {i.1} theorem witness_geometry (A T D : Finset G) (i : G × G × G) (hi : i ∈ externalWitnesses A T D) : i.1 ∈ T ∧ i.2.2 ∈ T ∧ witnessFree A T i ⊆ T ∧ i.1 ≠ i.2.2 ∧ i.1 ∉ witnessFree A T i ∧ i.2.2 ∉ witnessFree A T i := by obtain ⟨ht, hu, hq, hD, hqA⟩ := (mem_externalWitnesses A T D i).mp hi have htq : i.1 ≠ i.2.2 := by intro h apply hqA simpa only [h, add_sub_cancel_right] using hu refine ⟨ht, hq, Finset.sdiff_subset.trans (Finset.filter_subset _ _), htq, ?_, ?_⟩ · simp [witnessFree] · intro h exact hqA (Finset.mem_filter.mp (Finset.mem_sdiff.mp h).1).2 theorem card_witnessFree_le (A T D : Finset G) (i : G × G × G) (hi : i ∈ externalWitnesses A T D) (M : ℕ) (hM : ∀ x : G, representationCount A T x ≤ M) : (witnessFree A T i).card ≤ M - 1 := by have hti : i.1 ∈ witnessRow A T i := by obtain ⟨ht, hu, hq, hD, hqA⟩ := (mem_externalWitnesses A T D i).mp hi exact Finset.mem_filter.mpr ⟨ht, by simpa only [add_sub_cancel_right] using hu⟩ have hcard := Finset.card_sdiff_add_card_eq_card (Finset.singleton_subset_iff.mpr hti) have hcap : (witnessRow A T i).card ≤ M := hM (i.2.1 + i.1) change (witnessRow A T i \ {i.1}).card ≤ M - 1 simp only [Finset.card_singleton] at hcard omega noncomputable def totalExternalCharge (A T D : Finset G) (L : ℕ) (θ : ℝ) (S : Finset G) : ℝ := ∑ i ∈ externalWitnesses A T D, twoSourceCharge i.1 i.2.2 (witnessFree A T i) L θ S theorem totalExternalCharge_nonneg (A T D : Finset G) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (S : Finset G) : 0 ≤ totalExternalCharge A T D L θ S := by exact Finset.sum_nonneg (fun i _ => twoSourceCharge_nonneg _ _ _ _ hθ S) /-- EX5's complete parent-uniform mean bound, with the finite binomial factor retained. The row/alias hypotheses concern the original deterministic parent. -/ theorem mean_totalExternalCharge_le (A T D : Finset G) (L K M : ℕ) {θ : ℝ} (hθ : 0 < θ) (hK : ∀ q ∈ T, representationCount A D q ≤ K) (hM : ∀ x : G, representationCount A T x ≤ M) : bernoulliMean T θ (totalExternalCharge A T D L θ) ≤ (K : ℝ) * (T.card : ℝ) ^ 2 * θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ) := by unfold totalExternalCharge rw [bernoulliMean_sum] have hfactor : 0 ≤ θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ) := mul_nonneg hθ.le (Finset.sum_nonneg (fun j _ => Nat.cast_nonneg _)) calc (∑ i ∈ externalWitnesses A T D, bernoulliMean T θ (twoSourceCharge i.1 i.2.2 (witnessFree A T i) L θ)) ≤ ∑ _i ∈ externalWitnesses A T D, θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ) := by apply Finset.sum_le_sum intro i hi obtain ⟨ht, hq, hF, htq, htF, hqF⟩ := witness_geometry A T D i hi rw [mean_twoSourceCharge T (witnessFree A T i) i.1 i.2.2 ht hq hF htq htF hqF L (ne_of_gt hθ)] apply mul_le_mul_of_nonneg_left _ hθ.le apply Finset.sum_le_sum intro j _ exact_mod_cast Nat.choose_le_choose j (card_witnessFree_le A T D i hi M hM) _ = ((externalWitnesses A T D).card : ℝ) * (θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ)) := by simp only [Finset.sum_const, nsmul_eq_mul] _ ≤ ((K * T.card ^ 2 : ℕ) : ℝ) * (θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ)) := by apply mul_le_mul_of_nonneg_right _ hfactor exact_mod_cast card_externalWitnesses_le A T D K hK _ = _ := by push_cast; ring /-- Sparse EX keeps only witnesses whose target is outside the fixed parent exceptional set. The target remains part of the label through `(t,u,q)`. -/ def externalWitnessesOutside (A T D X : Finset G) : Finset (G × G × G) := (externalWitnesses A T D).filter (fun i => i.2.1 + i.1 ∉ X) noncomputable def totalExternalChargeOutside (A T D X : Finset G) (L : ℕ) (θ : ℝ) (S : Finset G) : ℝ := ∑ i ∈ externalWitnessesOutside A T D X, twoSourceCharge i.1 i.2.2 (witnessFree A T i) L θ S theorem totalExternalChargeOutside_nonneg (A T D X : Finset G) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) (S : Finset G) : 0 ≤ totalExternalChargeOutside A T D X L θ S := by exact Finset.sum_nonneg (fun i _ => twoSourceCharge_nonneg _ _ _ _ hθ S) theorem card_witnessFree_le_at (A T D : Finset G) (i : G × G × G) (hi : i ∈ externalWitnesses A T D) (M : ℕ) (hM : representationCount A T (i.2.1 + i.1) ≤ M) : (witnessFree A T i).card ≤ M - 1 := by have hti : i.1 ∈ witnessRow A T i := by obtain ⟨ht, hu, hq, hD, hqA⟩ := (mem_externalWitnesses A T D i).mp hi exact Finset.mem_filter.mpr ⟨ht, by simpa only [add_sub_cancel_right] using hu⟩ have hcard := Finset.card_sdiff_add_card_eq_card (Finset.singleton_subset_iff.mpr hti) change (witnessRow A T i).card ≤ M at hM change (witnessRow A T i \ {i.1}).card ≤ M - 1 simp only [Finset.card_singleton] at hcard omega /-- The sparse EX mean uses a profile cap only outside X. It imposes no cap at an exceptional target and pays no additional factor for its multiplicity. -/ theorem mean_totalExternalChargeOutside_le (A T D X : Finset G) (L K M : ℕ) {θ : ℝ} (hθ : 0 < θ) (hK : ∀ q ∈ T, representationCount A D q ≤ K) (hM : ∀ x : G, x ∉ X → representationCount A T x ≤ M) : bernoulliMean T θ (totalExternalChargeOutside A T D X L θ) ≤ (K : ℝ) * (T.card : ℝ) ^ 2 * θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ) := by unfold totalExternalChargeOutside rw [bernoulliMean_sum] have hfactor : 0 ≤ θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ) := mul_nonneg hθ.le (Finset.sum_nonneg (fun j _ => Nat.cast_nonneg _)) calc (∑ i ∈ externalWitnessesOutside A T D X, bernoulliMean T θ (twoSourceCharge i.1 i.2.2 (witnessFree A T i) L θ)) ≤ ∑ _i ∈ externalWitnessesOutside A T D X, θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ) := by apply Finset.sum_le_sum intro i hi obtain ⟨hi, hx⟩ := Finset.mem_filter.mp hi obtain ⟨ht, hq, hF, htq, htF, hqF⟩ := witness_geometry A T D i hi rw [mean_twoSourceCharge T (witnessFree A T i) i.1 i.2.2 ht hq hF htq htF hqF L (ne_of_gt hθ)] apply mul_le_mul_of_nonneg_left _ hθ.le apply Finset.sum_le_sum intro j _ exact_mod_cast Nat.choose_le_choose j (card_witnessFree_le_at A T D i hi M (hM _ hx)) _ = ((externalWitnessesOutside A T D X).card : ℝ) * (θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ)) := by simp only [Finset.sum_const, nsmul_eq_mul] _ ≤ ((K * T.card ^ 2 : ℕ) : ℝ) * (θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ)) := by apply mul_le_mul_of_nonneg_right _ hfactor exact_mod_cast (Finset.card_filter_le _ _).trans (card_externalWitnesses_le A T D K hK) _ = _ := by push_cast; ring end ActualExternalWitnesses section DescriptorExternalCharge variable {G : Type v} [AddCommGroup G] [DecidableEq G] [Fintype G] open DescriptorPrior SourceCanonicalMask /-- Every actual external target supplies two selected source bits and enough remaining row sources to pay its entire forced-count weight. The deterministic parent in this statement is A\\E0, not A: exceptional removed inputs may occur at an external source and must not be mistaken for internal forced inputs. -/ theorem exists_externalWitness_protected (A E0 T S D : Finset G) (hS : S ⊆ T) (x : G) (hx : x ∈ externalTargets (D, E0, protectedInputs A E0 S D, S)) : ∃ i ∈ externalWitnesses (A \ E0) T D, i.2.1 + i.1 = x ∧ i.1 ∈ S ∧ i.2.2 ∈ S ∧ sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x - 1 ≤ (witnessFree (A \ E0) T i ∩ S).card := by classical let d := (D, E0, protectedInputs A E0 S D, S) obtain ⟨t, ht, q, hq, hD, hnot⟩ := (Finset.mem_filter.mp hx).2 have htS : t ∈ S := ((mem_forcedSources d x t).mp ht).1 have htu : x - t ∈ A \ E0 := by have h := ((mem_forcedSources d x t).mp ht).2 rw [sourceForcedSet_protectedInputs] at h exact (Finset.mem_inter.mp h).1 have hqA : x - q ∉ A \ E0 := by intro hqA apply hnot rw [sourceForcedSet_protectedInputs] refine Finset.mem_inter.mpr ⟨hqA, ?_⟩ exact Finset.mem_sub.mpr ⟨t, htS, q - (x - t), hD, by abel⟩ let i : G × G × G := (t, x - t, q) have hi : i ∈ externalWitnesses (A \ E0) T D := by apply (mem_externalWitnesses _ _ _ _).mpr refine ⟨hS htS, htu, hS hq, hD, ?_⟩ simpa only [i, sub_add_cancel] using hqA refine ⟨i, hi, by simp [i], htS, hq, ?_⟩ have hsub : forcedSources d x \ {t} ⊆ witnessFree (A \ E0) T i ∩ S := by intro r hr obtain ⟨hrF, hrt⟩ := Finset.mem_sdiff.mp hr obtain ⟨hrS, hrA⟩ := (mem_forcedSources d x r).mp hrF rw [sourceForcedSet_protectedInputs] at hrA refine Finset.mem_inter.mpr ⟨Finset.mem_sdiff.mpr ⟨?_, hrt⟩, hrS⟩ apply Finset.mem_filter.mpr exact ⟨hS hrS, by simpa only [i, sub_add_cancel] using (Finset.mem_inter.mp hrA).1⟩ have hcard := Finset.card_sdiff_add_card_eq_card (Finset.singleton_subset_iff.mpr ht) rw [Finset.card_singleton, card_forcedSources] at hcard change (forcedSources d x \ {t}).card + 1 = sourceForcedCount d x at hcard have hle := Finset.card_le_card hsub change sourceForcedCount d x - 1 ≤ _ omega /-- Pointwise comparison with the actual descriptor EX sum. Summing within target fibres prevents one witness from paying unrelated external targets. -/ theorem actual_external_sum_le_totalExternalChargeOutside (A E0 T S D X : Finset G) (hS : S ⊆ T) (L : ℕ) {θ : ℝ} (hθ : 0 ≤ θ) : (∑ x ∈ externalTargets (D, E0, protectedInputs A E0 S D, S) \ X, if sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x ≤ L then (θ⁻¹) ^ sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x else 0) ≤ totalExternalChargeOutside (A \ E0) T D X L θ S := by classical let d := (D, E0, protectedInputs A E0 S D, S) let I := externalWitnessesOutside (A \ E0) T D X let w : G × G × G → ℝ := fun i => twoSourceCharge i.1 i.2.2 (witnessFree (A \ E0) T i) L θ S have hw (i : G × G × G) : 0 ≤ w i := twoSourceCharge_nonneg _ _ _ _ hθ S change (∑ x ∈ externalTargets d \ X, if sourceForcedCount d x ≤ L then (θ⁻¹) ^ sourceForcedCount d x else 0) ≤ ∑ i ∈ I, w i calc _ ≤ ∑ x ∈ externalTargets d \ X, ∑ i ∈ I with i.2.1 + i.1 = x, w i := by apply Finset.sum_le_sum intro x hx obtain ⟨hxExt, hxX⟩ := Finset.mem_sdiff.mp hx by_cases hcL : sourceForcedCount d x ≤ L · rw [if_pos hcL] obtain ⟨i, hi, hix, ht, hq, hroom⟩ := exists_externalWitness_protected A E0 T S D hS x hxExt have hiI : i ∈ I := Finset.mem_filter.mpr ⟨hi, by simpa only [hix] using hxX⟩ have hpay : (θ⁻¹) ^ sourceForcedCount d x ≤ w i := inv_pow_le_twoSourceCharge _ _ _ _ _ _ hθ (external_has_forced_count d x hxExt) hcL ht hq hroom exact hpay.trans (Finset.single_le_sum (fun i _ => hw i) (Finset.mem_filter.mpr ⟨hiI, hix⟩)) · rw [if_neg hcL] exact Finset.sum_nonneg (fun i _ => hw i) _ ≤ _ := Finset.sum_fiberwise_le_sum_of_sum_fiber_nonneg (fun _ _ => Finset.sum_nonneg (fun i _ => hw i)) /-- EX5 for the actual descriptor-dependent external observable, restricted outside X. The expectation is over the original independent source bits. -/ theorem mean_actual_external_sum_le (A E0 T D X : Finset G) (L K M : ℕ) {θ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : ∀ q ∈ T, representationCount (A \ E0) D q ≤ K) (hM : ∀ x : G, x ∉ X → representationCount (A \ E0) T x ≤ M) : bernoulliMean T θ (fun S => ∑ x ∈ externalTargets (D, E0, protectedInputs A E0 S D, S) \ X, if sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x ≤ L then (θ⁻¹) ^ sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x else 0) ≤ (K : ℝ) * (T.card : ℝ) ^ 2 * θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ) := by exact (bernoulliMean_mono T hθ.le hθ1 (fun S hS => actual_external_sum_le_totalExternalChargeOutside A E0 T S D X hS L hθ.le)).trans (mean_totalExternalChargeOutside_le (A \ E0) T D X L K M hθ hK hM) end DescriptorExternalCharge end Green39Submission.ScoreExtraction end Green39AssemblyScope_f009c35d9f79583e /- Source: Green39Submission.SourceSize; SHA256 d1d9b97e988f0092a61a4683e46eb19ed375bb40bd9c744293b87a7713db8d82 -/ section Green39AssemblyScope_fbcecdbffff150f6 /-! Finite Bernoulli source-cardinality moments and narrow source windows. The probability is the actual weighted finite source law on subsets of the fixed original parent. No distribution is assigned to an adaptive cleanup. -/ namespace Green39Submission.SourceSize open scoped BigOperators Classical open SourceProbability ProtectedScores universe u variable {α : Type u} [DecidableEq α] /-- Exact second moment of the cardinality of independent source bits. -/ theorem mean_source_card_sq (T : Finset α) (θ : ℝ) : bernoulliMean T θ (fun S => (S.card : ℝ) ^ 2) = ((T.card : ℝ) * θ) ^ 2 + (T.card : ℝ) * θ * (1 - θ) := by induction T using Finset.induction_on with | empty => simp [bernoulliMean, bernoulliWeight] | @insert t T ht ih => rw [bernoulliMean_insert ht] have hshift : bernoulliMean T θ (fun S => ((insert t S).card : ℝ) ^ 2) = bernoulliMean T θ (fun S => (S.card : ℝ) ^ 2) + 2 * ((T.card : ℝ) * θ) + 1 := by calc _ = bernoulliMean T θ (fun S => (S.card : ℝ) ^ 2 + 2 * (S.card : ℝ) + 1) := by apply bernoulliMean_congr intro S hS have htS : t ∉ S := fun h => ht (hS h) rw [Finset.card_insert_of_notMem htS, Nat.cast_add, Nat.cast_one] ring _ = _ := by rw [bernoulliMean_add, bernoulliMean_add, bernoulliMean_const_mul, bernoulliMean_const, RichStar.mean_source_card] rw [hshift, ih, Finset.card_insert_of_notMem ht, Nat.cast_add, Nat.cast_one] ring /-- The exact finite binomial variance, valid algebraically for every real θ. -/ theorem variance_source_card (T : Finset α) (θ : ℝ) : bernoulliVariance T θ (fun S => (S.card : ℝ)) = (T.card : ℝ) * θ * (1 - θ) := by unfold bernoulliVariance rw [mean_source_card_sq, RichStar.mean_source_card] ring /-- The same variance cap from the compiled uniform-coordinate theorem: inserting one source changes cardinality by exactly one. -/ theorem variance_source_card_le (T : Finset α) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) : bernoulliVariance T θ (fun S => (S.card : ℝ)) ≤ (T.card : ℝ) * θ * (1 - θ) := by have h := bernoulliVariance_le_card_mul T hθ hθ1 (fun S => (S.card : ℝ)) (K := 1) (by intro t _ht S _hS htS rw [Finset.card_insert_of_notMem htS, Nat.cast_add, Nat.cast_one] norm_num) simpa using h theorem variance_source_card_le_mean (T : Finset α) {θ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) : bernoulliVariance T θ (fun S => (S.card : ℝ)) ≤ (T.card : ℝ) * θ := by calc _ ≤ (T.card : ℝ) * θ * (1 - θ) := variance_source_card_le T hθ hθ1 _ ≤ (T.card : ℝ) * θ * 1 := mul_le_mul_of_nonneg_left (by linarith) (mul_nonneg (Nat.cast_nonneg _) hθ) _ = _ := mul_one _ /-- Cardinality Chebyshev with an arbitrary positive absolute radius. -/ theorem source_card_deviation_tail (T : Finset α) {θ a : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 < a) : bernoulliMean T θ (fun S => if a < |(S.card : ℝ) - (T.card : ℝ) * θ| then 1 else 0) ≤ (T.card : ℝ) * θ / a ^ 2 := by have h := ScoreExtraction.source_deviation_tail T hθ hθ1 ha (fun S => (S.card : ℝ)) rw [RichStar.mean_source_card] at h exact h.trans (div_le_div_of_nonneg_right (variance_source_card_le_mean T hθ hθ1) (sq_nonneg a)) theorem mass_div_relative_square {m δ : ℝ} (hm : 0 < m) (hδ : 0 < δ) : m / (δ * m) ^ 2 = 1 / (δ ^ 2 * m) := by field_simp [hm.ne', hδ.ne'] <;> ring /-- The relative source window has failure at most `1/(δ² θ |T|)`. All denominator positivity is explicit. -/ theorem source_card_relative_tail (T : Finset α) {θ δ : ℝ} (hT : 0 < T.card) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hδ : 0 < δ) : bernoulliMean T θ (fun S => if δ * ((T.card : ℝ) * θ) < |(S.card : ℝ) - (T.card : ℝ) * θ| then 1 else 0) ≤ 1 / (δ ^ 2 * ((T.card : ℝ) * θ)) := by have hm : 0 < (T.card : ℝ) * θ := mul_pos (Nat.cast_pos.mpr hT) hθ have h := source_card_deviation_tail T hθ.le hθ1 (mul_pos hδ hm) rwa [mass_div_relative_square hm hδ] at h /-- One-sided cardinality tail at a deterministic upper bound on the mean. The parent may be empty; the radius is still required to be positive. -/ theorem source_card_upper_tail_of_mean_le (T : Finset α) {θ a m : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 < a) (hm : (T.card : ℝ) * θ ≤ m) : bernoulliMean T θ (fun S => if m + a < (S.card : ℝ) then 1 else 0) ≤ m / a ^ 2 := by have h := ScoreExtraction.source_upper_tail_of_mean_le T hθ hθ1 ha (fun S => (S.card : ℝ)) (by simpa only [RichStar.mean_source_card] using hm) exact h.trans (div_le_div_of_nonneg_right ((variance_source_card_le_mean T hθ hθ1).trans hm) (sq_nonneg a)) theorem source_card_upper_tail_of_card_le (T : Finset α) {N : ℕ} {θ a : ℝ} (hTN : T.card ≤ N) (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (ha : 0 < a) : bernoulliMean T θ (fun S => if (N : ℝ) * θ + a < (S.card : ℝ) then 1 else 0) ≤ (N : ℝ) * θ / a ^ 2 := by apply source_card_upper_tail_of_mean_le T hθ hθ1 ha exact mul_le_mul_of_nonneg_right (by exact_mod_cast hTN) hθ theorem source_card_relative_upper_tail_of_card_le (T : Finset α) {N : ℕ} {θ δ : ℝ} (hTN : T.card ≤ N) (hN : 0 < N) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hδ : 0 < δ) : bernoulliMean T θ (fun S => if (N : ℝ) * θ + δ * ((N : ℝ) * θ) < (S.card : ℝ) then 1 else 0) ≤ 1 / (δ ^ 2 * ((N : ℝ) * θ)) := by have hm : 0 < (N : ℝ) * θ := mul_pos (Nat.cast_pos.mpr hN) hθ have h := source_card_upper_tail_of_card_le T hTN hθ.le hθ1 (mul_pos hδ hm) rwa [mass_div_relative_square hm hδ] at h theorem mass_div_threeQuarter_square {m : ℝ} (hm : 0 < m) : m / (m ^ (3 / 4 : ℝ)) ^ 2 = m ^ (-1 / 2 : ℝ) := by have hsquare : (m ^ (3 / 4 : ℝ)) ^ 2 = m ^ (3 / 2 : ℝ) := by rw [← Real.rpow_mul_natCast hm.le] norm_num calc _ = m ^ (1 : ℝ) / m ^ (3 / 2 : ℝ) := by rw [hsquare, Real.rpow_one] _ = m ^ (1 - 3 / 2 : ℝ) := (Real.rpow_sub hm _ _).symm _ = _ := by norm_num /-- The manuscript's full narrow window, with exact finite failure bound. -/ theorem source_card_narrow_window_tail (T : Finset α) {θ : ℝ} (hT : 0 < T.card) (hθ : 0 < θ) (hθ1 : θ ≤ 1) : bernoulliMean T θ (fun S => if ((T.card : ℝ) * θ) ^ (3 / 4 : ℝ) < |(S.card : ℝ) - (T.card : ℝ) * θ| then 1 else 0) ≤ ((T.card : ℝ) * θ) ^ (-1 / 2 : ℝ) := by have hm : 0 < (T.card : ℝ) * θ := mul_pos (Nat.cast_pos.mpr hT) hθ have h := source_card_deviation_tail T hθ.le hθ1 (Real.rpow_pos_of_pos hm (3 / 4 : ℝ)) rwa [mass_div_threeQuarter_square hm] at h /-- The upper narrow window remains valid for any smaller parent, including the empty parent; only the deterministic centering scale must be positive. -/ theorem source_card_narrow_upper_tail (T : Finset α) {θ m : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (hm : 0 < m) (hmean : (T.card : ℝ) * θ ≤ m) : bernoulliMean T θ (fun S => if m + m ^ (3 / 4 : ℝ) < (S.card : ℝ) then 1 else 0) ≤ m ^ (-1 / 2 : ℝ) := by have h := source_card_upper_tail_of_mean_le T hθ hθ1 (Real.rpow_pos_of_pos hm (3 / 4 : ℝ)) hmean rwa [mass_div_threeQuarter_square hm] at h theorem source_card_narrow_upper_tail_of_card_le (T : Finset α) {N : ℕ} {θ : ℝ} (hTN : T.card ≤ N) (hN : 0 < N) (hθ : 0 < θ) (hθ1 : θ ≤ 1) : bernoulliMean T θ (fun S => if (N : ℝ) * θ + ((N : ℝ) * θ) ^ (3 / 4 : ℝ) < (S.card : ℝ) then 1 else 0) ≤ ((N : ℝ) * θ) ^ (-1 / 2 : ℝ) := by apply source_card_narrow_upper_tail T hθ.le hθ1 (mul_pos (Nat.cast_pos.mpr hN) hθ) exact mul_le_mul_of_nonneg_right (by exact_mod_cast hTN) hθ.le /-- Literal `100*k` specialization, retaining `|T| ≤ 100*k`. -/ theorem source_card_narrow_upper_tail_100 (T : Finset α) {k : ℕ} {θ : ℝ} (hTk : T.card ≤ 100 * k) (hk : 0 < k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) : bernoulliMean T θ (fun S => if 100 * (k : ℝ) * θ + (100 * (k : ℝ) * θ) ^ (3 / 4 : ℝ) < (S.card : ℝ) then 1 else 0) ≤ (100 * (k : ℝ) * θ) ^ (-1 / 2 : ℝ) := by simpa only [Nat.cast_mul, Nat.cast_ofNat] using source_card_narrow_upper_tail_of_card_le T hTk (Nat.mul_pos (by norm_num) hk) hθ hθ1 theorem source_card_narrow_window_tail_100 (T : Finset α) {k : ℕ} {θ : ℝ} (hTk : T.card = 100 * k) (hk : 0 < k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) : bernoulliMean T θ (fun S => if (100 * (k : ℝ) * θ) ^ (3 / 4 : ℝ) < |(S.card : ℝ) - 100 * (k : ℝ) * θ| then 1 else 0) ≤ (100 * (k : ℝ) * θ) ^ (-1 / 2 : ℝ) := by have hT : 0 < T.card := by rw [hTk]; exact Nat.mul_pos (by norm_num) hk simpa only [hTk, Nat.cast_mul, Nat.cast_ofNat] using source_card_narrow_window_tail T hT hθ hθ1 end Green39Submission.SourceSize end Green39AssemblyScope_fbcecdbffff150f6 /- Source: Green39Submission.OverlapGuards; SHA256 3eaaf3e7b2562c03f4c8a05892e30c64692e9e76fe2c1c02f34e45453210de3b -/ section Green39AssemblyScope_a98a2fd5c7932074 /-! Appendix E source majorizers. A source witness records its target, its forced source set, and its marker source set. In particular, two targets with the same physical input support remain different labels. The target set Z is fixed but arbitrary, allowing the off-exceptional-target cap used in Appendix H. This module does not condition on any adaptively chosen protection set or free universe. Its deterministic source polynomials dominate all such choices. -/ namespace Green39Submission.OverlapGuards open scoped BigOperators Pointwise open SourceProbability universe u v w section SumEmbedding /-- Transport a nonnegative sum along an injection, retaining every label. -/ theorem sum_le_sum_of_injection {ι : Type v} {κ : Type w} (I : Finset ι) (J : Finset κ) (f : ι → ℝ) (g : κ → ℝ) (φ : ι → κ) (hmap : ∀ i ∈ I, φ i ∈ J) (hinj : Set.InjOn φ (I : Set ι)) (hterm : ∀ i ∈ I, f i ≤ g (φ i)) (hzero : ∀ j ∈ J, 0 ≤ g j) : (∑ i ∈ I, f i) ≤ ∑ j ∈ J, g j := by classical calc _ ≤ ∑ i ∈ I, g (φ i) := Finset.sum_le_sum hterm _ = ∑ j ∈ I.image φ, g j := (Finset.sum_image hinj).symm _ ≤ _ := Finset.sum_le_sum_of_subset_of_nonneg (by intro j hj; obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hj; exact hmap i hi) (fun j hj _ => hzero j hj) end SumEmbedding section WitnessGeometry variable {G : Type u} [AddCommGroup G] [DecidableEq G] /-- The deterministic parent sources that represent a fixed target. -/ def parentRow (A T : Finset G) (x : G) : Finset G := T.filter (fun t => x - t ∈ A) theorem mem_parentRow (A T : Finset G) (x t : G) : t ∈ parentRow A T x ↔ t ∈ T ∧ x - t ∈ A := Finset.mem_filter theorem parentRow_subset (A T : Finset G) (x : G) : parentRow A T x ⊆ T := Finset.filter_subset _ _ theorem card_parentRow (A T : Finset G) (x : G) : (parentRow A T x).card = representationCount A T x := rfl /-- Translate-reflect an input support into its source markers. -/ def markerSet (x : G) (U : Finset G) : Finset G := U.image (fun u => x - u) theorem mem_markerSet (x t : G) (U : Finset G) : t ∈ markerSet x U ↔ x - t ∈ U := by constructor · intro ht obtain ⟨u, hu, rfl⟩ := Finset.mem_image.mp ht have hc : x - (x - u) = u := by abel simpa only [hc] using hu · intro ht apply Finset.mem_image.mpr refine ⟨x - t, ht, ?_⟩ abel theorem markerSet_markerSet (x : G) (U : Finset G) : markerSet x (markerSet x U) = U := by ext u have hc : x - (x - u) = u := by abel simp only [mem_markerSet, hc] theorem markerSet_injective (x : G) : Function.Injective (markerSet x) := by intro U V h have h' := congrArg (markerSet x) h simpa only [markerSet_markerSet] using h' theorem card_markerSet (x : G) (U : Finset G) : (markerSet x U).card = U.card := by apply Finset.card_image_of_injective intro a b hab exact sub_right_injective hab theorem markerSet_subset_iff (x : G) (U V : Finset G) : markerSet x U ⊆ V ↔ U ⊆ markerSet x V := by constructor · intro h u hu apply (mem_markerSet x u V).mpr exact h (Finset.mem_image.mpr ⟨u, hu, rfl⟩) · intro h t ht have hmem := h ((mem_markerSet x t U).mp ht) have hc : x - (x - t) = t := by abel simpa only [mem_markerSet, hc] using hmem /-- FG6, stated only in the upstream geometry needed by source witnesses. -/ theorem forced_markers_disjoint (P V S U : Finset G) (x : G) (hPV : Disjoint P V) (hUV : U ⊆ V) : Disjoint (parentRow P S x) (markerSet x U) := by apply Finset.disjoint_left.mpr intro t htQ htM exact Finset.disjoint_left.mp hPV ((mem_parentRow P S x t).mp htQ).2 (hUV ((mem_markerSet x t U).mp htM)) /-- A target and two disjoint source sets. No quotient identifies equal supports. -/ abbrev SourceWitness (G : Type u) := Σ _ : G, Finset G × Finset G def sourceWitnesses (A T Z : Finset G) (c j : ℕ) : Finset (SourceWitness G) := Z.sigma fun x => (((parentRow A T x).powersetCard c).product (T.powersetCard j)).filter (fun qm => Disjoint qm.1 qm.2) def sourceSupport (w : SourceWitness G) : Finset G := w.2.1 ∪ w.2.2 def inputSupport (w : SourceWitness G) : Finset G := markerSet w.1 w.2.2 theorem mem_sourceWitnesses (A T Z : Finset G) (c j : ℕ) (w : SourceWitness G) : w ∈ sourceWitnesses A T Z c j ↔ w.1 ∈ Z ∧ (w.2.1 ⊆ parentRow A T w.1 ∧ w.2.1.card = c) ∧ (w.2.2 ⊆ T ∧ w.2.2.card = j) ∧ Disjoint w.2.1 w.2.2 := by simp [sourceWitnesses, and_assoc] theorem sourceSupport_subset (A T Z : Finset G) (c j : ℕ) (w : SourceWitness G) (hw : w ∈ sourceWitnesses A T Z c j) : sourceSupport w ⊆ T := by obtain ⟨_, hQ, hM, _⟩ := (mem_sourceWitnesses A T Z c j w).mp hw exact Finset.union_subset (hQ.1.trans (parentRow_subset A T w.1)) hM.1 theorem card_sourceSupport (A T Z : Finset G) (c j : ℕ) (w : SourceWitness G) (hw : w ∈ sourceWitnesses A T Z c j) : (sourceSupport w).card = c + j := by obtain ⟨_, hQ, hM, hdis⟩ := (mem_sourceWitnesses A T Z c j w).mp hw simp only [sourceSupport, Finset.card_union_of_disjoint hdis, hQ.2, hM.2] theorem card_inputSupport (A T Z : Finset G) (c j : ℕ) (w : SourceWitness G) (hw : w ∈ sourceWitnesses A T Z c j) : (inputSupport w).card = j := by rw [inputSupport, card_markerSet] exact ((mem_sourceWitnesses A T Z c j w).mp hw).2.2.1.2 theorem card_sourceWitnesses_le (A T Z : Finset G) (c j R : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) : (sourceWitnesses A T Z c j).card ≤ Z.card * (R ^ c * T.card ^ j) := by unfold sourceWitnesses rw [Finset.card_sigma] calc _ ≤ ∑ x ∈ Z, R ^ c * T.card ^ j := by apply Finset.sum_le_sum intro x hx calc _ ≤ (((parentRow A T x).powersetCard c).product (T.powersetCard j)).card := Finset.card_filter_le _ _ _ = (parentRow A T x).card.choose c * T.card.choose j := by simp _ ≤ R ^ c * T.card ^ j := Nat.mul_le_mul ((Nat.choose_le_choose c (hR x hx)).trans (Nat.choose_le_pow R c)) (Nat.choose_le_pow T.card j) _ = _ := by simp /-- Lift an actual target/support label using its unique forced-source set. -/ def actualWitness (P S : Finset G) (i : G × Finset G) : SourceWitness G := ⟨i.1, parentRow P S i.1, markerSet i.1 i.2⟩ theorem actualWitness_injective (P S : Finset G) : Function.Injective (actualWitness P S) := by rintro ⟨x, U⟩ ⟨y, V⟩ h have hxy : x = y := congrArg Sigma.fst h subst y have hM : markerSet x U = markerSet x V := by exact congrArg (fun w : SourceWitness G => w.2.2) h exact Prod.ext rfl (markerSet_injective x hM) theorem inputSupport_actualWitness (P S : Finset G) (i : G × Finset G) : inputSupport (actualWitness P S i) = i.2 := by exact markerSet_markerSet i.1 i.2 theorem actualWitness_mem {A T Z P V S : Finset G} {c j : ℕ} (hPA : P ⊆ A) (hST : S ⊆ T) (hPV : Disjoint P V) (i : G × Finset G) (hx : i.1 ∈ Z) (hc : representationCount P S i.1 = c) (hUV : i.2 ⊆ V) (hMS : markerSet i.1 i.2 ⊆ S) (hj : i.2.card = j) : actualWitness P S i ∈ sourceWitnesses A T Z c j := by apply (mem_sourceWitnesses A T Z c j _).mpr refine ⟨hx, ⟨?_, hc⟩, ⟨hMS.trans hST, ?_⟩, ?_⟩ · intro t ht obtain ⟨htS, htP⟩ := (mem_parentRow P S i.1 t).mp ht exact (mem_parentRow A T i.1 t).mpr ⟨hST htS, hPA htP⟩ · change (markerSet i.1 i.2).card = j simpa only [card_markerSet] using hj · exact forced_markers_disjoint P V S i.2 i.1 hPV hUV theorem sourceSupport_actualWitness_subset (P S : Finset G) (i : G × Finset G) (hMS : markerSet i.1 i.2 ⊆ S) : sourceSupport (actualWitness P S i) ⊆ S := Finset.union_subset (parentRow_subset P S i.1) hMS end WitnessGeometry section MeanMajorizer variable {G : Type u} [AddCommGroup G] [DecidableEq G] noncomputable def meanMajorizer (A T Z : Finset G) (c j : ℕ) (θ K ρ : ℝ) (S : Finset G) : ℝ := containmentSum (sourceWitnesses A T Z c j) sourceSupport (fun _ => K / θ ^ (c + j) * ρ ^ j) S theorem meanMajorizer_nonneg (A T Z : Finset G) (c j : ℕ) {θ K ρ : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (S : Finset G) : 0 ≤ meanMajorizer A T Z c j θ K ρ S := by unfold meanMajorizer containmentSum apply Finset.sum_nonneg intro w _ split_ifs · exact mul_nonneg (div_nonneg hK (pow_nonneg hθ _)) (pow_nonneg hρ _) · exact le_rfl /-- Exact cancellation of all distinct source bits in one witness, including j=0. -/ theorem bernoulliMean_meanMajorizer (A T Z : Finset G) (c j : ℕ) {θ : ℝ} (hθ : θ ≠ 0) (K ρ : ℝ) : bernoulliMean T θ (meanMajorizer A T Z c j θ K ρ) = (sourceWitnesses A T Z c j).card * (K * ρ ^ j) := by change bernoulliMean T θ (containmentSum (sourceWitnesses A T Z c j) sourceSupport (fun _ => K / θ ^ (c + j) * ρ ^ j)) = _ rw [WeightedCleanup.bernoulliMean_containmentSum T θ _ _ _ (sourceSupport_subset A T Z c j)] calc _ = ∑ _w ∈ sourceWitnesses A T Z c j, K * ρ ^ j := by apply Finset.sum_congr rfl intro w hw rw [card_sourceSupport A T Z c j w hw] field_simp _ = _ := by simp /-- FG7 with the finite constants exposed. -/ theorem bernoulliMean_meanMajorizer_le (A T Z : Finset G) (c j R : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) {θ K ρ : ℝ} (hθ : θ ≠ 0) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) : bernoulliMean T θ (meanMajorizer A T Z c j θ K ρ) ≤ (Z.card : ℝ) * (R : ℝ) ^ c * K * ((T.card : ℝ) * ρ) ^ j := by rw [bernoulliMean_meanMajorizer A T Z c j hθ K ρ] calc _ ≤ (Z.card * (R ^ c * T.card ^ j) : ℕ) * (K * ρ ^ j) := mul_le_mul_of_nonneg_right (by exact_mod_cast card_sourceWitnesses_le A T Z c j R hR) (mul_nonneg hK (pow_nonneg hρ _)) _ = _ := by push_cast; rw [mul_pow]; ring theorem actual_meanSum_le_majorizer (A T Z P V S : Finset G) (c j : ℕ) (hPA : P ⊆ A) (hST : S ⊆ T) (hPV : Disjoint P V) (I : Finset (G × Finset G)) (weight : (G × Finset G) → ℝ) {θ K ρ : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hlabel : ∀ i ∈ I, i.1 ∈ Z ∧ representationCount P S i.1 = c ∧ i.2 ⊆ V ∧ markerSet i.1 i.2 ⊆ S ∧ i.2.card = j) (hweight : ∀ i ∈ I, weight i ≤ K / θ ^ (c + j)) : (∑ i ∈ I, weight i * ρ ^ i.2.card) ≤ meanMajorizer A T Z c j θ K ρ S := by classical unfold meanMajorizer containmentSum apply sum_le_sum_of_injection I (sourceWitnesses A T Z c j) _ _ (actualWitness P S) · intro i hi obtain ⟨hx, hc, hV, hM, hj⟩ := hlabel i hi exact actualWitness_mem hPA hST hPV i hx hc hV hM hj · exact (actualWitness_injective P S).injOn · intro i hi obtain ⟨_, _, _, hM, hj⟩ := hlabel i hi rw [if_pos (sourceSupport_actualWitness_subset P S i hM), hj] exact mul_le_mul_of_nonneg_right (hweight i hi) (pow_nonneg hρ _) · intro w _ split_ifs · exact mul_nonneg (div_nonneg hK (pow_nonneg hθ _)) (pow_nonneg hρ _) · exact le_rfl theorem actual_bernoulliMean_le_majorizer (A T Z P V S : Finset G) (c j : ℕ) (hPA : P ⊆ A) (hST : S ⊆ T) (hPV : Disjoint P V) (I : Finset (G × Finset G)) (weight : (G × Finset G) → ℝ) {θ K ρ : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hlabel : ∀ i ∈ I, i.1 ∈ Z ∧ representationCount P S i.1 = c ∧ i.2 ⊆ V ∧ markerSet i.1 i.2 ⊆ S ∧ i.2.card = j) (hweight : ∀ i ∈ I, weight i ≤ K / θ ^ (c + j)) : bernoulliMean V ρ (containmentSum I Prod.snd weight) ≤ meanMajorizer A T Z c j θ K ρ S := by rw [WeightedCleanup.bernoulliMean_containmentSum V ρ I Prod.snd weight (fun i hi => (hlabel i hi).2.2.1)] exact actual_meanSum_le_majorizer A T Z P V S c j hPA hST hPV I weight hθ hK hρ hlabel hweight end MeanMajorizer section OverlapMajorizer variable {G : Type u} [AddCommGroup G] [DecidableEq G] noncomputable def overlapPairWeight (amp ρ : ℝ) (w v : SourceWitness G) : ℝ := if Disjoint (inputSupport w) (inputSupport v) then 0 else amp ^ 2 * ρ ^ (inputSupport w ∪ inputSupport v).card theorem overlapPairWeight_nonneg (amp : ℝ) {ρ : ℝ} (hρ : 0 ≤ ρ) (w v : SourceWitness G) : 0 ≤ overlapPairWeight amp ρ w v := by unfold overlapPairWeight split_ifs · exact le_rfl · exact mul_nonneg (sq_nonneg _) (pow_nonneg hρ _) /-- Ordered source polynomial: the product retains equal target labels, equal witnesses, and repeated physical supports. -/ noncomputable def overlapMajorizer (A T Z : Finset G) (c j : ℕ) (θ K ρ : ℝ) (S : Finset G) : ℝ := containmentSum ((sourceWitnesses A T Z c j).product (sourceWitnesses A T Z c j)) (fun wv => sourceSupport wv.1 ∪ sourceSupport wv.2) (fun wv => overlapPairWeight (K / θ ^ (c + j)) ρ wv.1 wv.2) S theorem overlapMajorizer_nonneg (A T Z : Finset G) (c j : ℕ) (θ K : ℝ) {ρ : ℝ} (hρ : 0 ≤ ρ) (S : Finset G) : 0 ≤ overlapMajorizer A T Z c j θ K ρ S := by unfold overlapMajorizer containmentSum apply Finset.sum_nonneg intro wv _ split_ifs · exact overlapPairWeight_nonneg _ hρ _ _ · exact le_rfl /-- The exact source expectation. No collision is dropped in this identity. -/ theorem bernoulliMean_overlapMajorizer (A T Z : Finset G) (c j : ℕ) (θ K ρ : ℝ) : bernoulliMean T θ (overlapMajorizer A T Z c j θ K ρ) = ∑ w ∈ sourceWitnesses A T Z c j, ∑ v ∈ sourceWitnesses A T Z c j, overlapPairWeight (K / θ ^ (c + j)) ρ w v * θ ^ (sourceSupport w ∪ sourceSupport v).card := by change bernoulliMean T θ (containmentSum _ _ _) = _ rw [WeightedCleanup.bernoulliMean_containmentSum] · exact Finset.sum_product _ _ _ · intro wv hwv obtain ⟨hw, hv⟩ := Finset.mem_product.mp hwv exact Finset.union_subset (sourceSupport_subset A T Z c j _ hw) (sourceSupport_subset A T Z c j _ hv) theorem actual_weightedOverlap_le_majorizer (A T Z P V S : Finset G) (c j : ℕ) (hPA : P ⊆ A) (hST : S ⊆ T) (hPV : Disjoint P V) (I : Finset (G × Finset G)) (weight : (G × Finset G) → ℝ) {θ K ρ : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hlabel : ∀ i ∈ I, i.1 ∈ Z ∧ representationCount P S i.1 = c ∧ i.2 ⊆ V ∧ markerSet i.1 i.2 ⊆ S ∧ i.2.card = j) (hweight : ∀ i ∈ I, 0 ≤ weight i ∧ weight i ≤ K / θ ^ (c + j)) : WeightedCleanup.weightedOverlap I Prod.snd weight ρ ≤ overlapMajorizer A T Z c j θ K ρ S := by classical have hAmp : 0 ≤ K / θ ^ (c + j) := div_nonneg hK (pow_nonneg hθ _) have hlift (i : G × Finset G) (hi : i ∈ I) : actualWitness P S i ∈ sourceWitnesses A T Z c j := by obtain ⟨hx, hc, hV, hM, hj⟩ := hlabel i hi exact actualWitness_mem hPA hST hPV i hx hc hV hM hj have hselected (i : G × Finset G) (hi : i ∈ I) : sourceSupport (actualWitness P S i) ⊆ S := sourceSupport_actualWitness_subset P S i (hlabel i hi).2.2.2.1 rw [WeightedCleanup.weightedOverlap_eq_sum] change (∑ i ∈ I, ∑ i' ∈ I, if Disjoint i.2 i'.2 then 0 else weight i * weight i' * ρ ^ (i.2 ∪ i'.2).card) ≤ _ rw [← Finset.sum_product I I (fun ii => if Disjoint ii.1.2 ii.2.2 then 0 else weight ii.1 * weight ii.2 * ρ ^ (ii.1.2 ∪ ii.2.2).card)] unfold overlapMajorizer containmentSum apply sum_le_sum_of_injection (I.product I) ((sourceWitnesses A T Z c j).product (sourceWitnesses A T Z c j)) _ _ (fun ii => (actualWitness P S ii.1, actualWitness P S ii.2)) · intro ii hii obtain ⟨hi, hi'⟩ := Finset.mem_product.mp hii exact Finset.mem_product.mpr ⟨hlift ii.1 hi, hlift ii.2 hi'⟩ · intro ii _ jj _ h exact Prod.ext (actualWitness_injective P S (congrArg Prod.fst h)) (actualWitness_injective P S (congrArg Prod.snd h)) · intro ii hii obtain ⟨hi, hi'⟩ := Finset.mem_product.mp hii rw [if_pos (Finset.union_subset (hselected ii.1 hi) (hselected ii.2 hi'))] simp only [overlapPairWeight, inputSupport_actualWitness] by_cases hdis : Disjoint ii.1.2 ii.2.2 · simp only [hdis, ite_true, le_refl] · simp only [hdis, ite_false] apply mul_le_mul_of_nonneg_right _ (pow_nonneg hρ _) simpa only [pow_two] using mul_le_mul (hweight ii.1 hi).2 (hweight ii.2 hi').2 (hweight ii.2 hi').1 hAmp · intro wv _ split_ifs · exact overlapPairWeight_nonneg _ hρ _ _ · exact le_rfl end OverlapMajorizer section SubsetCounting variable {α : Type u} [DecidableEq α] /-- Supports with exactly u markers inside a prescribed comparison set. -/ def intersectionFamily (T F : Finset α) (j u : ℕ) : Finset (Finset α) := (T.powersetCard j).filter (fun N => (N ∩ F).card = u) theorem mem_intersectionFamily (T F N : Finset α) (j u : ℕ) : N ∈ intersectionFamily T F j u ↔ N ⊆ T ∧ N.card = j ∧ (N ∩ F).card = u := by simp [intersectionFamily, and_assoc] theorem card_residual (T F N : Finset α) (j u : ℕ) (hN : N ∈ intersectionFamily T F j u) : (N \ F).card = j - u := by obtain ⟨_, hj, hu⟩ := (mem_intersectionFamily T F N j u).mp hN have hc := Finset.card_sdiff_add_card_inter N F omega theorem splitSupport_injective (F : Finset α) : Function.Injective (fun N : Finset α => (N ∩ F, N \ F)) := by intro N M h have h' := congrArg (fun q : Finset α × Finset α => q.2 ∪ q.1) h simpa only [Finset.sdiff_union_inter] using h' theorem card_intersectionFamily_le (T F : Finset α) (j u : ℕ) : (intersectionFamily T F j u).card ≤ 2 ^ F.card * T.card ^ (j - u) := by calc _ ≤ (F.powerset.product (T.powersetCard (j - u))).card := by apply Finset.card_le_card_of_injOn (fun N => (N ∩ F, N \ F)) · intro N hN obtain ⟨hNT, _, _⟩ := (mem_intersectionFamily T F N j u).mp hN exact Finset.mem_product.mpr ⟨Finset.mem_powerset.mpr Finset.inter_subset_right, Finset.mem_powersetCard.mpr ⟨Finset.sdiff_subset.trans hNT, card_residual T F N j u hN⟩⟩ · exact (splitSupport_injective F).injOn _ = 2 ^ F.card * T.card.choose (j - u) := by simp _ ≤ _ := Nat.mul_le_mul_left _ (Nat.choose_le_pow _ _) /-- A residual support meeting a fixed small set has one fewer free source choice. -/ def meetingFamily (T E : Finset α) (n : ℕ) : Finset (Finset α) := (T.powersetCard n).filter (fun N => (N ∩ E).Nonempty) theorem meetingFamily_zero (T E : Finset α) : meetingFamily T E 0 = ∅ := by simp [meetingFamily] theorem card_meetingFamily_le (T E : Finset α) (n : ℕ) (hn : 0 < n) (hET : E ⊆ T) : (meetingFamily T E n).card ≤ E.card * T.card ^ (n - 1) := by have hcover : meetingFamily T E n ⊆ E.biUnion (fun t => (T.powersetCard n).filter (fun N => t ∈ N)) := by intro N hN obtain ⟨hNT, t, ht⟩ := Finset.mem_filter.mp hN obtain ⟨htN, htE⟩ := Finset.mem_inter.mp ht exact Finset.mem_biUnion.mpr ⟨t, htE, Finset.mem_filter.mpr ⟨hNT, htN⟩⟩ calc _ ≤ (E.biUnion (fun t => (T.powersetCard n).filter (fun N => t ∈ N))).card := Finset.card_le_card hcover _ ≤ ∑ t ∈ E, ((T.powersetCard n).filter (fun N => t ∈ N)).card := Finset.card_biUnion_le _ ≤ ∑ _t ∈ E, T.card ^ (n - 1) := by apply Finset.sum_le_sum intro t ht have hc := Finset.card_filter_powersetCard_subset {t} T n (Finset.singleton_subset_iff.mpr (hET ht)) (by simpa using Nat.succ_le_of_lt hn) have hc' : ((T.powersetCard n).filter (fun N => t ∈ N)).card = (T.card - 1).choose (n - 1) := by simpa using hc rw [hc'] exact (Nat.choose_le_choose (n - 1) (Nat.sub_le _ _)).trans (Nat.choose_le_pow _ _) _ = _ := by simp /-- The saved-source estimate including the empty residual boundary. -/ theorem card_mul_card_meetingFamily_le (T E : Finset α) (n : ℕ) (hET : E ⊆ T) : T.card * (meetingFamily T E n).card ≤ E.card * T.card ^ n := by cases n with | zero => simp [meetingFamily_zero] | succ n => calc _ ≤ T.card * (E.card * T.card ^ n) := Nat.mul_le_mul_left _ (by simpa using card_meetingFamily_le T E (n + 1) (Nat.succ_pos n) hET) _ = _ := by rw [pow_succ]; ring def residualMeetingFamily (T F E : Finset α) (j u : ℕ) : Finset (Finset α) := (intersectionFamily T F j u).filter (fun N => ((N \ F) ∩ E).Nonempty) theorem card_residualMeetingFamily_le (T F E : Finset α) (j u : ℕ) : (residualMeetingFamily T F E j u).card ≤ 2 ^ F.card * (meetingFamily T E (j - u)).card := by calc _ ≤ (F.powerset.product (meetingFamily T E (j - u))).card := by apply Finset.card_le_card_of_injOn (fun N => (N ∩ F, N \ F)) · intro N hN obtain ⟨hN, hmeet⟩ := Finset.mem_filter.mp hN obtain ⟨hNT, _, _⟩ := (mem_intersectionFamily T F N j u).mp hN exact Finset.mem_product.mpr ⟨Finset.mem_powerset.mpr Finset.inter_subset_right, Finset.mem_filter.mpr ⟨Finset.mem_powersetCard.mpr ⟨Finset.sdiff_subset.trans hNT, card_residual T F N j u hN⟩, hmeet⟩⟩ · exact (splitSupport_injective F).injOn _ = _ := by simp end SubsetCounting section MarkerCounting variable {G : Type u} [AddCommGroup G] [DecidableEq G] def shiftBack (d : G) (M : Finset G) : Finset G := M.image (fun t => t - d) theorem card_shiftBack (d : G) (M : Finset G) : (shiftBack d M).card = M.card := by apply Finset.card_image_of_injective intro a b h exact sub_left_injective h theorem mem_shiftBack (d t : G) (M : Finset G) : t ∈ shiftBack d M ↔ t + d ∈ M := by constructor · intro ht obtain ⟨m, hm, rfl⟩ := Finset.mem_image.mp ht simpa using hm · intro ht exact Finset.mem_image.mpr ⟨t + d, ht, by abel⟩ /-- Exact-u marker pairs, with their difference. Choosing an overlap already puts the difference in M-T. Zero differences are retained here. -/ def markerConfigurations (T : Finset G) (j u : ℕ) : Finset (Σ M : Finset G, Σ _d : G, Finset G) := (T.powersetCard j).sigma fun M => (M - T).sigma fun d => intersectionFamily T (shiftBack d M) j u /-- FG9 as a finite-set encoding. The constant j*2^j is harmless for fixed degree. -/ theorem card_markerConfigurations_le (T : Finset G) (j u : ℕ) (huj : u ≤ j) : (markerConfigurations T j u).card ≤ j * 2 ^ j * T.card ^ (2 * j - u + 1) := by unfold markerConfigurations rw [Finset.card_sigma] calc _ ≤ ∑ _M ∈ T.powersetCard j, j * T.card * (2 ^ j * T.card ^ (j - u)) := by apply Finset.sum_le_sum intro M hM have hMj := (Finset.mem_powersetCard.mp hM).2 rw [Finset.card_sigma] calc _ ≤ ∑ _d ∈ M - T, 2 ^ j * T.card ^ (j - u) := by apply Finset.sum_le_sum intro d _ simpa only [card_shiftBack, hMj] using card_intersectionFamily_le T (shiftBack d M) j u _ = (M - T).card * (2 ^ j * T.card ^ (j - u)) := by simp _ ≤ (j * T.card) * (2 ^ j * T.card ^ (j - u)) := by apply Nat.mul_le_mul_right simpa only [hMj] using (Finset.card_sub_le (s := M) (t := T)) _ = T.card.choose j * (j * T.card * (2 ^ j * T.card ^ (j - u))) := by simp _ ≤ T.card ^ j * (j * T.card * (2 ^ j * T.card ^ (j - u))) := Nat.mul_le_mul_right _ (Nat.choose_le_pow _ _) _ = _ := by have hexp : 2 * j - u + 1 = j + (j - u) + 1 := by omega rw [hexp, pow_succ, pow_add] ring def localCollidingMarkers (T M : Finset G) (j u : ℕ) : Finset (Σ _d : G, Finset G) := (M - T).sigma fun d => (intersectionFamily T (shiftBack d M) j u).filter (fun N => (M ∩ N).Nonempty) theorem localCollidingMarkers_subset (T M : Finset G) (j u : ℕ) : localCollidingMarkers T M j u ⊆ ((M - M).sigma fun d => intersectionFamily T (shiftBack d M) j u) ∪ ((M - T).sigma fun d => residualMeetingFamily T (shiftBack d M) M j u) := by intro dn hdn obtain ⟨hd, hN⟩ := Finset.mem_sigma.mp hdn obtain ⟨hN, hcoll⟩ := Finset.mem_filter.mp hN by_cases hMM : dn.1 ∈ M - M · exact Finset.mem_union_left _ (Finset.mem_sigma.mpr ⟨hMM, hN⟩) · apply Finset.mem_union_right apply Finset.mem_sigma.mpr refine ⟨hd, Finset.mem_filter.mpr ⟨hN, ?_⟩⟩ obtain ⟨t, ht⟩ := hcoll obtain ⟨htM, htN⟩ := Finset.mem_inter.mp ht have htF : t ∉ shiftBack dn.1 M := by intro ht apply hMM exact Finset.mem_sub.mpr ⟨t + dn.1, (mem_shiftBack dn.1 t M).mp ht, t, htM, by abel⟩ exact ⟨t, Finset.mem_inter.mpr ⟨Finset.mem_sdiff.mpr ⟨htN, htF⟩, htM⟩⟩ theorem card_localCollidingMarkers_le (T M : Finset G) (j u : ℕ) (hMT : M ⊆ T) (hMj : M.card = j) : (localCollidingMarkers T M j u).card ≤ 2 * j ^ 2 * 2 ^ j * T.card ^ (j - u) := by have hfirst : ((M - M).sigma fun d => intersectionFamily T (shiftBack d M) j u).card ≤ j ^ 2 * 2 ^ j * T.card ^ (j - u) := by rw [Finset.card_sigma] calc _ ≤ ∑ _d ∈ M - M, 2 ^ j * T.card ^ (j - u) := by apply Finset.sum_le_sum intro d _ simpa only [card_shiftBack, hMj] using card_intersectionFamily_le T (shiftBack d M) j u _ = (M - M).card * (2 ^ j * T.card ^ (j - u)) := by simp _ ≤ (j * j) * (2 ^ j * T.card ^ (j - u)) := by apply Nat.mul_le_mul_right simpa only [hMj] using (Finset.card_sub_le (s := M) (t := M)) _ = _ := by ring have hsecond : ((M - T).sigma fun d => residualMeetingFamily T (shiftBack d M) M j u).card ≤ j ^ 2 * 2 ^ j * T.card ^ (j - u) := by rw [Finset.card_sigma] calc _ ≤ ∑ _d ∈ M - T, 2 ^ j * (meetingFamily T M (j - u)).card := by apply Finset.sum_le_sum intro d _ simpa only [card_shiftBack, hMj] using card_residualMeetingFamily_le T (shiftBack d M) M j u _ = (M - T).card * (2 ^ j * (meetingFamily T M (j - u)).card) := by simp _ ≤ (j * T.card) * (2 ^ j * (meetingFamily T M (j - u)).card) := by apply Nat.mul_le_mul_right simpa only [hMj] using (Finset.card_sub_le (s := M) (t := T)) _ = j * 2 ^ j * (T.card * (meetingFamily T M (j - u)).card) := by ring _ ≤ j * 2 ^ j * (j * T.card ^ (j - u)) := Nat.mul_le_mul_left _ (by simpa only [hMj] using card_mul_card_meetingFamily_le T M (j - u) hMT) _ = _ := by ring calc _ ≤ (((M - M).sigma fun d => intersectionFamily T (shiftBack d M) j u) ∪ ((M - T).sigma fun d => residualMeetingFamily T (shiftBack d M) M j u)).card := Finset.card_le_card (localCollidingMarkers_subset T M j u) _ ≤ _ + _ := Finset.card_union_le _ _ _ ≤ _ + _ := Nat.add_le_add hfirst hsecond _ = _ := by ring def collidingMarkerConfigurations (T : Finset G) (j u : ℕ) : Finset (Σ M : Finset G, Σ _d : G, Finset G) := (T.powersetCard j).sigma fun M => localCollidingMarkers T M j u /-- FG13 marker collisions save a complete source-label choice. This stronger count also allows d=0 and retains the j=u boundary without a negative exponent. -/ theorem card_collidingMarkerConfigurations_le (T : Finset G) (j u : ℕ) (huj : u ≤ j) : (collidingMarkerConfigurations T j u).card ≤ 2 * j ^ 2 * 2 ^ j * T.card ^ (2 * j - u) := by unfold collidingMarkerConfigurations rw [Finset.card_sigma] calc _ ≤ ∑ _M ∈ T.powersetCard j, 2 * j ^ 2 * 2 ^ j * T.card ^ (j - u) := by apply Finset.sum_le_sum intro M hM exact card_localCollidingMarkers_le T M j u (Finset.mem_powersetCard.mp hM).1 (Finset.mem_powersetCard.mp hM).2 _ = T.card.choose j * (2 * j ^ 2 * 2 ^ j * T.card ^ (j - u)) := by simp _ ≤ T.card ^ j * (2 * j ^ 2 * 2 ^ j * T.card ^ (j - u)) := Nat.mul_le_mul_right _ (Nat.choose_le_pow _ _) _ = _ := by have hexp : 2 * j - u = j + (j - u) := by omega rw [hexp, pow_add] ring def sameTargetMarkerConfigurations (T : Finset G) (j u : ℕ) : Finset (Σ _M : Finset G, Finset G) := (T.powersetCard j).sigma fun M => intersectionFamily T M j u /-- The equal-target count includes M=N and hence every identical-index term. -/ theorem card_sameTargetMarkerConfigurations_le (T : Finset G) (j u : ℕ) (huj : u ≤ j) : (sameTargetMarkerConfigurations T j u).card ≤ 2 ^ j * T.card ^ (2 * j - u) := by unfold sameTargetMarkerConfigurations rw [Finset.card_sigma] calc _ ≤ ∑ _M ∈ T.powersetCard j, 2 ^ j * T.card ^ (j - u) := by apply Finset.sum_le_sum intro M hM simpa only [(Finset.mem_powersetCard.mp hM).2] using card_intersectionFamily_le T M j u _ = T.card.choose j * (2 ^ j * T.card ^ (j - u)) := by simp _ ≤ T.card ^ j * (2 ^ j * T.card ^ (j - u)) := Nat.mul_le_mul_right _ (Nat.choose_le_pow _ _) _ = _ := by have hexp : 2 * j - u = j + (j - u) := by omega rw [hexp, pow_add] ring theorem markerSet_inter (x y : G) (M N : Finset G) : markerSet y (markerSet x M ∩ markerSet y N) = N ∩ shiftBack (x - y) M := by ext t have hxy : x - (y - t) = t + (x - y) := by abel have hyy : y - (y - t) = t := by abel simp only [mem_markerSet, Finset.mem_inter, hxy, hyy, mem_shiftBack, and_comm] theorem card_physical_intersection (x y : G) (M N : Finset G) : (markerSet x M ∩ markerSet y N).card = (N ∩ shiftBack (x - y) M).card := by rw [← card_markerSet y (markerSet x M ∩ markerSet y N), markerSet_inter] theorem difference_mem_of_intersection (T M N : Finset G) (d : G) (hNT : N ⊆ T) (hinter : (N ∩ shiftBack d M).Nonempty) : d ∈ M - T := by obtain ⟨t, ht⟩ := hinter obtain ⟨htN, htM⟩ := Finset.mem_inter.mp ht exact Finset.mem_sub.mpr ⟨t + d, (mem_shiftBack d t M).mp htM, t, hNT htN, by abel⟩ end MarkerCounting section ForcingCounting variable {G : Type u} [AddCommGroup G] [DecidableEq G] def pairedTargets (Z : Finset G) (d : G) : Finset G := Z.filter (fun x => x - d ∈ Z) def forcingRows (A T : Finset G) (c : ℕ) (d x : G) : Finset (Finset G × Finset G) := ((parentRow A T x).powersetCard c).product ((parentRow A T (x - d)).powersetCard c) def forcingPairs (A T Z : Finset G) (c : ℕ) (d : G) : Finset (SourceWitness G) := (pairedTargets Z d).sigma (forcingRows A T c d) theorem card_forcingRows_le (A T : Finset G) (c R : ℕ) (d x : G) (hx : representationCount A T x ≤ R) (hy : representationCount A T (x - d) ≤ R) : (forcingRows A T c d x).card ≤ R ^ (2 * c) := by calc (forcingRows A T c d x).card = (representationCount A T x).choose c * (representationCount A T (x - d)).choose c := by simp [forcingRows, card_parentRow] _ ≤ R ^ c * R ^ c := Nat.mul_le_mul ((Nat.choose_le_choose c hx).trans (Nat.choose_le_pow R c)) ((Nat.choose_le_choose c hy).trans (Nat.choose_le_pow R c)) _ = R ^ (2 * c) := by rw [← pow_add, two_mul] theorem card_forcingPairs_subfamily_le (A T Z : Finset G) (c R : ℕ) (d : G) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (I : Finset (SourceWitness G)) (hI : I ⊆ forcingPairs A T Z c d) (X : Finset G) (hX : X ⊆ pairedTargets Z d) (hIX : ∀ w ∈ I, w.1 ∈ X) : I.card ≤ X.card * R ^ (2 * c) := by have hsub : I ⊆ X.sigma (forcingRows A T c d) := by intro w hw exact Finset.mem_sigma.mpr ⟨hIX w hw, (Finset.mem_sigma.mp (hI hw)).2⟩ calc _ ≤ (X.sigma (forcingRows A T c d)).card := Finset.card_le_card hsub _ = ∑ x ∈ X, (forcingRows A T c d x).card := Finset.card_sigma _ _ _ ≤ ∑ _x ∈ X, R ^ (2 * c) := by apply Finset.sum_le_sum intro x hx obtain ⟨hxZ, hyZ⟩ := Finset.mem_filter.mp (hX hx) exact card_forcingRows_le A T c R d x (hR x hxZ) (hR (x - d) hyZ) _ = _ := by simp theorem card_forcingPairs_le (A T Z : Finset G) (c R : ℕ) (d : G) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) : (forcingPairs A T Z c d).card ≤ Z.card * R ^ (2 * c) := by calc _ ≤ (pairedTargets Z d).card * R ^ (2 * c) := card_forcingPairs_subfamily_le A T Z c R d hR _ (Finset.Subset.refl _) _ (Finset.Subset.refl _) (fun w hw => (Finset.mem_sigma.mp hw).1) _ ≤ _ := Nat.mul_le_mul_right _ (Finset.card_filter_le _ _) /-- The restricted-target FG12 double count. Its only geometric input is the actual codegree at -d, with the same sign convention as CodegreeMultiplicity. -/ theorem sum_common_parentRows_le (A T Z : Finset G) (d : G) : (∑ x ∈ Z, (parentRow A T x ∩ parentRow A T (x - d)).card) ≤ T.card * (A.filter (fun a => a - d ∈ A)).card := by calc _ = (Z.sigma fun x => parentRow A T x ∩ parentRow A T (x - d)).card := (Finset.card_sigma _ _).symm _ ≤ (T.product (A.filter (fun a => a - d ∈ A))).card := by apply Finset.card_le_card_of_injOn (fun xt => (xt.2, xt.1 - xt.2)) · intro xt hxt obtain ⟨_, ht⟩ := Finset.mem_sigma.mp hxt obtain ⟨htx, hty⟩ := Finset.mem_inter.mp ht obtain ⟨htT, hxA⟩ := (mem_parentRow A T xt.1 xt.2).mp htx have hyA := ((mem_parentRow A T (xt.1 - d) xt.2).mp hty).2 have heq : xt.1 - xt.2 - d = (xt.1 - d) - xt.2 := by abel exact Finset.mem_product.mpr ⟨htT, Finset.mem_filter.mpr ⟨hxA, heq ▸ hyA⟩⟩ · rintro ⟨x, t⟩ _ ⟨y, s⟩ _ h have hts : t = s := congrArg Prod.fst h have hxy : x - t = y - s := congrArg Prod.snd h subst s have hxy' : x = y := sub_left_injective hxy subst y rfl _ = _ := Finset.card_product _ _ theorem sum_common_parentRows_le_codegree (A T Z : Finset G) (J : ℕ) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) (d : G) (hd : d ≠ 0) : (∑ x ∈ Z, (parentRow A T x ∩ parentRow A T (x - d)).card) ≤ T.card * J := by apply (sum_common_parentRows_le A T Z d).trans apply Nat.mul_le_mul_left simpa only [sub_eq_add_neg] using hcode (-d) (neg_ne_zero.mpr hd) def forcedCollisionPairs (A T Z : Finset G) (c : ℕ) (d : G) : Finset (SourceWitness G) := (forcingPairs A T Z c d).filter (fun w => (w.2.1 ∩ w.2.2).Nonempty) /-- A shared forced source restricts the target through the parent codegree. No power of R is saved or needed in this convenient finite bound. -/ theorem card_forcedCollisionPairs_le (A T Z : Finset G) (c R J : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) (d : G) (hd : d ≠ 0) : (forcedCollisionPairs A T Z c d).card ≤ T.card * J * R ^ (2 * c) := by classical let E := (pairedTargets Z d).sigma fun x => (parentRow A T x ∩ parentRow A T (x - d)).sigma fun _t => forcingRows A T c d x have hcover : forcedCollisionPairs A T Z c d ⊆ E.image (fun w => (⟨w.1, w.2.2⟩ : SourceWitness G)) := by intro w hw obtain ⟨hw, ht⟩ := Finset.mem_filter.mp hw obtain ⟨hx, hQ⟩ := Finset.mem_sigma.mp hw obtain ⟨hQ₁, hQ₂⟩ := Finset.mem_product.mp hQ obtain ⟨t, ht⟩ := ht obtain ⟨ht₁, ht₂⟩ := Finset.mem_inter.mp ht apply Finset.mem_image.mpr refine ⟨⟨w.1, t, w.2⟩, ?_, rfl⟩ exact Finset.mem_sigma.mpr ⟨hx, Finset.mem_sigma.mpr ⟨Finset.mem_inter.mpr ⟨(Finset.mem_powersetCard.mp hQ₁).1 ht₁, (Finset.mem_powersetCard.mp hQ₂).1 ht₂⟩, hQ⟩⟩ calc _ ≤ (E.image (fun w => (⟨w.1, w.2.2⟩ : SourceWitness G))).card := Finset.card_le_card hcover _ ≤ E.card := Finset.card_image_le _ = ∑ x ∈ pairedTargets Z d, ((parentRow A T x ∩ parentRow A T (x - d)).sigma fun _t => forcingRows A T c d x).card := Finset.card_sigma _ _ _ ≤ ∑ x ∈ pairedTargets Z d, (parentRow A T x ∩ parentRow A T (x - d)).card * R ^ (2 * c) := by apply Finset.sum_le_sum intro x hx obtain ⟨hxZ, hyZ⟩ := Finset.mem_filter.mp hx rw [Finset.card_sigma] calc _ ≤ ∑ _t ∈ parentRow A T x ∩ parentRow A T (x - d), R ^ (2 * c) := Finset.sum_le_sum (fun _ _ => card_forcingRows_le A T c R d x (hR x hxZ) (hR (x - d) hyZ)) _ = _ := by simp _ = (∑ x ∈ pairedTargets Z d, (parentRow A T x ∩ parentRow A T (x - d)).card) * R ^ (2 * c) := (Finset.sum_mul _ _ _).symm _ ≤ _ := Nat.mul_le_mul_right _ (sum_common_parentRows_le_codegree A T (pairedTargets Z d) J hcode d hd) theorem card_target_source_meeting_le (A T X M : Finset G) (d : G) : (X.filter (fun x => (parentRow A T (x - d) ∩ M).Nonempty)).card ≤ A.card * M.card := by calc _ ≤ (A + M).card := by apply Finset.card_le_card_of_injOn (fun x => x - d) · intro x hx obtain ⟨_, t, ht⟩ := Finset.mem_filter.mp hx obtain ⟨htR, htM⟩ := Finset.mem_inter.mp ht have htA := ((mem_parentRow A T (x - d) t).mp htR).2 exact Finset.mem_add.mpr ⟨(x - d) - t, htA, t, htM, by abel⟩ · intro x _ y _ h exact sub_left_injective h _ ≤ _ := Finset.card_add_le def crossForcingMarkerPairs (A T Z M N : Finset G) (c : ℕ) (d : G) : Finset (SourceWitness G) := (forcingPairs A T Z c d).filter (fun w => (w.2.1 ∩ N).Nonempty ∨ (w.2.2 ∩ M).Nonempty) /-- A forced/marker collision restricts the target to a translate of A. The two directions are both included, with arbitrary fixed marker sets. -/ theorem card_crossForcingMarkerPairs_le (A T Z M N : Finset G) (c R : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (d : G) : (crossForcingMarkerPairs A T Z M N c d).card ≤ (M.card + N.card) * A.card * R ^ (2 * c) := by have hleft : ((forcingPairs A T Z c d).filter (fun w => (w.2.1 ∩ N).Nonempty)).card ≤ A.card * N.card * R ^ (2 * c) := by let X := (pairedTargets Z d).filter (fun x => (parentRow A T x ∩ N).Nonempty) have hbound := card_forcingPairs_subfamily_le A T Z c R d hR ((forcingPairs A T Z c d).filter (fun w => (w.2.1 ∩ N).Nonempty)) (Finset.filter_subset _ _) X (Finset.filter_subset _ _) (by intro w hw obtain ⟨hw, t, ht⟩ := Finset.mem_filter.mp hw obtain ⟨hx, hQ⟩ := Finset.mem_sigma.mp hw obtain ⟨htQ, htN⟩ := Finset.mem_inter.mp ht exact Finset.mem_filter.mpr ⟨hx, t, Finset.mem_inter.mpr ⟨(Finset.mem_powersetCard.mp (Finset.mem_product.mp hQ).1).1 htQ, htN⟩⟩) apply hbound.trans apply Nat.mul_le_mul_right simpa only [X, sub_zero] using card_target_source_meeting_le A T (pairedTargets Z d) N 0 have hright : ((forcingPairs A T Z c d).filter (fun w => (w.2.2 ∩ M).Nonempty)).card ≤ A.card * M.card * R ^ (2 * c) := by let X := (pairedTargets Z d).filter (fun x => (parentRow A T (x - d) ∩ M).Nonempty) have hbound := card_forcingPairs_subfamily_le A T Z c R d hR ((forcingPairs A T Z c d).filter (fun w => (w.2.2 ∩ M).Nonempty)) (Finset.filter_subset _ _) X (Finset.filter_subset _ _) (by intro w hw obtain ⟨hw, t, ht⟩ := Finset.mem_filter.mp hw obtain ⟨hx, hQ⟩ := Finset.mem_sigma.mp hw obtain ⟨htQ, htM⟩ := Finset.mem_inter.mp ht exact Finset.mem_filter.mpr ⟨hx, t, Finset.mem_inter.mpr ⟨(Finset.mem_powersetCard.mp (Finset.mem_product.mp hQ).2).1 htQ, htM⟩⟩) exact hbound.trans (Nat.mul_le_mul_right _ (card_target_source_meeting_le A T (pairedTargets Z d) M d)) unfold crossForcingMarkerPairs rw [Finset.filter_or] calc _ ≤ _ + _ := Finset.card_union_le _ _ _ ≤ _ + _ := Nat.add_le_add hleft hright _ = _ := by ring end ForcingCounting section PairCounting variable {G : Type u} [AddCommGroup G] [DecidableEq G] abbrev MarkerConfiguration (G : Type u) := Σ _M : Finset G, Σ _d : G, Finset G def pairEncoding (wv : SourceWitness G × SourceWitness G) : Σ _mc : MarkerConfiguration G, SourceWitness G := ⟨⟨wv.1.2.2, wv.1.1 - wv.2.1, wv.2.2.2⟩, ⟨wv.1.1, wv.1.2.1, wv.2.2.1⟩⟩ def pairDecoding (e : Σ _mc : MarkerConfiguration G, SourceWitness G) : SourceWitness G × SourceWitness G := (⟨e.2.1, e.2.2.1, e.1.1⟩, ⟨e.2.1 - e.1.2.1, e.2.2.2, e.1.2.2⟩) theorem pairDecoding_encoding (wv : SourceWitness G × SourceWitness G) : pairDecoding (pairEncoding wv) = wv := by rcases wv with ⟨⟨x, Q, M⟩, ⟨y, Q', N⟩⟩ have hxy : x - (x - y) = y := by abel simp only [pairDecoding, pairEncoding, hxy] theorem pairEncoding_injective : Function.Injective (pairEncoding (G := G)) := (show Function.LeftInverse pairDecoding pairEncoding from pairDecoding_encoding).injective def overlapPairs (A T Z : Finset G) (c j u : ℕ) : Finset (SourceWitness G × SourceWitness G) := ((sourceWitnesses A T Z c j).product (sourceWitnesses A T Z c j)).filter (fun wv => (inputSupport wv.1 ∩ inputSupport wv.2).card = u) theorem pairEncoding_mem (A T Z : Finset G) (c j u : ℕ) (hu : 0 < u) (wv : SourceWitness G × SourceWitness G) (hwv : wv ∈ overlapPairs A T Z c j u) : pairEncoding wv ∈ (markerConfigurations T j u).sigma (fun mc => forcingPairs A T Z c mc.2.1) := by rcases wv with ⟨⟨x, Q, M⟩, ⟨y, Q', N⟩⟩ obtain ⟨hwv, hinter⟩ := Finset.mem_filter.mp hwv obtain ⟨hw, hv⟩ := Finset.mem_product.mp hwv obtain ⟨hx, hQ, hM, _⟩ := (mem_sourceWitnesses A T Z c j _).mp hw obtain ⟨hy, hQ', hN, _⟩ := (mem_sourceWitnesses A T Z c j _).mp hv have hinter' : (N ∩ shiftBack (x - y) M).card = u := by rw [← card_physical_intersection x y M N] exact hinter have hd : x - y ∈ M - T := difference_mem_of_intersection T M N (x - y) hN.1 (Finset.card_pos.mp (hinter' ▸ hu)) have hxy : x - (x - y) = y := by abel apply Finset.mem_sigma.mpr constructor · exact Finset.mem_sigma.mpr ⟨Finset.mem_powersetCard.mpr hM, Finset.mem_sigma.mpr ⟨hd, (mem_intersectionFamily T (shiftBack (x - y) M) N j u).mpr ⟨hN.1, hN.2, hinter'⟩⟩⟩ · change (⟨x, Q, Q'⟩ : SourceWitness G) ∈ forcingPairs A T Z c (x - y) apply Finset.mem_sigma.mpr refine ⟨Finset.mem_filter.mpr ⟨hx, ?_⟩, Finset.mem_product.mpr ⟨Finset.mem_powersetCard.mpr hQ, ?_⟩⟩ · simpa only [hxy] using hy · apply Finset.mem_powersetCard.mpr simpa only [hxy] using hQ' theorem card_pairFamily_le (I : Finset (SourceWitness G × SourceWitness G)) (MC : Finset (MarkerConfiguration G)) (F : MarkerConfiguration G → Finset (SourceWitness G)) (B : ℕ) (hmap : ∀ wv ∈ I, pairEncoding wv ∈ MC.sigma F) (hF : ∀ mc ∈ MC, (F mc).card ≤ B) : I.card ≤ MC.card * B := by calc _ ≤ (MC.sigma F).card := Finset.card_le_card_of_injOn pairEncoding hmap pairEncoding_injective.injOn _ = ∑ mc ∈ MC, (F mc).card := Finset.card_sigma _ _ _ ≤ ∑ _mc ∈ MC, B := Finset.sum_le_sum hF _ = _ := by simp theorem card_overlapPairs_le (A T Z : Finset G) (c j u R : ℕ) (hu : 0 < u) (huj : u ≤ j) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) : (overlapPairs A T Z c j u).card ≤ (j * 2 ^ j * T.card ^ (2 * j - u + 1)) * (Z.card * R ^ (2 * c)) := by apply (card_pairFamily_le (overlapPairs A T Z c j u) (markerConfigurations T j u) (fun mc => forcingPairs A T Z c mc.2.1) (Z.card * R ^ (2 * c)) (pairEncoding_mem A T Z c j u hu) (fun mc _ => card_forcingPairs_le A T Z c R mc.2.1 hR)).trans exact Nat.mul_le_mul_right _ (card_markerConfigurations_le T j u huj) theorem mem_collidingMarkerConfigurations (T : Finset G) (j u : ℕ) (mc : MarkerConfiguration G) : mc ∈ collidingMarkerConfigurations T j u ↔ mc ∈ markerConfigurations T j u ∧ (mc.1 ∩ mc.2.2).Nonempty := by simp only [collidingMarkerConfigurations, localCollidingMarkers, markerConfigurations, Finset.mem_sigma, Finset.mem_filter, and_assoc] def markerCollisionOverlaps (A T Z : Finset G) (c j u : ℕ) : Finset (SourceWitness G × SourceWitness G) := (overlapPairs A T Z c j u).filter (fun wv => (wv.1.2.2 ∩ wv.2.2.2).Nonempty) theorem card_markerCollisionOverlaps_le (A T Z : Finset G) (c j u R : ℕ) (hu : 0 < u) (huj : u ≤ j) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) : (markerCollisionOverlaps A T Z c j u).card ≤ (2 * j ^ 2 * 2 ^ j * T.card ^ (2 * j - u)) * (Z.card * R ^ (2 * c)) := by refine (card_pairFamily_le (markerCollisionOverlaps A T Z c j u) (collidingMarkerConfigurations T j u) (fun mc => forcingPairs A T Z c mc.2.1) (Z.card * R ^ (2 * c)) ?_ (fun mc _ => card_forcingPairs_le A T Z c R mc.2.1 hR)).trans ?_ · intro wv hwv obtain ⟨hwv, hcoll⟩ := Finset.mem_filter.mp hwv obtain ⟨hMC, hF⟩ := Finset.mem_sigma.mp (pairEncoding_mem A T Z c j u hu wv hwv) exact Finset.mem_sigma.mpr ⟨(mem_collidingMarkerConfigurations _ _ _ _).mpr ⟨hMC, hcoll⟩, hF⟩ · exact Nat.mul_le_mul_right _ (card_collidingMarkerConfigurations_le T j u huj) def forcedCollisionOverlaps (A T Z : Finset G) (c j u : ℕ) : Finset (SourceWitness G × SourceWitness G) := (overlapPairs A T Z c j u).filter (fun wv => wv.1.1 ≠ wv.2.1 ∧ (wv.1.2.1 ∩ wv.2.2.1).Nonempty) theorem card_forcedCollisionOverlaps_le (A T Z : Finset G) (c j u R J : ℕ) (hu : 0 < u) (huj : u ≤ j) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) : (forcedCollisionOverlaps A T Z c j u).card ≤ (j * 2 ^ j * T.card ^ (2 * j - u + 1)) * (T.card * J * R ^ (2 * c)) := by classical let F : MarkerConfiguration G → Finset (SourceWitness G) := fun mc => if mc.2.1 = 0 then ∅ else forcedCollisionPairs A T Z c mc.2.1 refine (card_pairFamily_le (forcedCollisionOverlaps A T Z c j u) (markerConfigurations T j u) F (T.card * J * R ^ (2 * c)) ?_ ?_).trans ?_ · intro wv hwv obtain ⟨hwv, hne, hcoll⟩ := Finset.mem_filter.mp hwv obtain ⟨hMC, hF⟩ := Finset.mem_sigma.mp (pairEncoding_mem A T Z c j u hu wv hwv) apply Finset.mem_sigma.mpr refine ⟨hMC, ?_⟩ change (pairEncoding wv).2 ∈ if wv.1.1 - wv.2.1 = 0 then ∅ else forcedCollisionPairs A T Z c (wv.1.1 - wv.2.1) rw [if_neg (sub_ne_zero.mpr hne)] exact Finset.mem_filter.mpr ⟨hF, hcoll⟩ · intro mc _ dsimp [F] split_ifs with hd · simp · exact card_forcedCollisionPairs_le A T Z c R J hR hcode mc.2.1 hd · exact Nat.mul_le_mul_right _ (card_markerConfigurations_le T j u huj) def crossCollisionOverlaps (A T Z : Finset G) (c j u : ℕ) : Finset (SourceWitness G × SourceWitness G) := (overlapPairs A T Z c j u).filter (fun wv => (wv.1.2.1 ∩ wv.2.2.2).Nonempty ∨ (wv.2.2.1 ∩ wv.1.2.2).Nonempty) theorem card_crossCollisionOverlaps_le (A T Z : Finset G) (c j u R : ℕ) (hu : 0 < u) (huj : u ≤ j) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) : (crossCollisionOverlaps A T Z c j u).card ≤ (j * 2 ^ j * T.card ^ (2 * j - u + 1)) * ((2 * j) * A.card * R ^ (2 * c)) := by refine (card_pairFamily_le (crossCollisionOverlaps A T Z c j u) (markerConfigurations T j u) (fun mc => crossForcingMarkerPairs A T Z mc.1 mc.2.2 c mc.2.1) ((2 * j) * A.card * R ^ (2 * c)) ?_ ?_).trans ?_ · intro wv hwv obtain ⟨hwv, hcoll⟩ := Finset.mem_filter.mp hwv obtain ⟨hMC, hF⟩ := Finset.mem_sigma.mp (pairEncoding_mem A T Z c j u hu wv hwv) exact Finset.mem_sigma.mpr ⟨hMC, Finset.mem_filter.mpr ⟨hF, hcoll⟩⟩ · intro mc hmc obtain ⟨hM, hdN⟩ := Finset.mem_sigma.mp hmc obtain ⟨_, hN⟩ := Finset.mem_sigma.mp hdN have hMcard := (Finset.mem_powersetCard.mp hM).2 have hNcard := ((mem_intersectionFamily _ _ _ _ _).mp hN).2.1 simpa only [hMcard, hNcard, ← two_mul] using card_crossForcingMarkerPairs_le A T Z mc.1 mc.2.2 c R hR mc.2.1 · exact Nat.mul_le_mul_right _ (card_markerConfigurations_le T j u huj) theorem shiftBack_zero (M : Finset G) : shiftBack 0 M = M := by simp [shiftBack] theorem card_zeroDifferenceMarkers_le (T : Finset G) (j u : ℕ) (huj : u ≤ j) : ((markerConfigurations T j u).filter (fun mc => mc.2.1 = 0)).card ≤ 2 ^ j * T.card ^ (2 * j - u) := by apply le_trans ?_ (card_sameTargetMarkerConfigurations_le T j u huj) apply Finset.card_le_card_of_injOn (fun mc : MarkerConfiguration G => (⟨mc.1, mc.2.2⟩ : Σ _M : Finset G, Finset G)) · intro mc hmc obtain ⟨hmc, hd⟩ := Finset.mem_filter.mp hmc obtain ⟨hM, hdN⟩ := Finset.mem_sigma.mp hmc obtain ⟨_, hN⟩ := Finset.mem_sigma.mp hdN apply Finset.mem_sigma.mpr exact ⟨hM, by simpa only [hd, shiftBack_zero] using hN⟩ · rintro ⟨M, d, N⟩ hmc ⟨M', d', N'⟩ hmc' h have hd : d = 0 := (Finset.mem_filter.mp hmc).2 have hd' : d' = 0 := (Finset.mem_filter.mp hmc').2 have hM : M = M' := congrArg Sigma.fst h have hN : N = N' := congrArg (fun q : Σ _M : Finset G, Finset G => q.2) h subst d subst d' subst M' subst N' rfl def sameTargetOverlaps (A T Z : Finset G) (c j u : ℕ) : Finset (SourceWitness G × SourceWitness G) := (overlapPairs A T Z c j u).filter (fun wv => wv.1.1 = wv.2.1) theorem card_sameTargetOverlaps_le (A T Z : Finset G) (c j u R : ℕ) (hu : 0 < u) (huj : u ≤ j) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) : (sameTargetOverlaps A T Z c j u).card ≤ (2 ^ j * T.card ^ (2 * j - u)) * (Z.card * R ^ (2 * c)) := by refine (card_pairFamily_le (sameTargetOverlaps A T Z c j u) ((markerConfigurations T j u).filter (fun mc => mc.2.1 = 0)) (fun mc => forcingPairs A T Z c mc.2.1) (Z.card * R ^ (2 * c)) ?_ (fun mc _ => card_forcingPairs_le A T Z c R mc.2.1 hR)).trans ?_ · intro wv hwv obtain ⟨hwv, heq⟩ := Finset.mem_filter.mp hwv obtain ⟨hMC, hF⟩ := Finset.mem_sigma.mp (pairEncoding_mem A T Z c j u hu wv hwv) exact Finset.mem_sigma.mpr ⟨Finset.mem_filter.mpr ⟨hMC, sub_eq_zero.mpr heq⟩, hF⟩ · exact Nat.mul_le_mul_right _ (card_zeroDifferenceMarkers_le T j u huj) end PairCounting section ExpectedOverlap variable {G : Type u} [AddCommGroup G] [DecidableEq G] def ordinaryPairBound (z m c j u R : ℕ) : ℕ := (j * 2 ^ j * m ^ (2 * j - u + 1)) * (z * R ^ (2 * c)) def collisionPairBound (a z m c j u R J : ℕ) : ℕ := (2 ^ j * m ^ (2 * j - u)) * (z * R ^ (2 * c)) + (j * 2 ^ j * m ^ (2 * j - u + 1)) * (m * J * R ^ (2 * c)) + (j * 2 ^ j * m ^ (2 * j - u + 1)) * ((2 * j) * a * R ^ (2 * c)) + (2 * j ^ 2 * 2 ^ j * m ^ (2 * j - u)) * (z * R ^ (2 * c)) def sourceCollisionOverlaps (A T Z : Finset G) (c j u : ℕ) : Finset (SourceWitness G × SourceWitness G) := (overlapPairs A T Z c j u).filter (fun wv => ¬ Disjoint (sourceSupport wv.1) (sourceSupport wv.2)) theorem sourceCollisionOverlaps_subset (A T Z : Finset G) (c j u : ℕ) : sourceCollisionOverlaps A T Z c j u ⊆ sameTargetOverlaps A T Z c j u ∪ forcedCollisionOverlaps A T Z c j u ∪ crossCollisionOverlaps A T Z c j u ∪ markerCollisionOverlaps A T Z c j u := by intro wv hwv obtain ⟨hwv, hsource⟩ := Finset.mem_filter.mp hwv by_cases hxy : wv.1.1 = wv.2.1 · exact Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_filter.mpr ⟨hwv, hxy⟩))) · obtain ⟨t, ht, ht'⟩ := Finset.not_disjoint_iff.mp hsource rcases Finset.mem_union.mp ht with htQ | htM <;> rcases Finset.mem_union.mp ht' with htQ' | htM' · exact Finset.mem_union_left _ (Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨hwv, hxy, t, Finset.mem_inter.mpr ⟨htQ, htQ'⟩⟩))) · exact Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨hwv, Or.inl ⟨t, Finset.mem_inter.mpr ⟨htQ, htM'⟩⟩⟩)) · exact Finset.mem_union_left _ (Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨hwv, Or.inr ⟨t, Finset.mem_inter.mpr ⟨htQ', htM⟩⟩⟩)) · exact Finset.mem_union_right _ (Finset.mem_filter.mpr ⟨hwv, t, Finset.mem_inter.mpr ⟨htM, htM'⟩⟩) theorem card_sourceCollisionOverlaps_le (A T Z : Finset G) (c j u R J : ℕ) (hu : 0 < u) (huj : u ≤ j) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) : (sourceCollisionOverlaps A T Z c j u).card ≤ collisionPairBound A.card Z.card T.card c j u R J := by have h₀ := Finset.card_le_card (sourceCollisionOverlaps_subset A T Z c j u) have h₁ := Finset.card_union_le (sameTargetOverlaps A T Z c j u) (forcedCollisionOverlaps A T Z c j u) have h₂ := Finset.card_union_le (sameTargetOverlaps A T Z c j u ∪ forcedCollisionOverlaps A T Z c j u) (crossCollisionOverlaps A T Z c j u) have h₃ := Finset.card_union_le (sameTargetOverlaps A T Z c j u ∪ forcedCollisionOverlaps A T Z c j u ∪ crossCollisionOverlaps A T Z c j u) (markerCollisionOverlaps A T Z c j u) have hs := card_sameTargetOverlaps_le A T Z c j u R hu huj hR have hf := card_forcedCollisionOverlaps_le A T Z c j u R J hu huj hR hcode have hx := card_crossCollisionOverlaps_le A T Z c j u R hu huj hR have hm := card_markerCollisionOverlaps_le A T Z c j u R hu huj hR unfold collisionPairBound omega theorem card_physical_union (A T Z : Finset G) (c j u : ℕ) (wv : SourceWitness G × SourceWitness G) (hwv : wv ∈ overlapPairs A T Z c j u) : (inputSupport wv.1 ∪ inputSupport wv.2).card = 2 * j - u := by obtain ⟨hwv, hinter⟩ := Finset.mem_filter.mp hwv obtain ⟨hw, hv⟩ := Finset.mem_product.mp hwv have hwj := card_inputSupport A T Z c j wv.1 hw have hvj := card_inputSupport A T Z c j wv.2 hv have hc := Finset.card_union_add_card_inter (inputSupport wv.1) (inputSupport wv.2) omega theorem sum_pairs_by_positive_overlap (A T Z : Finset G) (c j : ℕ) (f : (SourceWitness G × SourceWitness G) → ℝ) : (∑ wv ∈ (sourceWitnesses A T Z c j).product (sourceWitnesses A T Z c j), if Disjoint (inputSupport wv.1) (inputSupport wv.2) then 0 else f wv) = ∑ u ∈ Finset.Icc 1 j, ∑ wv ∈ overlapPairs A T Z c j u, f wv := by classical unfold overlapPairs rw [Finset.sum_fiberwise_eq_sum_filter, Finset.sum_filter] apply Finset.sum_congr rfl intro wv hwv obtain ⟨hw, _⟩ := Finset.mem_product.mp hwv have hle : (inputSupport wv.1 ∩ inputSupport wv.2).card ≤ j := by calc _ ≤ (inputSupport wv.1).card := Finset.card_le_card Finset.inter_subset_left _ = j := card_inputSupport A T Z c j _ hw by_cases hdis : Disjoint (inputSupport wv.1) (inputSupport wv.2) · have hzero := Finset.disjoint_iff_inter_eq_empty.mp hdis simp [hdis, hzero] · obtain ⟨t, ht, ht'⟩ := Finset.not_disjoint_iff.mp hdis have hpos := Finset.card_pos.mpr ⟨t, Finset.mem_inter.mpr ⟨ht, ht'⟩⟩ have hmem : (inputSupport wv.1 ∩ inputSupport wv.2).card ∈ Finset.Icc 1 j := Finset.mem_Icc.mpr ⟨hpos, hle⟩ simp only [hdis, hmem, ite_false, ite_true] noncomputable def pairSourceTerm (θ K ρ : ℝ) (c j : ℕ) (wv : SourceWitness G × SourceWitness G) : ℝ := ((K / θ ^ (c + j)) ^ 2 * ρ ^ (inputSupport wv.1 ∪ inputSupport wv.2).card) * θ ^ (sourceSupport wv.1 ∪ sourceSupport wv.2).card theorem bernoulliMean_overlapMajorizer_eq_spectrum (A T Z : Finset G) (c j : ℕ) (θ K ρ : ℝ) : bernoulliMean T θ (overlapMajorizer A T Z c j θ K ρ) = ∑ u ∈ Finset.Icc 1 j, ∑ wv ∈ overlapPairs A T Z c j u, pairSourceTerm θ K ρ c j wv := by rw [← sum_pairs_by_positive_overlap, bernoulliMean_overlapMajorizer, Finset.product_eq_sprod, Finset.sum_product] apply Finset.sum_congr rfl intro w _ apply Finset.sum_congr rfl intro v _ by_cases hdis : Disjoint (inputSupport w) (inputSupport v) <;> simp [overlapPairWeight, pairSourceTerm, hdis] theorem pairSourceTerm_le (A T Z : Finset G) (c j u : ℕ) {θ ρ : ℝ} (hθ : 0 ≤ θ) (hθ1 : θ ≤ 1) (hρ : 0 ≤ ρ) (K : ℝ) (wv : SourceWitness G × SourceWitness G) (hwv : wv ∈ overlapPairs A T Z c j u) : pairSourceTerm θ K ρ c j wv ≤ (K / θ ^ (c + j)) ^ 2 * ρ ^ (2 * j - u) := by unfold pairSourceTerm rw [card_physical_union A T Z c j u wv hwv] exact mul_le_of_le_one_right (mul_nonneg (sq_nonneg _) (pow_nonneg hρ _)) (pow_le_one₀ hθ hθ1) theorem pairSourceTerm_of_disjoint (A T Z : Finset G) (c j u : ℕ) {θ : ℝ} (hθ : θ ≠ 0) (K ρ : ℝ) (wv : SourceWitness G × SourceWitness G) (hwv : wv ∈ overlapPairs A T Z c j u) (hdis : Disjoint (sourceSupport wv.1) (sourceSupport wv.2)) : pairSourceTerm θ K ρ c j wv = K ^ 2 * ρ ^ (2 * j - u) := by obtain ⟨hw, hv⟩ := Finset.mem_product.mp (Finset.mem_filter.mp hwv).1 unfold pairSourceTerm rw [card_physical_union A T Z c j u wv hwv, Finset.card_union_of_disjoint hdis, card_sourceSupport A T Z c j wv.1 hw, card_sourceSupport A T Z c j wv.2 hv, pow_add] field_simp <;> simp only [pow_add, pow_two] <;> ring private theorem sum_le_card_add_card_filter {ι : Type v} (I : Finset ι) (P : ι → Prop) [DecidablePred P] (f : ι → ℝ) (a b : ℝ) (ha : 0 ≤ a) (hclean : ∀ i ∈ I, ¬ P i → f i ≤ a) (hbad : ∀ i ∈ I, P i → f i ≤ b) : (∑ i ∈ I, f i) ≤ (I.card : ℝ) * a + ((I.filter P).card : ℝ) * b := by calc _ ≤ ∑ i ∈ I, (a + (if P i then b else 0)) := by apply Finset.sum_le_sum intro i hi by_cases hP : P i · rw [if_pos hP] exact (hbad i hi hP).trans (le_add_of_nonneg_left ha) · rw [if_neg hP, add_zero] exact hclean i hi hP _ = _ := by rw [Finset.sum_add_distrib, ← Finset.sum_filter]; simp theorem sum_pairSourceTerm_le (A T Z : Finset G) (c j u R J : ℕ) (hu : 0 < u) (huj : u ≤ j) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) {θ ρ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hρ : 0 ≤ ρ) (K : ℝ) : (∑ wv ∈ overlapPairs A T Z c j u, pairSourceTerm θ K ρ c j wv) ≤ ((ordinaryPairBound Z.card T.card c j u R : ℝ) * K ^ 2 + (collisionPairBound A.card Z.card T.card c j u R J : ℝ) * (K / θ ^ (c + j)) ^ 2) * ρ ^ (2 * j - u) := by classical have hclean : 0 ≤ K ^ 2 * ρ ^ (2 * j - u) := mul_nonneg (sq_nonneg _) (pow_nonneg hρ _) have hbad : 0 ≤ (K / θ ^ (c + j)) ^ 2 * ρ ^ (2 * j - u) := mul_nonneg (sq_nonneg _) (pow_nonneg hρ _) have hsum := sum_le_card_add_card_filter (overlapPairs A T Z c j u) (fun wv => ¬ Disjoint (sourceSupport wv.1) (sourceSupport wv.2)) (pairSourceTerm θ K ρ c j) (K ^ 2 * ρ ^ (2 * j - u)) ((K / θ ^ (c + j)) ^ 2 * ρ ^ (2 * j - u)) hclean (fun wv hwv hdis => (pairSourceTerm_of_disjoint A T Z c j u hθ.ne' K ρ wv hwv (not_not.mp hdis)).le) (fun wv hwv _ => pairSourceTerm_le A T Z c j u hθ.le hθ1 hρ K wv hwv) calc _ ≤ (overlapPairs A T Z c j u).card * (K ^ 2 * ρ ^ (2 * j - u)) + (sourceCollisionOverlaps A T Z c j u).card * ((K / θ ^ (c + j)) ^ 2 * ρ ^ (2 * j - u)) := hsum _ ≤ (ordinaryPairBound Z.card T.card c j u R : ℝ) * (K ^ 2 * ρ ^ (2 * j - u)) + (collisionPairBound A.card Z.card T.card c j u R J : ℝ) * ((K / θ ^ (c + j)) ^ 2 * ρ ^ (2 * j - u)) := by apply add_le_add · apply mul_le_mul_of_nonneg_right _ hclean exact_mod_cast card_overlapPairs_le A T Z c j u R hu huj hR · apply mul_le_mul_of_nonneg_right _ hbad exact_mod_cast card_sourceCollisionOverlaps_le A T Z c j u R J hu huj hR hcode _ = _ := by ring /-- Exact finite FG13 bound before any square-root-density estimates. -/ theorem bernoulliMean_overlapMajorizer_le_sum (A T Z : Finset G) (c j R J : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) {θ ρ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hρ : 0 ≤ ρ) (K : ℝ) : bernoulliMean T θ (overlapMajorizer A T Z c j θ K ρ) ≤ ∑ u ∈ Finset.Icc 1 j, ((ordinaryPairBound Z.card T.card c j u R : ℝ) * K ^ 2 + (collisionPairBound A.card Z.card T.card c j u R J : ℝ) * (K / θ ^ (c + j)) ^ 2) * ρ ^ (2 * j - u) := by rw [bernoulliMean_overlapMajorizer_eq_spectrum] apply Finset.sum_le_sum intro u hu exact sum_pairSourceTerm_le A T Z c j u R J (Finset.mem_Icc.mp hu).1 (Finset.mem_Icc.mp hu).2 hR hcode hθ hθ1 hρ K /-- The exact expected-overlap expression, with all dependence on the source density, codegree, parent size, translate size and target restriction exposed. -/ noncomputable def overlapExpectationBound (a z m c j R J : ℕ) (θ K ρ : ℝ) : ℝ := K ^ 2 * (R : ℝ) ^ (2 * c) * (2 : ℝ) ^ j * (∑ u ∈ Finset.Icc 1 j, ((m : ℝ) * ρ) ^ (2 * j - u)) * ((j : ℝ) * z * m + (θ ^ (c + j))⁻¹ ^ 2 * ((j : ℝ) * (m : ℝ) ^ 2 * J + 2 * (j : ℝ) ^ 2 * a * m + (2 * (j : ℝ) ^ 2 + 1) * z)) theorem overlap_count_bound_algebra (a z m c j u R J : ℕ) (θ K ρ : ℝ) : ((ordinaryPairBound z m c j u R : ℝ) * K ^ 2 + (collisionPairBound a z m c j u R J : ℝ) * (K / θ ^ (c + j)) ^ 2) * ρ ^ (2 * j - u) = K ^ 2 * (R : ℝ) ^ (2 * c) * (2 : ℝ) ^ j * ((m : ℝ) * ρ) ^ (2 * j - u) * ((j : ℝ) * z * m + (θ ^ (c + j))⁻¹ ^ 2 * ((j : ℝ) * (m : ℝ) ^ 2 * J + 2 * (j : ℝ) ^ 2 * a * m + (2 * (j : ℝ) ^ 2 + 1) * z)) := by simp only [ordinaryPairBound, collisionPairBound, Nat.cast_add, Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat, pow_succ, mul_pow, div_pow, div_eq_mul_inv] ring theorem bernoulliMean_overlapMajorizer_le (A T Z : Finset G) (c j R J : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) {θ ρ : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hρ : 0 ≤ ρ) (K : ℝ) : bernoulliMean T θ (overlapMajorizer A T Z c j θ K ρ) ≤ overlapExpectationBound A.card Z.card T.card c j R J θ K ρ := by apply (bernoulliMean_overlapMajorizer_le_sum A T Z c j R J hR hcode hθ hθ1 hρ K).trans_eq simp_rw [overlap_count_bound_algebra] unfold overlapExpectationBound rw [Finset.mul_sum, Finset.sum_mul] end ExpectedOverlap section DensityMonotonicity variable {G : Type u} [AddCommGroup G] [DecidableEq G] theorem meanMajorizer_mono_density (A T Z : Finset G) (c j : ℕ) {θ K ρ ρ' : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hρ' : ρ ≤ ρ') (S : Finset G) : meanMajorizer A T Z c j θ K ρ S ≤ meanMajorizer A T Z c j θ K ρ' S := by unfold meanMajorizer containmentSum apply Finset.sum_le_sum intro w _ split_ifs · exact mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hρ hρ' j) (div_nonneg hK (pow_nonneg hθ _)) · exact le_rfl theorem overlapMajorizer_mono_density (A T Z : Finset G) (c j : ℕ) (θ K : ℝ) {ρ ρ' : ℝ} (hρ : 0 ≤ ρ) (hρ' : ρ ≤ ρ') (S : Finset G) : overlapMajorizer A T Z c j θ K ρ S ≤ overlapMajorizer A T Z c j θ K ρ' S := by unfold overlapMajorizer containmentSum apply Finset.sum_le_sum intro wv _ split_ifs · dsimp only [overlapPairWeight] split_ifs · exact le_rfl · exact mul_le_mul_of_nonneg_left (pow_le_pow_left₀ hρ hρ' _) (sq_nonneg _) · exact le_rfl /-- A guard evaluated at one deterministic upper density covers every allowed actual descriptor density, even when P,V and that density depend on all source bits. -/ theorem actual_weightedOverlap_le_guard (A T Z P V S : Finset G) (c j : ℕ) (hPA : P ⊆ A) (hST : S ⊆ T) (hPV : Disjoint P V) (I : Finset (G × Finset G)) (weight : (G × Finset G) → ℝ) {θ K ρ ρmax D : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ ρmax) (hlabel : ∀ i ∈ I, i.1 ∈ Z ∧ representationCount P S i.1 = c ∧ i.2 ⊆ V ∧ markerSet i.1 i.2 ⊆ S ∧ i.2.card = j) (hweight : ∀ i ∈ I, 0 ≤ weight i ∧ weight i ≤ K / θ ^ (c + j)) (hguard : overlapMajorizer A T Z c j θ K ρmax S ≤ D) : WeightedCleanup.weightedOverlap I Prod.snd weight ρ ≤ D := (actual_weightedOverlap_le_majorizer A T Z P V S c j hPA hST hPV I weight hθ hK hρ hlabel hweight).trans ((overlapMajorizer_mono_density A T Z c j θ K hρ hρmax S).trans hguard) theorem actual_bernoulliMean_le_guard (A T Z P V S : Finset G) (c j : ℕ) (hPA : P ⊆ A) (hST : S ⊆ T) (hPV : Disjoint P V) (I : Finset (G × Finset G)) (weight : (G × Finset G) → ℝ) {θ K ρ ρmax M : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ ρmax) (hlabel : ∀ i ∈ I, i.1 ∈ Z ∧ representationCount P S i.1 = c ∧ i.2 ⊆ V ∧ markerSet i.1 i.2 ⊆ S ∧ i.2.card = j) (hweight : ∀ i ∈ I, weight i ≤ K / θ ^ (c + j)) (hguard : meanMajorizer A T Z c j θ K ρmax S ≤ M) : bernoulliMean V ρ (containmentSum I Prod.snd weight) ≤ M := (actual_bernoulliMean_le_majorizer A T Z P V S c j hPA hST hPV I weight hθ hK hρ hlabel hweight).trans ((meanMajorizer_mono_density A T Z c j hθ hK hρ hρmax S).trans hguard) end DensityMonotonicity section CommonSourceEvent open scoped Classical variable {G : Type u} [AddCommGroup G] [DecidableEq G] theorem meanMajorizer_failure_le (A T Z : Finset G) (c j R : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) {θ K ρ M : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hM : 0 < M) : bernoulliMean T θ (fun S => if M < meanMajorizer A T Z c j θ K ρ S then 1 else 0) ≤ ((Z.card : ℝ) * (R : ℝ) ^ c * K * ((T.card : ℝ) * ρ) ^ j) / M := by apply (le_div_iff₀ hM).mpr have hm := RichStar.source_markov T hθ.le hθ1 (meanMajorizer A T Z c j θ K ρ) M (fun S _ => meanMajorizer_nonneg A T Z c j hθ.le hK hρ S) simpa only [mul_comm] using hm.trans (bernoulliMean_meanMajorizer_le A T Z c j R hR hθ.ne' hK hρ) theorem overlapMajorizer_failure_le (A T Z : Finset G) (c j R J : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) {θ ρ D : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hρ : 0 ≤ ρ) (hD : 0 < D) (K : ℝ) : bernoulliMean T θ (fun S => if D < overlapMajorizer A T Z c j θ K ρ S then 1 else 0) ≤ overlapExpectationBound A.card Z.card T.card c j R J θ K ρ / D := by apply (le_div_iff₀ hD).mpr have hm := RichStar.source_markov T hθ.le hθ1 (overlapMajorizer A T Z c j θ K ρ) D (fun S _ => overlapMajorizer_nonneg A T Z c j θ K hρ S) simpa only [mul_comm] using hm.trans (bernoulliMean_overlapMajorizer_le A T Z c j R J hR hcode hθ hθ1 hρ K) def guardFailure (A T Z : Finset G) (blocks : Finset (ℕ × ℕ)) (θ K ρ M D : ℝ) (S : Finset G) : Prop := ∃ b ∈ blocks, M < meanMajorizer A T Z b.1 b.2 θ K ρ S ∨ D < overlapMajorizer A T Z b.1 b.2 θ K ρ S /-- One actual source event controls every requested block. Its complement therefore controls all adaptive P,V and all descriptor densities below ρ. No conditioning on the adaptive extraction is asserted. -/ theorem guardFailure_probability_le (A T Z : Finset G) (blocks : Finset (ℕ × ℕ)) (R J : ℕ) (hR : ∀ x ∈ Z, representationCount A T x ≤ R) (hcode : ∀ d : G, d ≠ 0 → (A.filter (fun a => a + d ∈ A)).card ≤ J) {θ K ρ M D : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hM : 0 < M) (hD : 0 < D) : bernoulliMean T θ (fun S => if guardFailure A T Z blocks θ K ρ M D S then 1 else 0) ≤ ∑ b ∈ blocks, (((Z.card : ℝ) * (R : ℝ) ^ b.1 * K * ((T.card : ℝ) * ρ) ^ b.2) / M + overlapExpectationBound A.card Z.card T.card b.1 b.2 R J θ K ρ / D) := by classical let f (b : ℕ × ℕ) (S : Finset G) : ℝ := (if M < meanMajorizer A T Z b.1 b.2 θ K ρ S then 1 else 0) + (if D < overlapMajorizer A T Z b.1 b.2 θ K ρ S then 1 else 0) have hf (b : ℕ × ℕ) (S : Finset G) : 0 ≤ f b S := by dsimp [f] split_ifs <;> norm_num have hpoint (S : Finset G) (_hS : S ⊆ T) : (if guardFailure A T Z blocks θ K ρ M D S then 1 else 0) ≤ ∑ b ∈ blocks, f b S := by by_cases hfail : guardFailure A T Z blocks θ K ρ M D S · rw [if_pos hfail] obtain ⟨b, hb, hbad⟩ := hfail have hone : 1 ≤ f b S := by rcases hbad with hbad | hbad · simp only [f, if_pos hbad] split_ifs <;> norm_num · simp only [f, if_pos hbad] split_ifs <;> norm_num exact hone.trans (Finset.single_le_sum (fun a _ => hf a S) hb) · rw [if_neg hfail] exact Finset.sum_nonneg (fun b _ => hf b S) calc _ ≤ bernoulliMean T θ (fun S => ∑ b ∈ blocks, f b S) := bernoulliMean_mono T hθ.le hθ1 hpoint _ = ∑ b ∈ blocks, bernoulliMean T θ (f b) := bernoulliMean_sum T θ blocks f _ ≤ _ := by apply Finset.sum_le_sum intro b _ change bernoulliMean T θ (fun S => (if M < meanMajorizer A T Z b.1 b.2 θ K ρ S then 1 else 0) + (if D < overlapMajorizer A T Z b.1 b.2 θ K ρ S then 1 else 0)) ≤ _ rw [bernoulliMean_add] exact add_le_add (meanMajorizer_failure_le A T Z b.1 b.2 R hR hθ hθ1 hK hρ hM) (overlapMajorizer_failure_le A T Z b.1 b.2 R J hR hcode hθ hθ1 hρ hD K) end CommonSourceEvent end Green39Submission.OverlapGuards end Green39AssemblyScope_a98a2fd5c7932074 /- Source: Green39Submission.SparseSourceExtraction; SHA256 a3b27b991e45f02131d1a292528e3990c422dc190896d1ad0c76014472e7514a -/ section Green39AssemblyScope_eb161f4e0ffecbcc /-! One actual independent-source sample satisfying all sparse extraction budgets. Every probability below is the Bernoulli law on the fixed parent T. The descriptor, its protected input set, and its eventual free-universe density may depend on S. The FG guards are imposed on deterministic majorizers at one fixed upper density, so the source event does not assert an adaptive posterior law. -/ namespace Green39Submission.SparseSourceExtraction open scoped BigOperators Pointwise Classical open SourceProbability ProtectedScores ScoreExtraction ScoreInfluence open DescriptorPrior SourceCanonicalMask OverlapGuards variable {G : Type*} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The exact finite common-event failure budget before asymptotic estimates. -/ noncomputable def failureBudget (a : ℕ → ℝ) (A T X : Finset G) (blocks : Finset (ℕ × ℕ)) (L M Q J KAlias nRoots z : ℕ) (θ scoreMargin extCap KInf KGuard ρ meanCap overlapCap : ℝ) (threshold : ℕ → ℝ) : ℝ := ((T.card : ℝ) * θ * (1 - θ) * ((A.card : ℝ) * (2 * inverseNewtonBound a L θ)) ^ 2) / scoreMargin ^ 2 + ((nRoots : ℝ) * θ) ^ (-1 / 2 : ℝ) + ((KAlias : ℝ) * (T.card : ℝ) ^ 2 * θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ)) / extCap + (A.card : ℝ) * influenceTailBudget L M Q J nRoots z θ KInf threshold + (∑ b ∈ blocks, ((((Finset.univ \ X).card : ℝ) * (M : ℝ) ^ b.1 * KGuard * ((T.card : ℝ) * ρ) ^ b.2) / meanCap + overlapExpectationBound A.card (Finset.univ \ X).card T.card b.1 b.2 M J θ KGuard ρ / overlapCap)) /-- All sparse source requirements hold together once their explicit finite failure budget is below one. The returned influence and initial score concern the clean parent A\\E0 needed for every later allowed input deletion. -/ theorem exists_source_with_budgets (a : ℕ → ℝ) (A E0 T D X : Finset G) (blocks : Finset (ℕ × ℕ)) (L M Q J KAlias nRoots z : ℕ) {θ scalarError scoreMargin extCap KInf KGuard ρ meanCap overlapCap : ℝ} (threshold : ℕ → ℝ) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hmargin : 0 < scoreMargin) (hext : 0 < extCap) (hKInf : 0 ≤ KInf) (hKGuard : 0 ≤ KGuard) (hρ : 0 ≤ ρ) (hmeanCap : 0 < meanCap) (hoverlapCap : 0 < overlapCap) (hscalar : ∀ r : ℕ, ScalarThinning.meanPolynomial a L θ r ≤ (if r = 0 then 1 else 0) + scalarError) (hE0 : E0 ⊆ A) (hT : T.card ≤ nRoots) (hnRoots : 0 < nRoots) (hM : ∀ x : G, x ∉ X → representationCount A T x ≤ M) (hQ : ∀ v : G, v ∉ D → (T.filter (fun s => s - v ∈ A)).card ≤ Q) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hAlias : ∀ q ∈ T, representationCount (A \ E0) D q ≤ KAlias) (ht : ∀ j ∈ Finset.range L, 0 < threshold (j + 1)) (hz : 1 ≤ z) (hsmall : failureBudget a A T X blocks L M Q J KAlias nRoots z θ scoreMargin extCap KInf KGuard ρ meanCap overlapCap threshold < 1) : ∃ S ⊆ T, fullScore a L θ A S ≤ (holeSet A T).card + scalarError * (Fintype.card G : ℝ) + scoreMargin ∧ fullScore a L θ (A \ E0) S ≤ (holeSet A T).card + scalarError * (Fintype.card G : ℝ) + scoreMargin + (E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound a L θ) ∧ (S.card : ℝ) ≤ (nRoots : ℝ) * θ + ((nRoots : ℝ) * θ) ^ (3 / 4 : ℝ) ∧ (∑ x ∈ externalTargets (D, E0, protectedInputs A E0 S D, S) \ X, if sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x ≤ L then (θ⁻¹) ^ sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x else 0) ≤ extCap ∧ (∀ u ∈ A \ protectedInputs A E0 S D, MaskedScoreDeletion.restrictedInputInfluence L θ KInf (A \ E0) S X u ≤ ∑ j ∈ Finset.range L, threshold (j + 1)) ∧ (∀ b ∈ blocks, meanMajorizer A T (Finset.univ \ X) b.1 b.2 θ KGuard ρ S ≤ meanCap ∧ overlapMajorizer A T (Finset.univ \ X) b.1 b.2 θ KGuard ρ S ≤ overlapCap) := by classical let scoreCap := (holeSet A T).card + scalarError * (Fintype.card G : ℝ) + scoreMargin let sizeCap := (nRoots : ℝ) * θ + ((nRoots : ℝ) * θ) ^ (3 / 4 : ℝ) let infCap := ∑ j ∈ Finset.range L, threshold (j + 1) let charge := totalExternalChargeOutside (A \ E0) T D X L θ let bad : ℕ → Finset G → Prop := fun i S => match i with | 0 => scoreCap < fullScore a L θ A S | 1 => sizeCap < (S.card : ℝ) | 2 => extCap < charge S | 3 => ∃ u ∈ A \ E0, u ∉ protectedInputs A E0 S D ∧ infCap < MaskedScoreDeletion.restrictedInputInfluence L θ KInf A S X u | _ => guardFailure A T (Finset.univ \ X) blocks θ KGuard ρ meanCap overlapCap S have hscore := fullScore_upper_tail_le a L hθ hθ1 hmargin hscalar A T have hsize := SourceSize.source_card_narrow_upper_tail_of_card_le T hT hnRoots hθ hθ1 have hMclean : ∀ x : G, x ∉ X → representationCount (A \ E0) T x ≤ M := by intro x hx exact (representationCount_mono Finset.sdiff_subset (Finset.Subset.refl T) x).trans (hM x hx) have hcharge : bernoulliMean T θ (fun S => if extCap < charge S then 1 else 0) ≤ ((KAlias : ℝ) * (T.card : ℝ) ^ 2 * θ * ∑ j ∈ Finset.range L, ((M - 1).choose j : ℝ)) / extCap := by apply (le_div_iff₀ hext).mpr have hm := RichStar.source_markov T hθ.le hθ1 charge extCap (fun S _ => totalExternalChargeOutside_nonneg _ _ _ _ _ hθ.le S) simpa only [mul_comm] using hm.trans (mean_totalExternalChargeOutside_le (A \ E0) T D X L KAlias M hθ hAlias hMclean) have hinf := all_free_restrictedInputInfluence_tail threshold hT hM hQ hJ hθ hθ1 hKInf ht hz (E0 := E0) have hfg := guardFailure_probability_le A T (Finset.univ \ X) blocks M J (fun x hx => hM x (Finset.mem_sdiff.mp hx).2) hJ hθ hθ1 hKGuard hρ hmeanCap hoverlapCap have hsum : (∑ i ∈ Finset.range 5, bernoulliMean T θ (fun S => if bad i S then 1 else 0)) ≤ failureBudget a A T X blocks L M Q J KAlias nRoots z θ scoreMargin extCap KInf KGuard ρ meanCap overlapCap threshold := by simpa only [Finset.sum_range_succ, Finset.sum_range_zero, zero_add, bad, scoreCap, sizeCap, charge, infCap, failureBudget] using add_le_add (add_le_add (add_le_add (add_le_add hscore hsize) hcharge) hinf) hfg obtain ⟨S, hST, hgood⟩ := RichStar.exists_source_sample_of_bad_sum_lt_one T hθ.le hθ1 (Finset.range 5) (fun i S => ¬ bad i S) (by refine lt_of_le_of_lt (le_trans ?_ hsum) hsmall apply Finset.sum_le_sum intro i _ apply bernoulliMean_mono T hθ.le hθ1 intro S _ by_cases h : bad i S <;> simp [h]) have hscoreS : fullScore a L θ A S ≤ scoreCap := by exact le_of_not_gt (hgood 0 (by simp)) have hclean : fullScore a L θ (A \ E0) S ≤ scoreCap + (E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound a L θ) := by have hd := (le_abs_self (fullScore a L θ (A \ E0) S - fullScore a L θ A S)).trans (abs_fullScore_delete_sub_le a L θ A E0 S hE0) linarith have hsizeS : (S.card : ℝ) ≤ sizeCap := le_of_not_gt (hgood 1 (by simp)) have hchargeS : charge S ≤ extCap := le_of_not_gt (hgood 2 (by simp)) have hinfS : ¬ ∃ u ∈ A \ E0, u ∉ protectedInputs A E0 S D ∧ infCap < MaskedScoreDeletion.restrictedInputInfluence L θ KInf A S X u := hgood 3 (by simp) have hfgS : ¬ guardFailure A T (Finset.univ \ X) blocks θ KGuard ρ meanCap overlapCap S := hgood 4 (by simp) refine ⟨S, hST, hscoreS, hclean, hsizeS, (actual_external_sum_le_totalExternalChargeOutside A E0 T S D X hST L hθ.le).trans hchargeS, ?_, ?_⟩ · intro u hu obtain ⟨huA, huP⟩ := Finset.mem_sdiff.mp hu have huE0 : u ∉ E0 := fun h => huP (Finset.mem_union_left _ h) have huInf : MaskedScoreDeletion.restrictedInputInfluence L θ KInf A S X u ≤ infCap := by apply le_of_not_gt intro hbad exact hinfS ⟨u, Finset.mem_sdiff.mpr ⟨huA, huE0⟩, huP, hbad⟩ exact (restrictedInputInfluence_mono_input A (A \ E0) S X u L hθ.le hKInf Finset.sdiff_subset).trans huInf · intro b hb constructor · apply le_of_not_gt intro hbad exact hfgS ⟨b, hb, Or.inl hbad⟩ · apply le_of_not_gt intro hbad exact hfgS ⟨b, hb, Or.inr hbad⟩ end Green39Submission.SparseSourceExtraction end Green39AssemblyScope_eb161f4e0ffecbcc /- Source: Green39Submission.OverlapGuardParameters; SHA256 6228aa717a8055fe04508c0ca81ad1069269e34d1d55bce8b09e42b64ffc53af -/ section Green39AssemblyScope_d2f6e8d4127485e6 /-! Finite numeric normalization of the actual Appendix E source majorizers. The combinatorial expression is imported intact, including equal targets, ordered diagonals and repeated physical supports. Constants depend only on the fixed degree and coefficient amplitude. No degree range is enumerated. -/ namespace Green39Submission.OverlapGuardParameters open scoped BigOperators open OverlapGuards noncomputable section def collisionConstant (d : ℕ) : ℝ := 10000 * (d : ℝ) + 208 * (d : ℝ) ^ 2 + 4 def bracketConstant (d : ℕ) : ℝ := 400 * (d : ℝ) + collisionConstant d def Cmu (d : ℕ) (K : ℝ) : ℝ := (K + 1) * (200 : ℝ) ^ d def Cdelta (d : ℕ) (K : ℝ) : ℝ := (K ^ 2 + 1) * (2 : ℝ) ^ d * ((d : ℝ) + 1) * (200 : ℝ) ^ (2 * d) * bracketConstant d def guardCoefficient (d : ℕ) : ℝ := 2 * ((d : ℝ) + 1) ^ 2 theorem collisionConstant_pos (d : ℕ) : 0 < collisionConstant d := by unfold collisionConstant positivity theorem bracketConstant_pos (d : ℕ) : 0 < bracketConstant d := by exact add_pos_of_nonneg_of_pos (by positivity) (collisionConstant_pos d) theorem Cmu_pos (d : ℕ) {K : ℝ} (hK : 0 ≤ K) : 0 < Cmu d K := by exact mul_pos (by linarith) (pow_pos (by norm_num) _) theorem Cdelta_pos (d : ℕ) (K : ℝ) : 0 < Cdelta d K := by unfold Cdelta exact mul_pos (mul_pos (mul_pos (mul_pos (by nlinarith [sq_nonneg K]) (pow_pos (by norm_num) _)) (by positivity)) (pow_pos (by norm_num) _)) (bracketConstant_pos d) theorem guardCoefficient_pos (d : ℕ) : 0 < guardCoefficient d := by unfold guardCoefficient positivity /-- The zero-size case is kept, so the density convention at `k=0` is harmless. -/ theorem source_density_le {k m : ℕ} {ρ : ℝ} (hm : m ≤ 100 * k) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) : (m : ℝ) * ρ ≤ 200 := by by_cases hk : k = 0 · have hm0 : m = 0 := by omega simp [hm0] · have hk0 : (0 : ℝ) < k := by exact_mod_cast Nat.pos_of_ne_zero hk have hm' : (m : ℝ) ≤ 100 * (k : ℝ) := by exact_mod_cast hm calc (m : ℝ) * ρ ≤ (100 * (k : ℝ)) * (2 / (k : ℝ)) := mul_le_mul hm' hρmax hρ (by positivity) _ = 200 := by field_simp <;> norm_num theorem source_density_power_le {k m n d : ℕ} {ρ : ℝ} (hm : m ≤ 100 * k) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hn : n ≤ d) : ((m : ℝ) * ρ) ^ n ≤ (200 : ℝ) ^ d := by exact (pow_le_pow_left₀ (mul_nonneg (Nat.cast_nonneg m) hρ) (source_density_le hm hρ hρmax) n).trans (pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 200) hn) theorem markerSpectrum_le {k m j d : ℕ} {ρ : ℝ} (hm : m ≤ 100 * k) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hj : j ≤ d) : (∑ u ∈ Finset.Icc 1 j, ((m : ℝ) * ρ) ^ (2 * j - u)) ≤ ((d : ℝ) + 1) * (200 : ℝ) ^ (2 * d) := by calc (∑ u ∈ Finset.Icc 1 j, ((m : ℝ) * ρ) ^ (2 * j - u)) ≤ ∑ _u ∈ Finset.Icc 1 j, (200 : ℝ) ^ (2 * d) := by apply Finset.sum_le_sum intro u hu exact source_density_power_le hm hρ hρmax (by omega) _ = (j : ℝ) * (200 : ℝ) ^ (2 * d) := by simp _ ≤ ((d : ℝ) + 1) * (200 : ℝ) ^ (2 * d) := by apply mul_le_mul_of_nonneg_right _ (by positivity) have hj' : (j : ℝ) ≤ d := by exact_mod_cast hj linarith /-- Numeric FG7, uniform in all permitted forced/free block sizes. -/ theorem meanExpected_le {k p z m c j M d : ℕ} {K ρ : ℝ} (hm : m ≤ 100 * k) (hz : z ≤ p) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hK : 0 ≤ K) (hM : 1 ≤ M) (hcj : c + j ≤ d) : (z : ℝ) * (M : ℝ) ^ c * K * ((m : ℝ) * ρ) ^ j ≤ Cmu d K * (p : ℝ) * (M : ℝ) ^ d := by have hc : c ≤ d := by omega have hj : j ≤ d := by omega have hz' : (z : ℝ) ≤ p := by exact_mod_cast hz have hM' : (1 : ℝ) ≤ M := by exact_mod_cast hM have hpow := pow_le_pow_right₀ hM' hc have hdens := source_density_power_le hm hρ hρmax hj have hK' : K ≤ K + 1 := by linarith calc (z : ℝ) * (M : ℝ) ^ c * K * ((m : ℝ) * ρ) ^ j ≤ (p : ℝ) * (M : ℝ) ^ d * (K + 1) * (200 : ℝ) ^ d := by gcongr _ = _ := by unfold Cmu; ring /-- The source-collision penalty is paid by the literal finite collision gate. -/ theorem collision_factor_le {k c j d J : ℕ} {θ : ℝ} (hk : 0 < k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hcj : c + j ≤ d) (hgate : ((J : ℝ) + 1) / ((k : ℝ) * θ ^ (2 * d)) ≤ 1) : (θ ^ (c + j))⁻¹ ^ 2 * ((J : ℝ) + 1) ≤ (k : ℝ) := by have hk0 : (0 : ℝ) < k := by exact_mod_cast hk have hp : θ ^ (2 * d) ≤ (θ ^ (c + j)) ^ 2 := by have hh := pow_le_pow_of_le_one hθ.le hθ1 (show (c + j) * 2 ≤ 2 * d by omega) simpa only [pow_mul] using hh have hinv : (θ ^ (c + j))⁻¹ ^ 2 ≤ (θ ^ (2 * d))⁻¹ := by rw [inv_pow] exact (inv_le_inv₀ (pow_pos (pow_pos hθ _) _) (pow_pos hθ _)).2 hp have hg : (J : ℝ) + 1 ≤ (k : ℝ) * θ ^ (2 * d) := (div_le_one (mul_pos hk0 (pow_pos hθ _))).1 hgate calc (θ ^ (c + j))⁻¹ ^ 2 * ((J : ℝ) + 1) ≤ (θ ^ (2 * d))⁻¹ * ((J : ℝ) + 1) := mul_le_mul_of_nonneg_right hinv (by positivity) _ ≤ (θ ^ (2 * d))⁻¹ * ((k : ℝ) * θ ^ (2 * d)) := mul_le_mul_of_nonneg_left hg (inv_nonneg.mpr (pow_nonneg hθ.le _)) _ = (k : ℝ) := by field_simp theorem collision_inner_le {k a z m j d J : ℕ} (ha : a ≤ k) (hz : z ≤ 4 * k ^ 2) (hm : m ≤ 100 * k) (hj : j ≤ d) : (j : ℝ) * (m : ℝ) ^ 2 * J + 2 * (j : ℝ) ^ 2 * a * m + (2 * (j : ℝ) ^ 2 + 1) * z ≤ collisionConstant d * (k : ℝ) ^ 2 * ((J : ℝ) + 1) := by have ha' : (a : ℝ) ≤ k := by exact_mod_cast ha have hz' : (z : ℝ) ≤ 4 * (k : ℝ) ^ 2 := by exact_mod_cast hz have hm' : (m : ℝ) ≤ 100 * (k : ℝ) := by exact_mod_cast hm have hj' : (j : ℝ) ≤ d := by exact_mod_cast hj have hcoef : 10000 * (d : ℝ) * J + 208 * (d : ℝ) ^ 2 + 4 ≤ collisionConstant d * ((J : ℝ) + 1) := by unfold collisionConstant nlinarith [(Nat.cast_nonneg d : (0 : ℝ) ≤ d), (Nat.cast_nonneg J : (0 : ℝ) ≤ J), mul_nonneg (sq_nonneg (d : ℝ)) (Nat.cast_nonneg J : (0 : ℝ) ≤ J)] calc (j : ℝ) * (m : ℝ) ^ 2 * J + 2 * (j : ℝ) ^ 2 * a * m + (2 * (j : ℝ) ^ 2 + 1) * z ≤ (d : ℝ) * (100 * (k : ℝ)) ^ 2 * J + 2 * (d : ℝ) ^ 2 * (k : ℝ) * (100 * (k : ℝ)) + (2 * (d : ℝ) ^ 2 + 1) * (4 * (k : ℝ) ^ 2) := by gcongr _ = (10000 * (d : ℝ) * J + 208 * (d : ℝ) ^ 2 + 4) * (k : ℝ) ^ 2 := by ring _ ≤ (collisionConstant d * ((J : ℝ) + 1)) * (k : ℝ) ^ 2 := mul_le_mul_of_nonneg_right hcoef (sq_nonneg _) _ = _ := by ring theorem overlap_bracket_le {k a z m c j d J : ℕ} {θ : ℝ} (hk : 0 < k) (ha : a ≤ k) (hz : z ≤ 4 * k ^ 2) (hm : m ≤ 100 * k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hcj : c + j ≤ d) (hgate : ((J : ℝ) + 1) / ((k : ℝ) * θ ^ (2 * d)) ≤ 1) : (j : ℝ) * z * m + (θ ^ (c + j))⁻¹ ^ 2 * ((j : ℝ) * (m : ℝ) ^ 2 * J + 2 * (j : ℝ) ^ 2 * a * m + (2 * (j : ℝ) ^ 2 + 1) * z) ≤ bracketConstant d * (k : ℝ) ^ 3 := by have hj : j ≤ d := by omega have hj' : (j : ℝ) ≤ d := by exact_mod_cast hj have hz' : (z : ℝ) ≤ 4 * (k : ℝ) ^ 2 := by exact_mod_cast hz have hm' : (m : ℝ) ≤ 100 * (k : ℝ) := by exact_mod_cast hm have hord : (j : ℝ) * z * m ≤ 400 * (d : ℝ) * (k : ℝ) ^ 3 := by calc (j : ℝ) * z * m ≤ (d : ℝ) * (4 * (k : ℝ) ^ 2) * (100 * (k : ℝ)) := by gcongr _ = _ := by ring have hcollision : (θ ^ (c + j))⁻¹ ^ 2 * ((j : ℝ) * (m : ℝ) ^ 2 * J + 2 * (j : ℝ) ^ 2 * a * m + (2 * (j : ℝ) ^ 2 + 1) * z) ≤ collisionConstant d * (k : ℝ) ^ 3 := by calc _ ≤ (θ ^ (c + j))⁻¹ ^ 2 * (collisionConstant d * (k : ℝ) ^ 2 * ((J : ℝ) + 1)) := mul_le_mul_of_nonneg_left (collision_inner_le ha hz hm hj) (sq_nonneg _) _ = (collisionConstant d * (k : ℝ) ^ 2) * ((θ ^ (c + j))⁻¹ ^ 2 * ((J : ℝ) + 1)) := by ring _ ≤ (collisionConstant d * (k : ℝ) ^ 2) * (k : ℝ) := mul_le_mul_of_nonneg_left (collision_factor_le hk hθ hθ1 hcj hgate) (mul_nonneg (collisionConstant_pos d).le (sq_nonneg _)) _ = _ := by ring unfold bracketConstant nlinarith /-- Numeric FG13 applied to the actual imported expression, without discarding any of its repeated-support or diagonal contributions. -/ theorem overlapExpected_le {k p a z m c j M d J : ℕ} {θ K ρ : ℝ} (ha : a ≤ k) (hz : z ≤ p) (hp : p ≤ 4 * k ^ 2) (hm : m ≤ 100 * k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hM : 1 ≤ M) (hcj : c + j ≤ d) (hgate : ((J : ℝ) + 1) / ((k : ℝ) * θ ^ (2 * d)) ≤ 1) : overlapExpectationBound a z m c j M J θ K ρ ≤ Cdelta d K * (k : ℝ) ^ 3 * (M : ℝ) ^ (2 * d) := by by_cases hk : k = 0 · subst k have ha0 : a = 0 := by omega have hm0 : m = 0 := by omega have hp0 : p = 0 := by simpa using hp have hz0 : z = 0 := by omega simp [overlapExpectationBound, ha0, hm0, hz0] · have hkpos : 0 < k := Nat.pos_of_ne_zero hk have hc : c ≤ d := by omega have hj : j ≤ d := by omega have hM' : (1 : ℝ) ≤ M := by exact_mod_cast hM have hMpow := pow_le_pow_right₀ hM' (show 2 * c ≤ 2 * d by omega) have htwo := pow_le_pow_right₀ (by norm_num : (1 : ℝ) ≤ 2) hj have hKsq : K ^ 2 ≤ K ^ 2 + 1 := by linarith have hspectrum := markerSpectrum_le hm hρ hρmax hj have hbracket := overlap_bracket_le hkpos ha (hz.trans hp) hm hθ hθ1 hcj hgate have hspectrum0 : 0 ≤ ∑ u ∈ Finset.Icc 1 j, ((m : ℝ) * ρ) ^ (2 * j - u) := Finset.sum_nonneg (fun u hu => pow_nonneg (mul_nonneg (Nat.cast_nonneg _) hρ) _) have hbracket0 : 0 ≤ (j : ℝ) * z * m + (θ ^ (c + j))⁻¹ ^ 2 * ((j : ℝ) * (m : ℝ) ^ 2 * J + 2 * (j : ℝ) ^ 2 * a * m + (2 * (j : ℝ) ^ 2 + 1) * z) := by positivity have hC0 : 0 ≤ bracketConstant d := (bracketConstant_pos d).le calc overlapExpectationBound a z m c j M J θ K ρ ≤ (K ^ 2 + 1) * (M : ℝ) ^ (2 * d) * (2 : ℝ) ^ d * (((d : ℝ) + 1) * (200 : ℝ) ^ (2 * d)) * (bracketConstant d * (k : ℝ) ^ 3) := by unfold overlapExpectationBound gcongr _ = _ := by unfold Cdelta; ring theorem meanThreshold_pos {d p M : ℕ} {K : ℝ} (hK : 0 ≤ K) (hp : 0 < p) (hM : 0 < M) : 0 < Cmu d K * (p : ℝ) * (M : ℝ) ^ (d + 1) := mul_pos (mul_pos (Cmu_pos d hK) (by exact_mod_cast hp)) (pow_pos (by exact_mod_cast hM) _) theorem overlapThreshold_pos {d k M : ℕ} (K : ℝ) (hk : 0 < k) (hM : 0 < M) : 0 < Cdelta d K * (k : ℝ) ^ 3 * (M : ℝ) ^ (2 * d + 1) := mul_pos (mul_pos (Cdelta_pos d K) (pow_pos (by exact_mod_cast hk) _)) (pow_pos (by exact_mod_cast hM) _) theorem meanMarkovRatio_le {k p z m c j M d : ℕ} {K ρ : ℝ} (hp : 0 < p) (hm : m ≤ 100 * k) (hz : z ≤ p) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hK : 0 ≤ K) (hM : 1 ≤ M) (hcj : c + j ≤ d) : ((z : ℝ) * (M : ℝ) ^ c * K * ((m : ℝ) * ρ) ^ j) / (Cmu d K * (p : ℝ) * (M : ℝ) ^ (d + 1)) ≤ 1 / (M : ℝ) := by have hM0 : (0 : ℝ) < M := by exact_mod_cast Nat.zero_lt_one.trans_le hM apply (div_le_iff₀ (meanThreshold_pos hK hp (Nat.zero_lt_one.trans_le hM))).2 calc (z : ℝ) * (M : ℝ) ^ c * K * ((m : ℝ) * ρ) ^ j ≤ Cmu d K * (p : ℝ) * (M : ℝ) ^ d := meanExpected_le hm hz hρ hρmax hK hM hcj _ = (1 / (M : ℝ)) * (Cmu d K * (p : ℝ) * (M : ℝ) ^ (d + 1)) := by rw [pow_succ (M : ℝ) d] field_simp theorem overlapMarkovRatio_le {k p a z m c j M d J : ℕ} {θ K ρ : ℝ} (hk : 0 < k) (ha : a ≤ k) (hz : z ≤ p) (hp : p ≤ 4 * k ^ 2) (hm : m ≤ 100 * k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hM : 1 ≤ M) (hcj : c + j ≤ d) (hgate : ((J : ℝ) + 1) / ((k : ℝ) * θ ^ (2 * d)) ≤ 1) : overlapExpectationBound a z m c j M J θ K ρ / (Cdelta d K * (k : ℝ) ^ 3 * (M : ℝ) ^ (2 * d + 1)) ≤ 1 / (M : ℝ) := by have hM0 : (0 : ℝ) < M := by exact_mod_cast Nat.zero_lt_one.trans_le hM apply (div_le_iff₀ (overlapThreshold_pos K hk (Nat.zero_lt_one.trans_le hM))).2 calc overlapExpectationBound a z m c j M J θ K ρ ≤ Cdelta d K * (k : ℝ) ^ 3 * (M : ℝ) ^ (2 * d) := overlapExpected_le ha hz hp hm hθ hθ1 hρ hρmax hM hcj hgate _ = (1 / (M : ℝ)) * (Cdelta d K * (k : ℝ) ^ 3 * (M : ℝ) ^ (2 * d + 1)) := by rw [pow_succ (M : ℝ) (2 * d)] field_simp theorem card_blocks_le {blocks : Finset (ℕ × ℕ)} {d : ℕ} (hblocks : ∀ b ∈ blocks, b.1 + b.2 ≤ d) : blocks.card ≤ (d + 1) ^ 2 := by have hsub : blocks ⊆ (Finset.range (d + 1)) ×ˢ (Finset.range (d + 1)) := by intro b hb have h := hblocks b hb exact Finset.mem_product.mpr ⟨Finset.mem_range.mpr (by omega), Finset.mem_range.mpr (by omega)⟩ have hh := Finset.card_le_card hsub simpa only [Finset.card_product, Finset.card_range, pow_two] using hh /-- Pure numeric conversion of05's actual finite block-union Markov bound. -/ theorem guardSum_le {k p a z m M d J : ℕ} {θ K ρ : ℝ} (blocks : Finset (ℕ × ℕ)) (hblocks : ∀ b ∈ blocks, b.1 + b.2 ≤ d) (hk : 0 < k) (hp0 : 0 < p) (ha : a ≤ k) (hz : z ≤ p) (hp : p ≤ 4 * k ^ 2) (hm : m ≤ 100 * k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hM : 1 ≤ M) (hgate : ((J : ℝ) + 1) / ((k : ℝ) * θ ^ (2 * d)) ≤ 1) : (∑ b ∈ blocks, (((z : ℝ) * (M : ℝ) ^ b.1 * K * ((m : ℝ) * ρ) ^ b.2) / (Cmu d K * (p : ℝ) * (M : ℝ) ^ (d + 1)) + overlapExpectationBound a z m b.1 b.2 M J θ K ρ / (Cdelta d K * (k : ℝ) ^ 3 * (M : ℝ) ^ (2 * d + 1)))) ≤ guardCoefficient d / (M : ℝ) := by calc _ ≤ ∑ _b ∈ blocks, ((1 : ℝ) / M + 1 / M) := by apply Finset.sum_le_sum intro b hb exact add_le_add (meanMarkovRatio_le hp0 hm hz hρ hρmax hK hM (hblocks b hb)) (overlapMarkovRatio_le hk ha hz hp hm hθ hθ1 hρ hρmax hM (hblocks b hb) hgate) _ = 2 * (blocks.card : ℝ) / (M : ℝ) := by simp; ring _ ≤ 2 * (((d + 1) ^ 2 : ℕ) : ℝ) / (M : ℝ) := by apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg _) apply mul_le_mul_of_nonneg_left _ (by norm_num) exact_mod_cast card_blocks_le hblocks _ = _ := by unfold guardCoefficient; push_cast; ring end end Green39Submission.OverlapGuardParameters end Green39AssemblyScope_d2f6e8d4127485e6 /- Source: Green39Submission.SparseCertificate; SHA256 64a12d9899c43dfbf32ec1fbe7d9c854afcf3b6178f51aa3ada6807d87d276cd -/ section Green39AssemblyScope_fe8164a8f905099e /-! Finite assembly of the actual sparse source certificate. The source selector supplies its initial score, restricted influences, source-size window, external charge, and observable guards. This module proves the descriptor prior mean from the calibrated forced-source geometry and proves the score bound after every allowed deletion. All numerical error budgets are explicit. -/ namespace Green39Submission namespace SparseCertificate open scoped BigOperators Pointwise Classical open DescriptorPrior DescriptorAsymptotics SourceCanonicalMask ProtectedScores open ConditionalMean HypergeometricCalibration MaskedScoreDeletion universe u section Finite variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- A uniform deterministic cap for descriptor loops and wedges, using the literal parent size `100*k`, cleaned multiplicity five, and actual codegrees. -/ noncomputable def badTargetCap (k J : ℕ) : ℕ := (100 * k * 5) * (1 + Parameters.H k * J) /-- The finite numerical obligations left to the parameter/asymptotic lane. None of these fields asserts a probability estimate, a prior mean, or an every-deletion score bound. -/ structure CertificateBudgets (p k e s b J : ℕ) (bound budgetExt initial influence meanFloor upper : ℝ) : Prop where influence_nonneg : 0 ≤ influence mean_floor : meanFloor ≤ calibrationBase * (p : ℝ) / 4 excluded : (e : ℝ) + (badTargetCap k J : ℝ) + 5 * (s : ℝ) ^ 2 ≤ (p : ℝ) / 4 mean_loss : bound * ((e : ℝ) + (badTargetCap k J : ℝ)) + absoluteRowConstant 10001 101 * budgetExt ≤ calibrationBase * (p : ℝ) / 8 score_loss : initial + ((30 * Parameters.H k : ℕ) : ℝ) * (s : ℝ) * (2 * bound) + (b : ℝ) * influence + 2 * bound * (e : ℝ) ≤ upper theorem actual_bad_card_le (A T X D E0 S : Finset G) {k J : ℕ} (hT : T.card ≤ 100 * k) (hST : S ⊆ T) (hD : D.card ≤ Parameters.H k) (hcap : ∀ x : G, representationCount (A \ E0) D x ≤ 5) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) : (badTargets (D, E0, protectedInputs A E0 S D, S)).card ≤ badTargetCap k J := by apply (ForcedParity.card_badTargets_protectedInputs_le A E0 S T D hST (fun x _ => hcap x) hJ).trans exact Nat.mul_le_mul (Nat.mul_le_mul_right 5 hT) (Nat.add_le_add_left (Nat.mul_le_mul_right J hD) 1) /-- Actual protected ordinary inputs are at most five times the source count. -/ theorem actual_forced_card_le (A E0 S D : Finset G) (hcap : ∀ x : G, representationCount (A \ E0) D x ≤ 5) : (sourceForcedSet (D, E0, protectedInputs A E0 S D, S)).card ≤ 5 * S.card := by rw [sourceForcedSet_protectedInputs] calc _ ≤ ∑ t ∈ S, representationCount (A \ E0) D t := card_aliasInputs_le_sum (A \ E0) S D _ ≤ ∑ _t ∈ S, 5 := Finset.sum_le_sum (fun t _ => hcap t) _ = _ := by simp [Nat.mul_comm] theorem actual_forced_product_le (A E0 S D : Finset G) {s : ℕ} (hcap : ∀ x : G, representationCount (A \ E0) D x ≤ 5) (hS : S.card ≤ s) : ((sourceForcedSet (D, E0, protectedInputs A E0 S D, S)).card : ℝ) * (S.card : ℝ) ≤ 5 * (s : ℝ) ^ 2 := by have hc : (sourceForcedSet (D, E0, protectedInputs A E0 S D, S)).card * S.card ≤ 5 * s * s := Nat.mul_le_mul ((actual_forced_card_le A E0 S D hcap).trans (Nat.mul_le_mul_left 5 hS)) hS have hreal : ((sourceForcedSet (D, E0, protectedInputs A E0 S D, S)).card : ℝ) * (S.card : ℝ) ≤ 5 * (s : ℝ) * (s : ℝ) := by exact_mod_cast hc nlinarith theorem freeInputs_subset_clean (A E0 S D : Finset G) : A \ protectedInputs A E0 S D ⊆ A \ E0 := by intro u hu obtain ⟨huA, huP⟩ := Finset.mem_sdiff.mp hu exact Finset.mem_sdiff.mpr ⟨huA, fun huE => huP (Finset.mem_union_left _ huE)⟩ /-- Initial clean-score and restricted-influence bounds imply the score bound for every permitted further deletion. The exceptional mask is charged once; its cost is independent of the deletion cardinality. -/ theorem every_deletion_upper_of_source_bounds (a : ℕ → ℝ) (L k e s b : ℕ) {θ amplitude influence bound initial upper : ℝ} (hL : 1 ≤ L) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hAmplitude : 0 ≤ amplitude) (hInfluence : 0 ≤ influence) (ha : ∀ j, j ≤ L → |a j| ≤ amplitude) (hbound : inverseNewtonBound a L θ ≤ bound) (A X D E0 S : Finset G) (hE0 : E0.card ≤ 30 * Parameters.H k) (hS : S.card ≤ s) (hX : X.card ≤ e) (hscore : fullScore a L θ (A \ E0) S ≤ initial + (E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound a L θ)) (hinf : ∀ u ∈ A \ protectedInputs A E0 S D, restrictedInputInfluence L θ (2 * amplitude) (A \ E0) S X u ≤ influence) (hbudget : initial + ((30 * Parameters.H k : ℕ) : ℝ) * (s : ℝ) * (2 * bound) + (b : ℝ) * influence + 2 * bound * (e : ℝ) ≤ upper) : ∀ E ⊆ A \ protectedInputs A E0 S D, E.card ≤ b → fullScore a L θ ((A \ E0) \ E) S ≤ upper := by have hB : 0 ≤ inverseNewtonBound a L θ := inverseNewtonBound_nonneg a L θ have hbound0 : 0 ≤ bound := hB.trans hbound have hE0R : (E0.card : ℝ) ≤ (30 * Parameters.H k : ℕ) := by exact_mod_cast hE0 have hSR : (S.card : ℝ) ≤ s := by exact_mod_cast hS have hXR : (X.card : ℝ) ≤ e := by exact_mod_cast hX have hclean : (E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound a L θ) ≤ ((30 * Parameters.H k : ℕ) : ℝ) * (s : ℝ) * (2 * bound) := by apply mul_le_mul · exact mul_le_mul hE0R hSR (Nat.cast_nonneg _) (Nat.cast_nonneg _) · exact mul_le_mul_of_nonneg_left hbound (by norm_num) · positivity · positivity have hmask : 2 * inverseNewtonBound a L θ * (X.card : ℝ) ≤ 2 * bound * (e : ℝ) := by exact mul_le_mul (mul_le_mul_of_nonneg_left hbound (by norm_num)) hXR (Nat.cast_nonneg _) (by positivity) intro E hE hEb have hEClean : E ⊆ A \ E0 := hE.trans (freeInputs_subset_clean A E0 S D) have hdel := fullScore_delete_upper_of_restricted_bounds a L hL hθ hθ1 hAmplitude hInfluence ha (A \ E0) E S X b hEClean hEb (fun u hu => hinf u (hE hu)) linarith /-- Finite geometric budgets are enough for the calibrated prior-mean inputs. In particular the forced-support contribution is paid by `5*s²`, derived from the actual protected set rather than postulated for the descriptor. -/ theorem actual_geometry_budgets (A T X D E0 S : Finset G) {k e s b J : ℕ} {bound budgetExt initial influence meanFloor upper : ℝ} (hT : T.card ≤ 100 * k) (hST : S ⊆ T) (hD : D.card ≤ Parameters.H k) (hcap : ∀ x : G, representationCount (A \ E0) D x ≤ 5) (hS : S.card ≤ s) (hX : X.card ≤ e) (hJ : CodegreeMultiplicity.NonzeroCodegreeBound A J) (hbound : 0 ≤ bound) (hbudget : CertificateBudgets (Fintype.card G) k e s b J bound budgetExt initial influence meanFloor upper) : ((X.card : ℝ) + ((badTargets (D, E0, protectedInputs A E0 S D, S)).card : ℝ)) + ((sourceForcedSet (D, E0, protectedInputs A E0 S D, S)).card : ℝ) * (S.card : ℝ) ≤ (Fintype.card G : ℝ) / 4 ∧ bound * ((X.card : ℝ) + ((badTargets (D, E0, protectedInputs A E0 S D, S)).card : ℝ)) + absoluteRowConstant 10001 101 * budgetExt ≤ calibrationBase * (Fintype.card G : ℝ) / 8 := by have hbad : ((badTargets (D, E0, protectedInputs A E0 S D, S)).card : ℝ) ≤ (badTargetCap k J : ℝ) := by exact_mod_cast actual_bad_card_le A T X D E0 S hT hST hD hcap hJ have hXR : (X.card : ℝ) ≤ e := by exact_mod_cast hX have hmask := add_le_add hXR hbad refine ⟨(add_le_add hmask (actual_forced_product_le A E0 S D hcap hS)).trans hbudget.excluded, ?_⟩ exact (add_le_add (mul_le_mul_of_nonneg_left hmask hbound) (le_refl (absoluteRowConstant 10001 101 * budgetExt))).trans hbudget.mean_loss end Finite /-- The common scalar calibration window is fixed before every source parameter, group, parent, descriptor and candidate mask. The conclusion is the actual SourceCertificate: prior mean and every-deletion upper score are proved here from the displayed finite geometric and source budgets. -/ theorem exists_fixed_source_certificate_window : ∃ εCal δCal : ℝ, 0 < εCal ∧ εCal ≤ 1 ∧ 0 < δCal ∧ ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ (εSource C : ℝ) (k e s b J : ℕ) (θ bound budgetExt initial influence meanFloor meanBound overlapBound upper : ℝ) (A T X D E0 S : Finset G), D.card ≤ Parameters.H k → E0 ⊆ A → E0.card ≤ 30 * Parameters.H k → (∀ x : G, representationCount (A \ E0) D x ≤ 5) → S.card ≤ s → (S.card : ℝ) ≤ C * sourceScale εSource k → (S.card : ℝ) ≤ sourceUpper εSource k → T.card ≤ 100 * k → S ⊆ T → X.card ≤ e → CodegreeMultiplicity.NonzeroCodegreeBound A J → FixedPriorConditions k θ εCal δCal (D, E0, protectedInputs A E0 S D, S) → inverseNewtonBound (Scalar.newtonCoeff 10001 100) 10001 θ ≤ bound → externalWeightOutside (D, E0, protectedInputs A E0 S D, S) X 10001 θ ≤ budgetExt → fullScore (Scalar.newtonCoeff 10001 100) 10001 θ (A \ E0) S ≤ initial + (E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound (Scalar.newtonCoeff 10001 100) 10001 θ) → (∀ u ∈ A \ protectedInputs A E0 S D, restrictedInputInfluence 10001 θ 2 (A \ E0) S X u ≤ influence) → observableGuards (Scalar.newtonCoeff 10001 100) k 10001 θ meanBound overlapBound (D, E0, protectedInputs A E0 S D, S) X → CertificateBudgets (Fintype.card G) k e s b J bound budgetExt initial influence meanFloor upper → SparseObstruction.SourceCertificate (Scalar.newtonCoeff 10001 100) εSource C k 10001 s b θ bound meanFloor meanBound overlapBound upper A X D E0 S := by obtain ⟨εCal, δCal, hεCal, hεCal1, hδCal, hmean⟩ := ConditionalMean.exists_fixed_masked_mean_window_of_source_geometry refine ⟨εCal, δCal, hεCal, hεCal1, hδCal, ?_⟩ intro G _ _ _ εSource C k e s b J θ bound budgetExt initial influence meanFloor meanBound overlapBound upper A T X D E0 S hD hEA hEcard hcap hScard hScoarse hSupper hT hST hX hJ hprior hbound hExt hscore hinf hguards hbudget have hbound0 : 0 ≤ bound := (inverseNewtonBound_nonneg (Scalar.newtonCoeff 10001 100) 10001 θ).trans hbound obtain ⟨hExcluded, hCost⟩ := actual_geometry_budgets A T X D E0 S hT hST hD hcap hScard hX hJ hbound0 hbudget have hactualMean := hmean G k θ bound budgetExt (D, E0, protectedInputs A E0 S D, S) X hprior (ForcedParity.forced_subset_forbidden_protectedInputs A E0 S D) hbound0 hExt hExcluded hCost refine { centers_card := hD exceptions_subset := hEA exceptions_card := hEcard multiplicity := hcap sources_card := hScard sources_coarse := hScoarse sources_upper := hSupper prior_mean := hbudget.mean_floor.trans hactualMean observable_guards := hguards score_upper := ?_ } apply every_deletion_upper_of_source_bounds (Scalar.newtonCoeff 10001 100) 10001 k e s b (amplitude := 1) (by norm_num) hprior.theta_pos hprior.theta_le_one (by norm_num) hbudget.influence_nonneg (fun j _ => Scalar.abs_newtonCoeff_le_one (by decide) j) hbound A X D E0 S hEcard hScard hX hscore · simpa only [mul_one] using hinf · exact hbudget.score_loss end SparseCertificate end Green39Submission end Green39AssemblyScope_fe8164a8f905099e /- Source: Green39Submission.SparseSourceParameters; SHA256 eb5b10a19db4bc01483abff6b9aa999177bbabd0fc39e76f3e44f8769e8fad14 -/ section Green39AssemblyScope_6beb05947141a8cd /-! Concrete deterministic sparse-source parameters. All scalar constants are chosen before the prime, group, parent input, source sample or descriptor. The eventual gates here are derived from the fixed parameter limits. -/ namespace Green39Submission.SparseSourceParameters open Filter Topology Parameters Green39Submission.Asymptotics open DescriptorAsymptotics SparseSourceAsymptotics open DescriptorPrior SourceCanonicalMask HypergeometricCalibration open scoped BigOperators noncomputable section def coefficients : ℕ → ℝ := Scalar.newtonCoeff L 100 def scalarConstant : ℝ := (2 : ℝ) ^ L def scalarBound (k : ℕ) : ℝ := scalarConstant / theta0 k ^ L def rowConstant : ℝ := ConditionalMean.absoluteRowConstant L 101 def scalarError : ℝ := calibrationBase / 256 def scoreMargin (p : ℕ) : ℝ := calibrationBase * (p : ℝ) / 256 def externalCap (p : ℕ) : ℝ := calibrationBase * (p : ℝ) / (16 * rowConstant) def influenceThreshold (k d : ℕ) : ℝ := 4 * SparseInfluenceAsymptotics.rootScale k d def influenceCap (k : ℕ) : ℝ := 400 * (k : ℝ) * binomialPrefix (M0 k) L def badCap (p : ℕ) : ℕ := (100 * Nat.sqrt p * 5) * (1 + H (Nat.sqrt p) * J p) theorem scalarConstant_pos : 0 < scalarConstant := by unfold scalarConstant; positivity theorem scalarConstant_one_le : 1 ≤ scalarConstant := one_le_pow₀ (by norm_num) theorem rowConstant_pos : 0 < rowConstant := by unfold rowConstant ConditionalMean.absoluteRowConstant positivity theorem scalarError_pos : 0 < scalarError := div_pos calibrationBase_pos (by norm_num) theorem scalarBound_nonneg (k : ℕ) : 0 ≤ scalarBound k := by unfold scalarBound exact div_nonneg scalarConstant_pos.le (pow_nonneg (Real.rpow_nonneg (Nat.cast_nonneg _) _) _) theorem scalarBound_one_le {k : ℕ} (hk : 1 ≤ k) : 1 ≤ scalarBound k := by have ht := source_theta_pos_le_one epsilon0_pos.le hk have hp : theta0 k ^ L ≤ 1 := pow_le_one₀ ht.1.le ht.2 apply (le_div_iff₀ (pow_pos ht.1 L)).mpr simpa only [one_mul, theta0] using hp.trans scalarConstant_one_le theorem inverseNewtonBound_le_scalarBound {k : ℕ} (hk : 1 ≤ k) : ProtectedScores.inverseNewtonBound coefficients L (theta0 k) ≤ scalarBound k := by have ht := source_theta_pos_le_one epsilon0_pos.le hk have hb := ProtectedScores.inverseNewtonBound_le coefficients L ht.1 ht.2 (show (0 : ℝ) ≤ 1 by norm_num) (fun j _ => Scalar.abs_newtonCoeff_le_one L_pos j) simpa only [one_mul, inv_pow, div_eq_mul_inv, scalarBound, scalarConstant, theta0] using hb theorem scoreMargin_pos {p : ℕ} (hp : 0 < p) : 0 < scoreMargin p := by have hp0 : (0 : ℝ) < p := by exact_mod_cast hp unfold scoreMargin exact div_pos (mul_pos calibrationBase_pos hp0) (by norm_num) theorem externalCap_pos {p : ℕ} (hp : 0 < p) : 0 < externalCap p := by have hp0 : (0 : ℝ) < p := by exact_mod_cast hp unfold externalCap exact div_pos (mul_pos calibrationBase_pos hp0) (mul_pos (by norm_num) rowConstant_pos) theorem externalCap_cost (p : ℕ) : rowConstant * externalCap p = calibrationBase * (p : ℝ) / 16 := by unfold externalCap field_simp [rowConstant_pos.ne'] theorem influenceThreshold_sum (k : ℕ) : (∑ j ∈ Finset.range L, influenceThreshold k (j + 1)) = influenceCap k := by have h := SparseInfluenceAsymptotics.sum_degree_thresholds k 2 norm_num only at h simpa only [influenceThreshold, influenceCap, binomialPrefix] using h theorem initial_score_budget (p : ℕ) : calibrationBase * (p : ℝ) / 128 + scalarError * (p : ℝ) + scoreMargin p = calibrationBase * (p : ℝ) / 64 := by unfold scalarError scoreMargin ring universe u /-- Adapter from the proved upper-source-window gate to the actual CAL record. -/ theorem eventually_fixedPriorConditions {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, Fintype.card G = p → SizeCaps epsilon0 200 (Nat.sqrt p) d → UpperWindow epsilon0 (Nat.sqrt p) d → ConditionalMean.FixedPriorConditions (Nat.sqrt p) (theta0 (Nat.sqrt p)) ε δ d := by filter_upwards [eventually_uniform_sqrt_calibration_parameters_of_upper epsilon0_pos epsilon0_lt_one (show (0 : ℝ) ≤ 200 by norm_num) hε hδ 10001] with p hp intro G _ _ _ d hcard hd hw obtain ⟨hb, hrank, ht0, ht1, herr, hmean⟩ := hp G d hcard hd hw refine ⟨by have := hb.parameter_two; omega, ?_, hb.square_le_twice_free, hrank, hb.remainder_le_free, ht0, ht1, ?_, herr⟩ · have hn := hb.remainder_half change (Nat.sqrt p : ℝ) ≤ 2 * (remainderSize (Nat.sqrt p) d : ℝ) linarith · intro x have h := hmean (rowInputs d x).card (translated_free_card_bounds d x).1 convert h using 1 <;> simp only [scaledParameter, priorDensity, remainderSize, freeSize, theta0] <;> ring theorem eventually_scalar_mean_bound : ∀ᶠ k : ℕ in atTop, ∀ r : ℕ, ScalarThinning.meanPolynomial coefficients L (theta0 k) r ≤ (if r = 0 then 1 else 0) + scalarError := by have hsign : ∀ r : ℕ, 1 ≤ r → ProtectedScores.newtonValue coefficients L r ≤ 0 := by intro r hr change ProtectedScores.newtonValue (Scalar.newtonCoeff L 100) L r ≤ 0 have hv : ProtectedScores.newtonValue (Scalar.newtonCoeff L 100) L r = Scalar.integerValue L 100 r := (Scalar.integerValue_eq_newton_sum L_pos 100 r).symm rw [hv] exact Scalar.integerValue_nonpos L_odd hr obtain ⟨δ, hδ, _hδ1, hmean⟩ := ScalarThinning.meanPolynomial_uniform coefficients L (Scalar.newtonCoeff_zero L_pos) (Scalar.newtonCoeff_top_neg L_odd) hsign scalarError_pos filter_upwards [(tendsto_order.1 theta0_tendsto_zero).2 δ hδ, eventually_ge_atTop (1 : ℕ)] with k hk hk1 exact hmean (theta0 k) (theta0_pos (Nat.zero_lt_one.trans_le hk1)) hk.le theorem eventually_shifted_minorant : ∀ᶠ k : ℕ in atTop, ∀ c n : ℕ, ProtectedScores.shiftedInterpolation coefficients L (theta0 k) c n ≤ ProtectedScores.clippedInverseNewton coefficients L (theta0 k) (c + n) := by obtain ⟨δ, hδ, hminor⟩ := ProtectedScores.exists_shiftedInterpolation_minorant_radius coefficients L (Scalar.newtonCoeff_top_neg L_odd) filter_upwards [(tendsto_order.1 theta0_tendsto_zero).2 δ hδ, eventually_ge_atTop (1 : ℕ)] with k hk hk1 exact hminor (theta0 k) (theta0_pos (Nat.zero_lt_one.trans_le hk1)) hk.le def cleanCost (p : ℕ) : ℝ := ((30 * H (Nat.sqrt p) : ℕ) : ℝ) * (SparseCleanupAsymptotics.sourceCap (Nat.sqrt p) : ℝ) * (2 * scalarBound (Nat.sqrt p)) def retentionCost (p : ℕ) : ℝ := (sparseBudget (Nat.sqrt p) : ℝ) * influenceCap (Nat.sqrt p) def maskCost (p : ℕ) : ℝ := 2 * scalarBound (Nat.sqrt p) * (N (Nat.sqrt p) : ℝ) def priorRawCost (p : ℕ) : ℝ := scalarBound (Nat.sqrt p) * ((N (Nat.sqrt p) : ℝ) + (badCap p : ℝ)) def excludedCap (p : ℕ) : ℝ := (N (Nat.sqrt p) : ℝ) + (badCap p : ℝ) + 5 * (SparseCleanupAsymptotics.sourceCap (Nat.sqrt p) : ℝ) ^ 2 def cleanError (p : ℕ) : ℝ := 12000 * scalarConstant * initialDeletionScale (Nat.sqrt p) def retentionError (p : ℕ) : ℝ := 400 * retentionScale (Nat.sqrt p) def maskError (p : ℕ) : ℝ := 2 * scalarConstant * exceptionScale (Nat.sqrt p) def priorRawError (p : ℕ) : ℝ := scalarConstant * (exceptionScale (Nat.sqrt p) + 500 * aliasScale p) def excludedError (p : ℕ) : ℝ := priorRawError p + 200000 * theta0 (Nat.sqrt p) ^ 2 theorem cleanError_tendsto_zero : Tendsto cleanError atTop (𝓝 0) := by change Tendsto (fun p => cleanError p) atTop (𝓝 0) simpa only [cleanError, Function.comp_def, mul_zero] using (initialDeletionScale_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul (12000 * scalarConstant) theorem retentionError_tendsto_zero : Tendsto retentionError atTop (𝓝 0) := by change Tendsto (fun p => retentionError p) atTop (𝓝 0) simpa only [retentionError, Function.comp_def, mul_zero] using (retentionScale_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul 400 theorem maskError_tendsto_zero : Tendsto maskError atTop (𝓝 0) := by change Tendsto (fun p => maskError p) atTop (𝓝 0) simpa only [maskError, Function.comp_def, mul_zero] using (exceptionScale_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul (2 * scalarConstant) theorem priorRawError_tendsto_zero : Tendsto priorRawError atTop (𝓝 0) := by change Tendsto (fun p => priorRawError p) atTop (𝓝 0) simpa only [priorRawError, Function.comp_def, mul_zero, add_zero] using ((exceptionScale_tendsto_zero.comp nat_sqrt_tendsto_atTop).add (aliasScale_tendsto_zero.const_mul 500)).const_mul scalarConstant theorem excludedError_tendsto_zero : Tendsto excludedError atTop (𝓝 0) := by change Tendsto (fun p => excludedError p) atTop (𝓝 0) simpa only [excludedError, Function.comp_def, show (0 : ℝ) ^ 2 = 0 by norm_num, mul_zero, add_zero] using priorRawError_tendsto_zero.add (((theta0_tendsto_zero.comp nat_sqrt_tendsto_atTop).pow 2).const_mul 200000) theorem badCap_le {p : ℕ} (hp : 0 < p) : (badCap p : ℝ) ≤ 500 * (Nat.sqrt p : ℝ) * (H (Nat.sqrt p) : ℝ) * ((J p : ℝ) + 1) := by have hk : 1 ≤ Nat.sqrt p := Nat.sqrt_pos.mpr hp have hH : (1 : ℝ) ≤ H (Nat.sqrt p) := by exact_mod_cast H_one_le hk have hi : (1 : ℝ) + (H (Nat.sqrt p) : ℝ) * (J p : ℝ) ≤ (H (Nat.sqrt p) : ℝ) * ((J p : ℝ) + 1) := by linarith calc (badCap p : ℝ) = 500 * (Nat.sqrt p : ℝ) * (1 + (H (Nat.sqrt p) : ℝ) * (J p : ℝ)) := by unfold badCap; push_cast; ring _ ≤ 500 * (Nat.sqrt p : ℝ) * ((H (Nat.sqrt p) : ℝ) * ((J p : ℝ) + 1)) := mul_le_mul_of_nonneg_left hi (by positivity) _ = _ := by ring theorem cleanCost_le {p : ℕ} (hp : 0 < p) : cleanCost p ≤ cleanError p * (p : ℝ) := by have hk := Nat.sqrt_pos.mpr hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hk have ht := theta0_pos hk have hsq : (Nat.sqrt p : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast Nat.sqrt_le' p have hs := SparseCleanupAsymptotics.sourceCap_le (Nat.sqrt p) have he0 : 0 ≤ cleanError p := by unfold cleanError initialDeletionScale exact mul_nonneg (mul_nonneg (by norm_num) scalarConstant_pos.le) (by positivity) calc cleanCost p ≤ ((30 * H (Nat.sqrt p) : ℕ) : ℝ) * (200 * sourceScale epsilon0 (Nat.sqrt p)) * (2 * scalarBound (Nat.sqrt p)) := by unfold cleanCost exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hs (Nat.cast_nonneg _)) (mul_nonneg (by norm_num) (scalarBound_nonneg _)) _ = cleanError p * (Nat.sqrt p : ℝ) ^ (2 : ℕ) := by unfold cleanError initialDeletionScale scalarBound sourceScale change ((30 * H (Nat.sqrt p) : ℕ) : ℝ) * (200 * ((Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p))) * (2 * (scalarConstant / theta0 (Nat.sqrt p) ^ L)) = _ push_cast field_simp [ht.ne', hk0.ne'] <;> ring _ ≤ cleanError p * (p : ℝ) := mul_le_mul_of_nonneg_left hsq he0 theorem retentionCost_le {p : ℕ} (hp : 0 < p) : retentionCost p ≤ retentionError p * (p : ℝ) := by have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast Nat.sqrt_pos.mpr hp have hsq : (Nat.sqrt p : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast Nat.sqrt_le' p have he0 : 0 ≤ retentionError p := by unfold retentionError retentionScale exact mul_nonneg (by norm_num) (div_nonneg (mul_nonneg (Nat.cast_nonneg _) (binomialPrefix_nonneg _ _)) hk0.le) calc retentionCost p = retentionError p * (Nat.sqrt p : ℝ) ^ (2 : ℕ) := by unfold retentionCost retentionError retentionScale influenceCap field_simp [hk0.ne'] <;> ring _ ≤ retentionError p * (p : ℝ) := mul_le_mul_of_nonneg_left hsq he0 theorem maskCost_le {p : ℕ} (hp : 0 < p) : maskCost p ≤ maskError p * (p : ℝ) := by have hk := Nat.sqrt_pos.mpr hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hk have ht := theta0_pos hk have hsq : (Nat.sqrt p : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast Nat.sqrt_le' p have he0 : 0 ≤ maskError p := by unfold maskError exceptionScale exact mul_nonneg (mul_nonneg (by norm_num) scalarConstant_pos.le) (by positivity) calc maskCost p = maskError p * (Nat.sqrt p : ℝ) ^ (2 : ℕ) := by unfold maskCost maskError exceptionScale scalarBound field_simp [hk0.ne', ht.ne'] <;> ring _ ≤ maskError p * (p : ℝ) := mul_le_mul_of_nonneg_left hsq he0 theorem priorRawCost_le {p : ℕ} (hp : 0 < p) : priorRawCost p ≤ priorRawError p * (p : ℝ) := by have hk := Nat.sqrt_pos.mpr hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hk have ht := theta0_pos hk have hsq : (Nat.sqrt p : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast Nat.sqrt_le' p have he0 : 0 ≤ priorRawError p := by unfold priorRawError exceptionScale aliasScale exact mul_nonneg scalarConstant_pos.le (by positivity) calc priorRawCost p ≤ scalarBound (Nat.sqrt p) * ((N (Nat.sqrt p) : ℝ) + 500 * (Nat.sqrt p : ℝ) * (H (Nat.sqrt p) : ℝ) * ((J p : ℝ) + 1)) := mul_le_mul_of_nonneg_left (add_le_add le_rfl (badCap_le hp)) (scalarBound_nonneg _) _ = priorRawError p * (Nat.sqrt p : ℝ) ^ (2 : ℕ) := by unfold priorRawError exceptionScale aliasScale scalarBound field_simp [hk0.ne', ht.ne'] <;> ring _ ≤ priorRawError p * (p : ℝ) := mul_le_mul_of_nonneg_left hsq he0 theorem excludedCap_le {p : ℕ} (hp : 0 < p) : excludedCap p ≤ excludedError p * (p : ℝ) := by have hk := Nat.sqrt_pos.mpr hp have ht := theta0_pos hk have hsq : (Nat.sqrt p : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast Nat.sqrt_le' p have hraw : (N (Nat.sqrt p) : ℝ) + (badCap p : ℝ) ≤ priorRawCost p := by exact le_mul_of_one_le_left (by positivity) (scalarBound_one_le hk) have hs := SparseCleanupAsymptotics.sourceCap_le (Nat.sqrt p) have hforced : 5 * (SparseCleanupAsymptotics.sourceCap (Nat.sqrt p) : ℝ) ^ 2 ≤ (200000 * theta0 (Nat.sqrt p) ^ 2) * (p : ℝ) := by calc _ ≤ 5 * (200 * sourceScale epsilon0 (Nat.sqrt p)) ^ 2 := by gcongr _ = (200000 * theta0 (Nat.sqrt p) ^ 2) * (Nat.sqrt p : ℝ) ^ (2 : ℕ) := by unfold sourceScale theta0 ring _ ≤ (200000 * theta0 (Nat.sqrt p) ^ 2) * (p : ℝ) := mul_le_mul_of_nonneg_left hsq (by positivity) unfold excludedCap excludedError have hh := add_le_add (hraw.trans (priorRawCost_le hp)) hforced simpa only [add_mul] using hh /-- These are the exact five deterministic errors consumed by the finite certificate, with each allowed cost and denominator already specialized. -/ theorem eventually_error_budgets : ∀ᶠ p : ℕ in atTop, cleanCost p ≤ calibrationBase * (p : ℝ) / 64 ∧ retentionCost p ≤ calibrationBase * (p : ℝ) / 64 ∧ maskCost p ≤ calibrationBase * (p : ℝ) / 64 ∧ priorRawCost p ≤ calibrationBase * (p : ℝ) / 16 ∧ excludedCap p ≤ (p : ℝ) / 4 := by have hbase := calibrationBase_pos have hc := (tendsto_order.1 cleanError_tendsto_zero).2 (calibrationBase / 64) (by positivity) have hr := (tendsto_order.1 retentionError_tendsto_zero).2 (calibrationBase / 64) (by positivity) have hm := (tendsto_order.1 maskError_tendsto_zero).2 (calibrationBase / 64) (by positivity) have hpR := (tendsto_order.1 priorRawError_tendsto_zero).2 (calibrationBase / 16) (by positivity) have he := (tendsto_order.1 excludedError_tendsto_zero).2 (1 / 4) (by norm_num) filter_upwards [hc, hr, hm, hpR, he, eventually_ge_atTop (1 : ℕ)] with p hc hr hm hpR he hp have hp0 : 0 < p := by omega refine ⟨?_, ?_, ?_, ?_, ?_⟩ · simpa only [div_mul_eq_mul_div] using (cleanCost_le hp0).trans (mul_le_mul_of_nonneg_right hc.le (Nat.cast_nonneg p)) · simpa only [div_mul_eq_mul_div] using (retentionCost_le hp0).trans (mul_le_mul_of_nonneg_right hr.le (Nat.cast_nonneg p)) · simpa only [div_mul_eq_mul_div] using (maskCost_le hp0).trans (mul_le_mul_of_nonneg_right hm.le (Nat.cast_nonneg p)) · simpa only [div_mul_eq_mul_div] using (priorRawCost_le hp0).trans (mul_le_mul_of_nonneg_right hpR.le (Nat.cast_nonneg p)) · simpa only [div_mul_eq_mul_div, one_mul] using (excludedCap_le hp0).trans (mul_le_mul_of_nonneg_right he.le (Nat.cast_nonneg p)) def perBlockMeanConstant : ℝ := OverlapGuardParameters.Cmu L scalarConstant def totalMeanConstant : ℝ := (SparseCleanupAsymptotics.blockBound : ℝ) * perBlockMeanConstant def overlapConstant : ℝ := OverlapGuardParameters.Cdelta L scalarConstant def perBlockMeanCap (p : ℕ) : ℝ := perBlockMeanConstant * (p : ℝ) * (M0 (Nat.sqrt p) : ℝ) ^ (L + 1) def totalMeanCap (p : ℕ) : ℝ := SparseCleanupAsymptotics.cleanupMean totalMeanConstant p (Nat.sqrt p) def overlapCap (p : ℕ) : ℝ := SparseCleanupAsymptotics.cleanupOverlap overlapConstant (Nat.sqrt p) theorem perBlockMeanConstant_pos : 0 < perBlockMeanConstant := OverlapGuardParameters.Cmu_pos L scalarConstant_pos.le theorem totalMeanConstant_pos : 0 < totalMeanConstant := mul_pos (by exact_mod_cast SparseCleanupAsymptotics.blockBound_pos) perBlockMeanConstant_pos theorem overlapConstant_pos : 0 < overlapConstant := OverlapGuardParameters.Cdelta_pos L scalarConstant theorem blockBound_mul_perBlockMeanCap (p : ℕ) : (SparseCleanupAsymptotics.blockBound : ℝ) * perBlockMeanCap p = totalMeanCap p := by unfold perBlockMeanCap totalMeanCap SparseCleanupAsymptotics.cleanupMean totalMeanConstant ring theorem le_four_sqrt_sq {p : ℕ} (hp : 0 < p) : p ≤ 4 * Nat.sqrt p ^ 2 := by have hk : 1 ≤ Nat.sqrt p := Nat.sqrt_pos.mpr hp calc p ≤ (Nat.sqrt p + 1) ^ 2 := (Nat.lt_succ_sqrt' p).le _ ≤ (2 * Nat.sqrt p) ^ 2 := Nat.pow_le_pow_left (by omega) _ _ = _ := by ring def varianceConstant : ℝ := 400 * (256 : ℝ) ^ 2 * scalarConstant ^ 2 / calibrationBase ^ 2 def externalConstant : ℝ := 800000 * rowConstant / calibrationBase def sizeFailure (p : ℕ) : ℝ := (((100 * Nat.sqrt p : ℕ) : ℝ) * theta0 (Nat.sqrt p)) ^ (-1 / 2 : ℝ) def guardFailureEnvelope (p : ℕ) : ℝ := OverlapGuardParameters.guardCoefficient L / (M0 (Nat.sqrt p) : ℝ) def sourceFailureEnvelope (p : ℕ) : ℝ := varianceConstant * varianceScale (Nat.sqrt p) + sizeFailure p + externalConstant * externalScale (Nat.sqrt p) + SparseInfluenceAsymptotics.inputTailEnvelope p + guardFailureEnvelope p theorem sizeFailure_tendsto_zero : Tendsto sizeFailure atTop (𝓝 0) := by have hb : Tendsto (fun p : ℕ => 100 * ((Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p))) atTop atTop := (k_mul_theta0_tendsto_atTop.comp nat_sqrt_tendsto_atTop).const_mul_atTop (by norm_num) change Tendsto (fun p => sizeFailure p) atTop (𝓝 0) simpa only [sizeFailure, Function.comp_def, Nat.cast_mul, Nat.cast_ofNat, mul_assoc, neg_div] using (_root_.tendsto_rpow_neg_atTop (by norm_num : (0 : ℝ) < 1 / 2)).comp hb theorem guardFailureEnvelope_tendsto_zero : Tendsto guardFailureEnvelope atTop (𝓝 0) := by have hM : Tendsto (fun p : ℕ => (M0 (Nat.sqrt p) : ℝ)) atTop atTop := tendsto_natCast_atTop_atTop.comp (M0_tendsto_atTop.comp nat_sqrt_tendsto_atTop) exact tendsto_const_nhds.div_atTop hM theorem sourceFailureEnvelope_tendsto_zero : Tendsto sourceFailureEnvelope atTop (𝓝 0) := by change Tendsto (fun p => sourceFailureEnvelope p) atTop (𝓝 0) simpa only [sourceFailureEnvelope, Function.comp_def, mul_zero, zero_add, add_zero] using ((((varianceScale_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul varianceConstant).add sizeFailure_tendsto_zero |>.add ((externalScale_tendsto_zero.comp nat_sqrt_tendsto_atTop).const_mul externalConstant)).add SparseInfluenceAsymptotics.inputTailEnvelope_tendsto_zero).add guardFailureEnvelope_tendsto_zero def scoreVarianceTerm (p a m : ℕ) : ℝ := ((m : ℝ) * theta0 (Nat.sqrt p) * (1 - theta0 (Nat.sqrt p)) * ((a : ℝ) * (2 * ProtectedScores.inverseNewtonBound coefficients L (theta0 (Nat.sqrt p)))) ^ 2) / scoreMargin p ^ 2 theorem scoreVarianceTerm_le {p a m : ℕ} (hp : 0 < p) (ha : a ≤ Nat.sqrt p) (hm : m ≤ 100 * Nat.sqrt p) : scoreVarianceTerm p a m ≤ varianceConstant * varianceScale (Nat.sqrt p) := by have hk : 1 ≤ Nat.sqrt p := Nat.sqrt_pos.mpr hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast Nat.zero_lt_one.trans_le hk have ht : 0 < theta0 (Nat.sqrt p) ∧ theta0 (Nat.sqrt p) ≤ 1 := source_theta_pos_le_one epsilon0_pos.le hk have hbase := calibrationBase_pos have ha' : (a : ℝ) ≤ Nat.sqrt p := by exact_mod_cast ha have hm' : (m : ℝ) ≤ 100 * (Nat.sqrt p : ℝ) := by exact_mod_cast hm have hb := inverseNewtonBound_le_scalarBound hk have hb0 := ProtectedScores.inverseNewtonBound_nonneg coefficients L (theta0 (Nat.sqrt p)) have hpref : (m : ℝ) * theta0 (Nat.sqrt p) * (1 - theta0 (Nat.sqrt p)) ≤ 100 * (Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) := by calc _ ≤ (m : ℝ) * theta0 (Nat.sqrt p) * 1 := mul_le_mul_of_nonneg_left (sub_le_self 1 ht.1.le) (mul_nonneg (Nat.cast_nonneg _) ht.1.le) _ ≤ _ := by simpa only [mul_one] using mul_le_mul_of_nonneg_right hm' ht.1.le have hi : (a : ℝ) * (2 * ProtectedScores.inverseNewtonBound coefficients L (theta0 (Nat.sqrt p))) ≤ (Nat.sqrt p : ℝ) * (2 * scalarBound (Nat.sqrt p)) := mul_le_mul ha' (mul_le_mul_of_nonneg_left hb (by norm_num)) (mul_nonneg (by norm_num) hb0) (Nat.cast_nonneg _) have hi2 := pow_le_pow_left₀ (show 0 ≤ (a : ℝ) * (2 * ProtectedScores.inverseNewtonBound coefficients L (theta0 (Nat.sqrt p))) from mul_nonneg (Nat.cast_nonneg _) (mul_nonneg (by norm_num) hb0)) hi 2 have hn := mul_le_mul hpref hi2 (sq_nonneg _) (show 0 ≤ 100 * (Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) from mul_nonneg (mul_nonneg (by norm_num) hk0.le) ht.1.le) have hsq : (Nat.sqrt p : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast Nat.sqrt_le' p have hden : calibrationBase * (Nat.sqrt p : ℝ) ^ (2 : ℕ) / 256 ≤ scoreMargin p := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hsq hbase.le) (by norm_num) have hden0 : 0 < calibrationBase * (Nat.sqrt p : ℝ) ^ (2 : ℕ) / 256 := div_pos (mul_pos hbase (pow_pos hk0 _)) (by norm_num) have hnum0 : 0 ≤ 100 * (Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) * ((Nat.sqrt p : ℝ) * (2 * scalarBound (Nat.sqrt p))) ^ 2 := mul_nonneg (mul_nonneg (mul_nonneg (by norm_num) hk0.le) ht.1.le) (sq_nonneg _) calc scoreVarianceTerm p a m ≤ (100 * (Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) * ((Nat.sqrt p : ℝ) * (2 * scalarBound (Nat.sqrt p))) ^ 2) / scoreMargin p ^ 2 := div_le_div_of_nonneg_right hn (sq_nonneg _) _ ≤ (100 * (Nat.sqrt p : ℝ) * theta0 (Nat.sqrt p) * ((Nat.sqrt p : ℝ) * (2 * scalarBound (Nat.sqrt p))) ^ 2) / (calibrationBase * (Nat.sqrt p : ℝ) ^ (2 : ℕ) / 256) ^ 2 := div_le_div_of_nonneg_left hnum0 (pow_pos hden0 _) (pow_le_pow_left₀ hden0.le hden _) _ = varianceConstant * varianceScale (Nat.sqrt p) := by unfold scalarBound varianceConstant varianceScale rw [show 2 * L = L * 2 by omega, pow_mul] field_simp [hbase.ne', hk0.ne', ht.1.ne'] <;> ring def externalTerm (p m : ℕ) : ℝ := (5 * (m : ℝ) ^ 2 * theta0 (Nat.sqrt p) * binomialPrefix (M0 (Nat.sqrt p)) L) / externalCap p theorem externalTerm_le {p m : ℕ} (hp : 0 < p) (hm : m ≤ 100 * Nat.sqrt p) : externalTerm p m ≤ externalConstant * externalScale (Nat.sqrt p) := by have hk := Nat.sqrt_pos.mpr hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hk have ht := theta0_pos hk have hbase := calibrationBase_pos have hrow := rowConstant_pos have hpre := binomialPrefix_nonneg (M0 (Nat.sqrt p)) L have hm' : (m : ℝ) ≤ 100 * (Nat.sqrt p : ℝ) := by exact_mod_cast hm have hnum : 5 * (m : ℝ) ^ 2 * theta0 (Nat.sqrt p) * binomialPrefix (M0 (Nat.sqrt p)) L ≤ 5 * (100 * (Nat.sqrt p : ℝ)) ^ 2 * theta0 (Nat.sqrt p) * binomialPrefix (M0 (Nat.sqrt p)) L := by exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (pow_le_pow_left₀ (Nat.cast_nonneg _) hm' 2) (by norm_num)) ht.le) hpre have hsq : (Nat.sqrt p : ℝ) ^ (2 : ℕ) ≤ (p : ℝ) := by exact_mod_cast Nat.sqrt_le' p have hden : calibrationBase * (Nat.sqrt p : ℝ) ^ (2 : ℕ) / (16 * rowConstant) ≤ externalCap p := div_le_div_of_nonneg_right (mul_le_mul_of_nonneg_left hsq hbase.le) (mul_nonneg (by norm_num) hrow.le) have hden0 : 0 < calibrationBase * (Nat.sqrt p : ℝ) ^ (2 : ℕ) / (16 * rowConstant) := div_pos (mul_pos hbase (pow_pos hk0 _)) (mul_pos (by norm_num) hrow) have hnum0 : 0 ≤ 5 * (100 * (Nat.sqrt p : ℝ)) ^ 2 * theta0 (Nat.sqrt p) * binomialPrefix (M0 (Nat.sqrt p)) L := mul_nonneg (mul_nonneg (mul_nonneg (by norm_num) (sq_nonneg _)) ht.le) hpre calc externalTerm p m ≤ (5 * (100 * (Nat.sqrt p : ℝ)) ^ 2 * theta0 (Nat.sqrt p) * binomialPrefix (M0 (Nat.sqrt p)) L) / externalCap p := div_le_div_of_nonneg_right hnum (externalCap_pos hp).le _ ≤ (5 * (100 * (Nat.sqrt p : ℝ)) ^ 2 * theta0 (Nat.sqrt p) * binomialPrefix (M0 (Nat.sqrt p)) L) / (calibrationBase * (Nat.sqrt p : ℝ) ^ (2 : ℕ) / (16 * rowConstant)) := div_le_div_of_nonneg_left hnum0 hden0 hden _ = externalConstant * externalScale (Nat.sqrt p) := by unfold externalConstant externalScale field_simp [hbase.ne', hrow.ne', hk0.ne'] <;> ring theorem influenceTail_eq (p : ℕ) : ScoreInfluence.influenceTailBudget L (M0 (Nat.sqrt p)) (RichStarAsymptotics.ordinaryCap (Nat.sqrt p)) (J p) (100 * Nat.sqrt p) (SparseInfluenceAsymptotics.momentOrder (Nat.sqrt p)) (theta0 (Nat.sqrt p)) 2 (influenceThreshold (Nat.sqrt p)) = SparseInfluenceAsymptotics.degreeTailBudget p (100 * Nat.sqrt p) (RichStarAsymptotics.ordinaryCap (Nat.sqrt p)) (J p) 2 := by simp only [ScoreInfluence.influenceTailBudget, influenceThreshold, SparseInfluenceAsymptotics.degreeTailBudget, SparseInfluenceAsymptotics.scaledMomentRatio, SparseInfluenceAsymptotics.momentChoose, show (2 : ℝ) * 2 = 4 by norm_num] section FiniteSource variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The exact finite common-source budget, with every numerical choice fixed. -/ def sourceFailureBudget (p : ℕ) (A T X : Finset G) : ℝ := SparseSourceExtraction.failureBudget coefficients A T X (positiveBlocks L) L (M0 (Nat.sqrt p)) (RichStarAsymptotics.ordinaryCap (Nat.sqrt p)) (J p) 5 (100 * Nat.sqrt p) (SparseInfluenceAsymptotics.momentOrder (Nat.sqrt p)) (theta0 (Nat.sqrt p)) (scoreMargin p) (externalCap p) 2 scalarConstant (2 / (Nat.sqrt p : ℝ)) (perBlockMeanCap p) (overlapCap p) (influenceThreshold (Nat.sqrt p)) end FiniteSource theorem positiveBlocks_degree (d : ℕ) (b : ℕ × ℕ) (hb : b ∈ positiveBlocks d) : b.1 + b.2 ≤ d := ((mem_positiveBlocks d b).mp hb).2.2.2 /-- Keep the block-index argument symbolic before substituting the fixed degree. -/ theorem positiveBlocks_guardSum_le {k p a z m M d J : ℕ} {θ K ρ : ℝ} (hk : 0 < k) (hp0 : 0 < p) (ha : a ≤ k) (hz : z ≤ p) (hp : p ≤ 4 * k ^ 2) (hm : m ≤ 100 * k) (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hK : 0 ≤ K) (hρ : 0 ≤ ρ) (hρmax : ρ ≤ 2 / (k : ℝ)) (hM : 1 ≤ M) (hgate : ((J : ℝ) + 1) / ((k : ℝ) * θ ^ (2 * d)) ≤ 1) : (∑ b ∈ positiveBlocks d, (((z : ℝ) * (M : ℝ) ^ b.1 * K * ((m : ℝ) * ρ) ^ b.2) / (OverlapGuardParameters.Cmu d K * (p : ℝ) * (M : ℝ) ^ (d + 1)) + OverlapGuards.overlapExpectationBound a z m b.1 b.2 M J θ K ρ / (OverlapGuardParameters.Cdelta d K * (k : ℝ) ^ 3 * (M : ℝ) ^ (2 * d + 1)))) ≤ OverlapGuardParameters.guardCoefficient d / (M : ℝ) := OverlapGuardParameters.guardSum_le (positiveBlocks d) (positiveBlocks_degree d) hk hp0 ha hz hp hm hθ hθ1 hK hρ hρmax hM hgate theorem eventually_sourceFailureBudget_le : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], Fintype.card G = p → ∀ A T X : Finset G, A.card ≤ Nat.sqrt p → T.card ≤ 100 * Nat.sqrt p → sourceFailureBudget p A T X ≤ sourceFailureEnvelope p := by have hcollision := (tendsto_order.1 collisionScale_tendsto_zero).2 1 (by norm_num) filter_upwards [SparseInfluenceAsymptotics.eventually_input_tailBudget_le, hcollision, eventually_ge_atTop (1 : ℕ)] with p hinf hcol hp1 intro G _ _ _ hcard A T X hA hT have hp : 0 < p := by omega have hk : 1 ≤ Nat.sqrt p := Nat.sqrt_pos.mpr hp have hk0 : 0 < Nat.sqrt p := by omega have ht : 0 < theta0 (Nat.sqrt p) ∧ theta0 (Nat.sqrt p) ≤ 1 := source_theta_pos_le_one epsilon0_pos.le hk have hv := scoreVarianceTerm_le hp hA hT have he := externalTerm_le hp hT have hi := hinf A.card (100 * Nat.sqrt p) (RichStarAsymptotics.ordinaryCap (Nat.sqrt p)) (J p) 2 hA le_rfl le_rfl le_rfl (by norm_num) rw [← influenceTail_eq p] at hi have hz : (Finset.univ \ X : Finset G).card ≤ p := by simpa only [hcard] using Finset.card_le_univ (Finset.univ \ X : Finset G) have hg := positiveBlocks_guardSum_le (k := Nat.sqrt p) (p := p) (a := A.card) (z := (Finset.univ \ X).card) (m := T.card) (M := M0 (Nat.sqrt p)) (d := L) (J := J p) (θ := theta0 (Nat.sqrt p)) (K := scalarConstant) (ρ := 2 / (Nat.sqrt p : ℝ)) hk0 hp hA hz (le_four_sqrt_sq hp) hT ht.1 ht.2 scalarConstant_pos.le (div_nonneg (by norm_num) (Nat.cast_nonneg _)) le_rfl (M0_one_le hk) hcol.le simpa only [sourceFailureBudget, SparseSourceExtraction.failureBudget, sourceFailureEnvelope, scoreVarianceTerm, externalTerm, sizeFailure, guardFailureEnvelope, perBlockMeanCap, perBlockMeanConstant, overlapCap, overlapConstant, SparseCleanupAsymptotics.cleanupOverlap, binomialPrefix, Nat.cast_ofNat] using add_le_add (add_le_add (add_le_add (add_le_add hv (le_refl (sizeFailure p))) he) hi) hg theorem eventually_sourceFailureBudget_lt_one : ∀ᶠ p : ℕ in atTop, ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], Fintype.card G = p → ∀ A T X : Finset G, A.card ≤ Nat.sqrt p → T.card ≤ 100 * Nat.sqrt p → sourceFailureBudget p A T X < 1 := by filter_upwards [eventually_sourceFailureBudget_le, (tendsto_order.1 sourceFailureEnvelope_tendsto_zero).2 1 (by norm_num)] with p hb hsmall intro G _ _ _ hcard A T X hA hT exact (hb G hcard A T X hA hT).trans_lt hsmall theorem eventually_sourceUpper_le : ∀ᶠ k : ℕ in atTop, sourceUpper epsilon0 k ≤ 200 * sourceScale epsilon0 k := by filter_upwards [(tendsto_order.1 (normalizedSourceUpper_tendsto epsilon0_lt_one)).2 200 (by norm_num), eventually_ge_atTop (1 : ℕ)] with k hsmall hk exact (div_le_iff₀ (sourceScale_pos epsilon0 (Nat.zero_lt_one.trans_le hk))).mp hsmall.le theorem sourceSize_expression (k : ℕ) : ((100 * k : ℕ) : ℝ) * theta0 k + (((100 * k : ℕ) : ℝ) * theta0 k) ^ (3 / 4 : ℝ) = sourceUpper epsilon0 k := by simp only [sourceUpper, sourceCenter, sourceWidth, sourceScale, Nat.cast_mul, Nat.cast_ofNat, theta0, mul_assoc] theorem source_card_le_cap {k s : ℕ} (hupper : sourceUpper epsilon0 k ≤ 200 * sourceScale epsilon0 k) (hs : (s : ℝ) ≤ sourceUpper epsilon0 k) : s ≤ SparseCleanupAsymptotics.sourceCap k := Nat.le_floor (hs.trans hupper) theorem influenceCap_nonneg (k : ℕ) : 0 ≤ influenceCap k := mul_nonneg (by positivity) (binomialPrefix_nonneg _ _) theorem eventually_certificate_budgets : ∀ᶠ p : ℕ in atTop, SparseCertificate.CertificateBudgets p (Nat.sqrt p) (N (Nat.sqrt p)) (SparseCleanupAsymptotics.sourceCap (Nat.sqrt p)) (sparseBudget (Nat.sqrt p)) (J p) (scalarBound (Nat.sqrt p)) (externalCap p) (calibrationBase * (p : ℝ) / 64) (influenceCap (Nat.sqrt p)) (calibrationBase * (p : ℝ) / 4) (calibrationBase * (p : ℝ) / 16) := by filter_upwards [eventually_error_budgets] with p hp obtain ⟨hclean, hretention, hmask, hraw, hexcluded⟩ := hp refine ⟨influenceCap_nonneg _, le_rfl, ?_, ?_, ?_⟩ · exact hexcluded · have hext := externalCap_cost p change priorRawCost p + rowConstant * externalCap p ≤ calibrationBase * (p : ℝ) / 8 linarith · change calibrationBase * (p : ℝ) / 64 + cleanCost p + retentionCost p + maskCost p ≤ _ linarith /-- A single threshold for the finite source selector and certificate. Its universal group/parent/descriptor fields retain the needed quantifier order. -/ structure ParameterGates (ε δ : ℝ) (p : ℕ) : Prop where parameter_two : 2 ≤ Nat.sqrt p theta_pos : 0 < theta0 (Nat.sqrt p) theta_le_one : theta0 (Nat.sqrt p) ≤ 1 roots_pos : 0 < 100 * Nat.sqrt p moment_pos : 1 ≤ SparseInfluenceAsymptotics.momentOrder (Nat.sqrt p) threshold_pos : ∀ j ∈ Finset.range L, 0 < influenceThreshold (Nat.sqrt p) (j + 1) score_margin_pos : 0 < scoreMargin p external_cap_pos : 0 < externalCap p mean_cap_pos : 0 < perBlockMeanCap p overlap_cap_pos : 0 < overlapCap p scalar_bound : ProtectedScores.inverseNewtonBound coefficients L (theta0 (Nat.sqrt p)) ≤ scalarBound (Nat.sqrt p) coefficient_bound : ∀ c j : ℕ, c + j ≤ L → |ProtectedScores.shiftedCoeff coefficients (theta0 (Nat.sqrt p)) c j| ≤ scalarConstant * ((theta0 (Nat.sqrt p))⁻¹) ^ (c + j) scalar_mean : ∀ r : ℕ, ScalarThinning.meanPolynomial coefficients L (theta0 (Nat.sqrt p)) r ≤ (if r = 0 then 1 else 0) + scalarError minorant : ∀ c n : ℕ, ProtectedScores.shiftedInterpolation coefficients L (theta0 (Nat.sqrt p)) c n ≤ ProtectedScores.clippedInverseNewton coefficients L (theta0 (Nat.sqrt p)) (c + n) source_upper : sourceUpper epsilon0 (Nat.sqrt p) ≤ 200 * sourceScale epsilon0 (Nat.sqrt p) certificate : SparseCertificate.CertificateBudgets p (Nat.sqrt p) (N (Nat.sqrt p)) (SparseCleanupAsymptotics.sourceCap (Nat.sqrt p)) (sparseBudget (Nat.sqrt p)) (J p) (scalarBound (Nat.sqrt p)) (externalCap p) (calibrationBase * (p : ℝ) / 64) (influenceCap (Nat.sqrt p)) (calibrationBase * (p : ℝ) / 4) (calibrationBase * (p : ℝ) / 16) prior : ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], ∀ d : Finset G × Finset G × Finset G × Finset G, Fintype.card G = p → SizeCaps epsilon0 200 (Nat.sqrt p) d → UpperWindow epsilon0 (Nat.sqrt p) d → PriorSizeBounds (Nat.sqrt p) d ∧ ConditionalMean.FixedPriorConditions (Nat.sqrt p) (theta0 (Nat.sqrt p)) ε δ d failure_small : ∀ (G : Type u) [AddCommGroup G] [DecidableEq G] [Fintype G], Fintype.card G = p → ∀ A T X : Finset G, A.card ≤ Nat.sqrt p → T.card ≤ 100 * Nat.sqrt p → sourceFailureBudget p A T X < 1 theorem eventually_parameterGates {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) : ∀ᶠ p : ℕ in atTop, ParameterGates.{u} ε δ p := by filter_upwards [nat_sqrt_tendsto_atTop.eventually_ge_atTop 2, nat_sqrt_tendsto_atTop.eventually (SparseInfluenceAsymptotics.momentOrder_tendsto_atTop.eventually_ge_atTop 1), SparseInfluenceAsymptotics.eventually_all_degree_base_ratio, nat_sqrt_tendsto_atTop.eventually eventually_scalar_mean_bound, nat_sqrt_tendsto_atTop.eventually eventually_shifted_minorant, nat_sqrt_tendsto_atTop.eventually eventually_sourceUpper_le, eventually_certificate_budgets, eventually_fixedPriorConditions hε hδ, eventually_uniform_sqrt_prior_size_bounds epsilon0_pos (show (0 : ℝ) ≤ 200 by norm_num), eventually_sourceFailureBudget_lt_one] with p hk hmoment hroot hscalar hminor hupper hcert hprior hsize hfail have hk1 : 1 ≤ Nat.sqrt p := by omega have hkpos : 0 < Nat.sqrt p := by omega have hp : 0 < p := Nat.sqrt_pos.mp hkpos have hp0 : (0 : ℝ) < p := by exact_mod_cast hp have hk0 : (0 : ℝ) < Nat.sqrt p := by exact_mod_cast hkpos have ht : 0 < theta0 (Nat.sqrt p) ∧ theta0 (Nat.sqrt p) ≤ 1 := source_theta_pos_le_one epsilon0_pos.le hk1 have hM : (0 : ℝ) < M0 (Nat.sqrt p) := SparseCleanupAsymptotics.M0_pos hk1 refine { parameter_two := hk theta_pos := ht.1 theta_le_one := ht.2 roots_pos := by positivity moment_pos := hmoment threshold_pos := ?_ score_margin_pos := scoreMargin_pos hp external_cap_pos := externalCap_pos hp mean_cap_pos := ?_ overlap_cap_pos := ?_ scalar_bound := inverseNewtonBound_le_scalarBound hk1 coefficient_bound := ?_ scalar_mean := hscalar minorant := hminor source_upper := hupper certificate := hcert prior := ?_ failure_small := hfail } · intro j hj have hjL : j + 1 ≤ L := by have := Finset.mem_range.mp hj; omega exact mul_pos (by norm_num) (hroot (j + 1) (by omega) hjL).1 · unfold perBlockMeanCap exact mul_pos (mul_pos perBlockMeanConstant_pos hp0) (pow_pos hM _) · unfold overlapCap SparseCleanupAsymptotics.cleanupOverlap exact mul_pos (mul_pos overlapConstant_pos (pow_pos hk0 _)) (pow_pos hM _) · intro c j hcj simpa only [one_mul, scalarConstant] using ProtectedScores.abs_shiftedCoeff_le_fixed_amplitude coefficients L ht.1 ht.2 (show (0 : ℝ) ≤ 1 by norm_num) (fun i _ => Scalar.abs_newtonCoeff_le_one L_pos i) c j hcj · intro G _ _ _ d hcard hd hw exact ⟨hsize G d hcard hd, hprior G d hcard hd hw⟩ theorem eventually_prime_parameterGates {ε δ : ℝ} (hε : 0 < ε) (hδ : 0 < δ) : ∀ᶠ p : {p : ℕ // p.Prime} in atTop, ParameterGates.{u} ε δ p.val := prime_val_tendsto_atTop.eventually (eventually_parameterGates hε hδ) end end Green39Submission.SparseSourceParameters end Green39AssemblyScope_6beb05947141a8cd /- Source: Green39Submission.SourceGuardAdapters; SHA256 1b7faadceaf4dd7b82ad7bdd5a0b7bd4cbc01b0800cdd472a8906d747f0bd984 -/ section Green39AssemblyScope_256f5d6d5bb8e590 /-! The deterministic FG bridge for the actual protected polynomial. Only labels with zero weight are removed. Distinct target labels and every ordered overlap pair, including diagonals, are retained throughout. -/ namespace Green39Submission.SourceGuardAdapters open scoped BigOperators Pointwise open DescriptorPrior SourceCanonicalMask SourceProbability OverlapGuards universe u v section ZeroWeights variable {α : Type u} {ι : Type v} /-- Filtering a finite sum does not change it when all removed terms vanish. -/ theorem sum_filter_eq_sum_of_zero_outside (I : Finset ι) (p : ι → Prop) [DecidablePred p] (f : ι → ℝ) (hzero : ∀ i ∈ I, ¬ p i → f i = 0) : (∑ i ∈ I.filter p, f i) = ∑ i ∈ I, f i := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i hi by_cases hp : p i · simp only [if_pos hp] · simp only [if_neg hp, hzero i hi hp] /-- Exact zero-weight removal for the implemented containment polynomial. -/ theorem containmentSum_filter_eq (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (p : ι → Prop) [DecidablePred p] (hzero : ∀ i ∈ I, ¬ p i → weight i = 0) (B : Finset α) : containmentSum (I.filter p) support weight B = containmentSum I support weight B := by classical unfold containmentSum apply sum_filter_eq_sum_of_zero_outside intro i hi hp rw [hzero i hi hp] simp /-- Exact zero-weight removal for the full ordered overlap sum. -/ theorem weightedOverlap_filter_eq [DecidableEq α] (I : Finset ι) (support : ι → Finset α) (weight : ι → ℝ) (p : ι → Prop) [DecidablePred p] (hzero : ∀ i ∈ I, ¬ p i → weight i = 0) (ρ : ℝ) : WeightedCleanup.weightedOverlap (I.filter p) support weight ρ = WeightedCleanup.weightedOverlap I support weight ρ := by classical rw [WeightedCleanup.weightedOverlap_eq_sum, WeightedCleanup.weightedOverlap_eq_sum] calc _ = ∑ i ∈ I.filter p, ∑ j ∈ I, if Disjoint (support i) (support j) then 0 else weight i * weight j * ρ ^ (support i ∪ support j).card := by apply Finset.sum_congr rfl intro i hi apply sum_filter_eq_sum_of_zero_outside intro j hj hp rw [hzero j hj hp] simp _ = _ := by apply sum_filter_eq_sum_of_zero_outside intro i hi hp rw [hzero i hi hp] simp end ZeroWeights section ActualLabels variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The free universe is disjoint from all forced inputs for every descriptor. -/ theorem forcedSet_disjoint_freeUniverse (d : Finset G × Finset G × Finset G × Finset G) : Disjoint (sourceForcedSet d) (sourceFreeUniverse d) := Finset.disjoint_of_subset_left Finset.sdiff_subset (protected_disjoint_freeUniverse Finset.univ d.2.2.1 (sourceForbidden d)) theorem positiveWeight_eq_zero_of_mem_mask (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (X : Finset G) (i : G × Finset G) (hi : i.1 ∈ X) : positiveWeight a θ d X i = 0 := by simp [positiveWeight, signedWeight, Finset.mem_union_left _ hi] theorem negativeWeight_eq_zero_of_mem_mask (a : ℕ → ℝ) (θ : ℝ) (d : Finset G × Finset G × Finset G × Finset G) (X : Finset G) (i : G × Finset G) (hi : i.1 ∈ X) : negativeWeight a θ d X i = 0 := by simp [negativeWeight, signedWeight, Finset.mem_union_left _ hi] /-- The same finite block partition applies to either sign of the weight. -/ theorem containmentSum_eq_sum_blocks (L : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (weight : G × Finset G → ℝ) (B : Finset G) : containmentSum (nonconstantLabels d L) Prod.snd weight B = ∑ b ∈ positiveBlocks L, containmentSum (positiveBlockLabels d L b.1 b.2) Prod.snd weight B := by classical let f : G × Finset G → ℕ × ℕ := fun i => (sourceForcedCount d i.1, i.2.card) have hmap : ∀ i ∈ nonconstantLabels d L, f i ∈ positiveBlocks L := by intro i hi obtain ⟨hU, hrow, hpos, hbound⟩ := (mem_nonconstantLabels d L i).mp hi apply (mem_positiveBlocks L (f i)).mpr dsimp [f] exact ⟨Finset.mem_range.mpr (by omega), Finset.mem_range.mpr (by omega), hpos, hbound⟩ have hf (b : ℕ × ℕ) : (nonconstantLabels d L).filter (fun i => f i = b) = positiveBlockLabels d L b.1 b.2 := by ext i simp [f, positiveBlockLabels, Prod.ext_iff] unfold containmentSum rw [← Finset.sum_fiberwise_of_maps_to hmap] apply Finset.sum_congr rfl intro b hb rw [hf] theorem offMask_block_labels (L c j : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (X : Finset G) (i : G × Finset G) (hi : i ∈ (positiveBlockLabels d L c j).filter (fun i => i.1 ∉ X)) : i.1 ∈ (Finset.univ \ X) ∧ representationCount (sourceForcedSet d) d.2.2.2 i.1 = c ∧ i.2 ⊆ sourceFreeUniverse d ∧ markerSet i.1 i.2 ⊆ d.2.2.2 ∧ i.2.card = j := by obtain ⟨hiblock, hiX⟩ := Finset.mem_filter.mp hi obtain ⟨hilabel, hc, hj⟩ := Finset.mem_filter.mp hiblock exact ⟨Finset.mem_sdiff.mpr ⟨Finset.mem_univ _, hiX⟩, hc, label_support_subset d L i hilabel, label_markers_subset d L i hilabel, hj⟩ /-- One actual exact-prior block mean follows from its deterministic-density source majorizer, after deleting only zero mask weights. -/ theorem blockPriorMean_le_guard (A T X : Finset G) (k L c j : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (weight : G × Finset G → ℝ) (hPA : sourceForcedSet d ⊆ A) (hST : d.2.2.2 ⊆ T) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) {θ K ρmax M : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρmax : ((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ) ≤ ρmax) (hzero : ∀ i, i.1 ∈ X → weight i = 0) (hweight : ∀ i ∈ positiveBlockLabels d L c j, 0 ≤ weight i ∧ weight i ≤ K / θ ^ (c + j)) (hguard : meanMajorizer A T (Finset.univ \ X) c j θ K ρmax d.2.2.2 ≤ M) : uniformMean (sourcePrior k d) (containmentSum (positiveBlockLabels d L c j) Prod.snd weight) ≤ M := by classical let I := (positiveBlockLabels d L c j).filter (fun i => i.1 ∉ X) have hremove : containmentSum I Prod.snd weight = containmentSum (positiveBlockLabels d L c j) Prod.snd weight := by funext B apply containmentSum_filter_eq intro i hi hmask exact hzero i (Classical.not_not.mp hmask) have hlabels := offMask_block_labels L c j d X have hbern := actual_bernoulliMean_le_guard A T (Finset.univ \ X) (sourceForcedSet d) (sourceFreeUniverse d) d.2.2.2 c j hPA hST (forcedSet_disjoint_freeUniverse d) I weight hθ hK (div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _)) hρmax hlabels (fun i hi => (hweight i (Finset.mem_filter.mp hi).1).2) hguard rw [← hremove] exact (WeightedCleanup.exactSlice_mean_le_bernoulli (sourceFreeUniverse d) (k - d.2.2.1.card) hn I Prod.snd weight (fun i hi => (hlabels i hi).2.2.1) (fun i hi => (hweight i (Finset.mem_filter.mp hi).1).1)).trans hbern /-- Every ordered overlap in the actual positive block is covered by the same source guard, at the actual descriptor density. -/ theorem blockOverlap_le_guard (A T X : Finset G) (k L c j : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (weight : G × Finset G → ℝ) (hPA : sourceForcedSet d ⊆ A) (hST : d.2.2.2 ⊆ T) {θ K ρmax D : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hρmax : ((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ) ≤ ρmax) (hzero : ∀ i, i.1 ∈ X → weight i = 0) (hweight : ∀ i ∈ positiveBlockLabels d L c j, 0 ≤ weight i ∧ weight i ≤ K / θ ^ (c + j)) (hguard : overlapMajorizer A T (Finset.univ \ X) c j θ K ρmax d.2.2.2 ≤ D) : WeightedCleanup.weightedOverlap (positiveBlockLabels d L c j) Prod.snd weight (((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ)) ≤ D := by classical let I := (positiveBlockLabels d L c j).filter (fun i => i.1 ∉ X) have hremove : WeightedCleanup.weightedOverlap I Prod.snd weight (((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ)) = WeightedCleanup.weightedOverlap (positiveBlockLabels d L c j) Prod.snd weight (((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ)) := by apply weightedOverlap_filter_eq intro i hi hmask exact hzero i (Classical.not_not.mp hmask) rw [← hremove] exact actual_weightedOverlap_le_guard A T (Finset.univ \ X) (sourceForcedSet d) (sourceFreeUniverse d) d.2.2.2 c j hPA hST (forcedSet_disjoint_freeUniverse d) I weight hθ hK (div_nonneg (Nat.cast_nonneg _) (Nat.cast_nonneg _)) hρmax (offMask_block_labels L c j d X) (fun i hi => hweight i (Finset.mem_filter.mp hi).1) hguard /-- A common cap on all finite block means controls the whole nonconstant part. -/ theorem priorMean_le_block_count_mul (k L : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (weight : G × Finset G → ℝ) {M : ℝ} (hM : 0 ≤ M) (hblock : ∀ b ∈ positiveBlocks L, uniformMean (sourcePrior k d) (containmentSum (positiveBlockLabels d L b.1 b.2) Prod.snd weight) ≤ M) : uniformMean (sourcePrior k d) (containmentSum (nonconstantLabels d L) Prod.snd weight) ≤ (((L + 1) ^ 2 : ℕ) : ℝ) * M := by change uniformMean (sourcePrior k d) (fun B => containmentSum (nonconstantLabels d L) Prod.snd weight B) ≤ _ simp_rw [containmentSum_eq_sum_blocks] rw [uniformMean_sum] calc _ ≤ ∑ _b ∈ positiveBlocks L, M := Finset.sum_le_sum hblock _ = ((positiveBlocks L).card : ℝ) * M := by simp _ ≤ _ := mul_le_mul_of_nonneg_right (by exact_mod_cast positiveBlocks_card_le L) hM /-- The actual observable tests follow from one common source-majorizer event. Its hypotheses quantify only over the eligible c+j≤L blocks. -/ theorem observableGuards_of_majorizer_bounds (a : ℕ → ℝ) (A T X : Finset G) (k L : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (hPA : sourceForcedSet d ⊆ A) (hST : d.2.2.2 ⊆ T) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) {θ K ρmax M D : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hM : 0 ≤ M) (hρmax : ((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ) ≤ ρmax) (hcoeff : ∀ c j : ℕ, c + j ≤ L → |ProtectedScores.shiftedCoeff a θ c j| ≤ K / θ ^ (c + j)) (hguards : ∀ b ∈ positiveBlocks L, meanMajorizer A T (Finset.univ \ X) b.1 b.2 θ K ρmax d.2.2.2 ≤ M ∧ overlapMajorizer A T (Finset.univ \ X) b.1 b.2 θ K ρmax d.2.2.2 ≤ D) : observableGuards a k L θ ((((L + 1) ^ 2 : ℕ) : ℝ) * M) D d X := by classical have hpweight (c j : ℕ) (hcj : c + j ≤ L) (i : G × Finset G) (hi : i ∈ positiveBlockLabels d L c j) : 0 ≤ positiveWeight a θ d X i ∧ positiveWeight a θ d X i ≤ K / θ ^ (c + j) := by obtain ⟨hilabel, hc, hj⟩ := Finset.mem_filter.mp hi refine ⟨positiveWeight_nonneg a θ d X i, ?_⟩ apply (positiveWeight_le_abs_shiftedCoeff a θ d X i).trans rw [hc, hj] exact hcoeff c j hcj have hnweight (c j : ℕ) (hcj : c + j ≤ L) (i : G × Finset G) (hi : i ∈ positiveBlockLabels d L c j) : 0 ≤ negativeWeight a θ d X i ∧ negativeWeight a θ d X i ≤ K / θ ^ (c + j) := by obtain ⟨hilabel, hc, hj⟩ := Finset.mem_filter.mp hi refine ⟨negativeWeight_nonneg a θ d X i, ?_⟩ apply (negativeWeight_le_abs_shiftedCoeff a θ d X i).trans rw [hc, hj] exact hcoeff c j hcj refine ⟨?_, ?_, ?_⟩ · apply priorMean_le_block_count_mul k L d (positiveWeight a θ d X) hM intro b hb exact blockPriorMean_le_guard A T X k L b.1 b.2 d (positiveWeight a θ d X) hPA hST hn hθ hK hρmax (positiveWeight_eq_zero_of_mem_mask a θ d X) (hpweight b.1 b.2 ((mem_positiveBlocks L b).mp hb).2.2.2) (hguards b hb).1 · apply priorMean_le_block_count_mul k L d (negativeWeight a θ d X) hM intro b hb exact blockPriorMean_le_guard A T X k L b.1 b.2 d (negativeWeight a θ d X) hPA hST hn hθ hK hρmax (negativeWeight_eq_zero_of_mem_mask a θ d X) (hnweight b.1 b.2 ((mem_positiveBlocks L b).mp hb).2.2.2) (hguards b hb).1 · intro c hc j hj hjpos hcj have hb : (c, j) ∈ positiveBlocks L := (mem_positiveBlocks L (c, j)).mpr ⟨hc, hj, hjpos, hcj⟩ exact blockOverlap_le_guard A T X k L c j d (positiveWeight a θ d X) hPA hST hθ hK hρmax (positiveWeight_eq_zero_of_mem_mask a θ d X) (hpweight c j hcj) (hguards (c, j) hb).2 theorem observableGuards_of_not_guardFailure (a : ℕ → ℝ) (A T X : Finset G) (k L : ℕ) (d : Finset G × Finset G × Finset G × Finset G) (hPA : sourceForcedSet d ⊆ A) (hST : d.2.2.2 ⊆ T) (hn : k - d.2.2.1.card ≤ (sourceFreeUniverse d).card) {θ K ρmax M D : ℝ} (hθ : 0 ≤ θ) (hK : 0 ≤ K) (hM : 0 ≤ M) (hρmax : ((k - d.2.2.1.card : ℕ) : ℝ) / ((sourceFreeUniverse d).card : ℝ) ≤ ρmax) (hcoeff : ∀ c j : ℕ, c + j ≤ L → |ProtectedScores.shiftedCoeff a θ c j| ≤ K / θ ^ (c + j)) (hguards : ¬ guardFailure A T (Finset.univ \ X) (positiveBlocks L) θ K ρmax M D d.2.2.2) : observableGuards a k L θ ((((L + 1) ^ 2 : ℕ) : ℝ) * M) D d X := by apply observableGuards_of_majorizer_bounds a A T X k L d hPA hST hn hθ hK hM hρmax hcoeff intro b hb exact ⟨le_of_not_gt (fun h => hguards ⟨b, hb, Or.inl h⟩), le_of_not_gt (fun h => hguards ⟨b, hb, Or.inr h⟩)⟩ /-- Fixed coefficient amplitude gives the exact K/θ^(c+j) source weight cap. -/ theorem shiftedCoeff_le_guard_amplitude (a : ℕ → ℝ) (L : ℕ) {θ A : ℝ} (hθ : 0 < θ) (hθ1 : θ ≤ 1) (hA : 0 ≤ A) (ha : ∀ i, i ≤ L → |a i| ≤ A) (c j : ℕ) (hcj : c + j ≤ L) : |ProtectedScores.shiftedCoeff a θ c j| ≤ (A * (2 : ℝ) ^ L) / θ ^ (c + j) := by simpa only [div_eq_mul_inv, inv_pow] using ProtectedScores.abs_shiftedCoeff_le_fixed_amplitude a L hθ hθ1 hA ha c j hcj end ActualLabels end Green39Submission.SourceGuardAdapters end Green39AssemblyScope_256f5d6d5bb8e590 /- Source: Green39Submission.SparseSourceCompletion; SHA256 bd9357d7c0546458ca0ea09b490d97619f0c567e812ca6db3a7d7d5a0f2dd2b6 -/ section Green39AssemblyScope_8572d4e2b9fc7490 /-! Completion of the actual sparse-source construction. The ordinary centers are selected from the whole original deterministic parent. The exceptional input set comes from the proved common multiplicity-cleanup gate. All source events are discharged by the simultaneous source theorem and the concrete eventual numerical gates. No source sample, posterior law or source certificate is an input to the unconditional endpoint. -/ namespace Green39Submission.SparseSourceCompletion open Filter Topology Parameters Green39Submission.Asymptotics open DescriptorPrior DescriptorAsymptotics SourceCanonicalMask ProtectedScores open SparseSourceParameters SparseCleanupAsymptotics SparseCertificate open HypergeometricCalibration SparseObstruction open scoped BigOperators Pointwise Classical noncomputable section /-- Reducing the scalar mask bound only reduces the two nonnegative costs in the finite certificate budgets. This lets the concrete overestimate pay for the literal inverseNewtonBound used by the final probability theorem. -/ theorem certificateBudgets_mono_bound {p k e s b J : ℕ} {smallBound bound budgetExt initial influence meanFloor upper : ℝ} (hbound : smallBound ≤ bound) (h : CertificateBudgets p k e s b J bound budgetExt initial influence meanFloor upper) : CertificateBudgets p k e s b J smallBound budgetExt initial influence meanFloor upper := by refine ⟨h.influence_nonneg, h.mean_floor, h.excluded, ?_, ?_⟩ · have hm : smallBound * ((e : ℝ) + (badTargetCap k J : ℝ)) ≤ bound * ((e : ℝ) + (badTargetCap k J : ℝ)) := mul_le_mul_of_nonneg_right hbound (add_nonneg (Nat.cast_nonneg e) (Nat.cast_nonneg (badTargetCap k J))) exact (add_le_add hm (le_refl _)).trans h.mean_loss · have hclean : ((30 * H k : ℕ) : ℝ) * (s : ℝ) * (2 * smallBound) ≤ ((30 * H k : ℕ) : ℝ) * (s : ℝ) * (2 * bound) := by gcongr have hmask : 2 * smallBound * (e : ℝ) ≤ 2 * bound * (e : ℝ) := by gcongr linarith [h.score_loss] universe u section ParentGeometry variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] /-- The whole-parent high-center construction gives the integer ordinary cap used by the rooted source moments, with no change to the original input. -/ theorem ordinary_cap_outside_actual_centers (A T : Finset G) (k : ℕ) : ∀ v : G, v ∉ MixedEnergy.highCenters A T ((k : ℝ) ^ (3 / 4 : ℝ)) → (T.filter (fun t => t - v ∈ A)).card ≤ RichStarAsymptotics.ordinaryCap k := by intro v hv exact Nat.le_floor (MixedEnergy.ordinaryOverlap_le_of_not_mem_highCenters hv) /-- The literal parent cap k^alpha is stronger than the integer M0 cap used inside the source extraction. -/ theorem profile_le_M0 (A T X : Finset G) {k : ℕ} (hprofile : ∀ x : G, x ∉ X → (representationCount A T x : ℝ) ≤ (k : ℝ) ^ alpha) : ∀ x : G, x ∉ X → representationCount A T x ≤ M0 k := by intro x hx have hceil : 2 * (k : ℝ) ^ alpha ≤ (M0 k : ℝ) := Nat.le_ceil _ have hpow := Real.rpow_nonneg (Nat.cast_nonneg k) alpha have hreal : (representationCount A T x : ℝ) ≤ (M0 k : ℝ) := by linarith [hprofile x hx] exact_mod_cast hreal /-- The exact forced-input set of the actual protected descriptor stays in the original parent, as required by the common source-majorizer adapter. -/ theorem actual_forced_subset_parent (A E0 S D : Finset G) : sourceForcedSet (D, E0, protectedInputs A E0 S D, S) ⊆ A := by rw [sourceForcedSet_protectedInputs] exact Finset.inter_subset_left.trans Finset.sdiff_subset end ParentGeometry /-- For every sufficiently large prime, every original input satisfying the proved common gate and every sparse parent has an actual source certificate. The ordinary centers in this stronger endpoint are literally the whole-parent highCenters set; the source sample and exceptional inputs are constructed. -/ theorem eventually_actual_source_certificate : ∀ᶠ p : PrimeIndex in atTop, ∀ A : Finset (ZMod (p : ℕ)), A.card = Nat.sqrt (p : ℕ) → CommonInputGate A (J (p : ℕ)) (H (Nat.sqrt (p : ℕ))) → ∀ T : Finset (ZMod (p : ℕ)), T.card ≤ 100 * Nat.sqrt (p : ℕ) → ∀ X : Finset (ZMod (p : ℕ)), X.card ≤ N (Nat.sqrt (p : ℕ)) → (∀ x : ZMod (p : ℕ), x ∉ X → (representationCount A T x : ℝ) ≤ (Nat.sqrt (p : ℕ) : ℝ) ^ alpha) → ((holeSet A T).card : ℝ) < (calibrationBase / 128) * ((p : ℕ) : ℝ) → ∃ E0 S : Finset (ZMod (p : ℕ)), SourceCertificate coefficients epsilon0 200 (Nat.sqrt (p : ℕ)) L (sourceCap (Nat.sqrt (p : ℕ))) (sparseBudget (Nat.sqrt (p : ℕ))) (theta0 (Nat.sqrt (p : ℕ))) (inverseNewtonBound coefficients L (theta0 (Nat.sqrt (p : ℕ)))) (calibrationBase * ((p : ℕ) : ℝ) / 4) (cleanupMean totalMeanConstant (p : ℕ) (Nat.sqrt (p : ℕ))) (cleanupOverlap overlapConstant (Nat.sqrt (p : ℕ))) (calibrationBase * ((p : ℕ) : ℝ) / 16) A X (MixedEnergy.highCenters A T ((Nat.sqrt (p : ℕ) : ℝ) ^ (3 / 4 : ℝ))) E0 S := by obtain ⟨εCal, δCal, hεCal, _hεCal1, hδCal, hcertificate⟩ := SparseCertificate.exists_fixed_source_certificate_window.{0} have hparameters := SparseSourceParameters.eventually_prime_parameterGates.{0} hεCal hδCal have hcenters := prime_val_tendsto_atTop.eventually HighCenters.eventually_highCenter_coefficient filter_upwards [hparameters, hcenters] with p hp hc intro A hA hgate T hT X hX hprofile hholes let k := Nat.sqrt (p : ℕ) let D := MixedEnergy.highCenters A T ((k : ℝ) ^ (3 / 4 : ℝ)) let θ := theta0 k have hD : D.card ≤ H k := HighCenters.highCenters_card_le_H hc.1 hA hT hgate.1 hc.2 obtain ⟨E0, hE0A, hE0card, _hJclean, hcap⟩ := exists_clean_input_of_gate A D (J (p : ℕ)) (H k) hgate hD have hM : ∀ x : ZMod (p : ℕ), x ∉ X → representationCount A T x ≤ M0 k := profile_le_M0 A T X hprofile have hQ : ∀ v : ZMod (p : ℕ), v ∉ D → (T.filter (fun s => s - v ∈ A)).card ≤ RichStarAsymptotics.ordinaryCap k := ordinary_cap_outside_actual_centers A T k have hfailure := hp.failure_small (ZMod (p : ℕ)) (ZMod.card (p : ℕ)) A T X hA.le hT obtain ⟨S, hST, _hrawScore, hcleanScore, hsize, hExt, hinf, hguards⟩ := SparseSourceExtraction.exists_source_with_budgets coefficients A E0 T D X (positiveBlocks L) L (M0 k) (RichStarAsymptotics.ordinaryCap k) (J (p : ℕ)) 5 (100 * k) (SparseInfluenceAsymptotics.momentOrder k) (influenceThreshold k) hp.theta_pos hp.theta_le_one hp.score_margin_pos hp.external_cap_pos (show (0 : ℝ) ≤ 2 by norm_num) scalarConstant_pos.le (by positivity) hp.mean_cap_pos hp.overlap_cap_pos hp.scalar_mean hE0A hT hp.roots_pos hM hQ hgate.1 (fun q _ => hcap q) hp.threshold_pos hp.moment_pos hfailure let d := (D, E0, protectedInputs A E0 S D, S) have hSupper : (S.card : ℝ) ≤ sourceUpper epsilon0 k := by simpa only [k, sourceSize_expression] using hsize have hScoarse : (S.card : ℝ) ≤ 200 * sourceScale epsilon0 k := hSupper.trans hp.source_upper have hScard : S.card ≤ sourceCap k := source_card_le_cap hp.source_upper hSupper have hSizes : SizeCaps epsilon0 200 k d := actual_descriptor_sizeCaps epsilon0 200 k A E0 S D hD hE0card hcap hScoarse obtain ⟨hpriorSize, hprior⟩ := hp.prior (ZMod (p : ℕ)) d (ZMod.card (p : ℕ)) hSizes hSupper have hcoefficient : ∀ c j : ℕ, c + j ≤ L → |shiftedCoeff coefficients θ c j| ≤ scalarConstant / θ ^ (c + j) := by intro c j hcj simpa only [div_eq_mul_inv, inv_pow] using hp.coefficient_bound c j hcj have hobservable := SourceGuardAdapters.observableGuards_of_majorizer_bounds coefficients A T X k L d (actual_forced_subset_parent A E0 S D) hST hpriorSize.remainder_le_free hp.theta_pos.le scalarConstant_pos.le hp.mean_cap_pos.le hpriorSize.density_le hcoefficient hguards change observableGuards coefficients k L θ ((blockBound : ℝ) * perBlockMeanCap (p : ℕ)) (overlapCap (p : ℕ)) d X at hobservable rw [blockBound_mul_perBlockMeanCap] at hobservable have hExternal : ConditionalMean.externalWeightOutside d X 10001 θ ≤ externalCap (p : ℕ) := by refine le_trans ?_ hExt unfold ConditionalMean.externalWeightOutside ConditionalMean.externalFactor apply Finset.sum_le_sum intro x _ by_cases hx : sourceForcedCount d x ≤ 10001 · have hx' : sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x ≤ L := hx simp only [if_pos hx, if_pos hx', d, θ, k, le_refl] · have hx' : ¬ sourceForcedCount (D, E0, protectedInputs A E0 S D, S) x ≤ L := hx simp only [if_neg hx, if_neg hx', le_refl] have hrawCap : ((holeSet A T).card : ℝ) + scalarError * (Fintype.card (ZMod (p : ℕ)) : ℝ) + scoreMargin (p : ℕ) ≤ calibrationBase * ((p : ℕ) : ℝ) / 64 := by rw [ZMod.card] have hholes' : ((holeSet A T).card : ℝ) ≤ calibrationBase * ((p : ℕ) : ℝ) / 128 := by simpa only [div_mul_eq_mul_div] using hholes.le calc _ ≤ calibrationBase * ((p : ℕ) : ℝ) / 128 + scalarError * ((p : ℕ) : ℝ) + scoreMargin (p : ℕ) := by linarith _ = _ := initial_score_budget (p : ℕ) have hclean : fullScore coefficients L θ (A \ E0) S ≤ calibrationBase * ((p : ℕ) : ℝ) / 64 + (E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound coefficients L θ) := by have hstart : fullScore coefficients L θ (A \ E0) S ≤ ((holeSet A T).card : ℝ) + scalarError * (Fintype.card (ZMod (p : ℕ)) : ℝ) + scoreMargin (p : ℕ) + (E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound coefficients L θ) := by simpa only [θ, k] using hcleanScore exact hstart.trans (add_le_add hrawCap (le_refl ((E0.card : ℝ) * (S.card : ℝ) * (2 * inverseNewtonBound coefficients L θ)))) have hInfluence : ∀ u ∈ A \ protectedInputs A E0 S D, MaskedScoreDeletion.restrictedInputInfluence 10001 θ 2 (A \ E0) S X u ≤ influenceCap k := by intro u hu have h := hinf u hu rwa [influenceThreshold_sum] at h have hbudgets : CertificateBudgets (Fintype.card (ZMod (p : ℕ))) k (N k) (sourceCap k) (sparseBudget k) (J (p : ℕ)) (inverseNewtonBound coefficients L θ) (externalCap (p : ℕ)) (calibrationBase * ((p : ℕ) : ℝ) / 64) (influenceCap k) (calibrationBase * ((p : ℕ) : ℝ) / 4) (calibrationBase * ((p : ℕ) : ℝ) / 16) := by simpa only [ZMod.card] using certificateBudgets_mono_bound hp.scalar_bound hp.certificate refine ⟨E0, S, ?_⟩ exact hcertificate (ZMod (p : ℕ)) epsilon0 200 k (N k) (sourceCap k) (sparseBudget k) (J (p : ℕ)) θ (inverseNewtonBound coefficients L θ) (externalCap (p : ℕ)) (calibrationBase * ((p : ℕ) : ℝ) / 64) (influenceCap k) (calibrationBase * ((p : ℕ) : ℝ) / 4) (totalMeanCap (p : ℕ)) (overlapCap (p : ℕ)) (calibrationBase * ((p : ℕ) : ℝ) / 16) A T X D E0 S hD hE0A hE0card hcap hScard hScoarse hSupper hT hST hX hgate.1 hprior le_rfl hExternal hclean hInfluence hobservable hbudgets /-- The unconditional source-existence premise in the final sparse probability theorem, retaining every original input, translate budget and candidate mask. -/ theorem eventually_source_certificates : ∀ᶠ p : PrimeIndex in atTop, ∀ A : Finset (ZMod (p : ℕ)), A.card = Nat.sqrt (p : ℕ) → CommonInputGate A (J (p : ℕ)) (H (Nat.sqrt (p : ℕ))) → ∀ T : Finset (ZMod (p : ℕ)), T.card ≤ 100 * Nat.sqrt (p : ℕ) → ∀ X : Finset (ZMod (p : ℕ)), X.card ≤ N (Nat.sqrt (p : ℕ)) → (∀ x : ZMod (p : ℕ), x ∉ X → (representationCount A T x : ℝ) ≤ (Nat.sqrt (p : ℕ) : ℝ) ^ alpha) → ((holeSet A T).card : ℝ) < (calibrationBase / 128) * ((p : ℕ) : ℝ) → ∃ D E0 S : Finset (ZMod (p : ℕ)), SourceCertificate coefficients epsilon0 200 (Nat.sqrt (p : ℕ)) L (sourceCap (Nat.sqrt (p : ℕ))) (sparseBudget (Nat.sqrt (p : ℕ))) (theta0 (Nat.sqrt (p : ℕ))) (inverseNewtonBound coefficients L (theta0 (Nat.sqrt (p : ℕ)))) (calibrationBase * ((p : ℕ) : ℝ) / 4) (cleanupMean totalMeanConstant (p : ℕ) (Nat.sqrt (p : ℕ))) (cleanupOverlap overlapConstant (Nat.sqrt (p : ℕ))) (calibrationBase * ((p : ℕ) : ℝ) / 16) A X D E0 S := by filter_upwards [eventually_actual_source_certificate] with p hp intro A hA hgate T hT X hX hprofile hholes obtain ⟨E0, S, hcert⟩ := hp A hA hgate T hT X hX hprofile hholes exact ⟨MixedEnergy.highCenters A T ((Nat.sqrt (p : ℕ) : ℝ) ^ (3 / 4 : ℝ)), E0, S, hcert⟩ end end Green39Submission.SparseSourceCompletion end Green39AssemblyScope_8572d4e2b9fc7490 /- Source: Green39Submission.SparseLimit; SHA256 a093732b5379d93c959076f82a9d2810afe5cc3d45a4cf5fcfad7aa896bd874d -/ section Green39AssemblyScope_0c07217304e91d7c /-! The unconditional sparse-hole failure limit for the literal native event. All actual source-certificate existence is supplied by SparseSourceCompletion; all canonical prior, cleanup, counting and analytic steps are supplied by SparseObstruction. The translate and exceptional-target sets remain adaptive. -/ namespace Green39Submission.SparseLimit open Filter Topology /-- The sparse obstruction holds with probability tending to one on the exact floor(sqrt(p))-element slice, through every prime, with the literal 100k budget. -/ theorem sparse_failure_limit : Tendsto (Integration.sparseFailureProbability (fun p : PrimeIndex => (Nat.sqrt (p : ℕ) : ℝ) ^ Parameters.alpha) (fun p : PrimeIndex => Parameters.N (Nat.sqrt (p : ℕ))) (HypergeometricCalibration.calibrationBase / 128)) atTop (𝓝 (0 : ℝ)) := by exact SparseObstruction.sparseFailureProbability_tendsto_zero_of_eventual_source_certificates SparseSourceParameters.coefficients (Scalar.newtonCoeff_top_neg Parameters.L_odd) _ _ _ HypergeometricCalibration.calibrationBase SparseSourceParameters.totalMeanConstant SparseSourceParameters.overlapConstant HypergeometricCalibration.calibrationBase_pos SparseSourceParameters.totalMeanConstant_pos.le SparseSourceParameters.overlapConstant_pos SparseSourceCompletion.eventually_source_certificates end Green39Submission.SparseLimit end Green39AssemblyScope_0c07217304e91d7c /- Source: Green39Submission.NativeRefutation; SHA256 90ef7fee806b1f26bdaacd0e4353cb86f6ecb1924a38f2d256cf8f6cdf578a30 -/ section Green39AssemblyScope_adaadb9746439ff4 /-! Combination of the two actual failure limits on the original exact-cardinality prime slices. Neither failure estimate is a hypothesis of the final theorem. The target-type macro uses only the type of the pinned native conjecture. -/ namespace Green39Submission open Filter Topology /-- The exact native cover probability tends to zero through every prime. -/ theorem coverProbability_tendsto_zero : Tendsto coverProbability atTop (𝓝 (0 : ℝ)) := by apply Integration.coverProbability_tendsto_zero_of_failure_limits PrimeIntegration.richThreshold PrimeIntegration.exceptionAllowance PrimeIntegration.holeMargin PrimeIntegration.holeMargin_pos PrimeIntegration.rich_failure_limit have hThreshold : PrimeIntegration.richThreshold = (fun p : PrimeIndex => (Nat.sqrt (p : ℕ) : ℝ) ^ Parameters.alpha) := rfl have hAllowance : PrimeIntegration.exceptionAllowance = (fun p : PrimeIndex => Parameters.N (Nat.sqrt (p : ℕ))) := rfl rw [hThreshold, hAllowance, PrimeIntegration.holeMargin] exact SparseLimit.sparse_failure_limit /-- Negation of the exact pinned native statement, with no remaining premise. -/ theorem native_refutation : ¬ (fcTypeOfName% "Green39.green_39") := native_refutation_of_zero_limit coverProbability_tendsto_zero end Green39Submission end Green39AssemblyScope_adaadb9746439ff4 end PrimeNonzero /- The trusted task header supplies namespace Bounty. The helper section has already closed, so this declaration has no residual typeclass parameter. -/ theorem target : ¬ (fcTypeOfName% "Green39.green_39") := by letI : ∀ p : Green39Submission.PrimeIndex, NeZero (p : ℕ) := fun p => ⟨p.property.ne_zero⟩ exact Green39Submission.native_refutation