Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add post on searching for lemmas #75

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

BoltonBailey
Copy link

This PR adds a blog post I wrote detailing a variety of ways a beginner might search for theorems in mathlib.

Inspired by @j-loreaux 's video on the subject, and this thread. I have tried to make it pretty open-minded and comprehensive, I am happy to take suggestions if there are strategies I missed.

@BoltonBailey
Copy link
Author

This is perhaps a bit out of date, but if anyone wants to pick this back up or make changes, feel free!

---
author: 'Bolton Bailey'
category: 'Overview'
date: 2024-06-01 13:35:44 UTC-08:00

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update before landing


![Moogle Main Page](/images/moogle-screenshot.png)

[Moogle](https://www.moogle.ai/) is a semantic search engine for Mathlib developed by [Morph labs](https://morph.so/). One enters searches in natural language and the engine tries to turn up theorems that match the search query. For example, if I search for ["the sum of two odd numbers is even"](https://www.moogle.ai/search/raw?q=the%20sum%20of%20two%20odd%20numbers%20is%20even), I turn up the result `Odd.add_odd` which matches this description pretty well as the fourth result.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, "semantic search" is not quite an accurate description. Maybe "LLM-based search"?


[Loogle](https://loogle.lean-lang.org/) is a third search engine for mathlib developed by Joachim Breitner at the [Lean Focused Research Organization](https://lean-fro.org/). It is meant to be a similar tool to [Hoogle](https://hoogle.haskell.org/) from the Haskell community: It allows you to search for lemmas by their type signature. For example, if I search for [`(?a -> ?b) -> List ?a -> List ?b`](https://loogle.lean-lang.org/?q=(?a%20-%3E%20?b)%20-%3E%20List%20?a%20-%3E%20List%20?b), I get results for `List.map`.

Loogle is a great tool for finding lemmas that you know the type of, but not the name of. It is a pretty precise tool; a downside is that it will not by default give you responses without you typing out the names of the definitions relevant to your search correctly and in full. To avoid putting in too many restrictions and getting an empty result list, it's recommended that you add search filters one at a time to your query.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally tend to use it more with just a list of definitions that are used rather than a full type signature. Maybe "...by their type signature or types that occur in it"


### Zulip

The [Zulip chat](https://leanprover.zulipchat.com/) for the Lean community has a channel called ["Is there code for X?"](https://leanprover.zulipchat.com/#narrow/stream/217875-Is-there-code-for-X.3F) where you can ask questions about the presence of particular theorems in mathlib, major and minor. If you are having trouble finding a theorem, you can ask in this channel and someone will likely be able to help you, although it might take longer than the search engine would.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add "You can also search the archives to see if someone has asked about the same results before."

## Other websites

There are a few other websites that can be helpful for finding theorems in mathlib, although they are not conventional search engines like the ones above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that leansearch.net should be mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants