Use this theorem
Create a project
lake +leanprover/lean4:v4.35.0 new myproject std.toml cd myprojectStandard template, not
math: themathtemplate adds its own Mathlib requirement pinned to the Lean release tag, not to the Mathlib commit this package is built and tested with, so you would get a second, different Mathlib. Mathlib comes in through this package. Skip this step in an existing project with the same Lean and Mathlib.Add the dependency to
lakefile.toml[[require]] name = "formalizations" git = "https://github.com/karlesmarin/formalizations" rev = "v0.15.0"Import the minimal module
import Formalizations.Reusable.PolynomialIn a file of the project, e.g.
Example.lean.Paste the example
open Formalizations.Reusable Polynomial /-- Newton's inequality for a monic real-rooted cubic and `k = 1`: `3 e₂ ≤ e₁²`. -/ example (p : Polynomial ℝ) (hp : p.Splits) (hm : p.Monic) (h3 : p.natDegree = 3) : 3 * p.roots.esymm 2 ≤ p.roots.esymm 1 ^ 2 := by have h := newton_inequality_esymm_roots hp hm (k := 1) le_rfl (by omega) rw [h3] at h norm_num [Nat.choose] at h linarithSteps 3 and 4 together are a complete Lean file:
FormalizationsTest/ReusablePolynomialExample.leanat v0.15.0, compiled by the CI.Fetch and check
lake update lake lean Example.leanlake updatefetches this package and Mathlib, and Mathlib's update hook downloads the compiled Mathlib (lake exe cache get).lake lean Example.leanbuilds the imports of the file (steps 3 and 4) and checks it. If the file belongs to alean_libof your project,lake build <lib>does the same. Avoid a barelake buildin a project from the standard template: its default target is the executable, whose link compiles every imported Mathlib module to native code. Same versions required: Leanv4.35.0, Mathlibf0b4c81.
Alternative: import Formalizations.Reusable imports the whole layer (all areas).
Newton's inequalities: for a monic real polynomial p of degree n that splits over ℝ and 1 ≤ k ≤ n − 1, e_k² · C(n,k−1) C(n,k+1) ≥ \(e_{k−1}\) \(e_{k+1}\) · C(n,k)², with e_j the elementary symmetric functions of the roots.
Lean statement
theorem newton_inequality_esymm_roots {p : Polynomial ℝ} (hp : p.Splits) (hmonic : p.Monic)
{k : ℕ} (hk : 1 ≤ k) (hk2 : k + 1 ≤ p.natDegree) :
(p.roots.esymm k) ^ 2 * ((p.natDegree.choose (k - 1) : ℝ) * (p.natDegree.choose (k + 1) : ℝ))
≥ (p.roots.esymm (k - 1)) * (p.roots.esymm (k + 1)) * ((p.natDegree.choose k : ℝ)) ^ 2Links
Lean docstring
Newton's inequalities. Let p be a monic real polynomial of degree n that splits over ℝ, with roots (with multiplicity) p.roots, and let e_j = p.roots.esymm j be their elementary symmetric functions. For 1 ≤ k ≤ n − 1, e_k² · C(n, k−1) · C(n, k+1) ≥ e_{k−1} · e_{k+1} · C(n, k)²; that is, the normalized E_k = e_k / C(n, k) satisfy E_k² ≥ E_{k−1} E_{k+1}. The proof differentiates and reverses the polynomial down to a real-rooted quadratic.
- Archive:
Newton.newton_inequality(Formalizations.Analysis.Polynomial.RealRoots.NewtonInequalities), restated withPolynomial.SplitsthroughrealRooted_iff_splits; the module cites no paper DOI of ours. - Classical reference: I. Newton, Arithmetica universalis (1707); G. H. Hardy, J. E. Littlewood, G. Pólya, Inequalities, 2nd ed. (1952), ch. II.
- Example: for
p = (X − 1)(X − 2)(X − 3)andk = 1, it givese_1² · 1 · 3 ≥ e_0 e_2 · 9, that is36 · 3 ≥ 11 · 9.
Upstream
a classical inequality stated with Multiset.esymm of Polynomial.roots; Mathlib has neither Newton nor Maclaurin
Depends on, in this repository
Formalizations.Analysis.Polynomial.RealRoots.RealRooted