dselsam / binport

A tool for building Lean4 .olean files from Lean3 export data
Apache License 2.0
10 stars 1 forks source link

Strings #18

Closed dselsam closed 3 years ago

dselsam commented 3 years ago

Even though strings are only used for meta-programming, the misalignment is unpleasant since e.g. every auto_param prints as an enormous term of unreadable string.str applications. There are four issues here:

The last two issues need to be solved independently. The first two seem to only be required for aligning strings.

Note: lean3 used to make fin a structure but changed it to a def so that the subtype API could be used: https://github.com/leanprover-community/lean/issues/359

I see a few options:

I suggest backporting fin4 (just for char) as a default, assuming Leo wants to keep Fin a structure.

leodemoura commented 3 years ago

What about erasing auto_param? That is, the porting tools rewrites auto_param a t ==> a.

dselsam commented 3 years ago

I agree that would be better than not aligning and keeping the unreadable junk. I think the auto-param is useful information though, and figured mathlib might reimplement it and want the old annotations. We could also only auto-port the string literals used in auto-param and discard whatever breaks because of that change, which is probably nothing besides the auto_param equations themselves.

dselsam commented 3 years ago

I added special support for replacing auto_param calls with autoParam calls inside mathport. I think every auto_param in mathlib uses obviously, and so for now I just hard-coded syntax for Mathlib.obviously in the new autoParam terms rather than parse the names.

digama0 commented 3 years ago

There are more than just obviously. Here's what I found (this should be an exhaustive list):

dselsam commented 3 years ago

Whoops, I had a buggy grep query. Good catch, thanks. I guess I will decode the names during mathport.

dselsam commented 3 years ago

Now we decode the concrete strings from auto_param arguments: https://github.com/dselsam/mathport/blob/master/MathPort/Translate.lean#L63