-
Notifications
You must be signed in to change notification settings - Fork 20
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
display automatic translations to informal math #168
base: master
Are you sure you want to change the base?
Conversation
#deploy |
@EdAyers Would you be interested in helping us with UI and databases? |
This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo! |
When the informal output includes a I thought MathJax was smart enough to do this, it handles |
@EdAyers if you're interested in helping with the UI, I have an approximate setup for the "data collection" part that needs to be hooked into the interface. We can chat. |
Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
#deploy |
This PR has been successfully deployed at http://leanprover-community.github.io/mathlib_docs_demo! |
Do you have a docstring in mind that proves this? |
https://leanprover-community.github.io/mathlib_docs_demo/model_theory/order.html#first_order.language.sentence.densely_ordered is an example. |
Even weirder, https://leanprover-community.github.io/mathlib_docs_demo/model_theory/order.html#first_order.language.term.realize_lt has both a working and broken occurence of |
I thought I just posted this (eaten by GitHub somehow?), but, the problem is This is nontrivial but possible to replace during processing. This must have come up in relation to mathjax before, but I'm not turning up anything quickly on Google somehow. |
This is not a mathjax problem, but a problem in our markdown parser. Mathjax cannot be reasonably expected to parse |
I was planning to switch out our parser for markdown-it, but am waiting on an upstream patch (executablebooks/mdit-py-plugins#46) |
#deploy |
This PR has been successfully deployed! You can find it at http://leanprover-community.github.io/mathlib_docs_demo in around 10 minutes, or watch the deployment progress by going to http://github.com/leanprover-community/mathlib_docs_demo |
#deploy |
<div class="statement"> | ||
{{ decl.informal_statement | convert_markdown }} | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried the mathjax rendering is going to have quite a large impact on page load times. Could we maybe:
- Defer mathjax rendering of
.informal_statement
until thedetails
is expanded - Put a "expand informal math" setting in the sidebar next to the color scheme setting, so that users can opt to collapse everything by default and get the associated performance boost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the details
should be collapsed by default, not for performance but because the translations are misleadingly sketchy:
Right now I put it in a
<details>
menu, expanded by default to make browsing this demo easier. I think they should be collapsed by default in production, at least until the translations improve.
But a toggle also sounds like a good idea.
Do you know how to defer the rendering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a (possibly outdated) question about deferring here: https://stackoverflow.com/a/27952213/102441
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This page in the documentation also seems relevant.
Enabling Lazy Typesetting would also be a reasonable option.
This PR has been successfully deployed! You can find it at http://leanprover-community.github.io/mathlib_docs_demo in around 10 minutes, or watch the deployment progress by going to http://github.com/leanprover-community/mathlib_docs_demo |
I reckon this is ready to merge once @zhangir-azerbayev has fixed truncated translations? |
I've seen very few truncated translations, and regenerating the translations is costly. I think it's fine to wait to fix this until we're ready for a "next round." But there are still a few more to-dos:
|
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
#deploy |
#deploy |
This PR has been successfully deployed! You can find it at http://leanprover-community.github.io/mathlib_docs_demo in around 10 minutes, or watch the deployment progress by going to http://github.com/leanprover-community/mathlib_docs_demo |
I think all of the to-dos are taken care of now (thanks @EdAyers !). I enabled lazy typesetting in mathjax, and confirmed it only processes when the display is unrolled. |
I think the warning should be more visible than using a light-grey color. |
#deploy (just so that we have something interesting at the docs_demo page) Edit: Oops, did not mean to close the PR |
Thanks to work by @zhangir-azerbayev , we have a dataset of every declaration in (a recent version of) mathlib translated to natural language. People from OpenAI are interested in improving this; in principle we can regenerate these translations periodically, and update the model with user responses from the displayed translations.
There is a static json file containing the translations. It also stores the theorem name and statement that were used to generate the text. doc-gen checks that the statement hasn't changed before printing the translation, so even if we go months between updates, the worst we'll see is a lot of theorems with no translation.
All of this is WIP:
<details>
menu, expanded by default to make browsing this demo easier. I think they should be collapsed by default in production, at least until the translations improve.