Root Finding: Bisection Algorithm #
This file implements the bisection method for root isolation.
Main definitions #
BisectionResult- Result structure from bisectionbisectRootGo- Worker function for bisectionbisectRoot- Main bisection entry point
Main theorems #
bisectRoot_hasRoot_correct- If status ishasRoot, there exists a root (via IVT)bisectRoot_noRoot_correct- If status isnoRoot, there are no roots
All bisection theorems are FULLY PROVED with no sorry.
Bisection result structure #
Result of bisection root finding
- intervals : List (Core.IntervalRat × RootStatus)
Interval-status pairs
- iterations : ℕ
Number of bisections performed
Instances For
Get just the candidate intervals
Equations
Instances For
Get just the statuses
Instances For
Bisection algorithm #
Worker function for bisection root finding.
Processes a worklist, discarding intervals that provably contain no roots, bisecting intervals that may contain roots until they are small enough.
Lifted to top-level so we can state correctness lemmas about it.
Equations
Instances For
Bisection root finding.
Repeatedly bisects the interval, discarding subintervals that provably contain no roots.
Equations
- LeanCert.Engine.bisectRoot e I maxIter tol _htol = LeanCert.Engine.bisectRootGo e tol maxIter [(I, LeanCert.Engine.RootStatus.unknown)] maxIter []
Instances For
Bisection correctness #
Key lemma: checkRootStatus returns noRoot only when excludesZero is true
Key lemma: checkRootStatus returns hasRoot only when signChange is true
Invariants for bisection proofs #
Invariant for bisection: every interval with hasRoot status has signChange = true. Note: noRoot intervals are discarded by the algorithm, so they never appear in output.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Invariant for tracking sub-intervals: all intervals in the list are sub-intervals of I
Equations
- LeanCert.Engine.SubIntervalInv I pairs = ∀ (J : LeanCert.Core.IntervalRat) (s : LeanCert.Engine.RootStatus), (J, s) ∈ pairs → I.lo ≤ J.lo ∧ J.hi ≤ I.hi
Instances For
The invariant holds for the initial work list
The sub-interval invariant holds initially
BisectInv is preserved when adding a hasRoot interval with signChange = true
BisectInv is preserved when adding non-hasRoot intervals
BisectInv holds for list append
SubIntervalInv holds for list append
SubIntervalInv is preserved when adding a sub-interval
Main correctness proofs #
noRoot never appears in output - the algorithm discards such intervals. We prove this by induction on iter.
Every hasRoot interval in output has signChange = true. We prove this by induction on iter. Note: We need BisectInv for work too, since at iter=0 we output work as-is.
Every interval in output is a sub-interval of the original. We prove this by induction on iter.
If bisection returns hasRoot for an interval, there exists a root (by IVT).
The proof works by showing that every (J, hasRoot) pair in the output has signChange e J = true, then applying signChange_correct.
Note about noRoot: The algorithm discards noRoot intervals, so they never appear in the output. Thus bisectRoot_noRoot_correct is vacuously true.
If bisection returns noRoot for an interval, there really is no root.
Note: The bisection algorithm discards noRoot intervals - when checkRootStatus
returns noRoot, we call go rest n done without adding J to done. So noRoot
never appears in the output intervals list.
This means the theorem is vacuously true: there are no (J, noRoot) pairs in the output.