Tactic linters #
This file defines passes to run from the tactic analysis framework.
lia is an alias for the cutsat tactic, which solves linear integer arithmetic goals.
Equations
- tacticLia = Lean.ParserDescr.node `tacticLia 1024 (Lean.ParserDescr.nonReservedSymbol "lia" false)
Instances For
Define a pass that tries replacing one terminal tactic with another.
newTacticName is a human-readable name for the tactic, for example "linarith".
This can be used to group messages together, so that ring, ring_nf, ring1, ...
all produce the same message.
oldTacticKind is the SyntaxNodeKind for the tactic's main parser,
for example Mathlib.Tactic.linarith.
newTactic stx goal selects the new tactic to try, which may depend on the old tactic invocation
in stx and the current goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define a pass that tries replacing a specific tactic with grind.
tacticName is a human-readable name for the tactic, for example "linarith".
This can be used to group messages together, so that ring, ring_nf, ring1, ...
all produce the same message.
tacticKind is the SyntaxNodeKind for the tactic's main parser,
for example Mathlib.Tactic.linarith.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Debug grind by identifying places where it does not yet supersede linarith.
Debug grind by identifying places where it does not yet supersede linarith.
Equations
- linarithToGrindRegressions = Mathlib.TacticAnalysis.grindReplacementWith "linarith" `Mathlib.Tactic.linarith
Instances For
Debug grind by identifying places where it does not yet supersede ring.
Debug grind by identifying places where it does not yet supersede ring.
Equations
- ringToGrindRegressions = Mathlib.TacticAnalysis.grindReplacementWith "ring" `Mathlib.Tactic.RingNF.ring
Instances For
Debug lia by identifying places where it does not yet supersede omega.
Debug lia by identifying places where it does not yet supersede omega.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Report places where omega can be replaced by lia.
Report places where omega can be replaced by lia.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Suggest merging two adjacent rw tactics if that also solves the goal.
Suggest merging two adjacent rw tactics if that also solves the goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Suggest merging tac; grind into just grind if that also solves the goal.
Suggest merging tac; grind into just grind if that also solves the goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Suggest replacing a sequence of tactics with grind if that also solves the goal.
Suggest replacing a sequence of tactics with grind if that also solves the goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
When running the "tryAtEachStep" tactic analysis linters,
only run on a fraction 1/n of the goals found in the library.
This is useful for running quick benchmarks.
Whether to show timing information in "tryAtEachStep" tactic analysis output.
When true (default), messages include elapsed time like (23ms).
Set to false in tests to avoid non-deterministic output.
Whether to report when a tactic can be replaced with itself.
When true (default), all successful replacements are reported, including when the suggested tactic matches the existing proof. When false, self-replacements are suppressed.
Run a tactic at each proof step, with optional timing.
label is an optional human-readable name for output. If none, the tactic syntax is used.
Reports elapsed time in milliseconds for each successful replacement
when linter.tacticAnalysis.tryAtEachStep.showTiming is true.
When linter.tacticAnalysis.tryAtEachStep.selfReplacements is false, cases where
the suggested tactic matches the existing proof are suppressed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run a tactic at each proof step. See tryAtEachStepCore for details.
Instances For
Run a tactic (given as a string) at each proof step, with optional timing.
label is the human-readable name shown in output (e.g., "grind").
tacticStr is the tactic syntax as a string (e.g., "grind +suggestions").
Tactic sequences like "simp; grind" are also supported.
Reports elapsed time in milliseconds for each successful replacement
when linter.tacticAnalysis.tryAtEachStep.showTiming is true.
To limit tactic runtime, use set_option maxHeartbeats N in the build command.
When linter.tacticAnalysis.tryAtEachStep.selfReplacements is false, cases where
the suggested tactic matches the existing proof are suppressed.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run a custom tactic at each proof step, configured via environment variables.
Reads from environment variables:
TRY_AT_EACH_STEP_TACTIC: Tactic syntax to try (e.g., "grind +suggestions") - requiredTRY_AT_EACH_STEP_LABEL: Human-readable label for output (optional, defaults to tactic)
If TRY_AT_EACH_STEP_TACTIC is missing, this linter does nothing.
To enable, add to the mathlibOnlyLinters array in lakefile.lean:
⟨`linter.tacticAnalysis.tryAtEachStepFromEnv, true⟩,
Then run with the environment variable:
TRY_AT_EACH_STEP_TACTIC="grind +suggestions" lake build Mathlib
This generic entry point is used by the hammer-bench benchmarking tool (https://github.com/leanprover-community/hammer-bench) to test arbitrary tactics without requiring Mathlib code changes for each new tactic variant.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run grind at every step in proofs, reporting where it succeeds.
Run grind at every step in proofs, reporting where it succeeds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run simp_all at every step in proofs, reporting where it succeeds.
Run simp_all at every step in proofs, reporting where it succeeds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run aesop at every step in proofs, reporting where it succeeds.
Run aesop at every step in proofs, reporting where it succeeds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run grind +suggestions at every step in proofs, reporting where it succeeds.
Run grind +suggestions at every step in proofs, reporting where it succeeds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run simp_all? +suggestions at every step in proofs, reporting where it succeeds.
Run simp_all? +suggestions at every step in proofs, reporting where it succeeds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run a custom tactic at every step in proofs, configured via environment variables.
Set TRY_AT_EACH_STEP_TACTIC to the tactic syntax to try (required).
Set TRY_AT_EACH_STEP_LABEL to the label for output messages (optional, defaults to tactic).
Run a custom tactic at every step in proofs, configured via environment variables.
Set TRY_AT_EACH_STEP_TACTIC to the tactic syntax to try (required).
Set TRY_AT_EACH_STEP_LABEL to the label for output messages (optional, defaults to tactic).
Instances For
Suggest merging two adjacent intro tactics which don't pattern match.
Suggest merging two adjacent intro tactics which don't pattern match.
Equations
- One or more equations did not get rendered due to their size.