Search + Certify APIs #
This module provides high-level APIs that wrap existing numerical algorithms to return answers with proofs, not just verdicts.
These APIs bridge the gap between "verify a guess" and "find the answer":
findRootsfinds isolating intervals with existence proofsfindUniqueRootfinds a unique root with existence AND uniqueness proofsfindGlobalMin/findGlobalMaxfinds extrema with bound proofsfindIntegralcomputes integral bounds with correctness proofs
Usage #
These APIs are designed to be:
- Called programmatically from other Lean code
- Used by the Python SDK to generate certificates
- Invoked by discovery tactics
Design Philosophy #
Each API wraps existing algorithms (bisection, Newton, branch-and-bound, etc.) and bundles the result with the appropriate correctness proof.
Root Finding API (0.1.1) #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Proof that a root exists in the given interval.
This structure bundles an interval with a proof that there exists a point x in the interval where f(x) = 0.
- supported : ExprSupportedCore e
Proof that the expression is supported (for correctness theorems)
- continuous : ContinuousOn (fun (x : ℝ) => Core.Expr.eval (fun (x_1 : ℕ) => x) e) (Set.Icc ↑I.lo ↑I.hi)
Proof of continuity on the interval
- hasRoot : ∃ x ∈ I, Core.Expr.eval (fun (x_1 : ℕ) => x) e = 0
The actual root existence proof
Instances For
Proof that a root exists AND is unique.
Extends RootExistenceProof with uniqueness: there is exactly one root.
- continuous : ContinuousOn (fun (x : ℝ) => Core.Expr.eval (fun (x_1 : ℕ) => x) e) (Set.Icc ↑I.lo ↑I.hi)
- hasRoot : ∃ x ∈ I, Core.Expr.eval (fun (x_1 : ℕ) => x) e = 0
- unique (x y : ℝ) : x ∈ I → y ∈ I → Core.Expr.eval (fun (x_1 : ℕ) => x) e = 0 → Core.Expr.eval (fun (x : ℕ) => y) e = 0 → x = y
Uniqueness: any two roots must be equal
Instances For
Result of root finding: an isolating interval with existence proof
- interval : Core.IntervalRat
The isolating interval containing the root
- proof : RootExistenceProof e self.interval
Proof that a root exists in this interval
Instances For
Find all roots of e in interval I, returning isolating intervals with existence proofs.
This wraps bisectRoot to find intervals with sign changes, then
constructs existence proofs using the IVT (via verify_sign_change).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Result of unique root finding: an interval with existence and uniqueness proof. This is a Type, not a Prop, so it can be used in Option.
- supported : ExprSupportedCore e
Proof that the expression is supported (for correctness theorems)
- continuous : ContinuousOn (fun (x : ℝ) => Core.Expr.eval (fun (x_1 : ℕ) => x) e) (Set.Icc ↑I.lo ↑I.hi)
Proof of continuity on the interval
- hasRoot : ∃ x ∈ I, Core.Expr.eval (fun (x_1 : ℕ) => x) e = 0
The actual root existence proof
- unique (x y : ℝ) : x ∈ I → y ∈ I → Core.Expr.eval (fun (x_1 : ℕ) => x) e = 0 → Core.Expr.eval (fun (x : ℕ) => y) e = 0 → x = y
Uniqueness: any two roots must be equal
Instances For
Find a unique root with existence AND uniqueness proof.
This wraps Newton contraction checking to find intervals where:
- A root exists (via contraction or sign change)
- The root is unique (via derivative being bounded away from 0)
Requires UsesOnlyVar0 e for the Newton contraction proof to work.
Returns none if no unique root can be verified.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Optimization API (0.1.2) #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Result of global minimization with proof.
Bundles the minimization result with proofs that:
minValue.lois a valid lower bound for all x in B- There exists a point achieving a value ≤
minValue.hi
- minimizerBox : Optimization.Box
Box containing the minimizer (best bound found here)
- minValue : Core.IntervalRat
Interval containing the minimum value
- lowerBoundProof (ρ : ℕ → ℝ) : Optimization.Box.envMem ρ B → (∀ i ≥ List.length B, ρ i = 0) → ↑self.minValue.lo ≤ Core.Expr.eval ρ e
Proof of the lower bound: ∀ x ∈ B, minValue.lo ≤ f(x)
- upperBoundWitness : ∃ (ρ : ℕ → ℝ), Optimization.Box.envMem ρ B ∧ (∀ i ≥ List.length B, ρ i = 0) ∧ Core.Expr.eval ρ e ≤ ↑self.minValue.hi
Proof of the upper bound witness: ∃ x ∈ B, f(x) ≤ minValue.hi
Instances For
Result of global maximization with proof.
Bundles the maximization result with proofs that:
maxValue.hiis a valid upper bound for all x in B- There exists a point achieving a value ≥
maxValue.lo
- maximizerBox : Optimization.Box
Box containing the maximizer (best bound found here)
- maxValue : Core.IntervalRat
Interval containing the maximum value
- upperBoundProof (ρ : ℕ → ℝ) : Optimization.Box.envMem ρ B → (∀ i ≥ List.length B, ρ i = 0) → Core.Expr.eval ρ e ≤ ↑self.maxValue.hi
Proof of the upper bound: ∀ x ∈ B, f(x) ≤ maxValue.hi
- lowerBoundWitness : ∃ (ρ : ℕ → ℝ), Optimization.Box.envMem ρ B ∧ (∀ i ≥ List.length B, ρ i = 0) ∧ ↑self.maxValue.lo ≤ Core.Expr.eval ρ e
Proof of the lower bound witness: ∃ x ∈ B, f(x) ≥ maxValue.lo
Instances For
Convert OptSearchConfig to GlobalOptConfig
Equations
- cfg.toGlobalOptConfig = { maxIterations := cfg.maxIterations, tolerance := cfg.tolerance, useMonotonicity := cfg.useMonotonicity, taylorDepth := cfg.taylorDepth }
Instances For
Find global minimum of e over box B with proof.
This wraps globalMinimizeCore and bundles the result with
correctness proofs derived from globalMinimizeCore_lo_correct.
Note: Uses ExprSupported (no log) for automatic domain validity.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find global maximum of e over box B with proof.
This wraps globalMaximizeCore and bundles the result with
correctness proofs.
Note: Uses ExprSupported (no log) for automatic domain validity.
Equations
- One or more equations did not get rendered due to their size.
Instances For
1D Optimization Convenience APIs #
Result of 1D global minimization with simplified proof structure
- minimizerInterval : Core.IntervalRat
Interval containing the minimizer
- minValue : Core.IntervalRat
Interval containing the minimum value
Proof of the lower bound: ∀ x ∈ I, minValue.lo ≤ f(x)
Instances For
Result of 1D global maximization with simplified proof structure
- maximizerInterval : Core.IntervalRat
Interval containing the maximizer
- maxValue : Core.IntervalRat
Interval containing the maximum value
Proof of the upper bound: ∀ x ∈ I, f(x) ≤ maxValue.hi
Instances For
Convert IntervalRat to a 1D Box
Equations
Instances For
Find global minimum of e over 1D interval I with proof.
Specialized version for single-variable functions.
Requires e.usesOnlyVar0 = true to ensure eval equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Find global maximum of e over 1D interval I with proof.
Specialized version for single-variable functions.
Requires e.usesOnlyVar0 = true to ensure eval equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Integration API (0.1.3) #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Result of verified integration.
Bundles the computed integral bounds with a proof that the true integral lies within those bounds.
- bounds : Core.IntervalRat
Interval containing the true integral
Proof that the integral is in the bounds
Instances For
Compute rigorous bounds on ∫[a,b] f(x) dx with proof.
This wraps integrateInterval1Core and bundles the result with
the correctness proof from integrateInterval1Core_correct.
Equations
- LeanCert.Engine.SearchAPI.findIntegral e hsupp I cfg hdom hcontdom = { bounds := LeanCert.Validity.Integration.integrateInterval1Core e I { taylorDepth := cfg.taylorDepth }, proof := ⋯ }
Instances For
Compute integral bounds with specified accuracy target.
Automatically increases subdivision count until the bound width is below the target tolerance (or max subdivisions reached).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convenience Functions for Common Cases #
Check if an expression has a root in an interval (boolean version)
Equations
- LeanCert.Engine.SearchAPI.hasRootIn e I cfg = LeanCert.Validity.RootFinding.checkSignChange e I { taylorDepth := cfg.taylorDepth }
Instances For
Check if an expression is positive on an interval
Equations
- LeanCert.Engine.SearchAPI.isPositiveOn e I cfg = decide (0 < (LeanCert.Engine.evalIntervalCore1 e I cfg).lo)
Instances For
Check if an expression is negative on an interval
Equations
- LeanCert.Engine.SearchAPI.isNegativeOn e I cfg = decide ((LeanCert.Engine.evalIntervalCore1 e I cfg).hi < 0)
Instances For
Get a lower bound on the minimum value
Equations
- LeanCert.Engine.SearchAPI.getLowerBound e I cfg = (LeanCert.Engine.evalIntervalCore1 e I cfg).lo
Instances For
Get an upper bound on the maximum value
Equations
- LeanCert.Engine.SearchAPI.getUpperBound e I cfg = (LeanCert.Engine.evalIntervalCore1 e I cfg).hi