@@ -6,6 +6,7 @@ Authors: Weiyi Wang
66module
77
88public import Mathlib.Algebra.Ring.NegOnePow
9+ public import Mathlib.Combinatorics.Enumerative.Pentagonal
910public import Mathlib.RingTheory.PowerSeries.PiTopology
1011
1112import Mathlib.Topology.Algebra.InfiniteSum.Pentagonal
@@ -41,55 +42,11 @@ left-hand side.
4142 topology on the ring.
4243 -/
4344
44- public section PublicPentagonalNumber
45- theorem two_pentagonal (k : ℤ) : 2 * (k * (3 * k - 1 ) / 2 ) = k * (3 * k - 1 ) := by
46- refine Int.two_mul_ediv_two_of_even ?_
47- obtain h | h := Int.even_or_odd k
48- · exact Even.mul_right h (3 * k - 1 )
49- · refine Even.mul_left (Int.even_sub_one.mpr (Int.not_even_iff_odd.mpr (Odd.mul ?_ h))) _
50- decide
51-
52- theorem pentagonal_nonneg (k : ℤ) : 0 ≤ k * (3 * k - 1 ) / 2 := by
53- suffices 0 ≤ 2 * (k * (3 * k - 1 ) / 2 ) by simpa
54- rw [two_pentagonal]
55- obtain h | h := lt_or_ge 0 k
56- · exact mul_nonneg h.le (by linarith)
57- · exact mul_nonneg_of_nonpos_of_nonpos h (by linarith)
58-
59- theorem two_pentagonal_inj {x y : ℤ} (h : x * (3 * x - 1 ) = y * (3 * y - 1 )) : x = y := by
60- simp_rw [mul_sub_one] at h
61- rw [sub_eq_sub_iff_sub_eq_sub, mul_left_comm x, mul_left_comm y, ← mul_sub] at h
62- rw [mul_self_sub_mul_self, ← mul_assoc, ← sub_eq_zero, ← sub_one_mul, mul_eq_zero] at h
63- obtain h | h := h
64- · simp [← Int.eq_of_mul_eq_one <| eq_of_sub_eq_zero h] at h
65- · exact eq_of_sub_eq_zero h
66-
67- theorem pentagonal_injective : Function.Injective (fun (k : ℤ) ↦ k * (3 * k - 1 ) / 2 ) := by
68- intro a b h
69- have : a * (3 * a - 1 ) = b * (3 * b - 1 ) := by
70- rw [← two_pentagonal a, ← two_pentagonal b]
71- simp [h]
72- exact two_pentagonal_inj this
73-
74- theorem toNat_pentagonal_injective :
75- Function.Injective (fun (k : ℤ) ↦ (k * (3 * k - 1 ) / 2 ).toNat) := by
76- intro a b h
77- apply pentagonal_injective
78- zify at h
79- simpa [pentagonal_nonneg] using h
80-
81- theorem toNat_pentagonal_inj {x y : ℤ}
82- (h : (x * (3 * x - 1 ) / 2 ).toNat = (y * (3 * y - 1 ) / 2 ).toNat) : x = y := by
83- apply toNat_pentagonal_injective.eq_iff.mp h
84-
85- end PublicPentagonalNumber
86-
8745open Filter PowerSeries WithPiTopology
8846variable (R : Type *) [CommRing R]
8947
9048namespace Pentagonal
9149
92- set_option backward.isDefEq.respectTransparency false in
9350theorem tendsto_order_powMulProdOneSubPow_X (k : ℕ) :
9451 Tendsto (fun i ↦ (powMulProdOneSubPow k i (X : R⟦X⟧)).order) atTop (nhds ⊤) := by
9552 nontriviality R using Subsingleton.eq_zero
@@ -100,7 +57,6 @@ theorem tendsto_order_powMulProdOneSubPow_X (k : ℕ) :
10057 norm_cast
10158 grind
10259
103- set_option backward.isDefEq.respectTransparency false in
10460theorem tendsto_order_neg_X_pow (k : ℕ) :
10561 Tendsto (fun i ↦ (-(X : R⟦X⟧) ^ (i + k + 1 )).order) atTop (nhds ⊤) := by
10662 nontriviality R using Subsingleton.eq_zero
@@ -110,18 +66,19 @@ theorem tendsto_order_neg_X_pow (k : ℕ) :
11066 norm_cast
11167 linarith
11268
113- set_option backward.isDefEq.respectTransparency false in
11469theorem tendsto_order_pow_pentagonal_sub :
115- Tendsto (fun i ↦ ((-1 ) ^ i * ((X : R⟦X⟧) ^ (i * ( 3 * i + 1 ) / 2 ) -
116- X ^ ((i + 1 ) * ( 3 * i + 2 ) / 2 ))).order) atTop (nhds ⊤) := by
70+ Tendsto (fun (i : ℕ) ↦ ((-1 ) ^ i * ((X : R⟦X⟧) ^ pentagonal (-i ) -
71+ X ^ (pentagonal (i + 1 )))).order) atTop (nhds ⊤) := by
11772 nontriviality R using Subsingleton.eq_zero
11873 refine ENat.tendsto_nhds_top_iff_natCast_lt.mpr fun n ↦ eventually_atTop.mpr ⟨n + 1 , ?_⟩
11974 intro k hk
12075 rw [sub_eq_add_neg]
12176 grw [← le_order_mul, ← min_order_le_order_add, order_neg, order_X_pow, order_X_pow]
12277 apply lt_add_of_nonneg_of_lt (by simp) ?_
123- rw [min_eq_left (by gcongr <;> simp)]
124- rw [Nat.cast_lt, ← Nat.add_one_le_iff, Nat.le_div_iff_mul_le (by simp)]
78+ rw [min_eq_left (by simpa using (pentagonal_neg_lt_pentagonal_add_one (Int.natCast_nonneg k)).le)]
79+ rw [pentagonal_neg]
80+ norm_cast
81+ rw [Int.toNat_natCast, ← Nat.add_one_le_iff, Nat.le_div_iff_mul_le (by simp)]
12582 exact Nat.mul_le_mul hk (by linarith)
12683
12784end Pentagonal
@@ -145,7 +102,7 @@ namespace WithPiTopology
145102variable [TopologicalSpace R]
146103
147104theorem summable_pow_pentagonal_sub : Summable fun (k : ℕ) ↦
148- ((-1 ) ^ k * (X ^ (k * ( 3 * k + 1 ) / 2 ) - X ^ ((k + 1 ) * ( 3 * k + 2 ) / 2 )) : R⟦X⟧) :=
105+ ((-1 ) ^ k * (X ^ pentagonal (-k) - X ^ pentagonal ( k + 1 )) : R⟦X⟧) :=
149106 summable_of_tendsto_order_atTop_nhds_top R (Pentagonal.tendsto_order_pow_pentagonal_sub R)
150107
151108set_option backward.isDefEq.respectTransparency false in
@@ -155,7 +112,7 @@ $$ \prod_{n = 0}^{\infty} (1 - x^{n + 1}) =
155112\sum_{k=0}^{\infty} (-1)^k \left(x^{k(3k+1)/2} - x^{(k+1)(3k+2)/2}\right) $$ -/
156113theorem tprod_one_sub_X_pow_eq_tsum_nat [IsTopologicalRing R] [T2Space R] :
157114 ∏' n, (1 - X ^ (n + 1 ) : R⟦X⟧) =
158- ∑' k , (-1 ) ^ k * (X ^ (k * ( 3 * k + 1 ) / 2 ) - X ^ ((k + 1 ) * ( 3 * k + 2 ) / 2 )) := by
115+ ∑' (k : ℕ) , (-1 ) ^ k * (X ^ pentagonal (-k) - X ^ pentagonal ( k + 1 )) := by
159116 nontriviality R
160117 refine Pentagonal.tprod_one_sub_pow ?_ ?_ ?_ ?_ ?_
161118 · rw [IsTopologicallyNilpotent, tendsto_iff_coeff_tendsto]
@@ -173,9 +130,8 @@ theorem tprod_one_sub_X_pow_eq_tsum_nat [IsTopologicalRing R] [T2Space R] :
173130 rw [order_X_pow, Nat.cast_lt, ← Nat.add_one_le_iff, Nat.le_div_iff_mul_le (by simp)]
174131 apply Nat.mul_le_mul <;> linarith
175132
176- set_option backward.isDefEq.respectTransparency false in
177133theorem summable_pow_pentagonal' [IsTopologicalRing R] :
178- Summable fun k ↦ (Int.negOnePow k : R⟦X⟧) * X ^ (k * ( 3 * k + 1 ) / 2 ).toNat := by
134+ Summable fun k ↦ (Int.negOnePow k : R⟦X⟧) * X ^ pentagonal (-k) := by
179135 nontriviality R
180136 apply Summable.of_add_one_of_neg_add_one
181137 all_goals
@@ -184,18 +140,18 @@ theorem summable_pow_pentagonal' [IsTopologicalRing R] :
184140 intro k hk
185141 grw [← le_order_mul, order_X_pow]
186142 refine lt_add_of_nonneg_of_lt (by simp) ?_
143+ rw [pentagonal_def]
187144 norm_cast
188145 grind
189146
190- set_option backward.isDefEq.respectTransparency false in
191147/-- **Pentagonal number theorem** for power series, summing over integers written using the
192148exponent $a_{-k}$ where $a_k = k(3k - 1)/2$ are the generalized pentagonal numbers.
193149Note that $a_{-k} = (-k)(3(-k) - 1)/2 = k(3k + 1)/2$, which explains the exponent in the
194150following formula:
195151
196152$$ \prod_{n = 0}^{\infty} (1 - x^{n + 1}) = \sum_{k=-\infty}^{\infty} (-1)^k x^{k(3k + 1)/2} $$ -/
197153theorem tprod_one_sub_X_pow' [IsTopologicalRing R] [T2Space R] :
198- ∏' n, (1 - X ^ (n + 1 )) = ∑' k, (Int.negOnePow k : R⟦X⟧) * X ^ (k * ( 3 * k + 1 ) / 2 ).toNat := by
154+ ∏' n, (1 - X ^ (n + 1 )) = ∑' k, (Int.negOnePow k : R⟦X⟧) * X ^ pentagonal (-k) := by
199155 rw [← tsum_nat_add_neg_add_one (summable_pow_pentagonal' R), tprod_one_sub_X_pow_eq_tsum_nat]
200156 refine tsum_congr fun k ↦ ?_
201157 rw [sub_eq_add_neg _ (X ^ _), mul_add, ← neg_mul_comm]
@@ -204,47 +160,41 @@ theorem tprod_one_sub_X_pow' [IsTopologicalRing R] [T2Space R] :
204160 · ring
205161 · norm_cast
206162
207- set_option backward.isDefEq.respectTransparency false in
208163theorem summable_pow_pentagonal [IsTopologicalRing R] :
209- Summable fun k ↦ (Int.negOnePow k : R⟦X⟧) * X ^ (k * ( 3 * k - 1 ) / 2 ).toNat := by
164+ Summable fun k ↦ (Int.negOnePow k : R⟦X⟧) * X ^ pentagonal k := by
210165 rw [← neg_injective.summable_iff (fun x hx ↦ by absurd hx; use -x; simp)]
211166 convert summable_pow_pentagonal' R
212167 rw [Function.comp_apply]
213- exact congr( $(by simp) * X ^ (Int.toNat ($( by ring_nf) / 2 )))
168+ congrm $(by simp) * X ^ _
214169
215- set_option backward.isDefEq.respectTransparency false in
216170/-- **Pentagonal number theorem** for power series, summing over integers written using the
217171exponent $a_k$ where $a_k = k(3k - 1)/2$ are the generalized pentagonal numbers:
218172
219173$$ \prod_{n = 0}^{\infty} (1 - x^{n + 1}) = \sum_{k=-\infty}^{\infty} (-1)^k x^{k(3k - 1)/2} $$ -/
220174theorem tprod_one_sub_X_pow [IsTopologicalRing R] [T2Space R] :
221- ∏' n, (1 - X ^ (n + 1 )) = ∑' k, (Int.negOnePow k : R⟦X⟧) * X ^ (k * ( 3 * k - 1 ) / 2 ).toNat := by
175+ ∏' n, (1 - X ^ (n + 1 )) = ∑' k, (Int.negOnePow k : R⟦X⟧) * X ^ pentagonal k := by
222176 rw [tprod_one_sub_X_pow', ← neg_injective.tsum_eq (by simp)]
223- exact tsum_congr fun k ↦ congr( $(by simp) * X ^ (Int.toNat ( $(by ring_nf) / 2 )) )
177+ congrm ∑' k, $(by simp) * X ^ pentagonal $(by simp )
224178
225179end WithPiTopology
226180
227181open WithPiTopology
228182
229- set_option backward.isDefEq.respectTransparency false in
230183theorem coeff_prod_one_sub_X_eventually_eq_negOnePow (k : ℤ) :
231- ∀ᶠ s in atTop, (∏ n ∈ s, (1 - X ^ (n + 1 ) : R⟦X⟧)).coeff (k * (3 * k - 1 ) / 2 ).toNat =
232- Int.negOnePow k := by
184+ ∀ᶠ s in atTop, (∏ n ∈ s, (1 - X ^ (n + 1 ) : R⟦X⟧)).coeff (pentagonal k) = Int.negOnePow k := by
233185 let _ : TopologicalSpace R := ⊥
234186 have _ : DiscreteTopology R := ⟨rfl⟩
235187 obtain h := (multipliable_one_sub_X_pow R).hasProd
236188 rw [tprod_one_sub_X_pow R, HasProd, tendsto_iff_coeff_tendsto] at h
237- specialize h (k * ( 3 * k - 1 ) / 2 ).toNat
189+ specialize h (pentagonal k)
238190 rw [(summable_pow_pentagonal R).map_tsum _ (WithPiTopology.continuous_coeff _ _),
239191 SummationFilter.unconditional_filter, nhds_discrete, tendsto_pure] at h
240192 have hpow (i : ℤ) : (i.negOnePow : R⟦X⟧) = C (i.negOnePow : R) := by simp
241193 simp_rw [hpow, coeff_C_mul, coeff_X_pow] at h
242- rw [tsum_eq_single k fun i hi ↦ by simp [toNat_pentagonal_injective.eq_iff.ne.mpr hi.symm]] at h
194+ rw [tsum_eq_single k fun i hi ↦ by simp [hi.symm]] at h
243195 simpa using h
244196
245- set_option backward.isDefEq.respectTransparency false in
246- theorem coeff_prod_one_sub_X_eventually_eq_zero {n : ℕ}
247- (hn : ∀ k : ℤ, n ≠ (k * (3 * k - 1 ) / 2 ).toNat) :
197+ theorem coeff_prod_one_sub_X_eventually_eq_zero {n : ℕ} (hn : ∀ k : ℤ, n ≠ pentagonal k) :
248198 ∀ᶠ s in atTop, (∏ n ∈ s, (1 - X ^ (n + 1 ) : R⟦X⟧)).coeff n = 0 := by
249199 let _ : TopologicalSpace R := ⊥
250200 have _ : DiscreteTopology R := ⟨rfl⟩
0 commit comments