Zulip Chat Archive

Stream: general

Topic: Loogle bug?


Kenny Lau (Oct 25 2025 at 15:50):

"ℕ" fails to find termℕ, which "termℕ" succeeds in for some reason

Kenny Lau (Oct 25 2025 at 15:51):

(cc @Joachim Breitner)

Aaron Liu (Oct 25 2025 at 15:52):

oh I remember this

Aaron Liu (Oct 25 2025 at 16:17):

looks like loogle doesn't find a declaration when you search for its last "letter" (whatever that means) and you only search by name fragments

Kenny Lau (Oct 25 2025 at 16:17):

interesting

Aaron Liu (Oct 25 2025 at 16:19):

oh I figured it out

Aaron Liu (Oct 25 2025 at 16:19):

this is really stupid

Aaron Liu (Oct 25 2025 at 16:19):

https://github.com/nomeata/loogle/blob/ad0d2bbd507ac28ef353c4421533192eda3c5555/Loogle/Find.lean#L196

Aaron Liu (Oct 25 2025 at 16:20):

it subtracts one, but List.range n only goes from 0 to n - 1 anyways, so it ends up going from 0 to s.length - 2

Aaron Liu (Oct 25 2025 at 16:21):

and when you drop s.length - 2 you end up with a string of length 2

Aaron Liu (Oct 25 2025 at 16:21):

so the length one suffix never gets added

Kenny Lau (Oct 25 2025 at 16:21):

import Lean

elab "test" : term => do
  have s := "testing"
  for i in List.range (s.length - 1) do -- -1 to not consider the empty suffix
    let suf := s.drop i
    Lean.logInfo suf
  return Lean.mkNatLit 1

#check test

Kenny Lau (Oct 25 2025 at 16:21):

yep your observation is correct

Kenny Lau (Oct 25 2025 at 16:21):

the last printed message is ng

Kenny Lau (Oct 25 2025 at 16:22):

@Aaron Liu you could probably just PR?

Aaron Liu (Oct 25 2025 at 16:22):

what

Aaron Liu (Oct 25 2025 at 16:22):

why me

Kenny Lau (Oct 25 2025 at 16:22):

you found the error code

Aaron Liu (Oct 25 2025 at 16:23):

fine I'll do it

Kenny Lau (Oct 25 2025 at 16:23):

thanks!

Aaron Liu (Oct 25 2025 at 16:28):

nomeata/loogle#45


Last updated: Dec 20 2025 at 21:32 UTC