Zulip Chat Archive

Stream: new members

Topic: Are the # commands listed and documented somewhere?


Ching-Tsun Chou (Dec 10 2024 at 20:12):

I know of #check, #eval, #synth, #print, and #simp. Is there a central place where all these # commands are listed and documented?

Mario Carneiro (Dec 10 2024 at 20:23):

Does #help command "#" do what you want?

Edward van de Meent (Dec 10 2024 at 20:24):

do note that not all commands start with #

Edward van de Meent (Dec 10 2024 at 20:24):

for example: whatsnew in

Mario Carneiro (Dec 10 2024 at 20:25):

#help command shows all commands, the ones with # are for "temporary" use (although arguably whatsnew should also be in that category)

Edward van de Meent (Dec 10 2024 at 20:28):

i seem to recall a different conversation where the distinction was suggested to be the fact that those with don't "alter the environment" or something like that?

Edward van de Meent (Dec 10 2024 at 20:28):

basically, i don't think this is very clear cut

Mario Carneiro (Dec 10 2024 at 20:28):

that's certainly not the case for #eval

Mario Carneiro (Dec 10 2024 at 20:29):

or example

Mario Carneiro (Dec 10 2024 at 20:29):

I think the intention of the convention is clear, but the execution isn't perfect

Edward van de Meent (Dec 10 2024 at 20:30):

i was thinking of #lean4 > why `whatsnew`?

Mario Carneiro (Dec 10 2024 at 20:30):

(I know that this is the meaning of the # because I have heard it said by the people who designed the syntax in the first place)

Edward van de Meent (Dec 10 2024 at 20:30):

something something descriptive/prescriptive language

Edward van de Meent (Dec 10 2024 at 20:33):

reading the conversation again, they do seem to agree that the commands with # are the ones which shouldn't stick around in non-testing code

Mario Carneiro (Dec 10 2024 at 20:34):

tests break this convention because it's not that strange to use an explicitly diagnostic-use-only command in a test

Mario Carneiro (Dec 10 2024 at 20:37):

almost all # commands also produce output via info messages

Mario Carneiro (Dec 10 2024 at 20:37):

which is another reason whatsnew seems like it should have a #

Ching-Tsun Chou (Dec 10 2024 at 22:53):

Thanks! I actually didn't know about #help. It is not mentioned in #mil or #tpil.

Mario Carneiro (Dec 10 2024 at 23:22):

you would have found it in the output of #help :upside_down:

mars0i (Dec 11 2024 at 00:32):

#help doesn't seem to work in nvim with lean.nvim. Why not document these on the web?

Kevin Buzzard (Dec 11 2024 at 00:38):

Probably because the naive approach ("just dump the output to a file and put it somewhere on the community website") leaves a maintenance burden (i.e. someone has to keep it up to date) and the clever way (keep running #help and posting the output to a file on the community website) requires someone to get the set-up working.

Ching-Tsun Chou (Dec 11 2024 at 00:50):

On the other hand, it would be nice if the #help command itself is mentioned in the introductory literature on Lean. So far as I can tell, it is not mentioned in any of the books listed here:

https://leanprover-community.github.io/learn.html

Indeed, I can find only a single mention of #synth in those books (in sec.7.1 of #mil) which does not make it clear that #synth is the command one can use to figure out what the type class system is doing.

Mario Carneiro (Dec 11 2024 at 01:06):

mars0i said:

#help doesn't seem to work in nvim with lean.nvim. Why not document these on the web?

I don't see any reason why that would be. Most likely you just don't have it imported (it's in Batteries.Tactic.HelpCmd)

Mario Carneiro (Dec 11 2024 at 01:08):

unfortunately lean core is rather cagey about documenting tactics that aren't shipped with lean itself, which IMO harms discoverability of things in mathlib

Mario Carneiro (Dec 11 2024 at 01:10):

books like #mil don't have the same constraints, but they are also aimed at a higher level of abstraction and kind of delegate some of the responsibility to document lower level things to lean core

mars0i (Dec 11 2024 at 03:35):

Thanks @Mario Carneiro. I didn't know #help needed an import. It does indeed work with that import. Another thing that I wish was noted in an obvious place!

For my own sake , I've been compiling a series of tips of various kinds for use and setup of Lean. Maybe I ought to clean it up and see whether various parts would be welcome somewhere on the wiki.


Last updated: May 02 2025 at 03:31 UTC