Zulip Chat Archive

Stream: general

Topic: Deterministic timeout in CI


Adam Topaz (Nov 12 2021 at 23:10):

CI is hitting deterministic timeouts in the following PR #10303 but I can't reproduce this on my machine.
Actually, the proof that causes issues is really not that slow on my machine. Can anyone reproduce?

Arthur Paulino (Nov 13 2021 at 21:38):

Does anyone know what might be happening?

Alex J. Best (Nov 13 2021 at 21:57):

Well looks like Adam fixed his specific issue, are you asking what can cause deterministic timeout in general? Some proofs are just too slow.

Adam Topaz (Nov 13 2021 at 22:15):

Yeah, I fixed it.

Arthur Paulino (Nov 13 2021 at 23:06):

Alex J. Best said:

Well looks like Adam fixed his specific issue, are you asking what can cause deterministic timeout in general? Some proofs are just too slow.

Ah, no. I saw the topic on my phone and I noticed that nobody had said anything so I just asked. Glad it was fixed :tada:

Xavier Roblot (Oct 31 2022 at 14:02):

CI has been failing repeatedly for #17212. The reason being a deterministic timeout in algebraic_geometry.structure_sheaf. Now, this file is unmodified by this PR. Still I was able to track back the problem to the import of field_theory.subfield in topology.algebra.field which I guess is imported at some point in algebraic_geometry.structure_sheaf... An easy fix would be to remove the import in topology.algebra.field and move the result using it elsewhere. But this result, which proves that the closure of a subfield is a subfield, does naturally fits there in my opinion so I am looking for some other options.
FYI, it takes about 50s for Lean to compile the file algebraic_geometry.structure_sheaf on my M1 laptop.

Anne Baanen (Oct 31 2022 at 14:58):

I can take a look, nothing obvious jumps out from just looking at the code. Though I recall having some timeouts in this file before.

Xavier Roblot (Oct 31 2022 at 15:00):

Thanks. Is there anything I can do to help?

Anne Baanen (Oct 31 2022 at 15:02):

I traced it to the @[simps] attribute at least, so it might just be a loop in the simp lemmas or similar.

Anne Baanen (Oct 31 2022 at 15:03):

Thanks for the offer, I'll experiment a bit further and let you know :)

Anne Baanen (Oct 31 2022 at 15:05):

It looks like the following config option fixes the timeout:

@[simps {rhs_md := tactic.transparency.semireducible}]
def global_sections_iso : CommRing.of R  (structure_sheaf R).1.obj (op ) :=
as_iso (to_open R )

Now to figure out why...

Anne Baanen (Oct 31 2022 at 15:28):

Conclusion: for some reason that I don't know how to diagnose, simps does some bad unfolds and ends up unifying in the types (which is usually a bad time). Adding the semireducible transparency helps it to choose the right path. So I think that my suggestion above is the way to go.

Xavier Roblot (Oct 31 2022 at 15:32):

Ok. Thanks a lot. I'll add this to the PR.

Xavier Roblot (Oct 31 2022 at 15:52):

Well, I am getting a timeout in algebraic_geometry/Spec.lean now. It seems to be related to a simp also. I'll see if the same fix works.

Floris van Doorn (Oct 31 2022 at 23:00):

Without having looked into it: if you add the @[simps] attribute to a definition whose definiens is not a constructor application, the @[simps] will call the simp tactic to compute what the right-hand side of the lemmas should be. In this case, it will apply simp on something like (as_iso (to_open R ⊤)).1 and (as_iso (to_open R ⊤)).2, which might take a long time. Writing @[simps {rhs_md := semireducible}] yourself disables this, but makes me wonder how useful the simp lemma will end up being (won't the same computation then happen whenever simp uses this lemma in a proof?)

Yaël Dillies (Jan 18 2023 at 09:09):

Putting it out here in case someone has time to investigate, we get timeouts in

  • algebraic_topology/dold_kan/normalized:118:4
  • ring_theory/adjoin_root:338:0

Yaël Dillies (Jan 18 2023 at 09:10):

See #17949 and #18202

Yaël Dillies (Jan 18 2023 at 09:47):

Opened #18207 for the first

Anne Baanen (Jan 18 2023 at 11:06):

Let me take a look at the adjoin_root timeout.

Anne Baanen (Jan 18 2023 at 11:06):

Ah, it's @[simps] on a non-constructor-application. I'll probably just replace it with manually written lemmas then.

Anne Baanen (Jan 18 2023 at 11:39):

#18209


Last updated: Dec 20 2023 at 11:08 UTC