Zulip Chat Archive

Stream: mathlib4

Topic: !4#2977 Algebra.DirectSum.TensorProduct


Eric Wieser (Mar 30 2023 at 17:19):

I've spent more than an hour on a single declaration in !4#2977 (port-status#linear_algebra/direct_sum/tensor_product) and am having a very bad tmie

Eric Wieser (Mar 30 2023 at 17:20):

The proof takes on the order of minutes before spitting out an error, and about every other change the syntax highlighting breaks and I have to restart the lean server

Eric Wieser (Mar 30 2023 at 17:23):

Example of broken highlighting:

image.png

Eric Wieser (Mar 30 2023 at 17:24):

The error message there is nonsensical and refers to unknown constant 'DirectSum.toModulR', which feels as though it's reporting an error about the mangled code that it's highlighting, not the code that is actually in the editor

Kevin Buzzard (Mar 30 2023 at 17:25):

One hack I found when Lean gets into this state is to go up to the theorem or definition you're working on and just change theorem to theoremq or definition to defq and then change it back. It's quicker than recompiling the entire file and seems to fix the syntax highlighting issue.

Eric Wieser (Mar 30 2023 at 17:31):

That doesn't work for me here

Eric Wieser (Mar 30 2023 at 17:31):

The orange bars jump around, but the syntax remains broken

Kevin Buzzard (Mar 30 2023 at 17:34):

I'm about to get on the tube @Eric Wieser but I don't want to duplicate work. Is it safe for me to play around with this (and possibly get nowhere)?

Eric Wieser (Mar 30 2023 at 17:35):

I might keep fighting it, but absolutely

Eric Wieser (Mar 30 2023 at 17:35):

I'd like to know if the bizarre editing experience is something weird with gitpod or something you can reproduce

Kevin Buzzard (Mar 30 2023 at 17:36):

ain't no gitpod underground. I'll get back to you in an hour.

Matthew Ballard (Mar 30 2023 at 18:03):

Is this working now?

Matthew Ballard (Mar 30 2023 at 18:05):

It does take a little bit to check but the proof you pushed for this result seems to work ok

Eric Wieser (Mar 30 2023 at 18:06):

I was able to get it to work just now

Eric Wieser (Mar 30 2023 at 18:06):

But I had to add a nasty number of (_)s

Eric Wieser (Mar 30 2023 at 18:18):

Does adding set_option profiler true slow things down considerably?

Matthew Ballard (Mar 30 2023 at 18:19):

A bit, yes. Tracing isDefEq also seems to to drag. I’ve had to bump heart beats after adding these

Eric Wieser (Mar 30 2023 at 18:23):

Ah, my lean server had crashed, but the orange bars stick around so it's hard to tell. The result is compilation of TensorProduct.directSum took 47.7s.

Matthew Ballard (Mar 30 2023 at 18:37):

Better than a lot of files

Kevin Buzzard (Mar 30 2023 at 18:55):

So I got it working too. I didn't experience the desyncing error reporting but perhaps that was a problem with the earlier long proof which was working when I pulled. Here's some diffs between my solution and what's on github:

You said

    repeat'
      first
        |rw [compr₂_apply]|rw [comp_apply]|rw [id_apply]|rw [mk_apply]|rw [DirectSum.toModule_lof]
        |rw [map_tmul]|rw [lift.tmul]|rw [flip_apply]|rw [curry_apply]

I said

    simp only [compr₂_apply, comp_apply, id_apply, mk_apply, DirectSum.toModule_lof, map_tmul, lift.tmul, flip_apply, curry_apply]

because it looks less odd. And you said

  erw [directSumLeft_tmul_lof, Dfinsupp.mapRange.linearEquiv_apply]
  exact Dfinsupp.mapRange_single

but I said

  rw [directSumLeft_tmul_lof]
  exact Dfinsupp.mapRange_single (hf := fun _ => rfl)

Kevin Buzzard (Mar 30 2023 at 18:56):

which makes me wonder if Lean 3 exact was able to solve an implicitfun _ => rfl before.

Matthew Ballard (Mar 30 2023 at 19:04):

There are other records of weird syntax errors on Zulip. I don’t know if a single culprit has been identified.

Did you try outlining the fields of directSum to speed it up?

Eric Wieser (Mar 30 2023 at 19:04):

What do you mean by outlining?

Eric Wieser (Mar 30 2023 at 19:05):

@Kevin Buzzard, the repeat first stuff was from mathport, your proof sounds much beter

Matthew Ballard (Mar 30 2023 at 19:05):

Construct each field in a separate declaration

Eric Wieser (Mar 30 2023 at 19:06):

Feel free to push your tidier proofs

Kevin Buzzard (Mar 30 2023 at 20:24):

I removed the repeat proof because in my experience proofs like that can be super slow and I wondered if this was causing the slowdown

Kevin Buzzard (Mar 30 2023 at 20:24):

But it was still slow afterwards

Matthew Ballard (Mar 30 2023 at 20:32):

Eric Wieser said:

Feel free to push your tidier proofs

Just comments from the peanut gallery. Are we happy with the time?


Last updated: Dec 20 2023 at 11:08 UTC