Back to browse
GitHub Repository

Proving polynomial inequalities with sum-of-squares certificates

29 starsPython

Sostactic – polynomial inequalities using sums-of-squares in Lean

by mmaaz·Apr 18, 2026·14 points·1 comment

AI Analysis

●●SolidNiche GemBig Brain

Beats Lean's `nlinarith` on nonlinear inequalities using Python-backed SOS decompositions.

Strengths
  • Bridges Lean tactics with Python SOS solvers for complex polynomial proofs.
  • Handles semialgebraic sets and infeasibility where standard `nlinarith` currently fails.
  • Seamless Lake package integration with auto-discovered local Python virtual environments.
Weaknesses
  • Requires managing both Lean toolchain and Python dependencies simultaneously.
  • Extremely niche audience limits adoption outside formal verification and math circles.
Target Audience

Formal verification engineers, mathematicians using Lean 4

Similar To

SOSTOOLS · YALMIP · Lean `nlinarith`

Post Description

Current support for nonlinear inequalities in Lean is quite limited. This package attempts to solve this. It contains a collection of Lean4 tactics for proving polynomial inequalities via sum-of-squares (SOS) decompositions, powered by a Python backend. You can use it via Python or Lean.

These tactics are significantly more powerful than `nlinarith` and `positivity` -- i.e., they can prove inequalities they cannot. In theory, they can be used to prove any of the following types of statements

- prove that a polynomial is nonnegative globally - prove that a polynomial is nonnegative over a semialgebraic set (i.e., defined by a set of polynomial inequalities) - prove that a semialgebraic set is empty, i.e., that a system of polynomial inequalities is infeasible

The underlying theory is based on the following observation: if a polynomial can be written as a sum of squares of other polynomials, then it is nonnegative everywhere. Theorems proving the existence of such decompositions were one of the landmark achievements of real algebraic geometry in the 20th century, and its connection to semidefinite programming in the 21st century made it a practical computational tool, and is what this software does in the background.

Similar Projects