Zulip Chat Archive
Stream: lean4
Topic: name for syntax category of `notation`, `namespace`, `def`..
Asei Inoue (Jun 22 2024 at 13:09):
I have seen top-level commands starting with #
, such as #check
and #reduce
, referred to as "diagnostic commands". On the other hand, are there any customary terms for other commands such as def
or notation
?
Asei Inoue (Jun 22 2024 at 13:13):
The commands group I have a question about here are as follows:
- def
- noncomputable
- notation
- infix
- prefix
- postfix
- open
- namespace
- class
- inductive
- structure
- ....
Asei Inoue (Jun 22 2024 at 13:19):
The question is: "Is there a short word for a top-level command that does not start with #
?
Eric Wieser (Jun 22 2024 at 13:51):
Syntactically, there is nothing special about #print
vs def
; both are in the command
category
Asei Inoue (Jun 22 2024 at 13:52):
Syntactically, there is nothing special about
def
; both are in thecommand
category
That's why I'm in trouble ...
Asei Inoue (Jun 22 2024 at 13:57):
I want a customary name for it, rather than a syntactic classification name.
Asei Inoue (Jun 22 2024 at 13:57):
Would it be strange if I called it "syntactic command"?
Damiano Testa (Jun 22 2024 at 14:15):
Maybe def
, theorem
,... can be called "keywords"?
The linter that excludes #
-commands is called... docs#Mathlib.Linter.linter.hashCommand, but this is not an official name.
Asei Inoue (Jun 22 2024 at 14:25):
"keyword" sounds nice. It can be called "syntactic keyword"?
Max Nowak 🐉 (Jun 22 2024 at 14:39):
I’d call them declarations
Max Nowak 🐉 (Jun 22 2024 at 14:39):
Except namespace, section, etc
Eric Wieser (Jun 22 2024 at 14:39):
Asei, can you elaborate on why you want a name for these?
Eric Wieser (Jun 22 2024 at 14:40):
Max Nowak 🐉 said:
I’d call them declarations
Declarations are the things (some of) these keywords generate, not the keywords themselves
Max Nowak 🐉 (Jun 22 2024 at 14:41):
Internally, def, inductive, etc elaborate the syntax tree, and then use the “addDecl” function to add the actual declaration to the Environment.
Eric Wieser (Jun 22 2024 at 14:41):
So maybe "declaration commands" would be reasonable, but I don't think this ends up being referred to often enough to need a name
Eric Wieser (Jun 22 2024 at 14:42):
And example
doesn't create a declaration at all!
Asei Inoue (Jun 22 2024 at 14:42):
Asei, can you elaborate on why you want a name for these?
Commands with # and without # seem to have different uses and appearances, but I thought it was inconvenient not to have a concise name for them.
Eric Wieser (Jun 22 2024 at 14:44):
I guess #align
and #align_import
are exceptions to that rule
Asei Inoue (Jun 22 2024 at 14:44):
oh its really an exception...
Damiano Testa (Jun 22 2024 at 14:47):
The expectation is that all such exceptions are in
private abbrev allowed_commands : HashSet String :=
{ "#align", "#align_import", "#noalign", "#adaptation_note" }
Mac Malone (Jun 23 2024 at 05:43):
Eric Wieser said:
And
example
doesn't create a declaration at all!
Nonetheless, it is part of the declaration
syntax. :laughing: :wink:
Mac Malone (Jun 23 2024 at 05:44):
(It actually does create a declaration. It just then discards it via withoutModifyingEnv
).
Last updated: May 02 2025 at 03:31 UTC