Root Finding: Basic Definitions #
This file provides the core definitions and basic correctness lemmas for root finding.
Main definitions #
RootStatus- Result of checking an interval for rootsexcludesZero- Check if an interval excludes zerosignChange- Check if function has opposite signs at endpointscheckRootStatus- Determine initial root status
Main theorems #
excludesZero_correct- If interval excludes zero, no roots existsignChange_correct- If sign change exists, a root exists (IVT)
Root status #
Result of checking an interval for roots
- noRoot : RootStatus
No root in this interval (interval evaluation doesn't contain 0)
- hasRoot : RootStatus
At least one root exists (by intermediate value theorem)
- uniqueRoot : RootStatus
Exactly one root exists (Newton contraction)
- unknown : RootStatus
Cannot determine
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Basic root checks #
Check if interval evaluation excludes zero
Instances For
Check if function values have opposite signs at endpoints (IVT applicable)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Initial root status check
Equations
- One or more equations did not get rendered due to their size.
Instances For
Core correctness lemmas #
If interval evaluation excludes zero, then f(x) ≠ 0 for all x in I. This is the key lemma for proving noRoot correctness.
If there is a sign change, then by IVT there exists a root. This uses Mathlib's intermediate_value_Icc theorem.
Proof strategy:
- signChange means f(lo) < 0 < f(hi) or f(hi) < 0 < f(lo)
- Use evalInterval1_correct on singletons to get actual values at endpoints
- Apply intermediate_value_Icc to conclude 0 is in the image
N-Variable Root Finding Infrastructure #
The following section provides infrastructure for root finding in multi-variable expressions. The key idea is that we search for roots along a specific coordinate while holding other variables fixed.
For a multi-variable expression e with environment ρ, we can find roots of
evalAlong e ρ idx - the function obtained by varying coordinate idx while
keeping all other coordinates fixed according to ρ.
N-variable root checks #
Check if interval evaluation along coordinate idx excludes zero.
Note: idx is kept for API consistency though the full box is checked.
Equations
- LeanCert.Engine.excludesZero_idx e ρ_int _idx = LeanCert.Engine.excludesZero (LeanCert.Engine.evalInterval e ρ_int)
Instances For
Check if function has opposite signs at endpoints along coordinate idx
Equations
- One or more equations did not get rendered due to their size.
Instances For
Initial root status check along coordinate idx
Equations
- One or more equations did not get rendered due to their size.
Instances For
N-variable correctness lemmas #
If interval evaluation excludes zero, then f(x) ≠ 0 for all x in the box. N-variable version: the function has no zeros in the entire box.
If there is a sign change along coordinate idx, then by IVT there exists a root
along that coordinate.
N-variable version: for any fixed values of other coordinates satisfying ρ_int,
there exists a value of coordinate idx where the function is zero.
N-variable bisection root finding #
Result of bisection root finding
- found
(I : Core.IntervalRat)
(depth : ℕ)
: BisectResult
Found interval containing root with a sign change
- noRoot : BisectResult
No root in this interval
- uncertain
(I : Core.IntervalRat)
(depth : ℕ)
: BisectResult
Could not determine (no sign change detected)
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Update an interval environment at a specific index
Instances For
Helper: membership in bisected intervals
N-variable bisection root finding along coordinate idx.
This searches for a root of e by bisecting the interval ρ idx while
keeping other coordinates fixed. It uses interval arithmetic to:
- Exclude intervals where the function cannot be zero
- Detect sign changes indicating a root exists (by IVT)
- Bisect when neither condition is met
Returns a BisectResult indicating whether a root was found, excluded, or uncertain.
Equations
- LeanCert.Engine.bisectRootIdx e ρ idx maxDepth = LeanCert.Engine.bisectRootIdx.go e ρ idx maxDepth (ρ idx) maxDepth
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Helper: when go returns found, signChange_idx was true for that interval
Correctness theorem for bisectRootIdx when it finds a root.
If bisectRootIdx returns found I d, then for any ρ_real satisfying ρ_int,
there exists a root of evalAlong e ρ_real idx in the returned interval I.
Helper: noRoot is preserved through bisection. The proof is complex due to the match structure in bisectRootIdx.go. The key insight is that noRoot can only be returned if excludesZero is true at some level of the recursion, and excludesZero implies the function is nonzero.
Correctness theorem for bisectRootIdx when it reports no root.
If bisectRootIdx returns noRoot, then for any ρ_real satisfying ρ_int,
the function evalAlong e ρ_real idx has no zeros in ρ_int idx.