Zulip Chat Archive

Stream: new members

Topic: installing lean4


stewart mandell (Dec 16 2025 at 00:41):

I'm new to everything here, including Tulip. I followed the instructions to install VSCode, lake, and the lean4 extension for VSCode. I make a folder which I see contains the required lake files etc. However when I open Main.lean or MyProject.lean and try to do something as simple as #eval 1 + 1 I get a squiggly line and it doesn't evaluate. I hope someone can get me started, I spent the whole day trying to do this.

Matt Diamond (Dec 16 2025 at 00:48):

Are you opening the folder in VSCode or just an individual file?

Matt Diamond (Dec 16 2025 at 00:50):

if it's the latter, try opening the folder instead (use File > Open Folder... instead of File > Open...)

Notification Bot (Dec 16 2025 at 00:52):

This topic was moved here from #mathlib4 > installing lean4 by Kim Morrison.

Kim Morrison (Dec 16 2025 at 00:53):

@stewart mandell just pinging you here in case you worry that your message disappeared.

Kevin Buzzard (Dec 16 2025 at 05:59):

Say which instructions you followed and send a screenshot of VS Code with the file visible and the file explorer open

stewart mandell (Dec 21 2025 at 22:46):

Going through Mechanics of Proof.

Don't understand what's wrong with my solution to this example

example {n : } (hn : n ^ 2 + 4 = 4 * n) : n = 2 := by
 have h :=
  calc
  0*(n-2) = n^2- 4*n + 4 := by addarith[hn]
  _= (n-2)*(n-2) := by ring
  cancel (n-2) at h

Kevin Buzzard (Dec 21 2025 at 22:59):

My guess is that the cancel tactic won't let you cancel x in a hypothesis unless you have a proof that x ≠ 0 (because this would not be valid mathematically) and here you cannot supply that proof because n - 2 = 0 is actually true. In short, you look to me like you're dividing by 0.

Dan Velleman (Dec 22 2025 at 16:14):

Also, I think you have indented cancel too far--it should be lined up with have, not calc. (Lean can be very fussy about indenting.)


Last updated: Feb 28 2026 at 14:05 UTC