Download data/lean/OAI/NumberTheory/Ostmann/QuadraticSieveComplement.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.94 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/QuadraticSieveComplement.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/Ostmann/QuadraticSieveComplement.lean
-
curl -L -o QuadraticSieveComplement.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/Ostmann/QuadraticSieveComplement.lean
3.94 kB
| import OAI.NumberTheory.Ostmann.QuadraticSieve | |
| import OAI.NumberTheory.Ostmann.QuadraticSieveSquareLattice | |
| import OAI.NumberTheory.Ostmann.QuadraticSieveSquarefreeReindex | |
| namespace OAI | |
| namespace Ostmann.QuadraticSieve | |
| open scoped SchwartzMap | |
| theorem tsum_squarefree_coprime_cutoff (K d : β) (f : β β β) : | |
| (β' v : {v : β // Squarefree v}, | |
| if v.val β€ K β§ Nat.Coprime v.val (2 * d) then f v.val else 0) = | |
| β v β oddSquarefreeUpTo K, if Nat.Coprime v d then f v else 0 := by | |
| classical | |
| change (β' v : {v : β | Squarefree v}, | |
| if v.val β€ K β§ Nat.Coprime v.val (2 * d) then f v.val else 0) = _ | |
| rw [tsum_subtype {v : β | Squarefree v} (fun v => | |
| if v β€ K β§ Nat.Coprime v (2 * d) then f v else 0)] | |
| rw [tsum_eq_sum (s := oddSquarefreeUpTo K)] | |
| Β· apply Finset.sum_congr rfl | |
| intro v hv | |
| have h := mem_oddSquarefreeUpTo.mp hv | |
| simp [h.2.2.2, h.2.1, Nat.coprime_mul_iff_right, | |
| Nat.coprime_two_right, h.2.2.1] | |
| Β· intro v hv | |
| by_cases hs : Squarefree v | |
| Β· by_cases h : v β€ K β§ Nat.Coprime v (2 * d) | |
| Β· have hc := Nat.coprime_mul_iff_right.mp h.2 | |
| have hmem : v β oddSquarefreeUpTo K := mem_oddSquarefreeUpTo.mpr | |
| β¨Nat.pos_of_ne_zero hs.ne_zero, h.1, Nat.coprime_two_right.mp hc.1, hsβ© | |
| exact (hv hmem).elim | |
| Β· simp [hs, h] | |
| Β· simp [hs] | |
| theorem schwartz_summable_positive (W : π’(β, β)) (M : β) (hM : M β 0) : | |
| Summable (fun n : {n : β // 0 < n} => W ((n.val : β) / M)) := by | |
| have hinj : Function.Injective (fun n : {n : β // 0 < n} => (n.val : β€)) := by | |
| intro a b h | |
| apply Subtype.ext | |
| change (a.val : β€) = (b.val : β€) at h | |
| exact Int.ofNat.inj h | |
| exact (schwartz_summable_scaled W M hM).comp_injective hinj | |
| theorem schwartz_complement_eq_coprime_lattices (W : π’(β, β)) | |
| (M : β) (hM : 0 < M) (K d q : β) [NeZero d] [NeZero q] : | |
| (β' n : {n : β // 0 < n}, if squarefreeKernel n.val β€ K then | |
| (if Odd n.val then (jacobiSym (n.val : β€) (d ^ 2 * q) : β) * | |
| W ((n.val : β) / M) else 0) else 0) = | |
| (1 / 2 : β) * β v β oddSquarefreeUpTo K, if Nat.Coprime v d then | |
| (jacobiSym (v : β€) q : β) * | |
| β' m : β€, if Nat.Coprime m.natAbs (2 * q * d) then | |
| squarePullback W 1 (by norm_num) ((m : β) / Real.sqrt (M / v)) else 0 else 0 := by | |
| have hk : 2 β€ 2 * q * d := by | |
| have hq := Nat.pos_of_neZero q | |
| have hd := Nat.pos_of_neZero d | |
| nlinarith | |
| rw [odd_kernel_cutoff_reindex (fun n => W ((n : β) / M)) | |
| (schwartz_summable_positive W M hM.ne') K d q] | |
| calc | |
| _ = β' v : {v : β // Squarefree v}, if v.val β€ K β§ Nat.Coprime v.val (2 * d) then | |
| (1 / 2 : β) * ((jacobiSym (v.val : β€) q : β) * | |
| β' m : β€, if Nat.Coprime m.natAbs (2 * q * d) then | |
| squarePullback W 1 (by norm_num) ((m : β) / Real.sqrt (M / v.val)) else 0) else 0 := by | |
| apply tsum_congr | |
| intro v | |
| split_ifs with hv | |
| Β· have hlat := positive_coprime_square_lattice W M hM v.val | |
| (Nat.pos_of_ne_zero v.property.ne_zero) (2 * q * d) hk | |
| push_cast | |
| rw [hlat] | |
| ring | |
| Β· rfl | |
| _ = (1 / 2 : β) * β' v : {v : β // Squarefree v}, | |
| if v.val β€ K β§ Nat.Coprime v.val (2 * d) then | |
| (jacobiSym (v.val : β€) q : β) * | |
| β' m : β€, if Nat.Coprime m.natAbs (2 * q * d) then | |
| squarePullback W 1 (by norm_num) ((m : β) / Real.sqrt (M / v.val)) else 0 else 0 := by | |
| rw [β tsum_mul_left] | |
| apply tsum_congr | |
| intro v | |
| split_ifs <;> simp | |
| _ = _ := congrArg (fun z : β => (1 / 2 : β) * z) | |
| (tsum_squarefree_coprime_cutoff K d (fun v => (jacobiSym (v : β€) q : β) * | |
| β' m : β€, if Nat.Coprime m.natAbs (2 * q * d) then | |
| squarePullback W 1 (by norm_num) ((m : β) / Real.sqrt (M / v)) else 0)) | |
| end Ostmann.QuadraticSieve | |
| end OAI | |