Zulip Chat Archive
Stream: mathlib4
Topic: Referencing mathlib 4 from module
Paul Chisholm (Nov 13 2021 at 00:49):
I create a Lean 4 package with leanpkg init
using the latest nightly. How do I then reference mathlib4
from modules in that package.
Paul Chisholm (Nov 13 2021 at 00:51):
To clarify, I don't mean how to import, I mean how to get mathlib4
on some search path so it is picked by imports in VS Code.
Scott Morrison (Nov 13 2021 at 09:32):
You probably want to switch from using leanpkg
to using lake
(which will be replacing it).
Scott Morrison (Nov 13 2021 at 09:32):
See https://github.com/leanprover/lake#creating-and-building-a-package
Scott Morrison (Nov 13 2021 at 09:34):
A minimal lakefile.lean
that depends on mathlib4 might be:
import Lake
open Lake DSL System
package my_package
{ dependencies := #[
{ name := "mathlib",
src := Source.git "https://github.com/leanprover-community/mathlib4.git", }], }
Paul Chisholm (Nov 14 2021 at 00:20):
Thanks very much, I have it working. A couple of things:
- I replaced the
,
after the URL string with"eaab772ea564d50801dc2a42af857a49038b8a54"
to make it type check, picking up that string from the last commit in GitHub. Do I always have to include a specific value, and if so is the one I used correct? - I notice the mathlib module
lean-toolchain
references a specific nightly. If the nightly my package uses is different, could that cause conflict?
Mac (Nov 14 2021 at 00:44):
@Paul Chisholm Yes on all accounts.
Last updated: Dec 20 2023 at 11:08 UTC