Zulip Chat Archive

Stream: new members

Topic: Syntactically-equal forms don't unify - how to disambiguate?


Jakob Kreuze (Dec 13 2023 at 23:53):

I'm looking for some tips on figuring out what an identifier actually refers to - or help troubleshooting what I'm perceiving as shadowing, I guess. On line 216 of the attached file, I'm getting the following error:

tactic 'apply' failed, failed to unify
  List.elem x disj = true
with
  List.elem x disj = true

It looks like it should work... My goal state is the following:

disj : List AllOf
context : Request
h_no_match :  (conj : AllOf), conj  disj  AllOf.eval conj context  MatchResult.is_match
h_indet :  conj, conj  disj  AllOf.eval conj context = MatchResult.indeterminate
x : AllOf
hx : x  disj  AllOf.eval x context = MatchResult.indeterminate
a : List.isEmpty disj = false
h :  (x : AllOf), x  disj  ¬AllOf.eval x context = MatchResult.is_match
hx' : AllOf.eval x context = MatchResult.indeterminate
 List.elem x disj = true

It seems like everything should be referring to the same x and the same disj, so I'm not sure what's going on. How would I figure out which x the goal is referring to? And how would I see if that x is the same as the x in hx?

If this looks like a bug, I can try a newer version of Lean and report back. I'm doing this in v4.2.0 right now.

reproducible.lean

Eric Wieser (Dec 14 2023 at 00:13):

To save people a download:

File contents

Eric Wieser (Dec 14 2023 at 00:14):

Can you tell us which line of the file you're talking about?

Jakob Kreuze (Dec 14 2023 at 00:14):

Very last one - apply List.elem_eq_true_of_mem hx.left. Line 216

Eric Wieser (Dec 14 2023 at 00:16):

It works for me without (that) issue in the web editor, which is using a very recently lean/mathlib version. Note that telling us the lean version isn't enough; if you import Mathlib, we need the mathlib commit to fully reproduce.

Eric Wieser (Dec 14 2023 at 00:18):

You can inspect what went wrong with your version by using set_option pp.explicit true before the lemma in question

Eric Wieser (Dec 14 2023 at 00:18):

Then the error should be clearer

Jakob Kreuze (Dec 14 2023 at 00:19):

I had mathlib pinned to v4.2.0.
Not exactly related, but which web editor is this? I didn't know there was one for Lean 4

Eric Wieser (Dec 14 2023 at 00:20):

image.png

Jakob Kreuze (Dec 14 2023 at 00:20):

Neat! Thank you

Jakob Kreuze (Dec 14 2023 at 00:25):

Looks like it works in Lean/mathlib v4.3.0 so maybe this is a bug that's since been fixed. Either way, this lets me get back to work. Appreciate the troubleshooting help

Eric Rodriguez (Dec 14 2023 at 18:01):

Does set_option pp.explicit true show the real cause? Or worst case, pp.all?

Kyle Miller (Dec 15 2023 at 03:10):

One good tool for debugging these unification issues is the convert tactic. It looks like that apply could have been an exact, and for a non-unifying exact what you do is use convert instead.

Kyle Miller (Dec 15 2023 at 03:14):

Either you get new goals showing what wasn't defeq to what, or convert magically solves the goal and, while you don't learn anything, at least the goal is solved.


Last updated: Dec 20 2023 at 11:08 UTC