Zulip Chat Archive

Stream: new members

Topic: Using Lake to import std


Philip Zucker (Feb 07 2023 at 15:08):

Hi, I'm having difficulty getting the lean4 standard lib to import successfully using lake (or any other method). The repo is here https://github.com/philzook58/philzook58.github.io/tree/master/_notes/Languages/lean/myproject vscode keeps saying unknown package 'Std' . I did add the require to the lakefile.lean I think. Ran lake update and lake build, not sure what else to do

Kevin Buzzard (Feb 07 2023 at 16:33):

I can't answer your question but you could compare and contrast with mathlib4, which imports std. If you don't get an answer here you could try the lean 4 stream.

Bolton Bailey (Apr 19 2023 at 00:26):

I am having the same issue. I run lake new Foo, I open the new project in VSCode and I put import Std.Data.Nat.Lemmas at the top of Foo.lean, and I get the error "unknown package Std".

Bolton Bailey (Apr 19 2023 at 00:34):

The mathlib4 lakefile is totally different from the one I get by default. Should I just replace all of it?

Bolton Bailey (Apr 19 2023 at 00:36):

Ok I got it working by "restarting the server" by closing and reopening the window.

Bolton Bailey (Apr 19 2023 at 00:37):

Word to the wise, when lean 4 tells you to restart the server, the VSCode command named "Lean: Restart" doesn't do it, I think it only works for Lean 3 or something.

Adam Topaz (Apr 19 2023 at 00:42):

FYI: you need “Lean4: Restart server”

Adam Topaz (Apr 19 2023 at 00:44):

To use Std, just copy and paste the line from mathlib4’s lakefile into the lakefile for your project.

Adam Topaz (Apr 19 2023 at 00:45):

Specifically the “require std from git …” line

Bolton Bailey (May 10 2023 at 15:37):

Screenshot-2023-05-10-at-10.26.27-AM.png

Why don't I see the command here?

Bolton Bailey (May 10 2023 at 15:38):

I feel like this happens periodically - I search for Lean 4: Restart Server and get no results

Bolton Bailey (May 10 2023 at 15:57):

The command has reappeared now. Seems more likely to be a problem with VSCode than with the Lean extension in particular.


Last updated: Dec 20 2023 at 11:08 UTC