Skip to content

Set up local mathlib installation support#247

Open
alok wants to merge 1 commit into
mainfrom
push-qnnxtynuquyy
Open

Set up local mathlib installation support#247
alok wants to merge 1 commit into
mainfrom
push-qnnxtynuquyy

Conversation

@alok
Copy link
Copy Markdown
Contributor

@alok alok commented Sep 18, 2025

This change allows using a locally-built mathlib4 installation instead of fetching from git. This is useful for:

  • CI/CD pipelines with pre-built mathlib on S3
  • Local development with custom mathlib modifications
  • Faster builds by avoiding mathlib recompilation

Setup Instructions

To use this configuration:

  1. Clone mathlib4 as a sibling directory to vericoding3: bash cd .. # Go to parent of vericoding3 git clone https://github.com/leanprover-community/mathlib4 cd mathlib4 git checkout v4.23.0-rc2 # Match the version we were using

  2. Build mathlib (this will take significant time on first build): bash cd mathlib4 lake build

  3. Optional but recommended: Use mathlib cache for faster setup: bash lake exe cache get

  4. Return to vericoding3 and build: bash cd ../vericoding3 lake build

For S3/CI Deployment

For S3-based deployment, the mathlib4 directory should be:

  • Pre-built with the correct version (v4.23.0-rc2)
  • Placed as a sibling directory to this repository
  • Include the .lake/build directory with compiled oleans

The relative path ../mathlib4 assumes the following directory structure:

parent-directory/
├── vericoding3/
│   └── lakefile.lean (this file)
└── mathlib4/
    ├── .lake/
    │   └── build/  # Pre-compiled oleans
    └── Mathlib/

This change allows using a locally-built mathlib4 installation instead of fetching from git.
This is useful for:
- CI/CD pipelines with pre-built mathlib on S3
- Local development with custom mathlib modifications
- Faster builds by avoiding mathlib recompilation

## Setup Instructions

To use this configuration:

1. Clone mathlib4 as a sibling directory to vericoding3:
   ```bash
   cd ..  # Go to parent of vericoding3
   git clone https://github.com/leanprover-community/mathlib4
   cd mathlib4
   git checkout v4.23.0-rc2  # Match the version we were using
   ```

2. Build mathlib (this will take significant time on first build):
   ```bash
   cd mathlib4
   lake build
   ```

3. Optional but recommended: Use mathlib cache for faster setup:
   ```bash
   lake exe cache get
   ```

4. Return to vericoding3 and build:
   ```bash
   cd ../vericoding3
   lake build
   ```

## For S3/CI Deployment

For S3-based deployment, the mathlib4 directory should be:
- Pre-built with the correct version (v4.23.0-rc2)
- Placed as a sibling directory to this repository
- Include the .lake/build directory with compiled oleans

The relative path ../mathlib4 assumes the following directory structure:
```
parent-directory/
├── vericoding3/
│   └── lakefile.lean (this file)
└── mathlib4/
    ├── .lake/
    │   └── build/  # Pre-compiled oleans
    └── Mathlib/
```
@alok alok requested a review from shaoweilin September 18, 2025 06:48
Copy link
Copy Markdown
Contributor

@TheodoreEhrenborg TheodoreEhrenborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we wait to merge this until we've done the s3 setup? Right now we don't have mathlib4 installed locally

Although the lean CI is still working on this PR? Not sure what's going on there

Making lake exe cache get more reliable would be nice, but the current workaround (falling back to a from-scratch build) is OK for now https://beneficialaif-jlt4758.slack.com/archives/C095QPZBALB/p1758139438372269?thread_ts=1758121047.933779&cid=C095QPZBALB

@alok
Copy link
Copy Markdown
Contributor Author

alok commented Sep 19, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants