Buckets:
| import Mathlib.Algebra.BigOperators.Ring.Finset | |
| import Mathlib.Tactic | |
| import OAI.NumberTheory.Jacobsthal.Analysis.BonferroniDensity | |
| namespace OAI | |
| namespace Erdos970 | |
| section | |
| namespace NumberTheoryLean.DisjointBlockExpansion | |
| open scoped BigOperators | |
| noncomputable def blockChoices (B : Finset ℕ) (blocks : ℕ → Finset ℕ) : | |
| Finset (∀ j ∈ B, Finset ℕ) := by | |
| classical | |
| exact B.pi fun j => (blocks j).powerset | |
| @[simp] theorem mem_blockChoices {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {choice : ∀ j ∈ B, Finset ℕ} : | |
| choice ∈ blockChoices B blocks ↔ ∀ j (hj : j ∈ B), choice j hj ⊆ blocks j := by | |
| classical | |
| simp only [blockChoices, Finset.mem_pi, Finset.mem_powerset] | |
| noncomputable def selectedUnion (B : Finset ℕ) (choice : ∀ j ∈ B, Finset ℕ) : Finset ℕ := by | |
| classical | |
| exact B.attach.biUnion fun j => choice j.1 j.2 | |
| theorem selectedUnion_subset {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {choice : ∀ j ∈ B, Finset ℕ} (hc : choice ∈ blockChoices B blocks) : | |
| selectedUnion B choice ⊆ B.biUnion blocks := by | |
| classical | |
| intro p hp | |
| obtain ⟨j, _, hpj⟩ := Finset.mem_biUnion.mp hp | |
| exact Finset.mem_biUnion.mpr ⟨j.1, j.2, (mem_blockChoices.mp hc j.1 j.2) hpj⟩ | |
| theorem selectedUnion_inter_block {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| {choice : ∀ j ∈ B, Finset ℕ} (hc : choice ∈ blockChoices B blocks) | |
| (j : ℕ) (hj : j ∈ B) : selectedUnion B choice ∩ blocks j = choice j hj := by | |
| classical | |
| ext p | |
| constructor | |
| · intro hp | |
| obtain ⟨hpu, hpj⟩ := Finset.mem_inter.mp hp | |
| obtain ⟨i, _, hpi⟩ := Finset.mem_biUnion.mp hpu | |
| by_cases hij : i.1 = j | |
| · subst j | |
| exact hpi | |
| · exact False.elim ((Finset.disjoint_left.mp (hdis i.2 hj hij)) | |
| ((mem_blockChoices.mp hc i.1 i.2) hpi) hpj) | |
| · intro hp | |
| exact Finset.mem_inter.mpr ⟨Finset.mem_biUnion.mpr | |
| ⟨⟨j, hj⟩, Finset.mem_attach _ _, hp⟩, (mem_blockChoices.mp hc j hj) hp⟩ | |
| def intersectionChoices (B : Finset ℕ) (blocks : ℕ → Finset ℕ) (T : Finset ℕ) : | |
| ∀ j ∈ B, Finset ℕ := fun j _ => T ∩ blocks j | |
| theorem intersectionChoices_mem (B : Finset ℕ) (blocks : ℕ → Finset ℕ) (T : Finset ℕ) : | |
| intersectionChoices B blocks T ∈ blockChoices B blocks := by | |
| apply mem_blockChoices.mpr | |
| intro j _ | |
| exact Finset.inter_subset_right | |
| theorem selectedUnion_intersectionChoices {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {T : Finset ℕ} (hT : T ⊆ B.biUnion blocks) : | |
| selectedUnion B (intersectionChoices B blocks T) = T := by | |
| classical | |
| ext p | |
| constructor | |
| · intro hp | |
| obtain ⟨j, _, hpj⟩ := Finset.mem_biUnion.mp hp | |
| exact (Finset.mem_inter.mp hpj).1 | |
| · intro hp | |
| obtain ⟨j, hj, hpj⟩ := Finset.mem_biUnion.mp (hT hp) | |
| exact Finset.mem_biUnion.mpr ⟨⟨j, hj⟩, Finset.mem_attach _ _, Finset.mem_inter.mpr ⟨hp, hpj⟩⟩ | |
| theorem sum_subsets_product (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (F : ℕ → Finset ℕ → ℝ) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, ∏ j ∈ B, F j (T ∩ blocks j)) = | |
| ∏ j ∈ B, ∑ T ∈ (blocks j).powerset, F j T := by | |
| classical | |
| symm | |
| rw [Finset.prod_sum] | |
| apply Finset.sum_bij (fun choice _ => selectedUnion B choice) | |
| · intro choice hc | |
| exact Finset.mem_powerset.mpr (selectedUnion_subset hc) | |
| · intro choice hc other ho heq | |
| funext j hj | |
| rw [← selectedUnion_inter_block hdis hc j hj, heq, | |
| selectedUnion_inter_block hdis ho j hj] | |
| · intro T hT | |
| exact ⟨intersectionChoices B blocks T, intersectionChoices_mem B blocks T, | |
| selectedUnion_intersectionChoices (Finset.mem_powerset.mp hT)⟩ | |
| · intro choice hc | |
| conv_rhs => rw [← Finset.prod_attach] | |
| apply Finset.prod_congr rfl | |
| intro j _ | |
| rw [selectedUnion_inter_block hdis hc j.1 j.2] | |
| def truncatedCoefficient (m : ℕ) (T : Finset ℕ) : ℝ := | |
| if T.card ≤ m then (-1 : ℝ) ^ T.card else 0 | |
| def layerCoefficient (m : ℕ) (T : Finset ℕ) : ℝ := | |
| if T.card = m then 1 else 0 | |
| theorem truncatedCoefficient_sum (m : ℕ) (P : Finset ℕ) (F : Finset ℕ → ℝ) : | |
| (∑ T ∈ P.powerset, truncatedCoefficient m T * F T) = | |
| BonferroniBlocks.momentPolynomial m P F := by | |
| classical | |
| let S := P.powerset.filter fun T => T.card ≤ m | |
| have hmap : ∀ T ∈ S, T.card ∈ Finset.range (m + 1) := by | |
| intro T hT | |
| exact Finset.mem_range.mpr (Nat.lt_succ_of_le (Finset.mem_filter.mp hT).2) | |
| calc | |
| _ = ∑ T ∈ S, (-1 : ℝ) ^ T.card * F T := by | |
| rw [Finset.sum_filter] | |
| apply Finset.sum_congr rfl | |
| intro T _ | |
| unfold truncatedCoefficient | |
| split_ifs <;> simp | |
| _ = ∑ r ∈ Finset.range (m + 1), ∑ T ∈ S.filter (fun T => T.card = r), | |
| (-1 : ℝ) ^ T.card * F T := | |
| (Finset.sum_fiberwise_of_maps_to hmap _).symm | |
| _ = _ := by | |
| unfold BonferroniBlocks.momentPolynomial | |
| apply Finset.sum_congr rfl | |
| intro r hr | |
| have hrm : r ≤ m := Nat.le_of_lt_succ (Finset.mem_range.mp hr) | |
| have hsets : S.filter (fun T => T.card = r) = P.powersetCard r := by | |
| ext T | |
| simp only [S, Finset.mem_filter, Finset.mem_powerset, Finset.mem_powersetCard] | |
| constructor | |
| · rintro ⟨⟨hTP, _⟩, hcard⟩ | |
| exact ⟨hTP, hcard⟩ | |
| · rintro ⟨hTP, hcard⟩ | |
| exact ⟨⟨hTP, by omega⟩, hcard⟩ | |
| rw [hsets, Finset.mul_sum] | |
| apply Finset.sum_congr rfl | |
| intro T hT | |
| rw [(Finset.mem_powersetCard.mp hT).2] | |
| theorem truncatedCoefficient_evaluation (m : ℕ) (P : Finset ℕ) (hit : ℕ → Prop) : | |
| (∑ T ∈ P.powerset, truncatedCoefficient m T * BonferroniBlocks.intersectionValue T hit) = | |
| BonferroniBlocks.coefficientPolynomial m P hit := | |
| truncatedCoefficient_sum m P (fun T => BonferroniBlocks.intersectionValue T hit) | |
| theorem layerCoefficient_evaluation (m : ℕ) (P : Finset ℕ) (hit : ℕ → Prop) : | |
| (∑ T ∈ P.powerset, layerCoefficient m T * BonferroniBlocks.intersectionValue T hit) = | |
| (((BonferroniBlocks.hitSet P hit).card).choose m : ℝ) := by | |
| classical | |
| calc | |
| _ = ∑ T ∈ P.powersetCard m, BonferroniBlocks.intersectionValue T hit := by | |
| rw [Finset.powersetCard_eq_filter, Finset.sum_filter] | |
| apply Finset.sum_congr rfl | |
| intro T _ | |
| unfold layerCoefficient | |
| split_ifs <;> simp | |
| _ = _ := BonferroniBlocks.sum_intersectionValue_eq_choose P hit m | |
| theorem intersectionValue_eq_product {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {T : Finset ℕ} (hT : T ⊆ B.biUnion blocks) (hit : ℕ → Prop) : | |
| BonferroniBlocks.intersectionValue T hit = | |
| ∏ j ∈ B, BonferroniBlocks.intersectionValue (T ∩ blocks j) hit := by | |
| classical | |
| by_cases hhit : ∀ p ∈ T, hit p | |
| · have hlocal : ∀ j ∈ B, BonferroniBlocks.intersectionValue (T ∩ blocks j) hit = 1 := by | |
| intro j _ | |
| apply ite_eq_left | |
| intro p hp | |
| exact hhit p (Finset.mem_inter.mp hp).1 | |
| unfold BonferroniBlocks.intersectionValue | |
| rw [ite_eq_left hhit] | |
| symm | |
| exact Finset.prod_eq_one hlocal | |
| · have hbad : ∃ p ∈ T, ¬ hit p := by | |
| simpa only [not_forall, Classical.not_imp, exists_prop] using hhit | |
| obtain ⟨p, hp, hnot⟩ := hbad | |
| obtain ⟨j, hj, hpj⟩ := Finset.mem_biUnion.mp (hT hp) | |
| have hlocal : BonferroniBlocks.intersectionValue (T ∩ blocks j) hit = 0 := | |
| ite_eq_right (fun h => hnot (h p (Finset.mem_inter.mpr ⟨hp, hpj⟩))) | |
| rw [BonferroniBlocks.intersectionValue, ite_eq_right hhit] | |
| symm | |
| exact Finset.prod_eq_zero hj hlocal | |
| noncomputable def globalCoefficient (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (localCoeff : ℕ → Finset ℕ → ℝ) (T : Finset ℕ) : ℝ := | |
| ∏ j ∈ B, localCoeff j (T ∩ blocks j) | |
| theorem globalCoefficient_evaluation (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (localCoeff : ℕ → Finset ℕ → ℝ) (hit : ℕ → Prop) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, | |
| globalCoefficient B blocks localCoeff T * BonferroniBlocks.intersectionValue T hit) = | |
| ∏ j ∈ B, ∑ T ∈ (blocks j).powerset, localCoeff j T * BonferroniBlocks.intersectionValue T hit := by | |
| calc | |
| _ = ∑ T ∈ (B.biUnion blocks).powerset, | |
| ∏ j ∈ B, localCoeff j (T ∩ blocks j) * BonferroniBlocks.intersectionValue (T ∩ blocks j) hit := by | |
| apply Finset.sum_congr rfl | |
| intro T hT | |
| rw [intersectionValue_eq_product (Finset.mem_powerset.mp hT), Finset.prod_mul_distrib] | |
| rfl | |
| _ = _ := sum_subsets_product B blocks hdis | |
| (fun j T => localCoeff j T * BonferroniBlocks.intersectionValue T hit) | |
| noncomputable def upperCoefficient (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (orders : ℕ → ℕ) (T : Finset ℕ) : ℝ := | |
| globalCoefficient B blocks (fun j => truncatedCoefficient (2 * orders j)) T | |
| noncomputable def correctionCoefficient (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (orders : ℕ → ℕ) (j : ℕ) (T : Finset ℕ) : ℝ := | |
| globalCoefficient B blocks | |
| (fun i => if i = j then layerCoefficient (2 * orders i + 1) | |
| else truncatedCoefficient (2 * orders i)) T | |
| noncomputable def lowerCoefficient (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (orders : ℕ → ℕ) (T : Finset ℕ) : ℝ := | |
| upperCoefficient B blocks orders T - ∑ j ∈ B, correctionCoefficient B blocks orders j T | |
| theorem upperCoefficient_evaluation (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders : ℕ → ℕ) (hit : ℕ → Prop) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, | |
| upperCoefficient B blocks orders T * BonferroniBlocks.intersectionValue T hit) = | |
| BonferroniBlocks.blockUpper B blocks orders hit := by | |
| unfold upperCoefficient | |
| rw [globalCoefficient_evaluation B blocks hdis] | |
| simp_rw [truncatedCoefficient_evaluation] | |
| rfl | |
| theorem correctionCoefficient_evaluation (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders : ℕ → ℕ) (hit : ℕ → Prop) (j : ℕ) (hj : j ∈ B) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, | |
| correctionCoefficient B blocks orders j T * BonferroniBlocks.intersectionValue T hit) = | |
| (BonferroniBlocks.coefficientPolynomial (2 * orders j) (blocks j) hit - | |
| BonferroniBlocks.coefficientPolynomial (2 * orders j + 1) (blocks j) hit) * | |
| ∏ i ∈ B.erase j, BonferroniBlocks.coefficientPolynomial (2 * orders i) (blocks i) hit := by | |
| classical | |
| unfold correctionCoefficient | |
| rw [globalCoefficient_evaluation B blocks hdis] | |
| rw [← Finset.mul_prod_erase B _ hj] | |
| simp only [ite_true] | |
| rw [layerCoefficient_evaluation, ← BonferroniBlocks.coefficientPolynomial_gap] | |
| congr 1 | |
| apply Finset.prod_congr rfl | |
| intro i hi | |
| have hij : i ≠ j := (Finset.mem_erase.mp hi).1 | |
| simp only [ite_eq_right hij] | |
| exact truncatedCoefficient_evaluation _ _ _ | |
| theorem lowerCoefficient_evaluation (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders : ℕ → ℕ) (hit : ℕ → Prop) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, | |
| lowerCoefficient B blocks orders T * BonferroniBlocks.intersectionValue T hit) = | |
| BonferroniBlocks.blockLower B blocks orders hit := by | |
| unfold lowerCoefficient BonferroniBlocks.blockLower BonferroniBlocks.blockCorrection | |
| simp_rw [sub_mul, Finset.sum_mul] | |
| rw [Finset.sum_sub_distrib, Finset.sum_comm, | |
| upperCoefficient_evaluation B blocks hdis] | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro j hj | |
| simpa only [sub_mul] using correctionCoefficient_evaluation B blocks hdis orders hit j hj | |
| @[simp] theorem truncatedCoefficient_ne_zero_iff (m : ℕ) (T : Finset ℕ) : | |
| truncatedCoefficient m T ≠ 0 ↔ T.card ≤ m := by | |
| unfold truncatedCoefficient | |
| split_ifs <;> simp_all | |
| @[simp] theorem layerCoefficient_ne_zero_iff (m : ℕ) (T : Finset ℕ) : | |
| layerCoefficient m T ≠ 0 ↔ T.card = m := by | |
| unfold layerCoefficient | |
| split_ifs <;> simp_all | |
| theorem truncatedCoefficient_abs_le (m : ℕ) (T : Finset ℕ) : | |
| |truncatedCoefficient m T| ≤ 1 := by | |
| unfold truncatedCoefficient | |
| split_ifs <;> simp | |
| theorem layerCoefficient_abs_le (m : ℕ) (T : Finset ℕ) : | |
| |layerCoefficient m T| ≤ 1 := by | |
| unfold layerCoefficient | |
| split_ifs <;> simp | |
| theorem globalCoefficient_abs_le (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (localCoeff : ℕ → Finset ℕ → ℝ) (T : Finset ℕ) | |
| (hlocal : ∀ j ∈ B, |localCoeff j (T ∩ blocks j)| ≤ 1) : | |
| |globalCoefficient B blocks localCoeff T| ≤ 1 := by | |
| unfold globalCoefficient | |
| rw [Finset.abs_prod] | |
| exact Finset.prod_le_one₀ (fun _ _ => abs_nonneg _) hlocal | |
| theorem upperCoefficient_abs_le (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (orders : ℕ → ℕ) (T : Finset ℕ) : |upperCoefficient B blocks orders T| ≤ 1 := | |
| globalCoefficient_abs_le B blocks _ T (fun _ _ => truncatedCoefficient_abs_le _ _) | |
| theorem correctionCoefficient_abs_le (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (orders : ℕ → ℕ) (j : ℕ) (T : Finset ℕ) : |correctionCoefficient B blocks orders j T| ≤ 1 := by | |
| apply globalCoefficient_abs_le | |
| intro i _ | |
| split_ifs | |
| · exact layerCoefficient_abs_le _ _ | |
| · exact truncatedCoefficient_abs_le _ _ | |
| theorem correctionCoefficient_own_card {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {orders : ℕ → ℕ} {j : ℕ} {T : Finset ℕ} (hj : j ∈ B) | |
| (hc : correctionCoefficient B blocks orders j T ≠ 0) : | |
| (T ∩ blocks j).card = 2 * orders j + 1 := by | |
| have h := Finset.prod_ne_zero_iff.mp hc j hj | |
| simpa only [ite_true, layerCoefficient_ne_zero_iff] using h | |
| theorem correctionCoefficient_other_card {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {orders : ℕ → ℕ} {i j : ℕ} {T : Finset ℕ} (hi : i ∈ B) (hij : i ≠ j) | |
| (hc : correctionCoefficient B blocks orders j T ≠ 0) : | |
| (T ∩ blocks i).card ≤ 2 * orders i := by | |
| have h := Finset.prod_ne_zero_iff.mp hc i hi | |
| simpa only [ite_eq_right hij, truncatedCoefficient_ne_zero_iff] using h | |
| theorem correctionCoefficient_disjoint {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {orders : ℕ → ℕ} {i j : ℕ} {T : Finset ℕ} (hi : i ∈ B) (_hj : j ∈ B) (hij : i ≠ j) | |
| (hiC : correctionCoefficient B blocks orders i T ≠ 0) : | |
| correctionCoefficient B blocks orders j T = 0 := by | |
| by_contra hjC | |
| have hown := correctionCoefficient_own_card hi hiC | |
| have hother := correctionCoefficient_other_card hi hij hjC | |
| omega | |
| theorem upperCoefficient_zero_of_correction {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {orders : ℕ → ℕ} {j : ℕ} {T : Finset ℕ} (hj : j ∈ B) | |
| (hc : correctionCoefficient B blocks orders j T ≠ 0) : upperCoefficient B blocks orders T = 0 := by | |
| have hcard := correctionCoefficient_own_card hj hc | |
| apply Finset.prod_eq_zero hj | |
| change (if (T ∩ blocks j).card ≤ 2 * orders j then (-1 : ℝ) ^ (T ∩ blocks j).card else 0) = 0 | |
| rw [ite_eq_right (by omega)] | |
| theorem lowerCoefficient_abs_le (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (orders : ℕ → ℕ) (T : Finset ℕ) : |lowerCoefficient B blocks orders T| ≤ 1 := by | |
| classical | |
| by_cases hactive : ∃ j ∈ B, correctionCoefficient B blocks orders j T ≠ 0 | |
| · obtain ⟨j, hj, hjC⟩ := hactive | |
| have hsum : (∑ i ∈ B, correctionCoefficient B blocks orders i T) = | |
| correctionCoefficient B blocks orders j T := by | |
| apply Finset.sum_eq_single_of_mem j hj | |
| intro i hi hij | |
| exact correctionCoefficient_disjoint hj hi hij.symm hjC | |
| rw [lowerCoefficient, upperCoefficient_zero_of_correction hj hjC, hsum, zero_sub, abs_neg] | |
| exact correctionCoefficient_abs_le _ _ _ _ _ | |
| · have hsum : (∑ j ∈ B, correctionCoefficient B blocks orders j T) = 0 := by | |
| apply Finset.sum_eq_zero | |
| intro j hj | |
| by_contra hjC | |
| exact hactive ⟨j, hj, hjC⟩ | |
| rw [lowerCoefficient, hsum, sub_zero] | |
| exact upperCoefficient_abs_le _ _ _ _ | |
| theorem prod_inter_blocks {M : Type*} [CommMonoid M] (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| {T : Finset ℕ} (hT : T ⊆ B.biUnion blocks) (g : ℕ → M) : | |
| (∏ p ∈ T, g p) = ∏ j ∈ B, ∏ p ∈ T ∩ blocks j, g p := by | |
| classical | |
| have hparts : (B : Set ℕ).PairwiseDisjoint (fun j => T ∩ blocks j) := by | |
| intro i hi j hj hij | |
| exact (hdis hi hj hij).mono Finset.inter_subset_right Finset.inter_subset_right | |
| have hUnion : B.biUnion (fun j => T ∩ blocks j) = T := by | |
| rw [← Finset.inter_biUnion, Finset.inter_eq_left.mpr hT] | |
| calc | |
| (∏ p ∈ T, g p) = ∏ p ∈ B.biUnion (fun j => T ∩ blocks j), g p := by rw [hUnion] | |
| _ = _ := Finset.prod_biUnion hparts | |
| theorem globalCoefficient_density (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (localCoeff : ℕ → Finset ℕ → ℝ) (g : ℕ → ℝ) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, globalCoefficient B blocks localCoeff T * ∏ p ∈ T, g p) = | |
| ∏ j ∈ B, ∑ T ∈ (blocks j).powerset, localCoeff j T * ∏ p ∈ T, g p := by | |
| calc | |
| _ = ∑ T ∈ (B.biUnion blocks).powerset, | |
| ∏ j ∈ B, localCoeff j (T ∩ blocks j) * ∏ p ∈ T ∩ blocks j, g p := by | |
| apply Finset.sum_congr rfl | |
| intro T hT | |
| rw [prod_inter_blocks B blocks hdis (Finset.mem_powerset.mp hT), Finset.prod_mul_distrib] | |
| rfl | |
| _ = _ := sum_subsets_product B blocks hdis (fun j T => localCoeff j T * ∏ p ∈ T, g p) | |
| theorem upperCoefficient_density (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders : ℕ → ℕ) (g : ℕ → ℝ) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, upperCoefficient B blocks orders T * ∏ p ∈ T, g p) = | |
| ∏ j ∈ B, BonferroniDensity.densityPolynomial (2 * orders j) (blocks j) g := by | |
| unfold upperCoefficient | |
| rw [globalCoefficient_density B blocks hdis] | |
| simp_rw [truncatedCoefficient_sum, ← BonferroniDensity.densityPolynomial_eq_momentPolynomial] | |
| theorem weighted_coefficient_expansion {α : Type*} (C : Finset α) (weight : α → ℝ) | |
| (hit : ℕ → α → Prop) (Q : Finset ℕ) (coeff : Finset ℕ → ℝ) : | |
| (∑ T ∈ Q.powerset, coeff T * BonferroniBlocks.intersectionMass C weight hit T) = | |
| ∑ x ∈ C, weight x * ∑ T ∈ Q.powerset, coeff T * BonferroniBlocks.intersectionValue T (fun p => hit p x) := by | |
| unfold BonferroniBlocks.intersectionMass | |
| simp_rw [Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro x _ | |
| apply Finset.sum_congr rfl | |
| intro T _ | |
| ring | |
| theorem global_main_remainder {α : Type*} (C : Finset α) (weight : α → ℝ) | |
| (hit : ℕ → α → Prop) (Q : Finset ℕ) (coeff : Finset ℕ → ℝ) (X : ℝ) (g : ℕ → ℝ) : | |
| (∑ T ∈ Q.powerset, coeff T * BonferroniBlocks.intersectionMass C weight hit T) = | |
| X * (∑ T ∈ Q.powerset, coeff T * ∏ p ∈ T, g p) + | |
| ∑ T ∈ Q.powerset, coeff T * BonferroniBlocks.intersectionRemainder C weight hit X g T := by | |
| unfold BonferroniBlocks.intersectionRemainder | |
| rw [Finset.mul_sum, ← Finset.sum_add_distrib] | |
| apply Finset.sum_congr rfl | |
| intro T _ | |
| ring | |
| theorem supported_remainder_bound (Q : Finset ℕ) (coeff E : Finset ℕ → ℝ) | |
| (hc : ∀ T ∈ Q.powerset, |coeff T| ≤ 1) : | |
| |∑ T ∈ Q.powerset, coeff T * E T| ≤ | |
| ∑ T ∈ Q.powerset.filter (fun T => coeff T ≠ 0), |E T| := by | |
| classical | |
| have hreindex : (∑ T ∈ Q.powerset, coeff T * E T) = | |
| ∑ T ∈ Q.powerset.filter (fun T => coeff T ≠ 0), coeff T * E T := by | |
| symm | |
| apply Finset.sum_subset (Finset.filter_subset _ _) | |
| intro T hT hnot | |
| have hz : coeff T = 0 := by | |
| by_contra hnz | |
| exact hnot (Finset.mem_filter.mpr ⟨hT, hnz⟩) | |
| rw [hz, zero_mul] | |
| rw [hreindex] | |
| apply (Finset.abs_sum_le_sum_abs _ _).trans | |
| apply Finset.sum_le_sum | |
| intro T hT | |
| rw [abs_mul] | |
| simpa only [one_mul] using mul_le_mul_of_nonneg_right (hc T (Finset.mem_filter.mp hT).1) (abs_nonneg _) | |
| theorem weighted_global_coefficient_bounds {α : Type*} (C : Finset α) (weight : α → ℝ) | |
| (hweight : ∀ x ∈ C, 0 ≤ weight x) (hit : ℕ → α → Prop) | |
| (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders : ℕ → ℕ) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, | |
| lowerCoefficient B blocks orders T * BonferroniBlocks.intersectionMass C weight hit T) ≤ | |
| (∑ x ∈ C, weight x * BonferroniBlocks.survives (B.biUnion blocks) (fun p => hit p x)) ∧ | |
| (∑ x ∈ C, weight x * BonferroniBlocks.survives (B.biUnion blocks) (fun p => hit p x)) ≤ | |
| ∑ T ∈ (B.biUnion blocks).powerset, | |
| upperCoefficient B blocks orders T * BonferroniBlocks.intersectionMass C weight hit T := by | |
| rw [weighted_coefficient_expansion, weighted_coefficient_expansion] | |
| simp_rw [lowerCoefficient_evaluation B blocks hdis, upperCoefficient_evaluation B blocks hdis] | |
| exact BonferroniBlocks.weighted_block_bounds C weight hweight B blocks orders hit | |
| theorem layerCoefficient_density (m : ℕ) (P : Finset ℕ) (g : ℕ → ℝ) : | |
| (∑ T ∈ P.powerset, layerCoefficient m T * ∏ p ∈ T, g p) = | |
| BonferroniDensity.elementarySum P g m := by | |
| classical | |
| unfold BonferroniDensity.elementarySum | |
| rw [Finset.powersetCard_eq_filter, Finset.sum_filter] | |
| apply Finset.sum_congr rfl | |
| intro T _ | |
| unfold layerCoefficient | |
| split_ifs <;> simp | |
| theorem correctionCoefficient_density (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders : ℕ → ℕ) (g : ℕ → ℝ) (j : ℕ) (hj : j ∈ B) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, correctionCoefficient B blocks orders j T * ∏ p ∈ T, g p) = | |
| BonferroniDensity.elementarySum (blocks j) g (2 * orders j + 1) * | |
| ∏ i ∈ B.erase j, BonferroniDensity.densityPolynomial (2 * orders i) (blocks i) g := by | |
| classical | |
| unfold correctionCoefficient | |
| rw [globalCoefficient_density B blocks hdis, ← Finset.mul_prod_erase B _ hj] | |
| simp only [ite_true] | |
| rw [layerCoefficient_density] | |
| congr 1 | |
| apply Finset.prod_congr rfl | |
| intro i hi | |
| have hij : i ≠ j := (Finset.mem_erase.mp hi).1 | |
| simp only [ite_eq_right hij] | |
| rw [truncatedCoefficient_sum] | |
| rfl | |
| theorem lowerCoefficient_density (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders : ℕ → ℕ) (g : ℕ → ℝ) : | |
| (∑ T ∈ (B.biUnion blocks).powerset, lowerCoefficient B blocks orders T * ∏ p ∈ T, g p) = | |
| (∏ j ∈ B, BonferroniDensity.densityPolynomial (2 * orders j) (blocks j) g) - | |
| ∑ j ∈ B, BonferroniDensity.elementarySum (blocks j) g (2 * orders j + 1) * | |
| ∏ i ∈ B.erase j, BonferroniDensity.densityPolynomial (2 * orders i) (blocks i) g := by | |
| unfold lowerCoefficient | |
| simp_rw [sub_mul, Finset.sum_mul] | |
| rw [Finset.sum_sub_distrib, Finset.sum_comm, upperCoefficient_density B blocks hdis] | |
| congr 1 | |
| apply Finset.sum_congr rfl | |
| intro j hj | |
| exact correctionCoefficient_density B blocks hdis orders g j hj | |
| theorem upperCoefficient_card {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {orders : ℕ → ℕ} {T : Finset ℕ} | |
| (hc : upperCoefficient B blocks orders T ≠ 0) (j : ℕ) (hj : j ∈ B) : | |
| (T ∩ blocks j).card ≤ 2 * orders j := by | |
| exact (truncatedCoefficient_ne_zero_iff _ _).mp (Finset.prod_ne_zero_iff.mp hc j hj) | |
| theorem lowerCoefficient_card {B : Finset ℕ} {blocks : ℕ → Finset ℕ} | |
| {orders : ℕ → ℕ} {T : Finset ℕ} | |
| (hc : lowerCoefficient B blocks orders T ≠ 0) (j : ℕ) (hj : j ∈ B) : | |
| (T ∩ blocks j).card ≤ 2 * orders j + 1 := by | |
| classical | |
| by_cases hu : upperCoefficient B blocks orders T = 0 | |
| · have hex : ∃ i ∈ B, correctionCoefficient B blocks orders i T ≠ 0 := by | |
| by_contra hnone | |
| have hsum : (∑ i ∈ B, correctionCoefficient B blocks orders i T) = 0 := by | |
| apply Finset.sum_eq_zero | |
| intro i hi | |
| by_contra hiC | |
| exact hnone ⟨i, hi, hiC⟩ | |
| apply hc | |
| rw [lowerCoefficient, hu, hsum, sub_self] | |
| obtain ⟨i, hi, hiC⟩ := hex | |
| by_cases hji : j = i | |
| · subst j | |
| exact le_of_eq (correctionCoefficient_own_card hi hiC) | |
| · exact (correctionCoefficient_other_card hj hji hiC).trans (Nat.le_succ _) | |
| · exact (upperCoefficient_card hu j hj).trans (Nat.le_succ _) | |
| theorem prime_product_support (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (budget height : ℕ → ℕ) (hheight : ∀ j ∈ B, 1 ≤ height j) | |
| (hprime : ∀ j ∈ B, ∀ p ∈ blocks j, p.Prime) | |
| (hsize : ∀ j ∈ B, ∀ p ∈ blocks j, p ≤ height j) | |
| {T : Finset ℕ} (hT : T ⊆ B.biUnion blocks) | |
| (hcard : ∀ j ∈ B, (T ∩ blocks j).card ≤ budget j) : | |
| Squarefree (∏ p ∈ T, p) ∧ (∏ p ∈ T, p) ≤ ∏ j ∈ B, height j ^ budget j := by | |
| constructor | |
| · apply IntervalBoundingSieve.squarefree_primeSet_product | |
| intro p hp | |
| obtain ⟨j, hj, hpj⟩ := Finset.mem_biUnion.mp (hT hp) | |
| exact hprime j hj p hpj | |
| · have hprod : (∏ p ∈ T, p) = ∏ j ∈ B, ∏ p ∈ T ∩ blocks j, p := by | |
| simpa only [id_eq] using prod_inter_blocks B blocks hdis hT id | |
| rw [hprod] | |
| apply Finset.prod_le_prod | |
| intro j hj | |
| exact (BonferroniBlocks.coefficient_divisor_support (blocks j) (hheight j hj) | |
| (hprime j hj) (hsize j hj) (hcard j hj) | |
| (Finset.mem_powersetCard.mpr ⟨Finset.inter_subset_right, rfl⟩)).2 | |
| theorem lowerCoefficient_prime_support (B : Finset ℕ) (blocks : ℕ → Finset ℕ) | |
| (hdis : (B : Set ℕ).Pairwise fun i j => Disjoint (blocks i) (blocks j)) | |
| (orders height : ℕ → ℕ) (hheight : ∀ j ∈ B, 1 ≤ height j) | |
| (hprime : ∀ j ∈ B, ∀ p ∈ blocks j, p.Prime) | |
| (hsize : ∀ j ∈ B, ∀ p ∈ blocks j, p ≤ height j) | |
| {T : Finset ℕ} (hT : T ⊆ B.biUnion blocks) (hc : lowerCoefficient B blocks orders T ≠ 0) : | |
| Squarefree (∏ p ∈ T, p) ∧ (∏ p ∈ T, p) ≤ ∏ j ∈ B, height j ^ (2 * orders j + 1) := | |
| prime_product_support B blocks hdis (fun j => 2 * orders j + 1) height hheight hprime hsize hT | |
| (lowerCoefficient_card hc) | |
| theorem prime_product_injective (Q : Finset ℕ) (hprime : ∀ p ∈ Q, p.Prime) : | |
| Set.InjOn (fun T : Finset ℕ => ∏ p ∈ T, p) (Q.powerset : Set (Finset ℕ)) := by | |
| intro T hT U hU heq | |
| have hTprod : (∏ p ∈ T, p).primeFactors = T := | |
| Nat.primeFactors_prod (fun p hp => hprime p (Finset.mem_powerset.mp hT hp)) | |
| have hUprod : (∏ p ∈ U, p).primeFactors = U := | |
| Nat.primeFactors_prod (fun p hp => hprime p (Finset.mem_powerset.mp hU hp)) | |
| change (∏ p ∈ T, p) = (∏ p ∈ U, p) at heq | |
| rw [← hTprod, ← hUprod, heq] | |
| end NumberTheoryLean.DisjointBlockExpansion | |
| end | |
| end Erdos970 | |
| end OAI | |
Xet Storage Details
- Size:
- 27.4 kB
- Xet hash:
- a21a3a5c905d34e520ce4ea2e53b3322646e1f61ddc06b4ef7a7d3e2207ef70c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.