Zulip Chat Archive
Stream: general
Topic: Unicode symbols in Loogle
Jeremy Kahn (Apr 14 2024 at 10:24):
One thing I've noticed using loogle is that I often want to search for expressions using special characters, as in _ \in _
or _ \le _
or _\inv
. Is there any mechanism for including such characters in loogle? Failing that, is there an easy way to look up the actual (ASCII) function for a special character?
Kevin Buzzard (Apr 14 2024 at 10:39):
I just write stuff in VS Code and then copy-paste.
Joachim Breitner (Apr 14 2024 at 10:49):
Or live.lean-lang.org if you don't have a browser.
I doubt it's easy to add that functionality to the Loogle webpage. One argument in favor of vscode-integrated Loogle search, so you might try that extension!
Yaël Dillies (Apr 14 2024 at 10:51):
You might want to try https://github.com/arthurpaulino/chrome-lean-unicode
Jeremy Kahn (Apr 14 2024 at 10:52):
Yes, @Kevin Buzzard 's suggestion is pure genius! I don't know why I didn't think of that. Maybe it's a matter of learning to look for workarounds. :laughing:
Joachim Breitner (Apr 14 2024 at 10:53):
Oh, nice. @Arthur Paulino , do you think you could make a variant of that that websites could embed and enable for specific text input fields?
Ruben Van de Velde (Apr 14 2024 at 11:05):
Also you can spell out Inv.inv
, for example
Jeremy Kahn (Apr 14 2024 at 11:07):
Is there a nice way to look up the official name for a function from its unicode infix or suffix?
Jeremy Kahn (Apr 14 2024 at 11:10):
@Yaël Dillies @Arthur Paulino I installed the extension, and now I can get ∈ and α in the Zulip chat. I added "https://loogle.lean-lang.org" to the list of covered websites, and the icon appears as green, but it doesn't seem to work in the loogle entry field.
Joachim Breitner (Apr 14 2024 at 11:10):
Would it be useful if the lean elaborator simply understood \in
just like corresponding symbol, so that ASCII input works? Would require the parser or elaborator to know the list of abbreviations, and is a bit of a layering violation, but would be useful in a few places (e.g. on the command line). (Not sure, just thinking out loudly)
Joachim Breitner (Apr 14 2024 at 11:11):
Maybe the extension only works in text areas, not input fields?
Mario Carneiro (Apr 14 2024 at 11:15):
the leader key isn't always \
Mario Carneiro (Apr 14 2024 at 11:16):
plus, that would cause problems for string escapes like \n
(which I always have to convince the extension to not replace with ¬
)
Mario Carneiro (Apr 14 2024 at 11:18):
Jeremy Kahn said:
Is there a nice way to look up the official name for a function from its unicode infix or suffix?
If you just type #check x \in y
or similar in the editor you can ctrl-click on the symbol to go to the definition
Mario Carneiro (Apr 14 2024 at 11:19):
ditto if you see it in existing code in either docgen or mathlib
Shreyas Srinivas (Apr 14 2024 at 19:40):
I tried adding that feature in the extension. But it is painful to get it right
Shreyas Srinivas (Apr 14 2024 at 19:41):
On the positive side, I do the copy paste thing easily because I am already in vscode
Shreyas Srinivas (Apr 14 2024 at 19:42):
If someone's willing to contribute this feature, PRs to the loogle extension repo are welcome
Arthur Paulino (Apr 15 2024 at 01:52):
Sorry, I don't have the time to debug :sad:
Jeremy Kahn (Apr 17 2024 at 14:40):
@Joachim Breitner I do think it would be helpful for loogle to understand escape sequences in the input field. But not really necessary given the cut-and-paste option and other workarounds (including the loogle bot in Zulip).
Joachim Breitner (Apr 17 2024 at 15:42):
I fully agree! I think the best course of action is if someone can generalize https://github.com/arthurpaulino/chrome-lean-unicode to a library that a website can embed, then loogle can use it.
Last updated: May 02 2025 at 03:31 UTC