Zulip Chat Archive

Stream: mathlib4

Topic: Timeout in `set .. with`


Yury G. Kudryashov (Jun 09 2023 at 17:22):

In !4#4912, if you add with hg to set in line https://github.com/leanprover-community/mathlib4/pull/4912/files#diff-6f2f772b41622ce6d9a4dc922f7e26f8aeb129f555c3aa567f4a386979db4acdR156, then Lean timeouts.

Yury G. Kudryashov (Jun 09 2023 at 17:22):

The same happens if you uncomment, e.g., line 160

Yury G. Kudryashov (Jun 09 2023 at 17:40):

Minimizing.

Alex J. Best (Jun 09 2023 at 17:42):

I already started doing the same
got to

theorem horizontal_strip
    (hB :  c < π / (b - a),  B,
       c = B)
     : f z  C := by
  -- If `im z = a` or `im z = b`, then we apply `hle_a` or `hle_b`, otherwise `im z ∈ Ioo a b`.
  -- After a change of variables, we deal with the strip `a - b < im z < a + b` instead
  -- of `a < im z < b`
  -- Choose some `c B : ℝ` satisfying `hB`, then choose `max c 0 < d < π / 2 / b`.
  rcases hB with c, hc, B, hO
  obtain d, hd :  d, c < d := by
    sorry
  set aff :    := fun w => 1
  set g :      := fun ε w => exp (ε * (exp (aff w) + exp (-aff w))) with h

so far

Yury G. Kudryashov (Jun 09 2023 at 17:43):

I've got

import Mathlib.Data.Complex.Basic

open Complex

variable {a b d B C : } {z : } {exp :   }

example : 1 = 2 := by
  set aff :    := fun w => d * (w - a * I)
  set g :      := fun ε w => exp (ε * (exp (aff w) + exp (-aff w))) with hg

Alex J. Best (Jun 09 2023 at 17:45):

edited:

example : 1 = 2 := by
  set g :      := (fun ε => ε) with h

Yury G. Kudryashov (Jun 09 2023 at 17:49):

Your example fails with type mismatch

Yury G. Kudryashov (Jun 09 2023 at 17:49):

Adding fun (ε : ℝ) (w : ℂ) helps with your example. Trying in the original source.

Yury G. Kudryashov (Jun 09 2023 at 17:50):

Works!

Yury G. Kudryashov (Jun 09 2023 at 17:50):

Probably, set parses RHS without expected type

Yury G. Kudryashov (Jun 09 2023 at 17:51):

(and in Lean 3 it used the expected type)

Alex J. Best (Jun 09 2023 at 18:11):

!4#4917, lets see if anything breaks with this change

Yury G. Kudryashov (Jun 09 2023 at 18:44):

Note that sometimes set fails too (with "type mismatch" error)

Yury G. Kudryashov (Jun 09 2023 at 18:44):

I had to move type information from left to right here and there.

Alex J. Best (Jun 20 2023 at 13:38):

I finally finished the above PR, please say if you find more distinct issues. Do you have an example of this type mismatch error I can look at?

Yury G. Kudryashov (Jun 20 2023 at 14:55):

A very non-minimal example: if you remove type annotations on the right in sets in src4#PhragmenLindelof.horizontal_strip, then the proof timeouts.

Yury G. Kudryashov (Jun 20 2023 at 14:55):

Even if you move them to the LHS

Yury G. Kudryashov (Jun 20 2023 at 14:59):

If you replace line 154 with

set g :      := fun ε w => exp (ε * (exp (aff w) + exp (-aff w)))

then it timeouts, even if you comment out everything after line 157

Alex J. Best (Jun 23 2023 at 10:39):

#5386 should fix this :fingers_crossed:

Yury G. Kudryashov (Jun 23 2023 at 18:00):

Thanks a lot!


Last updated: Dec 20 2023 at 11:08 UTC