Beyond arithmetic and simplification, Mathlib offers a collection of automation tactics that can close whole classes of goals with minimal user input. These range from complete decision procedures for finite computations (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/leanprover-community/mathlib4/llms.txt
Use this file to discover all available pages before exploring further.
decide, native_decide) through propositional logic solvers (tauto) and general proof search (aesop) to domain-specific provers for positivity, continuity, measurability, and other function properties. Knowing which tool fits a given goal can make the difference between a one-line proof and a lengthy manual argument.
decide and native_decide
decide proves any goal whose type is a Decidable proposition by running the kernel’s evaluator on the decision procedure. It is complete for decidable goals but can be very slow for large computations because the Lean kernel performs each reduction step in the type theory.
native_decide works identically but compiles the decision procedure to native code before running it. This makes it orders of magnitude faster for computationally intensive goals, such as primality tests or large finite-set membership checks.
- Basic decide
- native_decide
tauto
tauto (also written itauto for the intuitionistic version) proves propositional tautologies in classical logic. It handles goals built from ∧, ∨, →, ¬, ↔, True, and False by exhaustive case analysis.
tauto works on propositional goals only — it does not understand quantifiers or arithmetic. For goals mixing logic and arithmetic, use aesop or a manual decomposition.aesop
aesop is Mathlib’s general-purpose proof search tactic. It combines forward reasoning, backward chaining, and simp-based normalization to explore a search tree of possible proof steps. It is extensible: users and library authors can tag lemmas with @[aesop] to register them as search rules.
Customizing aesop with @[aesop]
Customizing aesop with @[aesop]
You can register your own lemmas as See the
aesop rules using the @[aesop] attribute:Mathlib.Tactic.Aesop documentation for the full rule syntax.positivity
positivity proves goals of the form 0 ≤ e, 0 < e, or e ≠ 0 by decomposing the expression e and applying positivity/nonnegativity lemmas for each operation. It understands:
- Arithmetic:
+,*,^,/,|·|(absolute value) - Special functions:
Real.sqrt,n !(factorial),Nat.choose - Sums and products:
∑,∏ - Conditional expressions:
ite,max,min
- Positivity extensions
- With hypotheses
positivity is extensible via the @[positivity] attribute. Mathlib uses this to teach it about Real.sqrt, Nat.factorial, abs, and many other functions. You can write your own positivity extensions for custom operations.continuity
continuity proves goals of the form Continuous f, ContinuousAt f x, or ContinuousOn f s by composing continuity lemmas. It works by breaking down the function into primitive components (arithmetic operations, polynomials, standard functions) and applying the corresponding lemmas.
fun_prop
fun_prop is the general-purpose tactic for proving function property goals. It subsumes continuity and measurability and can prove goals about:
Continuous,ContinuousAt,ContinuousOnMeasurable,MeasurableSet,AEMeasurableDifferentiable,DifferentiableAt,DifferentiableOnHasFDerivAt,HasDerivAtIntegrable,AEStronglyMeasurable- Any property registered with
@[fun_prop]
Registering custom function properties with fun_prop
Registering custom function properties with fun_prop
To make
fun_prop aware of a new property MyProp, register it with the @[fun_prop] attribute:measurability
measurability proves Measurable f and MeasurableSet s goals by composing measurability lemmas. Like continuity, it has been largely superseded by fun_prop, but it remains available and still works for many standard goals.
fun_prop is the preferred tactic in current Mathlib.