Zulip Chat Archive

Stream: mathlib4

Topic: mathport and forward-porting


Mario Carneiro (Jan 03 2023 at 21:53):

This is very much not recommended. If you differ too much from mathport's output then later diffing is a lot harder

Eric Wieser (Jan 03 2023 at 21:55):

I think the problem is:

  • Our current "all mathlib3 PRs must have an open forward-ported PR" stance means that we can't rely on the mathport nightlies to do our work for us.
  • There is significant activation energy required to install mathport from the command line.
  • Even if everyone did have a mathport installation****, we don't have any tools to compute appropriate diffs

Mauricio Collares (Jan 03 2023 at 21:57):

Yaël only submitted synchronization PRs as far as I can tell, so maybe mathport was not particularly useful for them

Eric Wieser (Jan 03 2023 at 21:58):

Right, but @Yaël Dillies did not ask mathport to translate their new lemmas, and instead guessed the translation. I would imagine that probably they made good guesses, but that's not really the point; mathport should be making as many decisions as it can for us,

Yaël Dillies (Jan 03 2023 at 21:59):

Yes, I feel exactly as Eric on this issue.

Eric Wieser (Jan 03 2023 at 22:00):

@Mario Carneiro, can mathport be used incrementally? Can I start with mathport output from $(git merge-base HEAD my_pr), and ask it to build the files on my_pr without touching the files with unchanged oleans?

Notification Bot (Jan 03 2023 at 22:01):

30 messages were moved here from #mathlib4 > port progress by Eric Wieser.

Mario Carneiro (Jan 03 2023 at 22:04):

Yes I think so. You would need to lean-3-build any files that you want to port (and their dependencies), and then you can call mathport on them

Eric Wieser (Jan 03 2023 at 22:05):

So lean --make $(filenames-changed) and then mathport $(filenames-changed) would work?

Mario Carneiro (Jan 03 2023 at 22:07):

modulo finicky command line syntax, yes

Mario Carneiro (Jan 03 2023 at 22:08):

you also have to make sure you have the right versions of stuff checked out

Mario Carneiro (Jan 03 2023 at 22:08):

it would be nice to have a makefile target or python program which automates this

Eric Wieser (Jan 03 2023 at 22:18):

Yes, I'm asking these questions with a view of automating this

Eric Wieser (Jan 03 2023 at 22:19):

you also have to make sure you have the right versions of stuff checked out

As in, you need merge-base to be a mathport-consumed commit?

Eric Wieser (Jan 03 2023 at 22:19):

I think it might help if there was a "latest mathport" branch in leanprover-community/mathlib

Mario Carneiro (Jan 04 2023 at 01:20):

More specifically, the main compiler commands you need are:

  • lean --make --recursive --ast --tlean $(filenames-changed) (not entirely sure what --recursive does but it's in the makefile)
  • ./build/bin/mathport --make config.json Leanbin::all Mathbin::$(filenames-changed) >> Logs/mathport.out 2> >(tee -a Logs/mathport.err >&2)

Mario Carneiro (Jan 04 2023 at 01:21):

Eric Wieser said:

you also have to make sure you have the right versions of stuff checked out

As in, you need merge-base to be a mathport-consumed commit?

You need to have the sources/lean and sources/mathlib directories checked out in such a way that calling lean 3 doesn't cause the world to be recompiled

Mario Carneiro (Jan 04 2023 at 01:22):

it doesn't have to be any particular commit, but you need to have predata that isn't out of date relative to the source files or else lean will recompile

Gabriel Ebner (Jan 04 2023 at 01:55):

not entirely sure what --recursive does but it's in the makefile

lean --recursive directory/ compiles all *.lean files inside directory/. It doesn't have an effect if you're passing it files.

Gabriel Ebner (Jan 04 2023 at 01:56):

./build/bin/mathport --make config.json Leanbin::all Mathbin::$(filenames-changed) >> Logs/mathport.out 2> >(tee -a Logs/mathport.err >&2)

That must be:
build/bin/mathport config.json Mathbin::$(lean3-modulenames-changed)

Gabriel Ebner (Jan 04 2023 at 01:56):

mathport --make will ignore all files that already have a Lean 4 olean.


Last updated: Dec 20 2023 at 11:08 UTC