Download data/lean/OAI/NumberTheory/PiExponent/Polynomials/PolynomialCumulative.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 4.37 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PiExponent/Polynomials/PolynomialCumulative.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/NumberTheory/PiExponent/Polynomials/PolynomialCumulative.lean
-
curl -L -o PolynomialCumulative.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/NumberTheory/PiExponent/Polynomials/PolynomialCumulative.lean
4.37 kB
| import Mathlib.Algebra.Polynomial.Degree.Lemmas | |
| import Mathlib.NumberTheory.BernoulliPolynomials | |
| import Mathlib.Tactic | |
| namespace OAI | |
| namespace PiExponentJets.W24 | |
| open Polynomial Finset | |
| noncomputable def powerPrefixPolynomial (d : β) : Polynomial β := | |
| C ((d + 1 : β)β»ΒΉ) * (Polynomial.bernoulli (d + 1) - C (_root_.bernoulli (d + 1))) | |
| theorem powerPrefixPolynomial_eval (d n : β) : | |
| (powerPrefixPolynomial d).eval (n : β) = β j β range n, (j : β) ^ d := by | |
| rw [powerPrefixPolynomial, eval_mul, eval_C, eval_sub, eval_C] | |
| rw [β Polynomial.sum_range_pow_eq_bernoulli_sub n d] | |
| have hd : (d + 1 : β) β 0 := by positivity | |
| exact inv_mul_cancel_leftβ hd _ | |
| theorem powerPrefixPolynomial_degree_le (d : β) : | |
| (powerPrefixPolynomial d).natDegree β€ d + 1 := by | |
| apply natDegree_le_iff_coeff_eq_zero.mpr | |
| intro j hj | |
| have hj0 : j β 0 := by omega | |
| simp only [powerPrefixPolynomial, coeff_C_mul, coeff_sub, | |
| Polynomial.coeff_bernoulli, ite_eq_right (by omega : Β¬j β€ d + 1), | |
| coeff_C, ite_eq_right hj0, sub_zero, mul_zero] | |
| theorem powerPrefixPolynomial_top_coefficient (d : β) : | |
| (powerPrefixPolynomial d).coeff (d + 1) = (d + 1 : β)β»ΒΉ := by | |
| simp [powerPrefixPolynomial, coeff_C_mul, Polynomial.coeff_bernoulli] | |
| noncomputable def polynomialPrefix (p : Polynomial β) : Polynomial β := | |
| β i β range (p.natDegree + 1), C (p.coeff i) * powerPrefixPolynomial i | |
| theorem polynomialPrefix_eval (p : Polynomial β) (n : β) : | |
| (polynomialPrefix p).eval (n : β) = β j β range n, p.eval (j : β) := by | |
| simp only [polynomialPrefix, eval_finsetSum, eval_mul, eval_C, | |
| powerPrefixPolynomial_eval, Finset.mul_sum] | |
| rw [Finset.sum_comm] | |
| apply Finset.sum_congr rfl | |
| intro j _ | |
| exact (Polynomial.eval_eq_sum_range (p := p) (j : β)).symm | |
| theorem polynomialPrefix_degree_le (p : Polynomial β) : | |
| (polynomialPrefix p).natDegree β€ p.natDegree + 1 := by | |
| apply Polynomial.natDegree_sum_le_of_forall_le | |
| intro i hi | |
| exact (natDegree_C_mul_le _ _).trans | |
| ((powerPrefixPolynomial_degree_le i).trans (by | |
| have hii := Finset.mem_range.mp hi | |
| omega)) | |
| theorem polynomialPrefix_top_coefficient (p : Polynomial β) : | |
| (polynomialPrefix p).coeff (p.natDegree + 1) = | |
| p.leadingCoeff * (p.natDegree + 1 : β)β»ΒΉ := by | |
| rw [polynomialPrefix, finsetSum_coeff] | |
| rw [Finset.sum_eq_single p.natDegree] | |
| Β· rw [coeff_C_mul, powerPrefixPolynomial_top_coefficient, coeff_natDegree] | |
| Β· intro i hi hne | |
| have hz : (powerPrefixPolynomial i).coeff (p.natDegree + 1) = 0 := | |
| coeff_eq_zero_of_natDegree_lt ((powerPrefixPolynomial_degree_le i).trans_lt (by | |
| have hii := Finset.mem_range.mp hi | |
| omega)) | |
| rw [coeff_C_mul, hz, mul_zero] | |
| Β· intro h | |
| exact (h (Finset.mem_range.mpr (Nat.lt_succ_self _))).elim | |
| theorem polynomialPrefix_natDegree (p : Polynomial β) (hp : p β 0) : | |
| (polynomialPrefix p).natDegree = p.natDegree + 1 := by | |
| apply natDegree_eq_of_le_of_coeff_ne_zero (polynomialPrefix_degree_le p) | |
| rw [polynomialPrefix_top_coefficient] | |
| exact mul_ne_zero (leadingCoeff_ne_zero.mpr hp) (inv_ne_zero (by positivity)) | |
| theorem exists_eventual_cumulative_polynomial | |
| (values : β β β) (p : Polynomial β) (hp0 : p β 0) (N : β) | |
| (hp : β n : β, N β€ n β p.eval (n : β) = (values n : β)) : | |
| β q : Polynomial β, q.natDegree = p.natDegree + 1 β§ | |
| β n : β, N β€ n β q.eval (n : β) = | |
| ((β j β range (n + 1), values j : β) : β) := by | |
| let c : β := (β j β range N, (values j : β)) - (polynomialPrefix p).eval (N : β) | |
| let q : Polynomial β := (polynomialPrefix p).comp (X + C 1) + C c | |
| have hsum (m : β) (hm : N β€ m) : | |
| (polynomialPrefix p).eval (m : β) + c = β j β range m, (values j : β) := by | |
| induction m, hm using Nat.le_induction with | |
| | base => simp [c] | |
| | succ m hm ih => | |
| rw [polynomialPrefix_eval, Finset.sum_range_succ, | |
| β polynomialPrefix_eval, hp m hm, Finset.sum_range_succ] | |
| linarith | |
| refine β¨q, ?_, ?_β© | |
| Β· simp only [q, natDegree_add_C, natDegree_comp, natDegree_X, mul_one, | |
| polynomialPrefix_natDegree p hp0] | |
| Β· intro n hn | |
| simpa only [q, eval_add, eval_comp, eval_X, eval_C, Nat.cast_add, Nat.cast_one, | |
| Nat.cast_sum] using hsum (n + 1) (by omega) | |
| end PiExponentJets.W24 | |
| end OAI | |