Discovery Mode: Proof-Carrying Result Types #
This module defines structures that bundle computed results with their semantic proofs. These are the foundation of "Discovery Mode" - finding and certifying answers automatically.
Main Definitions #
VerifiedGlobalMin- A global minimum bound with proofVerifiedGlobalMax- A global maximum bound with proofVerifiedRoot- An isolating interval with existence proofUniqueVerifiedRoot- An isolating interval with uniqueness proofVerifiedIntegral- Integral bounds with containment proof
Design Philosophy #
Each structure contains:
- Data: The computed numerical result (bounds, intervals, etc.)
- Witness: Location information (which box/interval contains the extremum)
- Proof: A Lean proof term establishing the semantic correctness
The proofs use the "Golden Theorems" from Certificate.lean applied to
computationally verified certificates.
Configuration #
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Convert to GlobalOptConfig
Equations
- cfg.toGlobalOptConfig = { maxIterations := cfg.maxIterations, tolerance := cfg.tolerance, useMonotonicity := cfg.useMonotonicity, taylorDepth := cfg.taylorDepth }
Instances For
Global Minimum #
A verified global minimum bound.
This structure bundles:
- The computed lower bound
bound - The best box
minimizerBoxcontaining a near-minimizer - A proof that
bound ≤ f(x)for allxin the domain
The proof establishes: ∀ ρ, Box.envMem ρ domain → (∀ i ≥ domain.length, ρ i = 0) → bound ≤ Expr.eval ρ expr
- bound : ℚ
The verified lower bound
- upperBound : ℚ
Upper bound on the minimum (for convergence info)
- minimizerBox : Engine.Optimization.Box
Box containing a near-minimizer
- iterations : ℕ
Number of iterations used
- is_lower_bound (ρ : ℕ → ℝ) : Engine.Optimization.Box.envMem ρ domain → (∀ i ≥ List.length domain, ρ i = 0) → ↑self.bound ≤ Core.Expr.eval ρ expr
Proof that bound is a valid lower bound
Instances For
Width of the bound interval
Equations
- v.width = v.upperBound - v.bound
Instances For
Check if the bound is tight within tolerance
Instances For
Global Maximum #
A verified global maximum bound.
This structure bundles:
- The computed upper bound
bound - The best box
maximizerBoxcontaining a near-maximizer - A proof that
f(x) ≤ boundfor allxin the domain
- bound : ℚ
The verified upper bound
- lowerBound : ℚ
Lower bound on the maximum (for convergence info)
- maximizerBox : Engine.Optimization.Box
Box containing a near-maximizer
- iterations : ℕ
Number of iterations used
- is_upper_bound (ρ : ℕ → ℝ) : Engine.Optimization.Box.envMem ρ domain → (∀ i ≥ List.length domain, ρ i = 0) → Core.Expr.eval ρ expr ≤ ↑self.bound
Proof that bound is a valid upper bound
Instances For
Width of the bound interval
Equations
- v.width = v.bound - v.lowerBound
Instances For
Root Finding #
Status of a verified root
- exists_root : VerifiedRootStatus
Root exists (sign change detected)
- unique_root : VerifiedRootStatus
Unique root (Newton contraction verified)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A verified root of an expression.
This structure bundles:
- An isolating interval
intervalcontaining a root - The status (existence vs uniqueness)
- A proof that there exists
x ∈ intervalwithf(x) = 0
- interval : Core.IntervalRat
Isolating interval containing the root
- status : VerifiedRootStatus
Status: existence or uniqueness
- exists_root : ∃ x ∈ self.interval, Core.Expr.eval (fun (x_1 : ℕ) => x) expr = 0
Proof of root existence
Instances For
Approximate location of the root (midpoint)
Instances For
Width of the isolating interval
Instances For
A verified unique root with uniqueness proof
- exists_root : ∃ x ∈ self.interval, Core.Expr.eval (fun (x_1 : ℕ) => x) expr = 0
- unique (x y : ℝ) : x ∈ self.interval → y ∈ self.interval → Core.Expr.eval (fun (x_1 : ℕ) => x) expr = 0 → Core.Expr.eval (fun (x : ℕ) => y) expr = 0 → x = y
Proof of uniqueness within the interval
Instances For
Integration #
A verified integral bound.
This structure bundles:
- Lower and upper bounds on the integral
- A proof that the true integral lies within these bounds
- lowerBound : ℚ
Lower bound on the integral
- upperBound : ℚ
Upper bound on the integral
- partitions : ℕ
Number of partitions used
- integral_bounds : self.lowerBound ≤ self.upperBound ∧ ∃ (I : ℝ), ↑self.lowerBound ≤ I ∧ I ≤ ↑self.upperBound
Proof that the integral lies in [lowerBound, upperBound]
Instances For
Width of the integral bound
Equations
- v.width = v.upperBound - v.lowerBound
Instances For
Bound Verification #
Multi-dimensional variants #
A verified bound over a box (multi-dimensional domain)
- lo : ℚ
Lower bound
- hi : ℚ
Upper bound
- bounds_valid (ρ : ℕ → ℝ) : Engine.Optimization.Box.envMem ρ domain → (∀ i ≥ List.length domain, ρ i = 0) → ↑self.lo ≤ Core.Expr.eval ρ expr ∧ Core.Expr.eval ρ expr ≤ ↑self.hi
Proof of bounds