Zulip Chat Archive

Stream: lean4

Topic: specification of Lean syntax


Martin Harrison (Mar 03 2024 at 11:28):

Where is the formal specification of the syntax of the Lean language? I found this conversation and agree that the grammar will not help me to learn Lean. But I want to find out if guided generation of structured output could improve sagredo. Supplying outlines or guidance with "the CFG for Lean4 syntax" would be a first step in this direction - does such a thing exist?

Jireh Loreaux (Mar 03 2024 at 12:55):

Syntax in Lean is user-extensible, so there is no complete specification.

Martin Harrison (Mar 03 2024 at 13:02):

Jireh Loreaux said:

Syntax in Lean is user-extensible, so there is no complete specification.

Is there a partial specification of a base syntax? Is there a formal specification of the rules for extensions?

Shreyas Srinivas (Mar 03 2024 at 13:14):

Lean has a concrete Syntax expressed by the Syntax inductive type

Shreyas Srinivas (Mar 03 2024 at 13:14):

@loogle Syntax

Martin Harrison (Mar 03 2024 at 13:15):

thanks

Shreyas Srinivas (Mar 03 2024 at 13:16):

Here's the link

Shreyas Srinivas (Mar 03 2024 at 13:16):

The abstract syntax tree is represented by the inductive type Expr

Martin Harrison (Mar 03 2024 at 13:16):

killer, thanks

Shreyas Srinivas (Mar 03 2024 at 13:17):

The doc link for Expr

Shreyas Srinivas (Mar 03 2024 at 13:17):

I am surprised loogle didn't work

Martin Harrison (Mar 03 2024 at 13:17):

Shreyas Srinivas said:

I am surprised loogle didn't work

was it supposed to respond in this thread or what?

Shreyas Srinivas (Mar 03 2024 at 13:17):

That's usually how it seems to work

Shreyas Srinivas (Mar 03 2024 at 13:18):

@Joachim Breitner I checked and loogle is up and running. I think loogle didn't find search results, but I thought the bot normally prints suggestions in the chat. Is this an unimplemented feature for the bot? EDIT: On second thought, is the bot only accessible in some streams or threads?

Joachim Breitner (Mar 03 2024 at 14:37):

It should have worked.
@loogle Syntax

loogle (Mar 03 2024 at 14:37):

:exclamation: unknown identifier 'Syntax'
Did you mean "Syntax", Lean.Syntax, or something else?

Notification Bot (Mar 03 2024 at 15:29):

Martin Harrison has marked this topic as resolved.

Notification Bot (Mar 04 2024 at 19:21):

Shreyas Srinivas has marked this topic as unresolved.


Last updated: May 02 2025 at 03:31 UTC