@@ -6,7 +6,10 @@ Everything is done using the `leanproject` command-line tool. You can
6
6
use ` leanproject --help ` to get the list of available commands and
7
7
options.
8
8
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
10
13
11
14
The command to fetch an existing project from GitHub and make sure it
12
15
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
58
61
project ` leanpkg.toml ` (see the next section if you want to update this
59
62
commit and get the latest mathlib).
60
63
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
+
61
68
### Upgrading mathlib
62
69
63
70
In an existing project depending on mathlib, you can upgrade to the
@@ -66,15 +73,19 @@ latest mathlib version by running:
66
73
leanproject upgrade-mathlib
67
74
```
68
75
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
70
77
match the latest version compatible with mathlib. You can forbid such an
71
78
upgrade by using ` leanproject --no-lean-upgrade upgrade-mathlib ` .
72
79
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
+
73
84
## Advanced usage
74
85
75
86
### Global mathlib install
76
87
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:
78
89
```
79
90
leanproject global-install
80
91
```
@@ -85,20 +96,24 @@ projects. You can upgrade this project using:
85
96
leanproject global-upgrade
86
97
```
87
98
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
+
88
103
### Adding mathlib to an existing project
89
104
90
105
If you already have a Lean project but it doesn't use mathlib yet, you
91
106
can go to the project folder and run:
92
107
```
93
108
leanproject add-mathlib
94
109
```
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
96
111
match the latest version compatible with mathlib. You can forbid such an
97
112
upgrade by using ` leanproject --no-lean-upgrade add-mathlib ` .
98
113
99
114
### Project olean cache
100
115
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,
102
117
especially if the project has several git branches. Storing oleans is
103
118
done by:
104
119
```
@@ -131,6 +146,10 @@ You can force download by running
131
146
` leanproject --force-download get-cache ` . This ` --force-download ` option
132
147
can also be used with the ` upgrade-mathlib ` command.
133
148
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
+
134
153
### Import graphs
135
154
136
155
If you want to generate a graph file showing your project import
0 commit comments