Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Hilbert's 17th problem · Hilbert17thProblemHomogenousPoly_zero_right

Source:Hilbert's problems
Sanity test Checks that the formal definitions behave as intended. First verified proof: +1 points.
Statement:reviewed
Statement:

No informal statement.

Subjects:Commutative Algebra (math.AC)
MSC classes:12
Cite as:NS.04274 [math.AC] · NS.04274v1 for this version
Declaration:Hilbert17.Hilbert17thProblemHomogenousPoly_zero_right
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 1; accepted critique: up to 60
Statement hash:d51938cb71ace0c9147d74b0b8252a2437685e4bbb3ec58dc7bcb114e5f96be5
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/HilbertProblems/17.lean

Formal statement

theorem Hilbert17thProblemHomogenousPoly_zero_right (n : ℕ) :
    Hilbert17thProblemHomogenousPoly n 0
Show the full Challenge.lean (120 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Hilbert's 17th problem

Let $f(x_1, \dots, x_n)$ be a multivariable polynomial with real coefficients that takes only
nonnegative values for all real inputs.
Hilbert's 17th problem asks whether there exist rational functions $g_1, \dots, g_m$ such that
$f = g_1^2 + g_2^2 + \cdots + g_m^2$. Resolved affirmatively by Artin in 1927.
*References:*
- [Wikipedia](https://en.wikipedia.org/wiki/Hilbert%27s_seventeenth_problem)
- Motzkin, "The arithmetic-geometric inequality". In Shisha, Oved (ed.). Inequalities. Academic Press. pp. 205–224.
-/

@[expose] public section

open Real MvPolynomial

namespace Hilbert17

/--
Hilbert's 17th problem: every non-negative multivariate polynomial is a sum of
squares of rational functions.
-/
@[category research solved, AMS 12]
theorem hilbert_17th_problem {n : ℕ} (hn : 0 < n) (f : MvPolynomial (Fin n) ℝ)
    (h : ∀ x : Fin n → ℝ, 0 ≤ f.eval x) :
    ∃ (m : ℕ) (g : Fin m → MvRatFunc (Fin n) ℝ), algebraMap _ _ f = ∑ i, (g i) ^ 2 := by
  sorry

/--
The statement is false in general if we restrict to polynomials. The polynomial (by Motzkin)
$f(x, y) = x^4 y^2 + x^2 y^4 - 3 x^2 y^2 + 1$ takes only nonnegative values but cannot be
written as a sum of squares of polynomials.
-/
noncomputable def f : MvPolynomial (Fin 2) ℝ :=
  X 0 ^ 4 * X 1 ^ 2 + X 0 ^ 2 * X 1 ^ 4 - 3 * X 0 ^ 2 * X 1 ^ 2 + 1

-- Proof taken from `motzkin_polynomial_nonneg` in mathlib
/-- The Motzkin polynomial is non-negative everywhere. -/
@[category textbook, AMS 12]
theorem f_nonneg : ∀ x y : ℝ, 0 ≤ f.eval ![x, y] := by
  intro x y
  simp only [Nat.succ_eq_add_one, Nat.reduceAdd, f, Fin.isValue, map_add, map_sub, map_mul, map_pow,
    eval_X, Matrix.cons_val_zero, Matrix.cons_val_one, Matrix.cons_val_fin_one, eval_ofNat, map_one]
  by_cases hx : x = 0
  · simp [hx]
  have h : 0 < (x ^ 2 + y ^ 2) ^ 2 := by positivity
  refine nonneg_of_mul_nonneg_left ?_ h
  have H : 0 ≤ (x ^ 3 * y + x * y ^ 3 - 2 * x * y) ^ 2 * (1 + x ^ 2 + y ^ 2)
    + (x ^ 2 - y ^ 2) ^ 2 := by positivity
  linear_combination H

/-- The Motzkin polynomial cannot be written as a sum of squares of polynomials. -/
@[category textbook, AMS 12]
theorem f_not_sum_of_squares :
    ¬∃ (n : ℕ) (hn : 0 < n) (S : Fin n → MvPolynomial (Fin 2) ℝ), f = ∑ i, S i ^ 2 := by
  sorry

/--
For the polynomial version, Hilbert showed that every nonnegative homogeneous polynomial in
$n$ variables of degree $2d$ can be written as a sum of squares of polynomials if and only if
- $n = 1$
- $n = 2$
- $d = 1$
- $(n, d) = (3, 2)$.
-/
def Hilbert17thProblemHomogenousPoly (n d : ℕ) : Prop :=
  ∀ f : MvPolynomial (Fin n) ℝ, f.IsHomogeneous (2 * d) →
    (∀ x : Fin n → ℝ, 0 ≤ f.eval x) →
      ∃ (m : ℕ) (g : Fin m → MvPolynomial (Fin n) ℝ), f = ∑ i, (g i) ^ 2

@[category test, AMS 12]
theorem Hilbert17thProblemHomogenousPoly_zero_left (d : ℕ) :
    Hilbert17thProblemHomogenousPoly 0 d := by
  refine fun f hf hf₀ ↦ ⟨1, fun _ ↦ C √(f.coeff 0), ?_⟩
  have hfd := hf.totalDegree
  rw [f.eq_C_of_isEmpty] at hf₀ ⊢
  rw [Finset.sum_congr rfl fun _ _ ↦ (map_pow _ _ _).symm, Real.sq_sqrt <| by simpa using hf₀]
  simp

@[category test, AMS 12]
theorem Hilbert17thProblemHomogenousPoly_zero_right (n : ℕ) :
    Hilbert17thProblemHomogenousPoly n 0 := by
  intro f hf hf₀
  rcases eq_or_ne f 0 with (rfl | hf_zero); · exact ⟨0, 0, by simp⟩
  have hfd := f.totalDegree_eq_zero_iff_eq_C.1 <| by simpa using hf.totalDegree hf_zero
  use 1, fun _ ↦ C √(f.coeff 0)
  rw [Finset.sum_congr rfl fun _ _ ↦ (map_pow _ _ _).symm, Real.sq_sqrt <| by
    simpa [constantCoeff] using hf₀ 0]
  simpa using hfd

/--
Hilbert's 17th problem for homogeneous polynomials: characterization of dimensions and degrees
where non-negative polynomials are sums of squares of polynomials.
-/
@[category research solved, AMS 12]
theorem hilbert_17th_problem_poly {n d : ℕ} (hn : 0 < n) (hd : 0 < d) :
    Hilbert17thProblemHomogenousPoly n d ↔ n = 1 ∨ n = 2 ∨ d = 1 ∨ n = 3 ∧ d = 2 := by
  sorry

end Hilbert17

To prove it: keep every definition of Challenge.lean unchanged and prove Hilbert17.Hilbert17thProblemHomogenousPoly_zero_right with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_Hilbert17thProblemHomogenousPoly_zero_right : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch hilbert-17--hilbert17thproblemhomogenouspoly-zero-right
nosorry submit hilbert-17--hilbert17thproblemhomogenouspoly-zero-right nosorry/hilbert-17--hilbert17thproblemhomogenouspoly-zero-right/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.