#list_unused_decls is a command used for theory development.
When writing a new theory one often tries
multiple variations of the same definitions:
foo₃, etc. Once the main definition or theorem has been written,
it's time to clean up and the file can contain a lot of dead code.
Mark the main declarations with
#list_unused_decls will show the declarations in the file
that are not needed to define the main declarations.
Some of the so-called "unused" declarations may turn out to be useful
after all. The oversight can be corrected by marking those as
#list_unused_decls will revise the list of
unused declarations. By default, the list of unused declarations will
not include any dependency of the main declarations.
@[main_declaration] attribute should be removed before submitting
code to mathlib as it is merely a tool for cleaning up a module.
#list_unused_decls lists the declarations that that
are not used the main features of the present file. The main features
of a file are taken as the declaration tagged with
A list of files can be given to
#list_unused_decls as follows:
They are given in a list that contains file names written as Lean
strings. With a list of files, the declarations from all those files
in addition to the declarations above
#list_unused_decls in the
current file will be considered and their interdependencies will be
analyzed to see which declarations are unused by declarations marked
@[main_declaration]. The files listed must be imported by the
current file. The path of the file names is expected to be relative to
the root of the project (i.e. the location of
leanpkg.toml when it
@[main_declaration] should appear
in a finished mathlib development.