Documentation

LeanCert.Engine.SearchAPI

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":

Usage #

These APIs are designed to be:

  1. Called programmatically from other Lean code
  2. Used by the Python SDK to generate certificates
  3. 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) #

Configuration for root finding search

  • maxDepth :

    Maximum bisection depth

  • tolerance :

    Tolerance for interval width

  • taylorDepth :

    Taylor depth for interval evaluation

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    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.

      Instances For

        Proof that a root exists AND is unique.

        Extends RootExistenceProof with uniqueness: there is exactly one root.

        Instances For

          Result of root finding: an isolating interval with existence proof

          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.

              Instances For

                Find a unique root with existence AND uniqueness proof.

                This wraps Newton contraction checking to find intervals where:

                1. A root exists (via contraction or sign change)
                2. 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) #

                  Configuration for optimization search

                  • maxIterations :

                    Maximum iterations for branch-and-bound

                  • tolerance :

                    Tolerance for box width

                  • useMonotonicity : Bool

                    Use monotonicity pruning

                  • taylorDepth :

                    Taylor depth for interval evaluation

                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Result of global minimization with proof.

                      Bundles the minimization result with proofs that:

                      1. minValue.lo is a valid lower bound for all x in B
                      2. There exists a point achieving a value ≤ minValue.hi
                      Instances For

                        Result of global maximization with proof.

                        Bundles the maximization result with proofs that:

                        1. maxValue.hi is a valid upper bound for all x in B
                        2. There exists a point achieving a value ≥ maxValue.lo
                        Instances For

                          Convert OptSearchConfig to GlobalOptConfig

                          Equations
                          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

                                Instances For

                                  Result of 1D global maximization with simplified proof structure

                                  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) #

                                        Configuration for integration search

                                        • subdivisions :

                                          Number of subdivisions for uniform partitioning

                                        • taylorDepth :

                                          Taylor depth for interval evaluation

                                        Instances For
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For

                                            Result of verified integration.

                                            Bundles the computed integral bounds with a proof that the true integral lies within those bounds.

                                            Instances For
                                              noncomputable def LeanCert.Engine.SearchAPI.findIntegral (e : Core.Expr) (hsupp : ExprSupportedCore e) (I : Core.IntervalRat) (cfg : IntegSearchConfig := { }) (hdom : evalDomainValid1 e I { taylorDepth := cfg.taylorDepth }) (hcontdom : Meta.exprContinuousDomainValid e (Set.Icc I.lo I.hi)) :

                                              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
                                              Instances For
                                                noncomputable def LeanCert.Engine.SearchAPI.findIntegralWithTolerance (e : Core.Expr) (hsupp : ExprSupportedCore e) (I : Core.IntervalRat) (taylorDepth : := 10) (hdom : evalDomainValid1 e I { taylorDepth := taylorDepth }) (hcontdom : Meta.exprContinuousDomainValid e (Set.Icc I.lo I.hi)) (_tol : ) (_htol : 0 < _tol) (_maxSubdiv : := 100) :

                                                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
                                                  Instances For

                                                    Check if an expression is positive on an interval

                                                    Equations
                                                    Instances For

                                                      Check if an expression is negative on an interval

                                                      Equations
                                                      Instances For

                                                        Get a lower bound on the minimum value

                                                        Equations
                                                        Instances For

                                                          Get an upper bound on the maximum value

                                                          Equations
                                                          Instances For