Certificate-Driven Verification Examples #
This file demonstrates the certificate-driven verification system.
All proofs use native_decide to execute the boolean checkers.
Design #
The golden theorems (verify_upper_bound, etc.) take:
- The expression
e - A proof
hsuppthateis inExprSupportedCore - The interval
I - The bound
c - An
EvalConfigspecifying Taylor depth - A proof
h_certthat the checker returnstrue
The last argument is discharged by native_decide.
Examples #
Basic algebraic bounds #
x² ≤ 1on[0, 1]with depth 10
Transcendental bounds with varying depth #
exp(x) ≤ 3on[0, 1]with depth 10sin(x) ≤ 1on[0, 1]with depth 10- Tighter bounds with higher depth
Demonstrating depth sensitivity #
- Same bound may require different depths for different interval widths
Setup: Expressions and intervals #
The unit interval [0, 1]
Equations
- LeanCert.Examples.Certificate.I01 = { lo := 0, hi := 1, le := LeanCert.Examples.Certificate.I01._proof_1 }
Instances For
The interval [0, 1.2]
Equations
- LeanCert.Examples.Certificate.I012 = { lo := 0, hi := 6 / 5, le := LeanCert.Examples.Certificate.I012._proof_1 }
Instances For
The expression x²
Equations
Instances For
Support proof for x²
Equations
Instances For
The expression exp(x)
Equations
Instances For
Support proof for exp(x)
Equations
Instances For
The expression sin(x)
Equations
Instances For
Support proof for sin(x)
Equations
Instances For
The expression cos(x)
Equations
Instances For
Support proof for cos(x)
Equations
Instances For
The expression x * exp(x)
Equations
Instances For
Support proof for x * exp(x)
Equations
Instances For
Basic algebraic bounds #
x² ≤ 1 on [0, 1] with default depth 10
0 ≤ x² on [0, 1] with default depth 10
Transcendental bounds #
exp(x) ≤ 3 on [0, 1] with depth 10
9/10 ≤ exp(x) on [0, 1] with depth 10 Note: The Taylor model gives a conservative lower bound slightly below 1, so we use 9/10 as a safe lower bound that the interval arithmetic can verify.
sin(x) ≤ 1 on [0, 1]
cos(x) ≤ 1 on [0, 1]
Tighter bounds with higher depth #
Higher Taylor depth allows tighter bounds to be verified.
exp(x) ≤ 2.75 on [0, 1] requires higher depth for tighter bound
Combined expression: x * exp(x) #
This demonstrates the certificate system on a more complex expression. On [0, 1], we have:
- x ∈ [0, 1]
- exp(x) ∈ [1, e]
- x * exp(x) ∈ [0, e] ≈ [0, 2.718]
x * exp(x) ≤ 3 on [0, 1]
0 ≤ x * exp(x) on [0, 1]
Strict bounds #
x² < 2 on [0, 1] (strict upper bound)
-1 < x² on [0, 1] (strict lower bound)
Two-sided bounds #
0 ≤ x² ≤ 1 on [0, 1]
9/10 ≤ exp(x) ≤ 3 on [0, 1]
Example: RPC workflow simulation #
This section demonstrates what Python-generated code would look like. Python determines the required depth, then generates a one-liner proof.
Simulated RPC call: Python found depth 12 sufficient for exp(x) ≤ 2.8 on [0,1]