{"id":13600862,"url":"https://github.com/leanprover-community/batteries","last_synced_at":"2026-04-02T12:29:56.590Z","repository":{"id":58098670,"uuid":"529900532","full_name":"leanprover-community/batteries","owner":"leanprover-community","description":"The \"batteries included\" extended library for the Lean programming language and theorem prover","archived":false,"fork":false,"pushed_at":"2025-04-06T22:39:22.000Z","size":16543,"stargazers_count":291,"open_issues_count":78,"forks_count":118,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-06T22:39:50.297Z","etag":null,"topics":["lean","lean4"],"latest_commit_sha":null,"homepage":"","language":"Lean","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leanprover-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-28T15:23:46.000Z","updated_at":"2025-04-04T03:44:39.000Z","dependencies_parsed_at":"2023-10-16T06:42:30.965Z","dependency_job_id":"1c33e9b4-dee8-42ae-8561-40513ab0596e","html_url":"https://github.com/leanprover-community/batteries","commit_stats":null,"previous_names":["leanprover-community/batteries"],"tags_count":412,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fbatteries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fbatteries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fbatteries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leanprover-community%2Fbatteries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leanprover-community","download_url":"https://codeload.github.com/leanprover-community/batteries/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154981,"owners_count":21056543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lean","lean4"],"created_at":"2024-08-01T18:00:50.064Z","updated_at":"2025-12-29T23:41:45.412Z","avatar_url":"https://github.com/leanprover-community.png","language":"Lean","funding_links":[],"categories":["Repositories","Lean","Core packages"],"sub_categories":[],"readme":"# Batteries\n\nThe \"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.\n\n# Using `batteries`\n\nTo use `batteries` in your project, add the following to your `lakefile.lean`:\n```lean\nrequire \"leanprover-community\" / \"batteries\" @ git \"main\"\n```\nOr add the following to your `lakefile.toml`:\n```toml\n[[require]]\nname = \"batteries\"\nscope = \"leanprover-community\"\nrev = \"main\"\n```\n\nAdditionally, 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`](./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.\n\n# Build instructions\n\n* Get the newest version of `elan`. If you already have installed a version of Lean, you can run\n  ```sh\n  elan self update\n  ```\n  If the above command fails, or if you need to install `elan`, run\n  ```sh\n  curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh\n  ```\n  If this also fails, follow the instructions under `Regular install` [here](https://leanprover-community.github.io/get_started.html).\n* To build `batteries` run `lake build`.\n* To build and run all tests, run `lake test`.\n* To run the environment linter, run `lake lint`.\n* If you added a new file, run the command `scripts/updateBatteries.sh` to update the imports.\n\n# Documentation\n\nYou can generate `batteries` documentation with\n\n```sh\ncd docs\nlake build Batteries:docs\n```\n\nThe top-level HTML file will be located at `docs/doc/index.html`, though to actually expose the\ndocumentation you need to run an HTTP server (e.g. `python3 -m http.server`) in the `docs/doc` directory.\n\nNote that documentation for the latest nightly of `batteries` is also available as part of [the Mathlib 4\ndocumentation][mathlib4 docs].\n\n[mathlib4 docs]: https://leanprover-community.github.io/mathlib4_docs/Batteries.html\n\n# Contributing\n\nThe first step to contribute is to create a fork of Batteries.\nThen add your contributions to a branch of your fork and make a PR to Batteries.\nDo not make your changes to the main branch of your fork, that may lead to complications on your end.\n\nEvery pull request should have exactly one of the status labels `awaiting-review`, `awaiting-author`\nor `WIP` (in progress).\nTo change the status label of a pull request, add a comment containing one of these options and\n_nothing else_.\nThis will remove the previous label and replace it by the requested status label.\nThese labels are used for triage.\n\nOne of the easiest ways to contribute is to find a missing proof and complete it. The\n[`proof_wanted`](https://github.com/search?q=repo%3Aleanprover-community%2Fbatteries+language%3ALean+%2F^proof_wanted%2F\u0026type=code)\ndeclaration documents statements that have been identified as being useful, but that have not yet\nbeen proven.\n\n### Mathlib Adaptations\n\nBatteries PRs often affect Mathlib, a key component of the Lean ecosystem.\nWhen Batteries changes in a significant way, Mathlib must adapt promptly.\nWhen necessary, Batteries contributors are expected to either create an adaptation PR on Mathlib, or ask for assistance for and to collaborate with this necessary process.\n\nEvery Batteries PR has an automatically created [Mathlib Nightly Testing](https://github.com/leanprover-community/mathlib4-nightly-testing/) branch called `batteries-pr-testing-N` where `N` is the number of the Batteries PR.\nThis is a clone of Mathlib where the Batteries requirement points to the Batteries PR branch instead of the main branch.\nBatteries uses this branch to check whether the Batteries PR needs Mathlib adaptations.\nA tag `builds-mathlib` will be issued when this branch needs no adaptation; a tag `breaks-mathlib` will be issued when the branch does need an adaptation.\n\nThe first step in creating an adaptation PR is to switch to the `batteries-pr-testing-N` branch and push changes to that branch until the Mathlib CI process works.\nYou may need to ask for write access to [Mathlib Nightly Testing](https://github.com/leanprover-community/mathlib4-nightly-testing/) to do that.\nChanges to the Batteries PR will be integrated automatically as you work on this process.\nDo not redirect the Batteries requirement to main until the Batteries PR is merged.\nPlease ask questions to Batteries and Mathlib maintainers if you run into issues with this process.\n\nWhen everything works, create an adaptation PR on Mathlib from the `batteries-pr-testing-N` branch.\nYou may need to ping a Mathlib maintainer to review the PR, ask if you don't know who to ping.\nOnce the Mathlib adaptation PR and the original Batteries PR have been reviewed and accepted, the Batteries PR will be merged first. Then, the Mathlib PR's lakefile needs to be repointed to the Batteries main branch: change the Batteries line to\n```lean\nrequire \"leanprover-community\" / \"batteries\" @ git \"main\"\n```\nOnce CI once again checks out on Mathlib, the adaptation PR can be merged using the regular Mathlib process.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover-community%2Fbatteries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleanprover-community%2Fbatteries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleanprover-community%2Fbatteries/lists"}