- Download VSCode.
- Install Lean4 along with the Lean4 VSCode extension following these instructions. If
#eval Lean.versionStringgives you a Lean version in VSCode, that’s working correctly. If not, typeelan showin a terminal to check if Lean4 has been installed at all. git clonethis repository.- Open the folder of this repository and run the following commands (as described here):
This will download Mathlib4 including its cache files which you will then find in the folder
curl -L https://raw.githubusercontent.com/leanprover-community/mathlib4/master/lean-toolchain -o lean-toolchain lake update lake exe cache getlake-packages. - Restart the Lean server:
VSCode > Command-Shift-P > Lean 4: Restart. - Test that your install of Mathlib has worked. For example, you could create a file like this:
Make sure the language of that VSCode file (in the bottom-right-hand corner of VSCode) says
import Mathlib.Data.Vector.Basic #check Vectorlean4rather thanlean. It might take a while for Lean4 to build Mathlib in the background, you should see an info text that tells you the file that is currently being built. - (Temporary) In order to see the custom rendering of the infoview, a custom version of the Lean 4 VSCode extension is required. It can be found and install from the
widget\lean4fork-0.0.111.vsixfile after pressingCommand-Shift-P > Extensions : Install from VSIX...and then disabling the original Lean 4 VSCode extension. - (Optional, but recommended) Run
lake exe discrTreesto build and store the discrimination tree cache used for library search.
You can run lake build Tests to run all tests in the Tests folder.