Zulip Chat Archive

Stream: new members

Topic: Weird HEq goal


Gareth Ma (Apr 23 2024 at 19:38):

Hi, I am not sure why the following yield a HEq goal that I can't seem to solve.

import Mathlib.Data.Finset.Basic
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.Int.Interval

open Int Finset

def T (q a b : ) : Finset (Ico 0 q) := univ.filter (fun x  x.val  Ico a b)

example {q a b : } :
    { x // x  T q a b }  Σ i : Ico a b, T q i.val i.val.succ where
  toFun := by
    intro x, h
    use x.val, sorry⟩, x.val, sorry⟩, sorry
  invFun := by
    intro x, y
    use y.val, sorry⟩, sorry
  left_inv := by intro; simp
  right_inv := by
    intro i, ⟨⟨x, y⟩, h⟩⟩
    simp
    use sorry, ?_
    congr 1
    · sorry
    · sorry

(Just the final sorry, where it has a HEq goal)

Damiano Testa (Apr 23 2024 at 19:41):

Does apply proof_irrel_heq work?

Gareth Ma (Apr 23 2024 at 19:41):

Ahh yes thanks

Gareth Ma (Apr 23 2024 at 19:41):

Why doesn't rw [heq_iff_eq] work then?

Damiano Testa (Apr 23 2024 at 19:42):

I have no idea: I found the proof using exact?...

Gareth Ma (Apr 23 2024 at 19:42):

what

Damiano Testa (Apr 23 2024 at 19:43):

exact? produces the correct lemma, plus some non-roundtripping filling. Luckily, apply comes to the rescue.

Gareth Ma (Apr 23 2024 at 19:43):

Ahh okay it works on this example because I minimised it, but in my actual use case it times out
apply? doesn't find anything useful either.

Gareth Ma (Apr 23 2024 at 19:43):

(My example involves Ico 0 q \x Ico 0 q and a few more conditions)

Gareth Ma (Apr 23 2024 at 19:44):

thanks, weird

Kyle Miller (Apr 23 2024 at 20:10):

If you use congr! 1 instead of congr 1, then it solves that last sorry for you. It knows about proof_irrel_heq.

Gareth Ma (Apr 23 2024 at 20:50):

Great thanks

Gareth Ma (Apr 23 2024 at 20:51):

In my use case it didn’t find it with exact? Because I forgot to congr first haha


Last updated: May 02 2025 at 03:31 UTC