Zulip Chat Archive

Stream: general

Topic: mathlib map


Patrick Massot (Jun 05 2020 at 21:41):

Is there anyone familiar with https://github.com/leanprover-community/doc-gen/ and CI that would like to make sure every matlib docs build generates a publicly available file giving the url (relative to https://leanprover-community.github.io/mathlib_docs/) corresponding to each declaration fully qualified name? That would be very helpful, in particular for the sphere eversion project. Any file format would do, this is really a list of pairs. One pair per line separated by a space would be enough.

Bryan Gin-ge Chen (Jun 05 2020 at 21:43):

That sounds pretty doable. If no one beats me to it, I'll try to do it this weekend.

Patrick Massot (Jun 05 2020 at 21:45):

Amazing, thanks.

Bryan Gin-ge Chen (Jun 05 2020 at 21:45):

I think the scripts may already be generating such a JSON file, but it's not published to the website.

Patrick Massot (Jun 05 2020 at 21:46):

Yes the lean file generates some json.

Patrick Massot (Jun 05 2020 at 21:46):

https://github.com/leanprover-community/doc-gen/blob/master/print_docs.py#L701

Patrick Massot (Jun 05 2020 at 21:47):

which probably consumes the output of https://github.com/leanprover-community/doc-gen/blob/master/gen_docs#L40

Bryan Gin-ge Chen (Jun 05 2020 at 21:50):

On a second look, that JSON still needs to be processed. It contains the Lean filenames, but not the final HTML filenames + anchor links.

Rob Lewis (Jun 06 2020 at 11:00):

This is easy enough to do. The catch is: it should also include the type of the declaration. This is slightly trickier just because of how auxiliary things are handled in the docs right now. If you have a top level declaration, the arguments are stored in a list, with names and binder types. This is so we can print them left of the colon. For structure fields, inductive constructors, etc, we don't print them as top level decls but as part of the corresponding main decl. Their type info isn't stored with the same level of granularity, I think it's just a string. So either this needs to be refactored or we have a non-uniform export.

Rob Lewis (Jun 06 2020 at 11:02):

This can get done soon enough. The type export is needed for the Freek 100 page. But that part of it is a little more than trivial.

Rob Lewis (Jun 06 2020 at 11:03):

In the meantime, if you're in a hurry, the location info you need can be scraped from the raw html at https://leanprover-community.github.io/mathlib_docs/find/manifold . The redirect link gives you the url you want.

Rob Lewis (Jun 06 2020 at 12:37):

https://github.com/leanprover-community/doc-gen/pull/28

Rob Lewis (Jun 06 2020 at 12:39):

I guess I missed the conversation this week, but I really hate the blue links in the docs :(

Patrick Massot (Jun 06 2020 at 12:48):

Thanks Rob! I think the blue links was a compromise to make you happy. My opinion is there should be no decoration at all.

Reid Barton (Jun 06 2020 at 12:55):

The blue is not meant to be permanent, just better than the underlines from before. Please feel free to submit a PR!

Rob Lewis (Jun 06 2020 at 13:28):

What about making it a slightly lighter grey than the surrounding non-linked text?

Rob Lewis (Jun 06 2020 at 13:28):

It's a hint that the links are different, without being intrusive

Reid Barton (Jun 06 2020 at 13:34):

Sounds good to me. Note that the arguments of a theorem that come before the colon are already a slightly lighter color than the rest--so slight that I didn't notice it until I started looking at how to change the underlines.

Jalex Stark (Jun 06 2020 at 13:37):

(deleted)

Johan Commelin (Jun 06 2020 at 13:38):

Did your cat jump on your keyboard?

Jalex Stark (Jun 06 2020 at 13:39):

my laptop fell on my keyboard... sorry

Johan Commelin (Jun 06 2020 at 13:39):

I hope your laptop and your keyboard are ok...

Jalex Stark (Jun 06 2020 at 13:40):

they are!

Rob Lewis (Jun 06 2020 at 14:23):

image.png ? The links get a little lighter (and underlined) when you mouse over.

Reid Barton (Jun 06 2020 at 14:24):

Now in nat.cases_succ you can't see (at least I can't) that the \Ns are links but the rest is not.

Reid Barton (Jun 06 2020 at 14:25):

I think getting rid of the separate color for arguments before the colon would be fine.

Johan Commelin (Jun 06 2020 at 14:26):

How about we underline everything that is not a link? [/jk]

Rob Lewis (Jun 06 2020 at 14:26):

Oh, I see what you mean there.

Rob Lewis (Jun 06 2020 at 14:27):

image.png ?

Johan Commelin (Jun 06 2020 at 14:28):

Should all the arguments be bold?

Johan Commelin (Jun 06 2020 at 14:28):

Or only lemma/theorem/def the_name

Rob Lewis (Jun 06 2020 at 14:31):

image.png ?

Johan Commelin (Jun 06 2020 at 14:33):

I think I like that.

Mario Carneiro (Jun 06 2020 at 14:57):

These colors are too subtle for me to see clearly, and I don't think my eyesight is below average

Mario Carneiro (Jun 06 2020 at 14:58):

what was wrong with the blue?

Mario Carneiro (Jun 06 2020 at 15:00):

some more saturation would be good to distinguish it from the various shades of grey in the text itself (especially with things like blackboard bold which have their own effective color)

Mario Carneiro (Jun 06 2020 at 15:03):

oh wait, is it literally gray? No wonder it looks desaturated

Rob Lewis (Jun 06 2020 at 16:29):

The blue was really glaring, since a lot of decls were almost completely blue. I think it's much easier on the eyes with a more subtle color for the links. Yes, it's literally gray, hopefully just enough to slightly distinguish it from the surrounding black. If you mouse over it changes more.

Rob Lewis (Jun 06 2020 at 16:29):

It's live now btw.

Patrick Massot (Jun 06 2020 at 18:07):

The docs export is nice, but it would even nicer if there could be a version containing only what I asked for. Here I'm downloading a 37Mo file and then do

with open('test', 'w') as test:
     for k, v in json.items():
         test.write(f"{k} {v['docs_link'][52:]}\n")

to get down to a 3.5Mo that zip then compresses to 705Ko.

Rob Lewis (Jun 06 2020 at 18:18):

I mean, I can zip it if the size is a problem, but it seems unnecessary to generate a bunch of custom maps when they're all subsets of this big one.

Patrick Massot (Jun 06 2020 at 18:26):

The download size is the issue.

Patrick Massot (Jun 06 2020 at 18:27):

What does it cost to generate the basic info? You're not even keeping old versions, right?

Rob Lewis (Jun 06 2020 at 18:53):

Just future proofing mostly. What if you decide in the future that you want links to GH source too? It's less effort to strip info from the big database now than to add it to the small one later.

Patrick Massot (Jun 06 2020 at 18:54):

Links to the GH source can also be reconstructed from what I extract above.

Rob Lewis (Jun 06 2020 at 18:57):

Can they? You need line numbers and Lean and mathlib versions (to make sure you direct to the right commits), no?

Rob Lewis (Jun 06 2020 at 18:57):

And this is running in CI, right? Does the extra 10 second download matter?

Patrick Massot (Jun 06 2020 at 19:00):

Indeed we don't get line number, only the file.

Patrick Massot (Jun 06 2020 at 19:01):

Right now there is no CI, but I should work on this.

Rob Lewis (Jun 07 2020 at 12:31):

It's now uploading export_db.json.gz which is ~4mb.


Last updated: Dec 20 2023 at 11:08 UTC