Documentation

LeanCert.Examples.Tactics

Tactic Examples #

This file demonstrates using LeanCert's interval arithmetic to prove bounds on expressions.

Verified Examples #

All examples in this file are FULLY PROVED using interval arithmetic. No sorry, no axioms beyond the standard Lean/Mathlib foundations.

Computability Design #

We have two evaluation strategies:

  1. Core (computable): For expressions in ExprSupportedCore (const, var, add, mul, neg, sin, cos), we use evalIntervalCore1 which is fully computable. The interval_le, interval_ge, etc. tactics work with native_decide.

  2. Extended (noncomputable): For expressions with exp, we use evalInterval1 which requires noncomputable evaluation due to Real.exp floor/ceil bounds. These proofs use FTIA directly.

Basic interval bound examples #

Proof that x² is in the core (computable) subset

Equations
Instances For

    Example: x² ≤ 1 for all x ∈ [0, 1] using the interval_le tactic. This uses the computable core evaluator with native_decide.

    Example: 0 ≤ x² for all x ∈ [0, 1] using native_decide.

    theorem LeanCert.Examples.Tactics.xsq_le_one (x : ) :
    x I01Core.Expr.eval (fun (x_1 : ) => x) exprXSq 1

    Example: x² ≤ 1 for all x ∈ [0, 1]. Manual proof for reference.

    theorem LeanCert.Examples.Tactics.zero_le_xsq (x : ) :
    x I010 Core.Expr.eval (fun (x_1 : ) => x) exprXSq

    Example: 0 ≤ x² for all x ∈ [0, 1]. Manual proof for reference.

    Trigonometric bounds #

    Example: sin(x) ≤ 1 for all x ∈ [0, 1] using native_decide.

    Example: -1 ≤ sin(x) for all x ∈ [0, 1] using native_decide.

    theorem LeanCert.Examples.Tactics.sin_le_one (x : ) :
    x I01Core.Expr.eval (fun (x_1 : ) => x) exprSin 1

    Example: sin(x) ≤ 1 for all x ∈ [0, 1]. Manual proof for reference.

    theorem LeanCert.Examples.Tactics.neg_one_le_sin (x : ) :
    x I01(-1) Core.Expr.eval (fun (x_1 : ) => x) exprSin

    Example: -1 ≤ sin(x) for all x ∈ [0, 1]. Manual proof for reference.

    Combined expressions #

    Example: x² + sin(x) ≤ 2 for all x ∈ [0, 1] using native_decide.

    Example: -1 ≤ x² + sin(x) for all x ∈ [0, 1] using native_decide.

    Example: x² + sin(x) ≤ 2 for all x ∈ [0, 1]. Manual proof for reference.

    Example: -1 ≤ x² + sin(x) for all x ∈ [0, 1]. Manual proof for reference.

    Strict bounds #

    Example: x² - 2 < 0 for all x ∈ [0, 1] using native_decide. Since x² ≤ 1 on [0,1], we have x² - 2 ≤ -1 < 0.

    Example: x² - 2 < 0 for all x ∈ [0, 1]. Manual proof for reference.

    Working with polynomials #

    The expression 2x² + 3x + 1

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Proof that 2x² + 3x + 1 is in the core subset

      Equations
      Instances For

        Example: 2x² + 3x + 1 ≤ 6 for all x ∈ [0, 1] using native_decide. At x=1: 2 + 3 + 1 = 6.

        Example: 1 ≤ 2x² + 3x + 1 for all x ∈ [0, 1] using native_decide. At x=0: 0 + 0 + 1 = 1.

        Example: 2x² + 3x + 1 ≤ 6 for all x ∈ [0, 1]. Manual proof for reference.

        theorem LeanCert.Examples.Tactics.one_le_poly (x : ) :
        x I011 Core.Expr.eval (fun (x_1 : ) => x) exprPoly

        Example: 1 ≤ 2x² + 3x + 1 for all x ∈ [0, 1]. Manual proof for reference.

        Examples with exp (noncomputable) #

        Expressions containing exp use the extended evaluator evalInterval1, which is noncomputable due to Real.exp floor/ceil bounds. These examples demonstrate bounds using direct FTIA application rather than native_decide.

        Proof that exp(x) is supported (but NOT in ExprSupportedCore)

        Equations
        Instances For
          theorem LeanCert.Examples.Tactics.exp_le_three (x : ) :
          x I01Core.Expr.eval (fun (x_1 : ) => x) exprExp 3

          Example: exp(x) ≤ 3 for all x ∈ [0, 1]. Since exp(1) ≈ 2.718, this bound holds. This uses the extended evaluator and requires direct proof.

          theorem LeanCert.Examples.Tactics.one_le_exp (x : ) :
          x I011 Core.Expr.eval (fun (x_1 : ) => x) exprExp

          Example: 1 ≤ exp(x) for all x ∈ [0, 1]. Since exp(0) = 1 and exp is increasing, this holds.

          Example: x + exp(x) ≤ 4 for all x ∈ [0, 1]. x ≤ 1 and exp(x) ≤ 3, so x + exp(x) ≤ 4.

          Example: 1 ≤ x + exp(x) for all x ∈ [0, 1]. x ≥ 0 and exp(x) ≥ 1, so x + exp(x) ≥ 1.