Skip to content

Commit 90d1ba5

Browse files
authored
Merge pull request #532 from Seasawher/auto-update-branch
2 parents 498b885 + 20b5888 commit 90d1ba5

File tree

6 files changed

+241
-159
lines changed

6 files changed

+241
-159
lines changed

docs/attributes.md

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Attributes
22

3-
Mathlib version: `5b4465844e3feb231af0edb5ef1ab8e2523b08a7`
3+
Mathlib version: `6a54a80825b060ab20dc31751ebdce78b3a3b518`
44

55
## Std.Internal.tree_tac
66
simp theorems used by internal DTreeMap lemmas
@@ -240,6 +240,20 @@ the first success. If the term to be delaborated is an application of a constant
240240
for `app.c` are tried first; this is also done for `Expr.const`s ("nullary applications") to reduce
241241
special casing. If the term is an `Expr.mdata` with a single key `k`, `mdata.k` is tried first.
242242

243+
## builtin_doElem_elab
244+
(builtin) do element elaborator
245+
Registers a `do` element elaborator for the given syntax node kind.
246+
247+
A `do` element elaborator should have type `DoElab` (which is
248+
`Lean.Syntax → DoElemCont → DoElabM Expr`), i.e. should take syntax of the given syntax node kind
249+
and a `DoElemCont` as parameters and produce an expression.
250+
251+
When elaborating a `do` block `do e; rest`, the elaborator for `e` is invoked with the syntax of `e`
252+
and the `DoElemCont` representing `rest`.
253+
254+
The `elab_rules` and `elab` commands should usually be preferred over using this attribute
255+
directly.
256+
243257
## builtin_doElem_parser
244258
Builtin parser
245259

@@ -581,6 +595,20 @@ special casing. If the term is an `Expr.mdata` with a single key `k`, `mdata.k`
581595
## deprecated
582596
mark declaration as deprecated
583597

598+
## doElem_elab
599+
do element elaborator
600+
Registers a `do` element elaborator for the given syntax node kind.
601+
602+
A `do` element elaborator should have type `DoElab` (which is
603+
`Lean.Syntax → DoElemCont → DoElabM Expr`), i.e. should take syntax of the given syntax node kind
604+
and a `DoElemCont` as parameters and produce an expression.
605+
606+
When elaborating a `do` block `do e; rest`, the elaborator for `e` is invoked with the syntax of `e`
607+
and the `DoElemCont` representing `rest`.
608+
609+
The `elab_rules` and `elab` commands should usually be preferred over using this attribute
610+
directly.
611+
584612
## doElem_parser
585613
parser
586614

@@ -1500,11 +1528,6 @@ have to be assigned in the same file as the declaration.
15001528
Similar to `registerParametricAttribute` except that attributes do not
15011529
have to be assigned in the same file as the declaration.
15021530

1503-
## to_additive_relevant_arg
1504-
Auxiliary attribute for `to_additive` stating which arguments are the types with a multiplicative structure.
1505-
Similar to `registerParametricAttribute` except that attributes do not
1506-
have to be assigned in the same file as the declaration.
1507-
15081531
## to_app
15091532

15101533

@@ -1521,11 +1544,6 @@ have to be assigned in the same file as the declaration.
15211544
Similar to `registerParametricAttribute` except that attributes do not
15221545
have to be assigned in the same file as the declaration.
15231546

1524-
## to_dual_relevant_arg
1525-
Auxiliary attribute for `to_dual` stating which arguments are the types with a dual structure.
1526-
Similar to `registerParametricAttribute` except that attributes do not
1527-
have to be assigned in the same file as the declaration.
1528-
15291547
## trans
15301548
transitive relation
15311549

@@ -1534,6 +1552,10 @@ have to be assigned in the same file as the declaration.
15341552
Similar to `registerParametricAttribute` except that attributes do not
15351553
have to be assigned in the same file as the declaration.
15361554

1555+
## try_suggestion
1556+
Register a tactic suggestion generator for try? (runs after built-in tactics)
1557+
Register the @[try_suggestion prio] attribute
1558+
15371559
## try_tactic
15381560
try_tactic elaborator
15391561

docs/commands.md

Lines changed: 93 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Commands
22

3-
Mathlib version: `5b4465844e3feb231af0edb5ef1ab8e2523b08a7`
3+
Mathlib version: `6a54a80825b060ab20dc31751ebdce78b3a3b518`
44

55
## \#adaptation_note
66
Defined in: `adaptationNoteCmd`
@@ -407,6 +407,79 @@ The optional trailing `approx`, as in `#find_syntax "∘" approx`, is only inten
407407
more stable: rather than outputting the exact count of the overall number of existing syntax
408408
declarations, it returns its round-down to the previous multiple of 100.
409409
410+
## \#grind_lint
411+
Defined in: `Lean.Grind.grindLintSkip`
412+
413+
`#grind_lint skip thm₁ …` marks the given theorem(s) to be skipped entirely by `#grind_lint check`.
414+
Skipped theorems are neither analyzed nor reported, but may still be used for
415+
instantiation when analyzing other theorems.
416+
Example:
417+
```lean
418+
#grind_lint skip Array.range_succ
419+
```
420+
421+
## \#grind_lint
422+
Defined in: `Lean.Grind.grindLintMute`
423+
424+
`#grind_lint mute thm₁ …` marks the given theorem(s) as *muted* during linting.
425+
426+
Muted theorems remain in the environment but are not instantiated when running
427+
`#grind_lint check` or `#grind_lint inspect`.
428+
This is useful for suppressing noisy or recursive lemmas that cause excessive
429+
E-matching without removing their annotations.
430+
431+
Example:
432+
```lean
433+
#grind_lint mute Array.zip_map Int.zero_shiftRight
434+
```
435+
436+
## \#grind_lint
437+
Defined in: `Lean.Grind.grindLintInspect`
438+
439+
`#grind_lint inspect thm₁ …` analyzes the specified theorem(s) individually.
440+
441+
It always prints detailed statistics regardless of thresholds and is useful
442+
for investigating specific `grind` lemmas that may generate excessive
443+
instantiations.
444+
Examples:
445+
```lean
446+
#grind_lint inspect Array.zip_map
447+
```
448+
You can use `set_option trace.grind.ematch.instance true` to instruct `grind` to display the
449+
actual instances it produces.
450+
451+
## \#grind_lint
452+
Defined in: `Lean.Grind.grindLintCheck`
453+
454+
`#grind_lint check` analyzes all theorems annotated for theorem instantiation using E-matching.
455+
456+
It creates artificial goals and reports the number of instances each theorem produces.
457+
The command helps detect long or unbounded theorem instantiation chains.
458+
459+
Usage examples:
460+
```lean
461+
#grind_lint check
462+
#grind_lint check (min:=10) (detailed:=50)
463+
#grind_lint check in Foo Bar -- restrict analysis to these namespaces
464+
#grind_lint check in module Foo -- restrict analysis to theorems defined in module `Foo` or any of its submodules
465+
```
466+
467+
Options can include any valid `grind` configuration option, and `min` and `detailed`.
468+
- `min`: minimum number of instantiations to print a summary (default: 10)
469+
- `detailed`: minimum number of instantiations to print detailed breakdown (default: 50)
470+
If the option `trace.grind.*` is enabled, additional details are printed.
471+
472+
By default, `#grind_lint` uses the following `grind` configuration:
473+
```lean
474+
splits := 0
475+
lookahead := false
476+
mbtc := false
477+
ematch := 20
478+
instances := 100
479+
gen := 10
480+
```
481+
Consider using `#grind_lint inspect <thm>` to focus on specific theorems.
482+
410483
## \#guard
411484
Defined in: `Lean.Parser.Command.guardCmd`
412485

@@ -1527,6 +1600,10 @@ Defined in: `Lean.Elab.Tactic.commandConfigElab`
15271600
Defined in: `Lean.Elab.Tactic.configElab`
15281601

15291602

1603+
## declare_config_getter
1604+
Defined in: `Lean.Elab.elabConfigGetter`
1605+
1606+
15301607
## declare_int_theorems
15311608
Defined in: `commandDeclare_int_theorems__`
15321609

@@ -2310,6 +2387,14 @@ Registers a tactic tag, saving its user-facing name and docstring.
23102387

23112388
Tactic tags can be used by documentation generation tools to classify related tactics.
23122389

2390+
## register_try?_tactic
2391+
Defined in: `Lean.Parser.Command.registerTryTactic`
2392+
2393+
`register_try?_tactic tac` registers a tactic `tac` as a suggestion generator for the `try?` tactic.
2394+
2395+
An optional priority can be specified with `register_try?_tactic (priority := 500) tac`.
2396+
Higher priority generators are tried first. The default priority is 1000.
2397+
23132398
## reprove
23142399
Defined in: `Lean.Elab.Command.reprove`
23152400

@@ -2379,6 +2464,13 @@ commands. Sections can be nested. `section <id>` provides a label to the section
23792464
with the matching `end`. In either case, the `end` can be omitted, in which case the section is
23802465
closed at the end of the file.
23812466

2467+
## set_library_suggestions
2468+
Defined in: `Lean.setLibrarySuggestionsCmd`
2469+
2470+
Specify a library suggestion engine.
2471+
Note that Lean does not ship a default library suggestion engine,
2472+
so this is only useful in conjunction with a downstream package which provides one.
2473+
23822474
## set_option
23832475
Defined in: `Lean.Parser.Command.set_option`
23842476

@@ -2396,13 +2488,6 @@ set_option pp.all true in
23962488
Similarly, `set_option <id> <value> in` can also be used inside terms and tactics to set an option
23972489
only in a single term or tactic.
23982490

2399-
## set_premise_selector
2400-
Defined in: `Lean.setPremiseSelectorCmd`
2401-
2402-
Specify a premise selection engine.
2403-
Note that Lean does not ship a default premise selection engine,
2404-
so this is only useful in conjunction with a downstream package which provides one.
2405-
24062491
## show_panel_widgets
24072492
Defined in: `Lean.Widget.showPanelWidgetsCmd`
24082493

0 commit comments

Comments
 (0)