The "batteries included" extended library for Lean 4. This is a collection of data structures and tactics intended for use by both computer-science applications and mathematics applications of Lean 4.
To use batteries
in your project, add the following to your lakefile.lean
:
require "leanprover-community" / "batteries" @ git "main"
Or add the following to your lakefile.toml
:
[[require]]
name = "batteries"
scope = "leanprover-community"
version = "main"
Additionally, please make sure that you're using the version of Lean that the current version of batteries
expects. The easiest way to do this is to copy the lean-toolchain
file from this repository to your project. Once you've added the dependency declaration, the command lake update
checks out the current version of batteries
and writes it the Lake manifest file. Don't run this command again unless you're prepared to potentially also update your Lean compiler version, as it will retrieve the latest version of dependencies and add them to the manifest.
- Get the newest version of
elan
. If you already have installed a version of Lean, you can runIf the above command fails, or if you need to installelan self update
elan
, runIf this also fails, follow the instructions undercurl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh
Regular install
here. - To build
batteries
runlake build
. - To build and run all tests, run
lake test
. - To run the environment linter, run
lake lint
. - If you added a new file, run the command
scripts/updateBatteries.sh
to update the imports.
You can generate batteries
documentation with
cd docs
lake build Batteries:docs
The top-level HTML file will be located at docs/doc/index.html
, though to actually expose the
documentation you need to run a HTTP server (e.g. python3 -m http.server
) in the docs/doc
directory.
Note that documentation for the latest nightly of batteries
is also available as part of the Mathlib 4
documentation.
Every pull request should have exactly one of the status labels awaiting-review
, awaiting-author
or WIP
(in progress).
To change the status label of a pull request, add a comment containing one of these options and
nothing else.
This will remove the previous label and replace it by the requested status label.
One of the easiest ways to contribute is to find a missing proof and complete it. The
proof_wanted
declaration documents statements that have been identified as being useful, but that have not yet
been proven.
In contrast to mathlib, batteries
uses pull requests from forks of this repository. Hence, no special permissions on this repository are required for new contributors.
You can change the labels on PRs by commenting one of awaiting-review
, awaiting-author
, or WIP
. This is helpful for triage.