lean4-htt/doc/quickstart.md
2021-12-19 17:23:25 +01:00

1.7 KiB

Quickstart

These instructions will walk you through setting up Lean using the "basic" setup and VS Code as the editor. See Setup for other ways and more details on setting up Lean.

  1. Install the latest Lean 4 nightly through elan: in any bash-compatible shell, run

    curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- --default-toolchain leanprover/lean4:nightly
    

    On Windows, instead run in cmd

    curl -O --location https://raw.githubusercontent.com/leanprover/elan/master/elan-init.ps1
    powershell -f elan-init.ps1 --default-toolchain leanprover/lean4:nightly
    del elan-init.ps1
    

    See the elan repo for other installation options and details.

  2. Install VS Code.

  3. Open VS Code and install the lean4 extension.

    installing the vscode-lean4 extension

  4. Create a new file with the extension .lean and add the following code:

    #eval Lean.versionString
    

    You should get a syntax-highlighted file with a "Lean Infoview" on the right that tells you the installed Lean version when placing your cursor on the last line.

    successful setup

  5. You are set up! You can now also run lake init foo from the command line to create a package, followed by lake build to get an executable version of your Lean program.

Note: Packages have to be opened using "File > Open Folder..." for imports to work. Saved changes are visible in other files after running "Lean 4: Refresh File Dependencies" (Ctrl+Shift+X).