Zulip Chat Archive
Stream: general
Topic: Moogle discussion
Jason Rute (Oct 31 2023 at 19:23):
It does ok on my go to example for this sort of thing:
the min of a list is less than the max of a list
I like this example since it isn’t exactly true as stated and the true version isn’t in the library but the relevant lemmas are.
Jason Rute (Oct 31 2023 at 19:27):
Well it can’t find anything good for “the minimum of a list is in the list”. Still not true without assumptions but is the true version not a theorem in mathlib or Std?
Jesse Michael Han (Oct 31 2023 at 19:29):
Hey y'all, we just announced Moogle (https://moogle.ai), a semantic search engine for mathlib. It lets you find theorems using natural language, and was built with some of the same techniques we used to create Morph Prover v0 7B. We hope this makes it easier for people with math knowledge but not mathlib knowledge to navigate mathlib.
We're excited to improve it based on your feedback!
Jason Rute (Oct 31 2023 at 19:29):
Oh, I found it. It was the 5th suggestion.
Jesse Michael Han (Oct 31 2023 at 19:30):
make sure to give it a thumbs up! its rank will move up as we improve Moogle
Notification Bot (Oct 31 2023 at 19:30):
4 messages were moved here from #announce > Moogle by Kyle Miller.
Kyle Miller (Oct 31 2023 at 19:31):
(@Jesse Michael Han I saw you created this topic so moved discussion here -- I can try to undo it if that wasn't your intent!)
Jesse Michael Han (Oct 31 2023 at 19:32):
all good :+1:
Jason Rute (Oct 31 2023 at 19:39):
You may also want to link to the docs# as well as the code. The docs provide useful meta data like instances and they allow click through navigation.
Jason Rute (Oct 31 2023 at 19:40):
Maybe you can even get the docs to have “search Moogle” along with “Search” and “Google site search” in the top right corner.
Jesse Michael Han (Oct 31 2023 at 19:48):
that would be great! i think a Zulip bot would be helpful as well, especially in new-members, where Moogle has already appeared in the wild.
Jason Rute (Oct 31 2023 at 20:18):
I’m not sure there is really value in showing the proofs of theorems and lemmas. They sort of clutter the output. Also in some cases the output is messed up and gets cut off.
Jason Rute (Oct 31 2023 at 20:18):
For example the second result here: https://www.moogle.ai/search/raw?q=A%20compact%20set%20is%20closed
Jason Rute (Oct 31 2023 at 20:33):
No good results for “a + b = 0 -> a = -b”. I remember it is a theorem, but it might be stated for (multiplicative) groups in the code. I bet you are going to have a big problem with theorems that are stated more generally than the user is expecting.
Junyan Xu (Oct 31 2023 at 20:38):
image.png
looks like a bug
Junyan Xu (Oct 31 2023 at 20:39):
Declaration mul_eq_one_iff_inv_eq
doesn't appear among the results.
Junyan Xu (Oct 31 2023 at 20:43):
mul_eq_one_iff_inv_eq₀
is the 2nd result but add_eq_zero_iff_eq_neg
is the 8th.
Bentley Long (Oct 31 2023 at 20:44):
thanks for flagging! we will investigate
Junyan Xu (Oct 31 2023 at 20:48):
This one is probably too challenging but I'd expect a good semantic search engine to find docs#unitInterval.qRight by searching https://www.moogle.ai/search/raw?q=homotopy%20between%20two%20continuous%20maps%20from%20the%20unit%20interval%20to%20itself even though the word "homotopy" doesn't appear in the docstring ... Would certainly requires some mathematical background knowledge.
Jesse Michael Han (Oct 31 2023 at 20:52):
feedback like this is exactly what we're looking for :pray:
Jesse Michael Han (Oct 31 2023 at 20:53):
it can be a bit wording sensitive and this can be improved by continuous training over time - for example the definition you linked shows up in the results with most results being aboug homotopies if you rephrase the query slightly
Junyan Xu (Oct 31 2023 at 20:58):
Technically it's a single homotopy though (a homotopy between two continuous maps from X to Y is a continuous map of the form I x X -> Y
where I
is the unit interval, so if both X
and Y
are I
then it's a map I x I -> I
. However qRight
doesn't actually contain the proof of continuity, so it's good that Moogle finds continuous_qRight. Maybe "space" works better because the declaration is in the file HSpace? Also note qRight
doesn't specify which two maps it's a homotopy between (unlike docs#ContinuousMap.Homotopy), so maybe that's why it can't be called a homotopy proper.
Joachim Breitner (Oct 31 2023 at 21:05):
Very impressive and very cool!
Julian Berman (Oct 31 2023 at 21:38):
Does Moogle have a current or planned API? And/or relatedly are there thoughts about what editor integration looks like?
Jason Rute (Oct 31 2023 at 21:48):
Can one just paste a goal in Moogle and expect it to find the relevant theorem (sort of like gptf could do especially if given the prompt “exact” or “apply”)? So far I tried some simple goals and it wasn’t so good.
Heather Macbeth (Oct 31 2023 at 21:53):
Hmm, it failed on the first thing I tried: didn't find docs#intervalIntegral.integral_mul_deriv_eq_deriv_mul on a search for "integration by parts", although this appears in a section header right above it and the conclusion of the theorem is pretty close to the traditional paper version of the theorem. (This example was suggested by @Alex Kontorovich yesterday.)
Jesse Michael Han (Oct 31 2023 at 22:10):
Jason Rute said:
Can one just paste a goal in Moogle and expect it to find the relevant theorem (sort of like gptf could do especially if given the prompt “exact” or “apply”)? So far I tried some simple goals and it wasn’t so good.
i wouldn't expect it to do well at this moment, but doing goal -> premise retrieval is on the roadmap!
Jesse Michael Han (Oct 31 2023 at 22:12):
Julian Berman said:
Does Moogle have a current or planned API? And/or relatedly are there thoughts about what editor integration looks like?
we will soon make the search available in VSCode with search context informed by open editor windows
Frédéric Dupuis (Oct 31 2023 at 22:15):
Very nice! Another case to have a look at for fine tuning: on "Cauchy-Schwarz" the first two hits are auxilliary lemmas, and the main result I would have expected (docs#inner_mul_inner_self_le, which is right below the first hit in the code) actually shows up pretty far down the list.
Frédéric Dupuis (Oct 31 2023 at 22:17):
(Admittedly this might be tricky to fix, since the auxilliary lemma actually has cauchy_schwarz
in the lemma name whereas the main one doesn't.)
Jesse Michael Han (Oct 31 2023 at 22:21):
please thumbs-up the correct hit! this will help us improve the model
Siddhartha Gadgil (Nov 01 2023 at 02:55):
Moogle seems to only search in Mathli, missing stuff in Lean core and Std, such as "Addition on natural numbers is commutative".
Scott Morrison (Nov 01 2023 at 03:09):
Yes, including results from Std would be very very useful!
Joachim Breitner (Nov 01 2023 at 10:14):
Jesse Michael Han said:
we will soon make the search available in VSCode with search context informed by open editor windows
I would expect that the local UI/UX considerations for such a search would be pretty much the same for searching using moogle and Loogle. Maybe there could be a single search tool that can query either service? Happy to adjust the Loogle API if it helps.
Shreyas Srinivas (Nov 01 2023 at 10:31):
Joachim Breitner said:
Jesse Michael Han said:
we will soon make the search available in VSCode with search context informed by open editor windows
I would expect that the local UI/UX considerations for such a search would be pretty much the same for searching using moogle and Loogle. Maybe there could be a single search tool that can query either service? Happy to adjust the Loogle API if it helps.
Up to a point yes. But most loogle searches are likely to be one-liners whereas moogle handles much larger queries and produces larger results.
Arthur Paulino (Nov 01 2023 at 11:12):
Idea: Moogle could have an escaping key (such as !
) to fallback to Loogle when the user has a clearer idea about what to search and is less reliant on mysterious inner mechanics of AI
Idea2: Loogle could be used as a way to enhance the data that Moogle consumes
In general, I agree with the idea of having a single, standard, search tool entry point. I think that's easier on the community (and also on the developers)
Shreyas Srinivas (Nov 01 2023 at 11:23):
I am writing the loogle part, but that's because I already have access to loogle's API. I don't see any easy integration of moogle other than as a side panel. Maybe a lean command #moogle is better than a separate GUI element for this.
Junyan Xu (Nov 01 2023 at 16:22):
Junyan Xu said:
Technically it's a single homotopy though (a homotopy between two continuous maps from X to Y is a continuous map of the form
I x X -> Y
whereI
is the unit interval, so if bothX
andY
areI
then it's a mapI x I -> I
. HoweverqRight
doesn't actually contain the proof of continuity, so it's good that Moogle finds continuous_qRight. Maybe "space" works better because the declaration is in the file HSpace? Also noteqRight
doesn't specify which two maps it's a homotopy between (unlike docs#ContinuousMap.Homotopy), so maybe that's why it can't be called a homotopy proper.
Actually, docs#Path.Homotopy.reparam is a better match that Moogle also doesn't find. It's an actual Homotopy, and even though a Path is a continuous map from I
to an arbitrary space X
that is not necessarily I
, this particular definition is obtained by composing a homotopy between two continuous maps I -> I
with a path I -> X
, so it's surely quite relevant.
Junyan Xu (Nov 01 2023 at 16:53):
Probably also a bug: sometimes Moogle gets the namespace but sometimes not
image.png
image_univ_equiv
is docs#Finset.image_univ_equiv
query
Jesse Michael Han (Nov 02 2023 at 00:16):
Joachim Breitner said:
Jesse Michael Han said:
we will soon make the search available in VSCode with search context informed by open editor windows
I would expect that the local UI/UX considerations for such a search would be pretty much the same for searching using moogle and Loogle. Maybe there could be a single search tool that can query either service? Happy to adjust the Loogle API if it helps.
yes, that would be great. one idea could be to use #find
syntax as a structured query language on top of semantic search results returned by Moogle. so in this combined API, a list of allowed declaration ids are returned by Loogle in response to an exact substring or unification-based search query, and this is used to filter results from Moogle.
Matthew Ballard (Nov 02 2023 at 16:06):
Jump to definition for terms in the returned declarations would be nice.
John Yang (Nov 02 2023 at 18:00):
Building this now! Coming soon
Shreyas Srinivas (Nov 05 2023 at 15:29):
@Jesse Michael Han : My loogle extension is out there (as a preview to see what is preferred UI-wise). Would it be possible to integrate moogle into it by API access?
Scott Morrison (Nov 05 2023 at 21:30):
I think this is not the highest priority. Rather than asking for custom work from the moogle people, how about we see if the loogle extension is viable and useful first?
Shreyas Srinivas (Nov 06 2023 at 00:21):
I am only asking if moogle allows api access already, and if I may personally experiment with it for integration. But yes, let's see if the extension is useful for now.
Agnishom Chattopadhyay (Nov 06 2023 at 15:00):
Great stuff. I definitely like the no-nonsense UI (no chatbot, no big paragraphs of human text). Besides, figuring out which theorem is where is always a chore, so I think this will be pretty helpful.
How does this work? Are you doing some kind of similarity search on some vector representations?
Thomas Murrills (Nov 07 2023 at 08:41):
Really cool! :D I noticed that if I searched for simply “Tensor product”, I got TensorProduct.tensorTensorTensorComm
, TensorProduct.tensorTensorTensorComm_symm
, and TensorProduct.tensorTensorTensorApply
as the first results—presumably because of how Tensor
-y they are.
Are the thumbs up/down appropriate here? I don’t want to suggest that they’re not related to the tensor product, but I do want to indicate that they’re not what should show up if you just search “Tensor product”!
Jesse Michael Han (Nov 07 2023 at 20:06):
absolutely, for a given query you should thumbs up a result if you think it should be higher ranked (resp. thumbs down, lower ranked)
Jesse Michael Han (Nov 07 2023 at 20:07):
for example, for a basic query like "tensor product" it ought to pull up the fundamental definition instead of some API lemmas so feedback like that is definitely helpful!
Siddhartha Gadgil (Nov 08 2023 at 01:13):
As I suggested last round, I do think part of Lean Core and Std should be covered. For example, try: "Addition is commutative for natural numbers." (it cannot find Nat.add_comm
which is in Lean core).
Jesse Michael Han (Nov 08 2023 at 19:50):
This has been fixed, thank you for the feedback!
Siddhartha Gadgil (Nov 09 2023 at 10:27):
Jesse Michael Han said:
This has been fixed, thank you for the feedback!
Thanks. This is a great tool.
Notification Bot (Nov 09 2023 at 20:07):
3 messages were moved here from #announce > Moogle by Yury G. Kudryashov.
Timo Carlin-Burns (Nov 30 2023 at 03:56):
I can't seem to select the search bar at https://moogle.ai to type anything in. Is it just me?
David Renshaw (Nov 30 2023 at 04:07):
same here
Scott Morrison (Nov 30 2023 at 04:47):
It's working for me. (Chrome on mac.)
Timo Carlin-Burns (Nov 30 2023 at 04:51):
Firefox on Linux for me
Timo Carlin-Burns (Nov 30 2023 at 04:54):
Chromium on my system does show a cursor. So I guess the site isn't working with Firefox
Jesse Michael Han (Nov 30 2023 at 05:43):
investigating --- we'll get a fix turned around asap, thanks for flagging!
Jesse Michael Han (Nov 30 2023 at 06:21):
Timo Carlin-Burns said:
I can't seem to select the search bar at https://moogle.ai to type anything in. Is it just me?
OK this should now be fixed --- please give it a try and let me know if it's still not working
Damiano Testa (Nov 30 2023 at 06:22):
It works for me now: firefox on linux!
Shreyas Srinivas (Nov 30 2023 at 10:32):
@Jesse Michael Han : Thanks, the moogle extension looks pretty good and works in a complementary fashion with the loogle extension. I do have one question: What does the "Open Moogle" command do? I tried it a couple of times and nothing seemed to happen.
Shreyas Srinivas (Nov 30 2023 at 10:39):
Also, a feature request for a dark mode :sweat_smile:
Last updated: Dec 20 2023 at 11:08 UTC