lean4-htt/src/Lean
David Thrane Christiansen 84e46162b5
feat: more infrastructure for tactic documentation (#4490)
This is the groundwork for a tactic index in generated documentation, as
there was in Lean 3. There are a few challenges to getting this to work
well in Lean 4:
* There's no natural notion of *tactic identity* - a tactic may be
specified by multiple syntax rules (e.g. the pattern-matching version of
`intro` is specified apart from the default version, but both are the
same from a user perspective)
* There's no natural notion of *tactic name* - here, we take the
pragmatic choice of using the first keyword atom in the tactic's syntax
specification, but this may need to be overridable someday.
* Tactics are extensible, but we don't want to allow arbitrary imports
to clobber existing tactic docstrings, which could become unpredictable
in practice.

For tactic identity, this PR introduces the notion of a *tactic
alternative*, which is a `syntax` specification that is really "the same
as" an existing tactic, but needs to be separate for technical reasons.
This provides a notion of tactic identity, which we can use as the basis
of a tactic index in generated documentation. Alternative forms of
tactics are specified using a new `@[tactic_alt IDENT]` attribute,
applied to the new tactic syntax. It is an error to declare a tactic
syntax rule to be an alternative of another one that is itself an
alternative. Documentation hovers now take alternatives into account,
and display the docs for the canonical name.

*Tactic tags*, created with the `register_tactic_tag` command, specify
tags that may be applied to tactics. This is intended to be used by
doc-gen and Verso. Tags may be applied using the `@[tactic_tag TAG1 TAG2
...]` attribute on a canonical tactic parser, which may be used in any
module to facilitate downstream projects introducing tags that apply to
pre-existing tactics. Tags may not be removed, but it's fine to
redundantly add them. The collection of tags, and the tactics to which
they're applied, can be seen using the `#print tactic tags` command.

*Extension documentation* provides a structured way to document
extensions to tactics. The resulting documentation is gathered into a
bulleted list at the bottom of the tactic's docstring. Extensions are
added using the `tactic_extension TAC` command. This can be used when
adding new interpretations of a tactic via `macro_rules`, when extending
some table or search index used by the tactic, or in any other way. It
is a command to facilitate its flexible use with various extension
mechanisms.
2024-06-21 12:49:30 +00:00
..
Compiler fix: validate UTF-8 at C++ -> Lean boundary (#3963) 2024-06-19 14:05:48 +00:00
Data chore: cleanup PersistentHashMap.lean 2024-06-19 20:21:34 +02:00
DocString feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
Elab feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
Language chore: slightly more informative trace.Elab.snapshotTree 2024-06-11 10:44:04 +02:00
Linter feat: add a linter for local vars that clash with their constructors (#4301) 2024-06-14 13:03:09 +00:00
Meta feat: complete Int div/mod simprocs (#3850) 2024-06-20 04:42:31 +00:00
Parser feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
ParserCompiler feat: reserved names (#3675) 2024-03-15 00:33:22 +00:00
PrettyPrinter chore: missing registerTraceClass (#4369) 2024-06-06 00:53:16 +00:00
Server feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
Util chore: fix linter errors (#4502) 2024-06-19 18:24:08 +00:00
Widget feat: widget messages (#4254) 2024-05-29 06:37:42 +00:00
AddDecl.lean feat: propagate maxHeartbeats to kernel (#4113) 2024-05-09 17:44:19 +00:00
Attributes.lean chore: fix linter errors (#4502) 2024-06-19 18:24:08 +00:00
AuxRecursor.lean refactor: constructions: modify environment in lean world (#4474) 2024-06-19 08:58:53 +00:00
BuiltinDocAttr.lean feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
Class.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Compiler.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
CoreM.lean fix: incorrect info tree reuse (#4340) 2024-06-04 09:28:40 +00:00
Data.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Declaration.lean refactor: constructions: modify environment in lean world (#4474) 2024-06-19 08:58:53 +00:00
DeclarationRange.lean feat: snapshot trees and language processors (#3014) 2024-03-14 13:40:08 +00:00
DocString.lean feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
Elab.lean feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
Environment.lean doc: more detailed docstring for PersistentEnvExtension (#4501) 2024-06-21 08:34:04 +00:00
Eval.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Exception.lean feat: apply’s error message should show implicit arguments as needed (#3929) 2024-05-18 06:25:43 +00:00
Expr.lean feat: shorten auto-generated instance names (#3089) 2024-04-13 18:08:50 +00:00
HeadIndex.lean chore: fix linter errors (#4502) 2024-06-19 18:24:08 +00:00
Hygiene.lean chore: remove the coercion from String to Name (#3589) 2024-03-21 23:46:03 +00:00
ImportingFlag.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
InternalExceptionId.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
KeyedDeclsAttribute.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
LabelAttribute.lean chore: reorganising to reduce imports (#3790) 2024-03-27 11:15:01 +00:00
LazyInitExtension.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Level.lean chore: remove partial TODO (#4380) 2024-06-06 18:04:55 +00:00
Linter.lean feat: add a linter for local vars that clash with their constructors (#4301) 2024-06-14 13:03:09 +00:00
LoadDynlib.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
LocalContext.lean chore: upstream omega (#3367) 2024-02-19 00:19:55 +00:00
Log.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Message.lean feat: default pp if pp expr/syntax/level without context (#4433) 2024-06-14 08:55:49 +00:00
Meta.lean feat: improve set_option diagnostics true (#4031) 2024-04-30 05:07:03 +00:00
MetavarContext.lean fix: eta reduce mvar assignments in isDefEq (#4387) 2024-06-18 23:41:40 +00:00
Modifiers.lean refactor: constructions: modify environment in lean world (#4474) 2024-06-19 08:58:53 +00:00
MonadEnv.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Parser.lean feat: more infrastructure for tactic documentation (#4490) 2024-06-21 12:49:30 +00:00
ParserCompiler.lean refactor: Offset.lean and related files (#3614) 2024-03-05 19:40:15 -08:00
PrettyPrinter.lean feat: use lazy MessageData for omega errors (#4360) 2024-06-14 20:21:37 +00:00
ProjFns.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
ReducibilityAttrs.lean chore: fix linter errors (#4502) 2024-06-19 18:24:08 +00:00
Replay.lean feat: propagate maxHeartbeats to kernel (#4113) 2024-05-09 17:44:19 +00:00
ReservedNameAction.lean fix: FunInd: support structural recursion on reflexive types (#4327) 2024-06-05 07:54:48 +00:00
ResolveName.lean feat: open _root_.<namespace> (#4505) 2024-06-19 21:59:46 +00:00
Runtime.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
ScopedEnvExtension.lean feat: flexible reducibility attributes 2024-04-29 05:46:11 +02:00
Server.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
Structure.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00
SubExpr.lean fix: use correct expr positions when delaborating match patterns (#4034) 2024-05-01 12:02:10 +00:00
Syntax.lean fix: incremental reuse leading to goals in front of the text cursor being shown (#4395) 2024-06-08 15:08:14 +00:00
ToExpr.lean feat: support idents in auto tactics (#3328) 2024-05-03 04:37:07 +00:00
Util.lean chore: upstream exact? and apply? from Std (#3447) 2024-02-23 21:55:24 +00:00
Widget.lean perf: add prelude to all Lean modules 2024-02-18 14:55:17 -08:00