Skip to content

Commit 5bb10c4

Browse files
leanproject.md: specify Lean 3, discourage global mathlib, remind VS Code users to restart Lean (#164)
Co-authored-by: Rob Lewis <[email protected]>
1 parent 9efa3a0 commit 5bb10c4

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

templates/leanproject.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ Everything is done using the `leanproject` command-line tool. You can
66
use `leanproject --help` to get the list of available commands and
77
options.
88

9-
### Getting an existing Lean project
9+
`leanproject` only supports Lean 3. If you are using Lean 4, the information
10+
on this page is not relevant.
11+
12+
### Getting an existing Lean 3 project
1013

1114
The command to fetch an existing project from GitHub and make sure it
1215
includes a copy of mathlib ready to go is `leanproject get name` where
@@ -58,6 +61,10 @@ to download a compiled mathlib at the commit currently specified in the
5861
project `leanpkg.toml` (see the next section if you want to update this
5962
commit and get the latest mathlib).
6063

64+
If you have Lean 3 in VS Code open, you should restart Lean by opening the
65+
command palette with `ctrl`+`p` (`cmd`+`p` on macOS) and running the
66+
"Lean: Restart server" command.
67+
6168
### Upgrading mathlib
6269

6370
In an existing project depending on mathlib, you can upgrade to the
@@ -66,15 +73,19 @@ latest mathlib version by running:
6673
leanproject upgrade-mathlib
6774
```
6875
This can be abbreviated to `leanproject up`.
69-
By default, this will update the version of Lean used by this project to
76+
By default, this will update the version of Lean 3 used by this project to
7077
match the latest version compatible with mathlib. You can forbid such an
7178
upgrade by using `leanproject --no-lean-upgrade upgrade-mathlib`.
7279

80+
If you have Lean 3 in VS Code open, you should restart Lean by opening the
81+
command palette with `ctrl`+`p` (`cmd`+`p` on macOS) and running the
82+
"Lean: Restart server" command.
83+
7384
## Advanced usage
7485

7586
### Global mathlib install
7687

77-
If you want to use mathlib outside of a Lean project, you can run:
88+
If you want to use mathlib outside of a Lean 3 project, you can run:
7889
```
7990
leanproject global-install
8091
```
@@ -85,20 +96,24 @@ projects. You can upgrade this project using:
8596
leanproject global-upgrade
8697
```
8798

99+
This is generally discouraged, as this can lead to trouble if you end up
100+
working with Lean 3 projects that depend on different versions of Lean 3 /
101+
mathlib.
102+
88103
### Adding mathlib to an existing project
89104

90105
If you already have a Lean project but it doesn't use mathlib yet, you
91106
can go to the project folder and run:
92107
```
93108
leanproject add-mathlib
94109
```
95-
By default, this will update the version of Lean used by this project to
110+
By default, this will update the version of Lean 3 used by this project to
96111
match the latest version compatible with mathlib. You can forbid such an
97112
upgrade by using `leanproject --no-lean-upgrade add-mathlib`.
98113

99114
### Project olean cache
100115

101-
In any Lean project, it can be useful to store and retrieve olean files,
116+
In any Lean 3 project, it can be useful to store and retrieve olean files,
102117
especially if the project has several git branches. Storing oleans is
103118
done by:
104119
```
@@ -131,6 +146,10 @@ You can force download by running
131146
`leanproject --force-download get-cache`. This `--force-download` option
132147
can also be used with the `upgrade-mathlib` command.
133148

149+
If you have Lean 3 in VS Code open, you should restart Lean by opening the
150+
command palette with `ctrl`+`p` (`cmd`+`p` on macOS) and running the
151+
"Lean: Restart server" command.
152+
134153
### Import graphs
135154

136155
If you want to generate a graph file showing your project import

0 commit comments

Comments
 (0)