Counter-Example Search #
This file provides machinery for finding counter-examples to bound claims.
Finding a counter-example is just global optimization: to disprove f(x) ≤ C,
we maximize f(x) and check if the result exceeds C.
Main definitions #
CounterExampleStatus- Whether a counter-example is verified or just a candidateCounterExample- A point that violates (or may violate) a boundfindViolation- Search for counter-examples tof(x) ≤ limitfindViolationLower- Search for counter-examples tolimit ≤ f(x)
Counter-Example Types #
Verified: The rigorous lower bound of
max(f)exceeds the limit. This is a mathematical proof that the bound is false.Candidate: The upper bound exceeds the limit, but the lower bound doesn't. This might indicate a true violation (precision too low) or a false positive (interval wrapping).
Usage #
-- Check if x² ≤ 3 on [-2, 2]
let result := findViolation (Expr.mul (Expr.var 0) (Expr.var 0)) [⟨-2, 2, by norm_num⟩] 3
-- Returns some { status := .Verified, ... } because max(x²) = 4 > 3
Counter-example types #
Status of a counter-example
- Verified : CounterExampleStatus
Definitely violates the bound (proof of negation possible)
- Candidate : CounterExampleStatus
Likely violates the bound (or precision too low)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A counter-example to a bound claim
The input point (midpoint of the best box)
- valueLo : ℚ
The computed output interval at/near the point
- valueHi : ℚ
- status : CounterExampleStatus
Whether the counter-example is verified or just a candidate
- box : Optimization.Box
The box containing the counter-example
- iterations : ℕ
Number of iterations used
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Is this a verified counter-example?
Equations
Instances For
Get the midpoint of each interval in the box
Equations
- LeanCert.Engine.Search.CounterExample.boxMidpoint B = List.map (fun (x : LeanCert.Core.IntervalRat) => x.midpoint) B
Instances For
Upper bound violation (f(x) ≤ limit) #
Search for a counter-example to the claim ∀ x ∈ domain, f(x) ≤ limit.
Returns some CounterExample if the bound cannot be verified.
Returns none if the theorem appears to be true (no violation found).
Algorithm: Maximize f(x) over the domain. If max(f).lo > limit,
the bound is definitely false. If max(f).hi > limit but lo ≤ limit,
there might be a violation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Variant of findViolation with division support.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Lower bound violation (limit ≤ f(x)) #
Search for a counter-example to the claim ∀ x ∈ domain, limit ≤ f(x).
Returns some CounterExample if the bound cannot be verified.
Algorithm: Minimize f(x) over the domain. If min(f).hi < limit,
the bound is definitely false.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Variant with division support.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Strict bound violations #
Search for a counter-example to ∀ x ∈ domain, f(x) < limit.
A violation means f(x) ≥ limit for some x.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Search for a counter-example to ∀ x ∈ domain, limit < f(x).
A violation means f(x) ≤ limit for some x.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Pretty printing #
Format a counter-example for display
Equations
- One or more equations did not get rendered due to their size.