We have installation instructions for Windows, Linux, and MacOS. As a backup plan, we prepared a virtual machine on which Lean is already installed.
Windows
-
Install Git for Windows: https://gitforwindows.org/. Accept all default answers during the installation (or, if you would like to minimize the installation, you may deselect all components on the "Select components" question).
-
Start the newly installed
Git Bash
by searching for it in the Windows search bar. -
In Git Bash, run the command
curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh
. -
Press
[Enter]
to proceed with the installation. -
Run
echo 'PATH="$HOME/.elan/bin:$PATH"' >> $HOME/.profile
. -
Close Git Bash.
- Download the Python installer and run it.
- Check
Add Python 3.7 to PATH
. - Click on
Install Now
. - Navigate to the folder where Python was installed. A reliable way to do this is to search for
python
in the Start Menu -> right clickPython 3.x (xx-bit)
-> open file location -> right clickPython 3.x (xx-bit)
-> open file location. The default location is something likeC:\Users\<user>\AppData\Local\Programs\Python\Python37-32
. - Create a copy of the file
python.exe
calledpython3.exe
. - Open Git Bash (type
Git Bash
in the Start Menu). - Test whether everything is working by typing
python3 --version
andpip3 --version
. If both commands give a short output and no error, everything is set up correctly. - If
pip3 --version
doesn't give any output, run the commandpython3 -m pip install --upgrade pip
, which should fix it.
- Run
git config --global core.autocrlf input
in Git Bash.
-
in Git Bash, run
-
curl https://raw.githubusercontent.com/leanprover-community/mathlib-tools/master/scripts/remote-install-update-mathlib.sh -sSf | bash
-
source ~/.profile
-
-
Install VSCode. (You can accept all default options.)
-
Launch VSCode.
-
Click on the extension icon . (or in older versions) in the side bar on the left edge of the screen (or press
Shift-Ctrl-c
) and search forleanprover
. -
Click "Install" and wait for the installation to complete. Click the "Reload" button if it appears.
-
Press
ctrl-shift-p
to open the command palette, and typeSelect Default Shell
, press enter, then selectgit bash
from the menu. -
Check that Lean is working: Create a new file using
ctrl-N
, save it usingctrl-S
, and name ittest.lean
in an arbitrary directory. Write#eval 1+1
into the new file. A green line should appear underneath#eval 1+1
, and hovering the mouse over it you should see2
displayed.
-
Close VSCode.
-
Open Git Bash.
-
In Git Bash, use
cd
to go to the directory you want to place the project in (a new folder will be created for it at that location). For instance, you can usecd ~/Documents
to go to your personal Documents folder. -
Run these commands in Git Bash:
-
git clone https://github.com/blanchette/logical_verification_2019
-
cd logical_verification_2019
-
leanpkg configure
-
update-mathlib
-
leanpkg build
-
-
Launch VSCode.
-
In the
File
menu, clickOpen Folder
, and choose the folderlogical_verification_2019
(not one of its subfolders). If you used~/Documents
above, it will be located in yourDocuments
folder. -
In the file explorer on the left-hand side, you will find all exercises and homework in the
lean
folder, as we upload them. -
You can retrieve the newest exercises and homework that we upload by clicking the two arrows forming a circle in the bottom left corner.
Debian/Ubuntu and Derivates
-
Open a terminal.
-
wget -q https://raw.githubusercontent.com/leanprover-community/mathlib-tools/master/scripts/install_debian.sh && bash install_debian.sh ; rm -f install_debian.sh && source ~/.profile
(will take some time)
-
Use
cd
to go to the directory you want to place the project in. (A new folder will be created for it at that location.) -
git clone https://github.com/blanchette/logical_verification_2019
. -
cd logical_verification_2019
. -
leanpkg configure
. -
update-mathlib
. -
leanpkg build
. -
Launch VScode, either through your application menu or by typing
code
. -
On the main screen, or in the
File
menu, clickOpen Folder
, and choose the folderlogical_verification_2019
(not one of its subfolders). -
In the file explorer on the left-hand side, you will find all exercises and homework in the
lean
folder, as we upload them. -
You can retrieve the newest exercises and homework that we upload by clicking the two arrows forming a circle in the bottom left corner.
Other Linux Distros
Follow these instructions and proceed by the instructions "Install our logical verification repository" for Debian/Ubunutu above.
macOS
-
Open a terminal.
-
Install homebrew by running
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
. Press enter to continue and enter your password. -
Run
brew install gmp coreutils
. -
Run
curl https://raw.githubusercontent.com/Kha/elan/master/elan-init.sh -sSf | sh
. Hit enter to proceed with the installation. -
Run
source $HOME/.elan/env
. -
Run
curl https://raw.githubusercontent.com/leanprover-community/mathlib-tools/master/scripts/remote-install-update-mathlib.sh -sSf | bash
. Pressy
if you are asked whether you want to install python3 and pip3. -
Run
source ~/.profile
.
-
Download VSCode. Open
Finder
, click onDownloads
, and drag the downloaded fileVisual Studio Code
intoApplications
. -
Open
Launchpad
and launchVisual Studio Code
. AddVisual Studio Code
to your Dock by right-clicking on the icon to bring up the context menu and choosingOptions
,Keep in Dock
. -
Click on the extension icon (or in older versions) in the side bar on the left edge of the screen (or press
Shift-Command-X
) and search forleanprover
. -
Click
Install
. -
Check that Lean is working: Create a new file using
Command-N
, save it usingCommand-S
, and name ittest.lean
in an arbitrary directory. Write#eval 1+1
into the new file. A green line should appear underneath#eval 1+1
, and hovering the mouse over it you should see2
displayed.
-
Open a terminal.
-
Use
cd
to go to the directory you want to place the project in (a new folder will be created for it at that location), for example you can use~/Documents
. -
Run
git clone https://github.com/blanchette/logical_verification_2019
. -
Run
cd logical_verification_2019
. -
Run
leanpkg configure
. -
Run
update-mathlib
. -
Run
leanpkg build
. -
Open VScode again.
-
In the
File
menu, clickOpen
, and choose the folderlogical_verification_2019
(not one of its subfolders). If you used~/Documents
above, it will be in theDocuments
folder. -
In the file explorer on the left-hand side, you will find all exercises and homework in the
lean
folder, as we upload them. -
You can retrieve the newest exercises and homework that we upload by clicking the two arrows forming a circle in the bottom left corner.
Virtual Machine (for Any Operating System)
-
Download and install VirtualBox. (Other virtualization software should also work.)
-
Download the virtual machine from https://drive.google.com/drive/folders/15R22c3iiYn4a2USkOFU6PvW6KbsS4-B0?usp=sharing.
-
Open VirtualBox.
-
Import the downloaded file via
File > Import Appliance
. -
Select the
.ova
file you downloaded, clickContinue
and thenImport
. -
Start the virtual machine by selecting
logical_verification_2019
and clicking theStart
button and wait for the system to boot. -
Open VSCode by clicking on the blue ribbon icon on the left.
-
If you need the password for the virtual machine at some point, it is
love
.