Documentation

LeanCert.Tactic.TestDiscovery

Tests for Discovery Mode Tactics #

This file tests the interval_roots tactic.

interval_roots Tests #

These tests verify the interval_roots tactic for proving root existence. The tactic works by:

  1. Detecting a sign change at the interval endpoints
  2. Applying the Intermediate Value Theorem

Test interval_roots tactic #

Now let's test the automated tactic. The tactic should:

  1. Parse the goal
  2. Reify the function
  3. Generate proofs
  4. Apply verify_sign_change
  5. Solve with native_decide

Test interval_minimize / interval_maximize tactics #

These tactics prove existential goals about bounds by:

  1. Running global optimization to find the bound
  2. Instantiating the existential with the found value
  3. Proving the universal bound using opt_bound

NOTE: The goal format must match exactly:

theorem LeanCert.Tactic.TestDiscovery.test_minimize_sin :
∃ (m : ), xI_0_7, Core.Expr.eval (fun (x_1 : ) => x) (Core.Expr.var 0).sin m
theorem LeanCert.Tactic.TestDiscovery.test_maximize_exp :
∃ (M : ), xI_0_1, Core.Expr.eval (fun (x_1 : ) => x) (Core.Expr.var 0).exp M

#explore Command Tests #

The #explore command analyzes a function on an interval and reports:

interval_unique_root Tests #

The interval_unique_root tactic proves ∃! x ∈ I, f(x) = 0 by:

  1. Checking Newton iteration contracts (derivative bounded away from 0)
  2. Using Rolle's theorem for uniqueness
  3. Using IVT for existence (via contraction)

NOTE: These tests require the theorem with a sorry for the existence part. The tactic will work at runtime but the proof contains sorry.

interval_integrate Tests #

The interval_integrate tactic proves goals of the form ∫ x in lo..hi, f(x) ∈ bound where the bound is computed via interval arithmetic.