Zulip Chat Archive

Stream: lean4

Topic: Is `until` reserved?


Mrigank Pawagi (Mar 07 2025 at 11:24):

until seems to be some sort of a reserved word in lean 4, but I am unable to find it in the documentation. I am just curious because I did something like the following

def until := 1

but got unexpected token 'until'; expected identifier.

Aaron Liu (Mar 07 2025 at 11:32):

docs#Lean.doElemRepeat__Until_

Mrigank Pawagi (Mar 07 2025 at 11:34):

Thanks! This line in the code makes it clear:

syntax "repeat " doSeq ppDedent(ppLine) "until " term : doElem

I have used repeat but not repeat ... until.

Damiano Testa (Mar 07 2025 at 17:31):

In case it is helpful for some other time, you could also have found out about this as follows:

import Mathlib.Tactic.FindSyntax

/--
info: Found 1 use among 579 syntax declarations
In `Init.While`:
  Lean.doElemRepeat__Until_: 'repeat  _ until'
-/
#guard_msgs in
#find_syntax "until"

Aaron Liu (Mar 07 2025 at 17:34):

I just did a @loogle "until"

loogle (Mar 07 2025 at 17:34):

:search: String.nextUntil, Lean.doElemRepeat__Until_, and 65 more

Mrigank Pawagi (Mar 09 2025 at 09:46):

Thanks so much for the tips, @Damiano Testa and @Aaron Liu. I am new to Lean and this seems very useful!


Last updated: May 02 2025 at 03:31 UTC