End-to-End Example: Discovery to Formal Theorem
This guide shows a Lean-only workflow from exploration to a finished proof.
Goal
Prove:
- for all
x in [0, 1],x^2 + sin(x) <= 2
Step 1: Explore Bounds
Suppose discovery reports an upper enclosure below 2. That gives a safe theorem target.
Step 2: Write the Theorem
Step 3: Add Root Evidence (Optional)
import LeanCert.Tactic.Discovery
open LeanCert.Core
def I12 : IntervalRat := { lo := 1, hi := 2, le := by norm_num }
example : ∃ x ∈ I12, Expr.eval (fun _ => x)
(Expr.add (Expr.mul (Expr.var 0) (Expr.var 0)) (Expr.neg (Expr.const 2))) = 0 := by
interval_roots
Practical Pattern
- Explore with discovery commands.
- Choose theorem constants with margin.
- Commit short proof scripts using
leancert; select a dedicated tactic only when you need explicit engine or configuration control.
Split Repositories
Python and bridge tooling live in separate repos:
https://github.com/alerad/leancert-pythonhttps://github.com/alerad/leancert-bridge