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.AlgebraicGeometryIn a file of the project, e.g.
Example.lean.Paste the example
open Formalizations.Reusable /-- Cotes: the harmonic-mean point lies on the polar of `p`. -/ example (f : MvPolynomial (Fin 2) ℝ) (p v : Fin 2 → ℝ) (hp : MvPolynomial.eval p f ≠ 0) (hsplit : (MvPolynomial.aeval (fun i => Polynomial.C (p i) + Polynomial.C (v i) * Polynomial.X) f).roots.card = (MvPolynomial.aeval (fun i => Polynomial.C (p i) + Polynomial.C (v i) * Polynomial.X) f).natDegree) (hd : 1 ≤ (MvPolynomial.aeval (fun i => Polynomial.C (p i) + Polynomial.C (v i) * Polynomial.X) f).natDegree) (hH : ((MvPolynomial.aeval (fun i => Polynomial.C (p i) + Polynomial.C (v i) * Polynomial.X) f).roots.map (fun r => r⁻¹)).sum ≠ 0) : let g := MvPolynomial.aeval (fun i => Polynomial.C (p i) + Polynomial.C (v i) * Polynomial.X) f ∑ i, MvPolynomial.eval p (MvPolynomial.pderiv i f) * ((g.natDegree : ℝ) / (g.roots.map (fun r => r⁻¹)).sum * v i) = -(g.natDegree : ℝ) * MvPolynomial.eval p f := cotes_harmonic_mean_polar f p v hp _ rfl hsplit hd hHSteps 3 and 4 together are a complete Lean file:
FormalizationsTest/ReusableAlgebraicGeometryExample.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).
Cotes' harmonic means theorem: if a line p + t v meets a real plane curve f = 0 in deg g real points (g(t) = f(p + t v) splits), the harmonic-mean point lies on the polar line ∇f(p)·(q − p) = −d f(p) of p.
Lean statement
theorem cotes_harmonic_mean_polar (f : MvPolynomial (Fin 2) ℝ) (p v : Fin 2 → ℝ)
(hp : MvPolynomial.eval p f ≠ 0)
(g : Polynomial ℝ)
(hg : g = MvPolynomial.aeval (fun i => Polynomial.C (p i) + Polynomial.C (v i) * Polynomial.X) f)
(hsplit : g.roots.card = g.natDegree) (hd : 1 ≤ g.natDegree)
(hH : (g.roots.map (fun r => r⁻¹)).sum ≠ 0) :
∑ i, MvPolynomial.eval p (MvPolynomial.pderiv i f) *
((g.natDegree : ℝ) / (g.roots.map (fun r => r⁻¹)).sum * v i)
= -(g.natDegree : ℝ) * MvPolynomial.eval p fLinks
Lean docstring
Cotes' harmonic means theorem. Let f ∈ ℝ[x, y] define a plane curve, p a point with f(p) ≠ 0 and v a direction, and let g(t) = f(p + t v). Suppose g splits over ℝ with d = deg g ≥ 1 roots tᵢ and Σ 1/tᵢ ≠ 0. Then the harmonic-mean point p + t* v, t* = d / Σ 1/tᵢ, satisfies ∇f(p) · (t* v) = −d f(p): it lies on the polar line ∇f(p) · (q − p) = −d f(p) of p, which does not depend on the direction v.
- Archive:
Cotes.harmonic_mean_polar(Formalizations.AlgebraicGeometry.PlaneCurve.Cotes, from Mathlib's logarithmic derivative of a split polynomial); no research paper. - Classical reference: R. Cotes, Harmonia Mensurarum, Cambridge, 1722; C. Maclaurin, De linearum geometricarum proprietatibus generalibus, 1748.
- Example: for the unit circle
f = x² + y² − 1,p = 0and anyv,g = |v|² t² − 1splits withΣ 1/tᵢ = 0, so the hypothesishHfails: the theorem says nothing about lines through the centre, as expected (the polar of the centre is the line at infinity).
Upstream
the hypotheses (roots.card = natDegree, nonzero sum of inverse roots) are tailored to the proof; a Mathlib version would need plane-curve API
Depends on, in this repository
None besides the archive module (repo_dependencies = []).